View previous topic :: View next topic |
Author |
Message |
whitt Tux's lil' helper
Joined: 28 Dec 2020 Posts: 131
|
Posted: Thu Dec 30, 2021 6:46 pm Post subject: how to s2ram when idle? |
|
|
forgive me if i missed it, but i have looked into this on and off over the last year or so - just haven't found a clear solution...
i've been in the habit of su'ing and running s2ram when i plan to step away. the problem is i also walk away from my machine and leave it running for hours when i'd rather it suspend automatically when i'm idle for some time.
exactly how do i set this up?
s2ram works wonderfully for me. i just want the system to s2ram when there hasn't been any mouse or keyboard input for a while. i rarely ssh into the machine - it'd be nice if it'd stay alive when connected and could wake from suspend on connection, but that's not a problem i need to solve right now.
thanks for any pointers! |
|
Back to top |
|
|
moniaqua n00b
Joined: 19 Dec 2021 Posts: 15 Location: Bavaria
|
Posted: Thu Dec 30, 2021 7:06 pm Post subject: |
|
|
It might perhaps help to know which environment you are using. Console, Gnome, KDE, Xfce, something else? _________________ cu
Monika |
|
Back to top |
|
|
whitt Tux's lil' helper
Joined: 28 Dec 2020 Posts: 131
|
Posted: Thu Dec 30, 2021 7:20 pm Post subject: |
|
|
i use fluxbox... zsh and alacritty. and it's a systemd setup. |
|
Back to top |
|
|
technotorpedo Apprentice
Joined: 10 Dec 2019 Posts: 151
|
Posted: Fri Dec 31, 2021 1:09 am Post subject: |
|
|
Interesting challenge there, went looking for approaches and one that seems might work for you is using the following package, it's called xprintidle and this is the description of what the thing does.
Quote: | xprintidle is a utility that queries the X server for the user's idle time and prints it to stdout (in milliseconds). |
Could run a script via systemd timer unit or crontab to check that output every so often and an if statement in the script to run the command to suspend. If user has been idle, the number of miliseconds is -gt = greater than your desired amount of time with no key presses, mouse movement etc, "systemctl suspend" Haven't tested it or tried putting anything together as don't have a need for this atm but seems it'd be a possible decent method of getting what you want. I just keep simple keybinds to handle suspend/reboot and poweroff. Not automatic but easy enough ... _________________ I <heart> gnu/Linux, Openbox and xdotool ... |
|
Back to top |
|
|
whitt Tux's lil' helper
Joined: 28 Dec 2020 Posts: 131
|
Posted: Fri Dec 31, 2021 1:43 am Post subject: |
|
|
thanks technotorpedo!
i appreciate hearing the only proposed solution thus far is somewhat of a hack... i was intentionally trying to avoid that sort of approach because it seemed like the kind of thing that should have been solved with other tools. i was looking at laptop-mode-tools and for whatever reason after starting that up my graphics output became super choppy. assuming it was related, i nixed that approach.
i like the xprintidle idea - that sounds like a cool approach. could be fun too.
it's just surprising that there isn't a common utility to suspend the machine the same way X can start a screensaver or turn the monitor off... |
|
Back to top |
|
|
technotorpedo Apprentice
Joined: 10 Dec 2019 Posts: 151
|
Posted: Fri Dec 31, 2021 2:06 am Post subject: |
|
|
You're welcome and there may well be such tools floating around, I avoid screensavers and lockers here. Though clear they can do along the lines of what you want. Imagine there is something available just don't know what off the top. It's been my experience someone won't know what all is readily available in a kickbutt OS like gnu/Linux, until they go looking or asking about it. Can't see anything technically wrong with the xprintidle suggestion though. Just hope it turns out being what you're shooting for and yep, hopefully some fun. _________________ I <heart> gnu/Linux, Openbox and xdotool ... |
|
Back to top |
|
|
figueroa Advocate
Joined: 14 Aug 2005 Posts: 2960 Location: Edge of marsh USA
|
Posted: Fri Dec 31, 2021 3:54 am Post subject: |
|
|
You can use xautolock with i3lock to suspend.
https://bbs.archlinux.org/viewtopic.php?id=208699 _________________ Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi |
|
Back to top |
|
|
technotorpedo Apprentice
Joined: 10 Dec 2019 Posts: 151
|
Posted: Fri Dec 31, 2021 6:25 am Post subject: |
|
|
^ Cool thanks for the add. Always good to have options. Another great thing imo about Linux, ask and (often) you shall receive. _________________ I <heart> gnu/Linux, Openbox and xdotool ... |
|
Back to top |
|
|
|