LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Bodhi
User Name
Password
Bodhi This forum is for the discussion of Bodhi Linux.

Notices


Reply
  Search this Thread
Old 11-18-2018, 07:28 PM   #1
joozooh
LQ Newbie
 
Registered: Nov 2018
Posts: 2

Rep: Reputation: Disabled
Both Lock and Suspend on Laptop Lid Close - Looking for command line option


Hi there,
I've been looking all over for a way to get my laptop running Bodhi to either:
both lock the screen and suspend when closing the laptop lid,
OR
set this to option to a key-binding WITHOUT getting a prompt appear to confirm whether I'm "sure [I] want to suspend [the] computer?".
I've set the lock settings to lock when suspending and when I suspend either from system menu, or from a keyboard shortcut, this works (though with keyboard shortcuts it has the above mentioned issue of a dialogue box that appears first for confirmation, which I then need to use the touchpad to confirm.)
However, when I suspend the laptop, or call:
suspend
from the command line, the lock does not properly activate.
The laptop just suspends and when waking from sleep does not prompt for a password before returning me to my session.
I've also tried:
systemctl suspend
from the command line, but this also does not lock before suspending.

I'm currently thinking to figure out how the screen lock functions on bodhi so that I can write a shell script which activates the lock and then suspends the computer. I would then append this the ACPI binding for lid close, which will launch a command to run the shell script.
However, I can't seem to find any information anywhere on how the lock settings on bodhi work under the hood, in which files the settings exist, or how to activate them via command line.

Any help or insights regarding any of the above would be greatly appreciated.
Even somebody just pointing me to some docs where I can find the command-line commands needed to work with the enlightenment/moksha environment from a terminal, specifically the lock settings,
or,
some docs that explain which program is being used for locking the screen on bodhi under the hood, so that I can look up docs for this on my own,
would be excellent.

Thanks in advance for any help,
Jo
 
Old 11-18-2018, 08:58 PM   #2
JWJones
Senior Member
 
Registered: Jun 2009
Posts: 1,444

Rep: Reputation: 709Reputation: 709Reputation: 709Reputation: 709Reputation: 709Reputation: 709Reputation: 709
I use slock to achieve this, via an entry in my fvwm menu (which I have named 'Lock + Sleep') that executes the following:

Code:
Exec slock & sudo sh -c 'echo -n mem > /sys/power/state'
 
1 members found this post helpful.
Old 11-19-2018, 04:45 AM   #3
rbtylee
Bodhi Developer
 
Registered: Jun 2018
Location: Ladson, SC US
Distribution: Bodhi
Posts: 454

Rep: Reputation: 437Reputation: 437Reputation: 437Reputation: 437Reputation: 437
Load the Dbus Extension module and then the command:

Code:
enlightenment_remote -desktop-lock
Locks the desktop.

And then the command

Code:
systemctl suspend
Should suspend the machine.
 
2 members found this post helpful.
Old 11-19-2018, 07:00 PM   #4
joozooh
LQ Newbie
 
Registered: Nov 2018
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks very much for all the help so far, I've been able to really get going with this as a result, so I'm very grateful.
So far, I've been able to:
  • Install slock and test its usage
  • Set the following command to launch from a key combination:
    Code:
    slock systemctl suspend
  • Disable systemd control of Lid Switch at /etc/systemd/logind.conf by uncommenting and adjusting this line:
    Code:
    HandleLidSwitch=ignore
  • Enable acpid:
    Code:
    systemctl enable acpid
    (was previously disabled checked with):
    Code:
    $> systemctl is-enabled acpid
    disabled
  • Create and ACPID event and corresponding action for the lid close event, which actually functions to append text to a file or call a script:
    • In /etc/acpi/events/ made a file called lid:
      Code:
      event=button/lid
      action=/etc/acpi/actions/close-lid.sh %e
    • In /etc/acpi/actions made a file called close-lid.sh:
      Code:
      #!/bin/sh
      
      echo $1 $2 $3 $4 $5 >> /home/username/mylog
      echo "$1" | grep "button/lid" && grep -q open /proc/acpi/button/lid/*/state && exit 0
      
      slock
      
      echo after slock >> /home/username/mylog
    • THEN: Tailed mylog file with:
      Code:
      tail -f /home/username/mylog
      And get output in realtime as the file adjusts with opening and closing the lid, but no slock function.
      SO:
    • Make a file in /home/username/ called slockTest.sh and make it executable:
      Code:
      #!/bin/sh
      echo in slocktest >> /home/username/mylog
      slock
      echo still in slocktest >> /home/username/mylog
    • Test execution with:
      Code:
      /home/user/slockTest.sh
      And slock works with mylog update in realtime
    • Adjust /etc/acpi/actions/close-lid.sh:
      Code:
      #!/bin/sh
      
      echo $1 $2 $3 $4 $5 >> /home/username/mylog
      echo "$1" | grep "button/lid" && grep -q open /proc/acpi/button/lid/*/state && exit 0
      
      /home/username/slockTest.sh
      
      echo after slock >> /home/username/mylog
      BUT !!! slock will still not work with the lid close function..

SO:
I've done a bit more research and found this Ask Ubuntu post, which points to this guide, which I will follow next to hopefully get some desired functionality with the lid close.
After that I'll also give rbtylee's suggestions a go to see if I can get some more enlightenment specific lock behaviour working.

I'll probably post any continuing progress here as well.

Thanks again JWJones and rbtylee for your help.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] CentOS with no GUI - disable suspend on laptop lid close EPLychon Linux - Laptop and Netbook 2 04-12-2015 07:30 PM
Laptop lid close suspend with i3 lzhiren Slackware 4 02-04-2015 01:35 AM
LXer: Ready for Gnome 3.2? no more suspend on laptop lid close LXer Syndicated Linux News 0 09-16-2011 02:41 AM
disable suspend when I close the laptop lid lindylex Debian 5 04-14-2009 08:53 AM
Suspend to Disk problem when I close my laptop lid xbaez Mandriva 0 06-23-2004 08:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Bodhi

All times are GMT -5. The time now is 11:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration