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

New to Puppy and have questions? Start here

Moderator: Forum moderators

Post Reply
rburkartjo
Posts: 237
Joined: Thu Feb 25, 2021 12:29 am
Been thanked: 4 times

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

Post 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

Last edited by rburkartjo on Sat Feb 27, 2021 5:38 pm, edited 1 time in total.
User avatar
mikewalsh
Moderator
Posts: 6208
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 806 times
Been thanked: 1998 times

Re: locking laptop

Post 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. ;)

User avatar
bigpup
Moderator
Posts: 7072
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 926 times
Been thanked: 1537 times

Re: locking laptop

Post 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.

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

williams2
Posts: 1065
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 306 times

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

Post 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.

rburkartjo
Posts: 237
Joined: Thu Feb 25, 2021 12:29 am
Been thanked: 4 times

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

Post by rburkartjo »

tka will

User avatar
elovelo
Posts: 4
Joined: Tue May 02, 2023 7:18 pm
Location: Poland
Has thanked: 1 time

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

Post 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.

User avatar
mikewalsh
Moderator
Posts: 6208
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 806 times
Been thanked: 1998 times

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

Post 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. ;)

User avatar
bigpup
Moderator
Posts: 7072
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 926 times
Been thanked: 1537 times

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

Post 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.

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
mikeslr
Posts: 2980
Joined: Mon Jul 13, 2020 11:08 pm
Has thanked: 179 times
Been thanked: 929 times

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

Post 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 677 times

Tip: Be careful what you wish for.

Post Reply

Return to “Beginners Help”