Ubuntu 18.04 doesn't lock when I close the lid
Clash Royale CLAN TAG#URR8PPP
Here's what I did:
I created a file /etc/acpi/events/lm_lid
and wrote into it:
event=button/lid.*
action=/etc/acpi/lid.sh
I created a file /etc/acpi/lid.sh
and wrote into it:
#!/bin/sh
gnome-screensaver-command --lock
The good news are that this script is being executed when I close the lid. The bad news are that it doesn't lock the system.
Any other command I put in the script is executed when I close the lid except the lock itself. When I run the script manually from command line the system locks.
What did I miss?
ubuntu power-management acpi
add a comment |
Here's what I did:
I created a file /etc/acpi/events/lm_lid
and wrote into it:
event=button/lid.*
action=/etc/acpi/lid.sh
I created a file /etc/acpi/lid.sh
and wrote into it:
#!/bin/sh
gnome-screensaver-command --lock
The good news are that this script is being executed when I close the lid. The bad news are that it doesn't lock the system.
Any other command I put in the script is executed when I close the lid except the lock itself. When I run the script manually from command line the system locks.
What did I miss?
ubuntu power-management acpi
1
I think your problem might be that that script is executed outside the X session you want to lock (and probably as another user) .You probably need gnome (I assume that you wanting to run gnome-screensaver is an indication you use gnome) to help you.
– Henrik
Dec 24 '18 at 12:38
add a comment |
Here's what I did:
I created a file /etc/acpi/events/lm_lid
and wrote into it:
event=button/lid.*
action=/etc/acpi/lid.sh
I created a file /etc/acpi/lid.sh
and wrote into it:
#!/bin/sh
gnome-screensaver-command --lock
The good news are that this script is being executed when I close the lid. The bad news are that it doesn't lock the system.
Any other command I put in the script is executed when I close the lid except the lock itself. When I run the script manually from command line the system locks.
What did I miss?
ubuntu power-management acpi
Here's what I did:
I created a file /etc/acpi/events/lm_lid
and wrote into it:
event=button/lid.*
action=/etc/acpi/lid.sh
I created a file /etc/acpi/lid.sh
and wrote into it:
#!/bin/sh
gnome-screensaver-command --lock
The good news are that this script is being executed when I close the lid. The bad news are that it doesn't lock the system.
Any other command I put in the script is executed when I close the lid except the lock itself. When I run the script manually from command line the system locks.
What did I miss?
ubuntu power-management acpi
ubuntu power-management acpi
edited Dec 30 '18 at 17:37
Jeff Schaller
39k1053125
39k1053125
asked Dec 24 '18 at 11:48
JothamB
61
61
1
I think your problem might be that that script is executed outside the X session you want to lock (and probably as another user) .You probably need gnome (I assume that you wanting to run gnome-screensaver is an indication you use gnome) to help you.
– Henrik
Dec 24 '18 at 12:38
add a comment |
1
I think your problem might be that that script is executed outside the X session you want to lock (and probably as another user) .You probably need gnome (I assume that you wanting to run gnome-screensaver is an indication you use gnome) to help you.
– Henrik
Dec 24 '18 at 12:38
1
1
I think your problem might be that that script is executed outside the X session you want to lock (and probably as another user) .You probably need gnome (I assume that you wanting to run gnome-screensaver is an indication you use gnome) to help you.
– Henrik
Dec 24 '18 at 12:38
I think your problem might be that that script is executed outside the X session you want to lock (and probably as another user) .You probably need gnome (I assume that you wanting to run gnome-screensaver is an indication you use gnome) to help you.
– Henrik
Dec 24 '18 at 12:38
add a comment |
2 Answers
2
active
oldest
votes
I'm using Debian and faced similar problem,
first, i wont recommend script because it doesn't work in lock screen.
if you are using gnome install gnome-tweaks and it has a option.
alternatively edit the /etc/systemd/logind.conf, just uncomment the HandleLidSwitch=suspend line.
this worked for me.
Thanks. I can suspend the system but I want to lock it.
– JothamB
Dec 24 '18 at 16:28
@JothamB There's a setting in Gnome settings under privacy, screen lock. Click on it and set the lock screen after blank for to the option screen turns off.
– Kushagra Karira
Dec 25 '18 at 17:23
add a comment |
Try downloading gnome-tweaks and there should be an option about locking when closing the lid.
To download gnome -tweaks do:sudo apt install gnome-tweaks-tool
You can also use this for tweaking things like right clicking and left clicking.
It only has an option to suspend. I want to lock without suspending.
– JothamB
Dec 27 '18 at 11:08
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f490757%2fubuntu-18-04-doesnt-lock-when-i-close-the-lid%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I'm using Debian and faced similar problem,
first, i wont recommend script because it doesn't work in lock screen.
if you are using gnome install gnome-tweaks and it has a option.
alternatively edit the /etc/systemd/logind.conf, just uncomment the HandleLidSwitch=suspend line.
this worked for me.
Thanks. I can suspend the system but I want to lock it.
– JothamB
Dec 24 '18 at 16:28
@JothamB There's a setting in Gnome settings under privacy, screen lock. Click on it and set the lock screen after blank for to the option screen turns off.
– Kushagra Karira
Dec 25 '18 at 17:23
add a comment |
I'm using Debian and faced similar problem,
first, i wont recommend script because it doesn't work in lock screen.
if you are using gnome install gnome-tweaks and it has a option.
alternatively edit the /etc/systemd/logind.conf, just uncomment the HandleLidSwitch=suspend line.
this worked for me.
Thanks. I can suspend the system but I want to lock it.
– JothamB
Dec 24 '18 at 16:28
@JothamB There's a setting in Gnome settings under privacy, screen lock. Click on it and set the lock screen after blank for to the option screen turns off.
– Kushagra Karira
Dec 25 '18 at 17:23
add a comment |
I'm using Debian and faced similar problem,
first, i wont recommend script because it doesn't work in lock screen.
if you are using gnome install gnome-tweaks and it has a option.
alternatively edit the /etc/systemd/logind.conf, just uncomment the HandleLidSwitch=suspend line.
this worked for me.
I'm using Debian and faced similar problem,
first, i wont recommend script because it doesn't work in lock screen.
if you are using gnome install gnome-tweaks and it has a option.
alternatively edit the /etc/systemd/logind.conf, just uncomment the HandleLidSwitch=suspend line.
this worked for me.
answered Dec 24 '18 at 12:00
Kushagra Karira
166
166
Thanks. I can suspend the system but I want to lock it.
– JothamB
Dec 24 '18 at 16:28
@JothamB There's a setting in Gnome settings under privacy, screen lock. Click on it and set the lock screen after blank for to the option screen turns off.
– Kushagra Karira
Dec 25 '18 at 17:23
add a comment |
Thanks. I can suspend the system but I want to lock it.
– JothamB
Dec 24 '18 at 16:28
@JothamB There's a setting in Gnome settings under privacy, screen lock. Click on it and set the lock screen after blank for to the option screen turns off.
– Kushagra Karira
Dec 25 '18 at 17:23
Thanks. I can suspend the system but I want to lock it.
– JothamB
Dec 24 '18 at 16:28
Thanks. I can suspend the system but I want to lock it.
– JothamB
Dec 24 '18 at 16:28
@JothamB There's a setting in Gnome settings under privacy, screen lock. Click on it and set the lock screen after blank for to the option screen turns off.
– Kushagra Karira
Dec 25 '18 at 17:23
@JothamB There's a setting in Gnome settings under privacy, screen lock. Click on it and set the lock screen after blank for to the option screen turns off.
– Kushagra Karira
Dec 25 '18 at 17:23
add a comment |
Try downloading gnome-tweaks and there should be an option about locking when closing the lid.
To download gnome -tweaks do:sudo apt install gnome-tweaks-tool
You can also use this for tweaking things like right clicking and left clicking.
It only has an option to suspend. I want to lock without suspending.
– JothamB
Dec 27 '18 at 11:08
add a comment |
Try downloading gnome-tweaks and there should be an option about locking when closing the lid.
To download gnome -tweaks do:sudo apt install gnome-tweaks-tool
You can also use this for tweaking things like right clicking and left clicking.
It only has an option to suspend. I want to lock without suspending.
– JothamB
Dec 27 '18 at 11:08
add a comment |
Try downloading gnome-tweaks and there should be an option about locking when closing the lid.
To download gnome -tweaks do:sudo apt install gnome-tweaks-tool
You can also use this for tweaking things like right clicking and left clicking.
Try downloading gnome-tweaks and there should be an option about locking when closing the lid.
To download gnome -tweaks do:sudo apt install gnome-tweaks-tool
You can also use this for tweaking things like right clicking and left clicking.
answered Dec 25 '18 at 17:43
maxim pavlenko
161
161
It only has an option to suspend. I want to lock without suspending.
– JothamB
Dec 27 '18 at 11:08
add a comment |
It only has an option to suspend. I want to lock without suspending.
– JothamB
Dec 27 '18 at 11:08
It only has an option to suspend. I want to lock without suspending.
– JothamB
Dec 27 '18 at 11:08
It only has an option to suspend. I want to lock without suspending.
– JothamB
Dec 27 '18 at 11:08
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f490757%2fubuntu-18-04-doesnt-lock-when-i-close-the-lid%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I think your problem might be that that script is executed outside the X session you want to lock (and probably as another user) .You probably need gnome (I assume that you wanting to run gnome-screensaver is an indication you use gnome) to help you.
– Henrik
Dec 24 '18 at 12:38