You are not logged in.

#1 2018-04-16 00:59:11

Caeruleas
Member
Registered: 2018-04-16
Posts: 26

How to lock screen after suspend - Laptop [SOLVED]

HI, I'm relatively new to Arch Linux (I've been using it for two days) and so far I'm enjoying the experience. I am using GDM and Budgie DE. However, I don't know how to configure it so that whenever I click the "lock" button or close the laptop lid it goes to the GDM login. Whenever I close the laptop lid it suspends succesfully, but whenever I open the lid again it goes straight back without showing me the GDM first. Please help, I am really enjoying Arch Linux. (BTW I'm still a newbie at the commands so please post them) smile

Last edited by Caeruleas (2018-04-22 03:53:38)

Offline

#2 2018-04-18 13:50:28

peterklarc
Member
Registered: 2017-03-28
Posts: 28

Re: How to lock screen after suspend - Laptop [SOLVED]

With budgie go to settings/power and them settings/privacy...

Last edited by peterklarc (2018-04-18 13:54:29)

Offline

#3 2018-04-19 18:35:45

JJK
Member
Registered: 2013-10-24
Posts: 56

Re: How to lock screen after suspend - Laptop [SOLVED]

If you don't manage to get it working through budgie settings you might fix it outside of budgie.

In general it is possible to run commands, like locking the screen, when the computer is put to sleep. See https://wiki.archlinux.org/index.php/Po … leep_hooks for details.

Offline

#4 2018-04-19 22:43:56

Caeruleas
Member
Registered: 2018-04-16
Posts: 26

Re: How to lock screen after suspend - Laptop [SOLVED]

Thank you for the replies. After some research I found out that I'm supposed to use a locking program such as xscreensaver. I couldn't get the budgie settings to work so I followed JJK's link. I have made the service files and enabled them, but now what?

Running "systemctl status suspend@caeruleas.service" gives:

● suspend@caeruleas.service - User suspend actions
   Loaded: loaded (/etc/systemd/system/suspend@caeruleas.service; enabled; vend>
   Active: failed (Result: exit-code) since Fri 2018-04-20 10:33:11 NZST; 1min >
  Process: 22213 ExecStartPre=/usr/local/bin/music.sh stop (code=exited, status>
  Process: 22212 ExecStartPre=/usr/bin/pkill -u root unison (code=exited, statu>

Apr 20 10:33:11 Caeruleas systemd[22213]: suspend@caeruleas.service: Failed to >
Apr 20 10:33:11 Caeruleas systemd[22213]: suspend@caeruleas.service: Failed at >

Running "systemctl status resume@caeruleas.service" gives:

● resume@caeruleas.service - User resume actions
   Loaded: loaded (/etc/systemd/system/resume@caeruleas.service; enabled; vendo>
   Active: inactive (dead)

I just can't seem to lock the screen successfully.

Last edited by Caeruleas (2018-04-19 23:39:07)

Offline

#5 2018-04-20 07:54:28

JJK
Member
Registered: 2013-10-24
Posts: 56

Re: How to lock screen after suspend - Laptop [SOLVED]

I'm sorry I was not clear enough in my first post.

You seem to have copy-pasted the suspend@ and resume@ files from the wiki.
However, my intention was that you create a suspend@ service in which the ExecStart field starts your lockscreen (i.e. i3lock or any of these https://wiki.archlinux.org/index.php/Li … n_lockers).
You can just replace all the ExecStartPre, ExecStart, ExecStartPost of the example on the wiki. They are just examples of commands that can be run before suspending.

My suspend@ service looks as follows.

[Unit]
Description=i3lock
Before=sleep.target

[Service]
User=jjk
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/i3lock

[Install]
WantedBy=sleep.target

Offline

#6 2018-04-20 13:10:36

Caeruleas
Member
Registered: 2018-04-16
Posts: 26

Re: How to lock screen after suspend - Laptop [SOLVED]

JJK wrote:

I'm sorry I was not clear enough in my first post.

You seem to have copy-pasted the suspend@ and resume@ files from the wiki.
However, my intention was that you create a suspend@ service in which the ExecStart field starts your lockscreen (i.e. i3lock or any of these https://wiki.archlinux.org/index.php/Li … n_lockers).
You can just replace all the ExecStartPre, ExecStart, ExecStartPost of the example on the wiki. They are just examples of commands that can be run before suspending.

My suspend@ service looks as follows.

[Unit]
Description=i3lock
Before=sleep.target

[Service]
User=jjk
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/i3lock

[Install]
WantedBy=sleep.target

Thank you for the reply. I did what you suggested and edited my suspend@caeruleas.service file like so:

[Unit]
Description=xscreensaver
Before=sleep.target

[Service]
User=caeruleas
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/xscreensaver
ExecStartPost=/usr/bin/sleep 1

[Install]
WantedBy=sleep.target

and the resume@caeruleas.service file:

[Unit]
Description=xscreensaver resume
After=suspend.target

[Service]
User=caeruleas
Type=simple
ExecStart=/usr/bin/mysql -e 'slave start'

[Install]
WantedBy=suspend.target

I ran sudo systemctl enable suspend@caeruleas.service again and started it and it came up with this image.
I guess that's a start, but I tried locking my screen through the budgie panel and tried closing the laptop lid but it didn't work. I think I've got the path to xscreensaver wrong.
More help would be greatly appreciated.

Offline

#7 2018-04-20 14:01:50

peterklarc
Member
Registered: 2017-03-28
Posts: 28

Re: How to lock screen after suspend - Laptop [SOLVED]

Budgie-desktop optional deps:
- gnome-screensaver.

pacman -Si budgie-desktop

Offline

#8 2018-04-20 14:18:37

JJK
Member
Registered: 2013-10-24
Posts: 56

Re: How to lock screen after suspend - Laptop [SOLVED]

It seems that your suspend@ script is working. So I do not think the path is wrong.
Is suspend triggered when you close the laptop lid? If not, see https://wiki.archlinux.org/index.php/Po … CPI_events to suspend on lid close.

Offline

#9 2018-04-21 00:33:16

Caeruleas
Member
Registered: 2018-04-16
Posts: 26

Re: How to lock screen after suspend - Laptop [SOLVED]

peterklarc wrote:

Budgie-desktop optional deps:
- gnome-screensaver.

pacman -Si budgie-desktop
sudo pacman -Si budgie-desktop

gives me:

Repository      : community
Name            : budgie-desktop
Version         : 10.4+34+gd6f3519f-1
Description     : Modern desktop environment from the Solus Project
Architecture    : x86_64
URL             : https://budgie-desktop.org/
Licenses        : GPL  LGPL
Groups          : None
Provides        : None
Depends On      : accountsservice  gnome-bluetooth  gnome-menus  gnome-session
                  gnome-themes-standard  libibus  libpeas  libwnck3  mutter
Optional Deps   : gnome-backgrounds: Default background
                  gnome-control-center: System settings
                  gnome-screensaver: Lock screen
                  network-manager-applet: Network management
Conflicts With  : None
Replaces        : None
Download Size   : 656.80 KiB
Installed Size  : 4006.00 KiB
Packager        : Balló György <ballogyor+arch@gmail.com>
Build Date      : Thu 29 Mar 2018 02:44:57 PM NZDT
Validated By    : MD5 Sum  SHA-256 Sum  Signature
JJK wrote:

It seems that your suspend@ script is working. So I do not think the path is wrong.
Is suspend triggered when you close the laptop lid? If not, see https://wiki.archlinux.org/index.php/Po … CPI_events to suspend on lid close.

Yes the screen does suspend when I close the lid, but when I open it again the image shows up again and airplane mode is on so I had to close then open the lid again to enable the wifi again. How can I make the lockscreen work? And on a side note, is there a way I can disable it so that it doesn't turn off the wifi whenever I suspend it?

Last edited by Caeruleas (2018-04-21 00:36:06)

Offline

#10 2018-04-21 05:56:02

JJK
Member
Registered: 2013-10-24
Posts: 56

Re: How to lock screen after suspend - Laptop [SOLVED]

If that image shows up your script is working, the command

xscreensaver

is called on suspend. Maybe the command xscreensaver does not lock the screen.

Anyway, I did not know about the optional dependency of budgie. As you can see in the output of

pacman -Qi budgie-desktop

it lists gnome-screensaver as a dependency to lock the screen. So, probably the easiest way to fix locking the screen now is to disable the script you created, the install gnome-screensaver, then the settings in budgie should work.

Last edited by JJK (2018-04-21 05:57:20)

Offline

#11 2018-04-21 06:01:17

Caeruleas
Member
Registered: 2018-04-16
Posts: 26

Re: How to lock screen after suspend - Laptop [SOLVED]

Okay, I just gave up with xscreensaver and tried i3lock, and it works perfectly when I close the laptop lid! I don't know what I did wrong with xscreensaver but I like the look of i3lock anyways. Thank you all for your help, but I still have the problem of the lock button not working on Budgie DE. This doesn't bother me as much but it would still be pretty useful if I could use this.

Offline

#12 2018-04-21 06:03:17

JJK
Member
Registered: 2013-10-24
Posts: 56

Re: How to lock screen after suspend - Laptop [SOLVED]

For the problem with xscreensaver, read the wiki page for it. You were using the wrong command in the script.

For the problem with the lock button, carefully read peterklarc's post and mine, you are missing a dependency.

Last edited by JJK (2018-04-21 06:04:05)

Offline

#13 2018-04-21 06:07:33

Caeruleas
Member
Registered: 2018-04-16
Posts: 26

Re: How to lock screen after suspend - Laptop [SOLVED]

JJK wrote:

For the problem with xscreensaver, read the wiki page for it. You were using the wrong command in the script.

For the problem with the lock button, carefully read peterklarc's post and mine, you are missing a dependency.


If the missing dependency is gnome-screensaver, I already have it installed.

Offline

#14 2018-04-21 11:38:59

peterklarc
Member
Registered: 2017-03-28
Posts: 28

Re: How to lock screen after suspend - Laptop [SOLVED]

In optional deps did you also installed gnome-control-center?
Because budgie intended to integrate with GNOME applications (until now) Budgie so my first comment I was talking about the settings in the gnome-control-center* not the budgie-settings (*touch the battery icon / power in the panel)
I just reinstalled budgie with optional deps and it's working.

note: check the button hidden under your name - just click on it and the lock button will appear - in the power off button panel.

Last edited by peterklarc (2018-04-21 11:49:58)

Offline

#15 2018-04-22 03:53:21

Caeruleas
Member
Registered: 2018-04-16
Posts: 26

Re: How to lock screen after suspend - Laptop [SOLVED]

Wow, after a restart everything is working just fine. Thank you so much peterklarc and JJK, this problem was really fustrating because I would need to use this laptop for school and I have a couple of friends that would sieze any chance to snoop on my laptop XD. Again, thank you so much!

Offline

#16 2019-03-30 15:03:29

wis
Member
Registered: 2019-02-15
Posts: 14

Re: How to lock screen after suspend - Laptop [SOLVED]

Caeruleas wrote:
JJK wrote:

I'm sorry I was not clear enough in my first post.

You seem to have copy-pasted the suspend@ and resume@ files from the wiki.
However, my intention was that you create a suspend@ service in which the ExecStart field starts your lockscreen (i.e. i3lock or any of these https://wiki.archlinux.org/index.php/Li … n_lockers).
You can just replace all the ExecStartPre, ExecStart, ExecStartPost of the example on the wiki. They are just examples of commands that can be run before suspending.

My suspend@ service looks as follows.

[Unit]
Description=i3lock
Before=sleep.target

[Service]
User=jjk
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/i3lock

[Install]
WantedBy=sleep.target

Thank you for the reply. I did what you suggested and edited my suspend@caeruleas.service file like so:

[Unit]
Description=xscreensaver
Before=sleep.target

[Service]
User=caeruleas
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/xscreensaver
ExecStartPost=/usr/bin/sleep 1

[Install]
WantedBy=sleep.target

and the resume@caeruleas.service file:

[Unit]
Description=xscreensaver resume
After=suspend.target

[Service]
User=caeruleas
Type=simple
ExecStart=/usr/bin/mysql -e 'slave start'

[Install]
WantedBy=suspend.target

I ran sudo systemctl enable suspend@caeruleas.service again and started it and it came up with this image.
I guess that's a start, but I tried locking my screen through the budgie panel and tried closing the laptop lid but it didn't work. I think I've got the path to xscreensaver wrong.
More help would be greatly appreciated.

use:

User=%i

instead, in order to avoid having user names in your system config

Offline

Board footer

Powered by FluxBB