You are not logged in.
Hello folks,
I'm kinda new to ArchLinux, recently installed it on my HP Stream 11 laptop, everything working great so far.
Except I cannot get the screen locker to lock the screen after suspend.
I found this on ArchLinux site:
Suspend/resume service files
Service files can be hooked into suspend.target, hibernate.target and sleep.target to execute actions before or after suspend/hibernate. Separate files should be created for user actions and root/system actions. Enable the suspend@user and resume@user services to have them started at boot. Examples:
/etc/systemd/system/suspend@.service
[Unit]
Description=User suspend actions
Before=sleep.target
[Service]
User=%I
Type=simple
Environment=DISPLAY=:0
ExecStartPre= -/usr/bin/pkill -u %u unison ; /usr/local/bin/music.sh stop ; /usr/bin/mysql -e 'slave stop'
ExecStart=/usr/bin/sflock
ExecStartPost=/usr/bin/sleep 1
[Install]
WantedBy=sleep.target
/etc/systemd/system/resume@.service
[Unit]
Description=User resume actions
After=suspend.target
[Service]
User=%I
Type=simple
ExecStartPre=/usr/local/bin/ssh-connect.sh
ExecStart=/usr/bin/mysql -e 'slave start'
[Install]
WantedBy=suspend.target
But no matter what I could not get it to work.
Any help appreciated.
Thanks.
Offline
Those are executed as UID 1, but you need (and want!) to run i3lock as the user which presently holds the XAUTHORITY and also must tell it which DISPLAY (usually an environment variable) to use.
Also, i suggest you run i3lock right *before* going STR (same problem, though)
Offline
Those are executed as UID 1, but you need (and want!) to run i3lock as the user which presently holds the XAUTHORITY and also must tell it which DISPLAY (usually an environment variable) to use.
Also, i suggest you run i3lock right *before* going STR (same problem, though)
Do you mean:
# systemctl enable suspend@javad.serviceAlse I think the DISPLAY variable is ok because when I run the service manually it does some flashing on the display.
Offline
Probably, could you please post (in code tags) the actual service file(s) you've created (ie. not the wiki example) and their status?
Offline
Probably, could you please post (in code tags) the actual service file(s) you've created (ie. not the wiki example) and their status?
Sure:
[Unit]
Description=User suspend actions
Before=sleep.target
[Service]
User=%I
Type=simple
Environment=DISPLAY=:0
ExecStart=/usr/bin/i3lock
ExecStartPost=/usr/bin/sleep 1
[Install]
WantedBy=sleep.target[javad@hp_arch system]$ sudo systemctl status suspend@javad.service
● suspend@javad.service - User suspend actions
Loaded: loaded (/etc/systemd/system/suspend@.service; enabled; vendor preset: di
Active: inactive (dead)
Nov 06 12:49:09 hp_arch systemd[1]: Starting User suspend actions...
Nov 06 12:49:10 hp_arch systemd[1]: Started User suspend actions.
Nov 06 13:00:45 hp_arch systemd[1]: Starting User suspend actions...
Nov 06 13:00:46 hp_arch systemd[1]: Started User suspend actions.Inactive(dead)?
Offline
Also, my
$ journalctl -xe-- The system clock has been changed to REALTIME microseconds after January 1st, 19
Nov 06 13:06:33 hp_arch systemd-sleep[1174]: System resumed.
-- Subject: System sleep state suspend left
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The system has now left the suspend sleep state.
Nov 06 13:06:33 hp_arch systemd[1]: Started Suspend.
-- Subject: Unit systemd-suspend.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-suspend.service has finished starting up.
--
-- The start-up result is done.
Nov 06 13:06:33 hp_arch systemd[1]: sleep.target: Unit not needed anymore. Stopping
Nov 06 13:06:33 hp_arch systemd[1]: Stopped target Sleep.
-- Subject: Unit sleep.target has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit sleep.target has finished shutting down.
Nov 06 13:06:33 hp_arch systemd[1]: Reached target Suspend.
-- Subject: Unit suspend.target has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit suspend.target has finished starting up.
--
-- The start-up result is done.
Nov 06 13:06:33 hp_arch systemd[1]: suspend.target: Unit is bound to inactive unit
Nov 06 13:06:33 hp_arch systemd[1]: Stopped target Suspend.
-- Subject: Unit suspend.target has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit suspend.target has finished shutting down.
Nov 06 13:06:33 hp_arch systemd-logind[283]: Operation 'sleep' finished.
Nov 06 13:06:33 hp_arch kernel: mmc1: cannot verify signal voltage switch
Nov 06 13:06:36 hp_arch kernel: wlan0: authenticate with 30:a8:db:bc:bc:10
Nov 06 13:06:36 hp_arch kernel: wlan0: send auth to 30:a8:db:bc:bc:10 (try 1/3)
Nov 06 13:06:37 hp_arch kernel: wlan0: authenticatedOffline
Type=simple
i3lock forks.
Offline
javadme wrote:Type=simplei3lock forks.
Haha, using
ExecStart=/usr/bin/i3lock --noforksolved the issue.
Thank you very much. ![]()
Should I close the thread or smth?
Offline