Skip to main content
Topic: Assistance with Suspend, Sleep, Hibernation, Power Management Aggravation (Read 858 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Assistance with Suspend, Sleep, Hibernation, Power Management Aggravation

Hello Troopers

What a hassle operating systems have become.
I just need 1 switch which identifies my hardware is a desktop computer with power supplied from the power grid.
ZERO batteries or power limitation or power limitations please!
- 120VAC feed
Don't give me hundreds of settings of power management control.
When I power on my computer I never want the system to auto suspend, auto logout, auto hibernate, auto sleep, or log out etc.

I'm running this weird desktop environment UKUI. The computer was always auto-suspending being idle.
The only method I discovered to prevent auto-suspend was changing config settings in elogind [sleep] file to off.

Now my question to experts - How to achieve this without completely neutering suspend function. I just want manual control . . .

Here is my elogind [sleep] configuration:

[Sleep]
AllowSuspend=no
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no
#SuspendMode=
#SuspendState=mem standby freeze
#HibernateMode=platform shutdown
#HibernateState=disk
#HybridSleepMode=suspend platform shutdown
#HybridSleepState=disk
#HibernateDelaySec=
#SuspendEstimationSec=60min

# elogind additions
#AllowPowerOffInterrupts=no
#BroadcastPowerOffInterrupts=yes
#AllowSuspendInterrupts=no
#BroadcastSuspendInterrupts=yes
#SuspendByUsing=
#HibernateByUsing=
#HandleNvidiaSleep=no

Re: Assistance with Suspend, Sleep, Hibernation, Power Management Aggravation

Reply #1
Code: [Select]
echo "mem" > /sys/power/state
is what the bloated (e)logind does in the end anyway.

The same, badly adapted from a tutorial, in C
Code: [Select]
   #include <stdio.h>
   #include <stdlib.h>
   #include <sys/types.h>
   #include <unistd.h>

int main() {
    #define word "mem"

    // creating file pointer to work with files
    FILE *fptr;
setuid(0);
    // opening file in writing mode
    fptr = fopen("/sys/power/state", "w");

    // exiting program
    if (fptr == NULL) {
        printf("Error!");
        exit(1);
    }
    fprintf(fptr, "%s", word);
    fclose(fptr);
    return 0;
}
Compile it, set it SUID, and then either set up a keyboard shortcut to it in UKUI, or if you are lucky you might be able to replace the program/call to suspend in the UKUI menu? With LXQT it's as simple as editing a .desktop file.

 
Artix forum uses a single cookie to remember youOK