You are not logged in.
I would like my notebook to suspend after a selected time for example after 30 minutes.
I am not using any DE.
Just slim i3 DWM - it's cool and clean.
how do i do this in Arch?
Last edited by DeletedUser211004 (2017-03-21 23:55:16)
Offline
Theres a Power Manager in Xfce's settings. I don't now about other DE's such thing, but there must be something.
Such a thing will be good for you, I guess.
Last edited by Lemongrass (2017-03-21 23:47:57)
Offline
Do you mean regardless of activity?
sleep 1800 && systemctl suspend
Or on event
https://wiki.archlinux.org/index.php/Power_Management
Look at
community/xautolock
and read
/etc/systemd/logind.conf
Offline
I mean that when im not doing any activity after 30 minutes the notebook should suspend
and after wake up i want my lockscreen first.
Just like in Windows 10 for example.
Offline
Which desktop environment do you have? Have you checked its power manager-like utility? It's just as easy to set in Xfce as in Windows. I don't have another DE now, so I can't tell about others, but I guess it's just as easy with them too. Look for something like this in the menu of your desktop environment (graphical menu, settings, just like Windows' Start button).
Last edited by Lemongrass (2017-03-22 22:39:29)
Offline
Offline
As mentioned by teckk, look at the /etc/systemd/logind.conf
You need to uncomment and change one line
IdleAction=suspend
, IdleActionSec already defaults to 30min
Arch is home!
https://github.com/Docbroke
Offline
I use xautolock, which checks for idleness and fires up programs. I have mine setup to notify-send me a warning, then locks screen (something like i3lock), then suspends.
Offline
Why everyone is firing with various ways to lock the screen, while Archer98 is trying to suspend his laptop??
Arch is home!
https://github.com/Docbroke
Offline
Why everyone is firing with various ways to lock the screen, while Archer98 is trying to suspend his laptop??
xautolock specifically allows you to specify the locker to run when it triggers, allowing you to use a bash script to run some arbitrary commands instead of using just a locker. I'm sure others do the same. this allows me, for instance, to use scrot and imagemagick to blur the screen before using i3lock to display it, or someone to lock their screen and suspend. it isn't an avoidance of the question, just suggestions on how to achieve the question.
another alternative is to use xset/DPMS to suspend. this would be an alternative to using a locker, if all you want to achieve is a suspend without invoking a lock screen, to quickly recover from
Last edited by HiImTye (2017-03-23 05:34:31)
Offline
1. True, I was unaware of ability of xautolock to run scripts.
2. xset/DPMS suspend is not like systemctl suspend, it just suspends the display. http://webpages.charter.net/dperr/dpms.htm
Arch is home!
https://github.com/Docbroke
Offline
2. xset/DPMS suspend is not like systemctl suspend, it just suspends the display. http://webpages.charter.net/dperr/dpms.htm
right, my mistake. I've never used xset much, except to disable screen blanking because it's annoying lol
Offline
I tried it with the logind.conf worked fine first.
Then I noticed that it also suspends even if I'm working on my machine. So the "idle detection" is pretty much crap.
So now i tried it with xautolock and the suspend+xautolock command is working alone
but what i want in my .config/i3/config is:
exec xautolock -time 15 -locker ~/.lock.sh &
exec xautolock -time 30 -locker "systemctl suspend" &
but this doesn't work like i want it to.
what is wrong?
Last edited by DeletedUser211004 (2017-03-24 20:39:25)
Offline
that lock.sh most likely grabs the X server and the second xautolock thus starts to fail.
you want to start the locker (i3lock?) wait 15 seconds and if the locker process is still running, STR
Offline
my lock.sh contains:
#!/bin/bash
scrot /tmp/screenshot.png
convert /tmp/screenshot.png -blur 0x5 /tmp/screenshot.png
i3lock -i /tmp/screenshot.png
rm screenshot.png
Offline
yes, and i3lock will grab all input devices (as will any reasonable screenlocker) so follow the approach suggested in comment #14: fork i3lock, sleep 15 seconds and then check whether i3lock is still running to decide whether to STR or not.
Offline
with fork you mean i should modify i3lock to my suggested needs?
what is STR?
sorry i don't know this abbreviation
Offline
with fork you mean i should modify i3lock to my suggested needs?
No, certainly not...
#!/bin/bash
convert x:root -blur 0x5 /tmp/i3lock_screenshot.png # convert can get the screen itself, no need for conversions and disk access
i3lock -n -u -i /tmp/i3lock_screenshot.png & # the ampersand forks the process in bash syntax
LOCKER_PID=$! # the PID of the i3lock process you just forked
sleep 15 # wait 15 seconds
kill -0 $LOCKER_PID && systemctl suspend # test whether the i3lock process is still alive and only then STR
rm /tmp/i3lock_screenshot.png # tidy up the proper file ...
what is STR?
Suspend To Ram
Offline
thanks for your efforts on the code.
but the code doesn't work correctly
i3lock doesn't show up correctly anymore after waking up from suspension
what i want were 2 processes means one locks after 15 min and 15 min after that one that suspends my machine
Offline
What do you mean "after waking up from suspension"? Invisible or the process is gone?
If it's just "invisible" that's not related to the script, but maybe your framebuffer driver, try w/o the background image first.
what i want were 2 processes
As explained, it won't work that way.
and 15 min after that one that suspends my machine
Just adjust the sleep timer? (hint: "man sleep" before using a calculator ...)
Offline
i3lock usually shows an indicator when you type in the password.
this doesn't happen because of the kill command for the i3lock process - seems logical!
but if i adjust the sleep time, do i then have the possibility to "come back from afk" between minute 15 and minute 30 after inactivity
without having a suspended notebook?
Offline
The indicator is absent because of "-u" .... so please answer my question in how far "i3lock doesn't show up correctly anymore"
The "kill" command doesn't *kill* anything, "-0" is NOOP and can eg. be used to test PID existence (and instead of inspecting /proc/$PID is actually portable to other UNIX)
And yes; the ability to "come back" is the purpose of this script, the PID existence test and everything...
Side-topic:
Do you really use archlinux and since when do you use linux (or any POSIX system) at all?
If the answer is "yes and last week" you'll have a hard couple of days ahead where you got to learn fast - or die.
First things to learn are how to google, where the arch wiki is, how to use manpages and how to read the "--help" output of commands.
Second thing is to find a "how to bash for dummies" crash course and walk through that so you know at least the bear [sic! ;-)] necessities.
Archlinux is not for beginners and this kind of hand-holding could possibly get me banned from the forum ...
Offline
if you got a problem with my questions then gtfo.
didn't knew that reading is that hard...
topic is called N - E - W - B - I - E C - O - R - N - E - R
it's not a must to answer me.
i am not that professional about arch but why should i die? is this a death threat?
where you got to learn fast - or die
First things to learn are how to google, where the arch wiki is
how do you think i got here???
could possibly get me banned from the forum ...
i hope you get...
Offline
no, it's metaphorical - and being a newbie doesn't mean you're not supposed to work on your own, please read the sticky on this.
You're apparently dealing w/ a copy pasted i3lock script that you do not understand the least and you refuse (again) to answer even clear questions regarding your problem but instead perhaps make false statements based upon apparently completely uninformed guesses - this makes it very hard to help (let alone "assist") you.
Please do your homework and ensure to not let this thread drift off-topic (to prevent it from being closed)
So last chance: how much of the process here do you understand and how do you determine i3lock ain't running after resuming from STR? (ie. is there still a process, but no window or was that assumption wrong to begin with? - Is there any problem left?)
Offline
i quite understand the script so don't think you could guess what i know and understand and what i do not!
all i want was a quick solution that fits my wishes so the problem was just that i3lock didn't showed up correctly so now i deleted the -u option and it works fine.
to be honest i'm very thankful for your quick and good help anyway you turned unfriendly and offensive.
no after i locked back in from suspending there is no i3lock process left.
so i think now everything works fine.
Last edited by DeletedUser211004 (2017-03-26 20:26:41)
Offline