Page 1 of 1

How to lock my laptop when the lid is closed? (Solved)

Posted: Fri Feb 26, 2021 9:21 pm
by rburkartjo

running puppy 9.5 on a stick. is there anyway to have the desktop lock when i close the lid. if so how. tks
note no problem when in ubuntu


Re: locking laptop

Posted: Sat Feb 27, 2021 1:10 am
by mikewalsh

@rburkartjo :-

Wot? no "cheese-maker's"....?? :lol: We miss you, mate. (NickAu's done a sterling job keeping it going, y'know....) :D

Mike. ;)


Re: locking laptop

Posted: Sat Feb 27, 2021 1:17 am
by bigpup

Not exactly by just closing the lid.

Xlock will lock the screen, by clicking on the lock icon, on the desktop.

To unlock, you have to enter a password, that you make, before using Xlock.

Right click on the desktop lock icon.
The right click menu gives you some options and selections, for Lock.

Do not forget the password.

To set password.
Click on the Lock icon.
A input window will open.
To set password:
Type it in
Press enter key
It will ask to Repeat, to make sure it got it correctly set.

I know, on the lock icon right click menu. It has option to clear the password.
But you are the one that unlocked the screen, so you are the one that set it.
If you have cleared the password.
When you click on the Lock icon.
It will ask you to make a password, before it locks the screen.


Re: How to lock my laptop when the lid is closed?

Posted: Sat Feb 27, 2021 6:23 am
by williams2

You could edit the file /etc/acpi/actions/suspend.sh
and add this line to the bottom of the file:

Code: Select all

xlock -mode blank

Closing the lid should suspend the computer,
then lock the screen when the lid is opened.

You can disable ctrl+alt+backspace if you want to prevent it from killing X.


Re: How to lock my laptop when the lid is closed?

Posted: Sat Feb 27, 2021 3:20 pm
by rburkartjo

tka will


Re: How to lock my laptop when the lid is closed? (Solved)

Posted: Tue May 02, 2023 7:48 pm
by elovelo

Hey, slacko 7.0 user here. I found out that in my case for the suspend.sh to work, apart from adding the xlock line, I also had to comment out the detection of USB devices which prevents the script from executing the suspend:

Code: Select all

# do not suspend if usb media mounted
USBS=$(probedisk2|grep '|usb' | cut -d'|' -f1 )
for USB in $USBS
do
	mount | grep -q "^$USB" && rm -f "$LOCKFILE" && exit 0
done

In my case, a built-in SD card reader is detected by probedisk2 as usb drive, even if the card is not inserted:

Code: Select all

# probedisk2
/dev/sda|drive|ATA WDC WD800BEVS-22
/dev/sdb|usbdrv|Generic- Multi-Card
# probedisk2|grep '|usb' | cut -d'|' -f1
/dev/sdb

Either comment this out or modify $USBS to your hardware specifications and needs. I am not sure what is even the purpose of this preventive check.


Re: How to lock my laptop when the lid is closed? (Solved)

Posted: Tue May 02, 2023 9:11 pm
by mikewalsh

@elovelo :- Hi.....and :welcome: to the "kennels".

Mm. That kinda sounds vaguely familiar, y'know. I'm thinking back to MY early days with Puppy, and the elderly Compaq desktop I was using at the time.

I'd inherited it from my sister - she'd "retired" it for a new Windows 7 machine when Windows XP went EOL, and I said I'd take it off her hands. It was around 10 yrs old then, and it had a 4-in-one multi-card reader. Which hadn't worked for years.....but Puppy saw that card reader as occupying 4 mount-points, regardless of whether it functioned or not.

My available mount-points always went from sdb direct to sdg; sdc, sdd, sde AND sdf were simply "unavailable" for use.....

So, yes; I'd say it's a long-standing, and in all likelihood well-known and/or well-documented issue. I doubt either you OR I are the first ones to have encountered it. Not by a long chalk..! :D

Mike. ;)


Re: How to lock my laptop when the lid is closed? (Solved)

Posted: Wed May 03, 2023 7:01 pm
by bigpup

suspend.sh to work, apart from adding the xlock line, I also had to comment out the detection of USB devices which prevents the script from executing the suspend:

That was in suspend.sh if you are booting from Puppy installed on a USB with the save on the USB.

If it suspended at the time the save was being written to, not a good idea.

Slacko 7 is not that updated to all the changes, to how Puppy works, that are in newer versions.

Slacko 7 is still a little buggy.


Re: How to lock my laptop when the lid is closed? (Solved)

Posted: Fri May 05, 2023 2:12 pm
by mikeslr

Universal Solution, no coding needed. It will work with any Puppy, any Laptop.

Laptop-lock.png
Laptop-lock.png (130.03 KiB) Viewed 687 times

Tip: Be careful what you wish for.