There have been a number of requests here on the forums and elsewhere to allow the screen_blanker command to immediately lock the screen. I was going to respond to some of them but there were at least a dozen threads so I’ll make a quick post.
I have submitted some changes that give the screen_blanker command a -l option to immediately lock the screen regardless of the delay setting in the ScreenSaver preference app. This command line option is available in Haiku builds after hrev58658. The new option makes it easier to use screen_blanker at boot time or with a keyboard shortcut using the Shortcuts preference app.
I have been testing this by using a launch_roster script to start screen_blanker at boot time. I am still working on it, but it seems to be reliable and also offers the option of being active even if Haiku was booted into safe mode if desired. To use it you can create a file at /system/non-packaged/data/user_launch/screen_blanker.launch with the contents from below.
Once the launch script is in place, the lock can be activated by creating an empty file at ~/config/settings/bootlock. You can also remove or comment out the no_safemode line to have the lock active even when booted to safe mode.
So, one of the other changes I made was to allow the system password to unlock the screensaver. You must go into the ScreenSaver preference app, enable the screen lock, and then choose to “Use system password”. After that, you must set a password for the main user on Haiku which is usually named “user”. You can do this from a Terminal by using the passwd command or the Users app from the HaikuUtils package.
After you followed steps above as @Lrrr responded to me …
… and for those, who unfamiliar with commands and would create the affected directorie(s)/file(s) in Terminal (as it is faster some times than clicking together on GUI) – here you are one solution :
~> ls -l /system/non-packaged/data/user_launch/screen_blanker.launch
ls: cannot access '/system/non-packaged/data/user_launch/screen_blanker.launch': No such file or directory
~> ls -l /system/non-packaged/data/user_launch
ls: cannot access '/system/non-packaged/data/user_launch': No such file or directory
~> ls -l /system/non-packaged/data/
total 16
drwxr-xr-x 1 user root 2048 okt. 24 08:09 firmware
drwxr-xr-x 1 user root 2048 dec. 17 2022 fonts
drwxr-xr-x 1 user root 2048 ápr. 7 2024 glib-2.0
drwxr-xr-x 1 user root 2048 márc. 23 2024 UIThemes
~> mkdir -p 755 /system/non-packaged/data/user_launch; cd /system/non-packaged/data/user_launch; touch /system/non-packaged/data/user_launch/screen_blanker.launch
/system/non-packaged/data/user_launch> StyledEdit /system/non-packaged/data/user_launch/screen_blanker.launch && chmod 755 /system/non-packaged/data/user_launch/screen_blanker.launch; ls -l; cat ./screen_blanker.launch
total 4
-rwxr-xr-x 1 user root 148 febr. 20 18:27 screen_blanker.launch
job lock-screen-at-boot {
launch /bin/screen_blanker -l
requires x-vnd.haiku-app_server
if file_exists ~/config/settings/bootlock
no_safemode
}/system/non-packaged/data/user_launch>
creating the bootlocker file
}/system/non-packaged/data/user_launch> ls -l ~/config/settings/bootlock
ls: cannot access '/boot/home/config/settings/bootlock': No such file or directory
/system/non-packaged/data/user_launch> touch ~/config/settings/bootlock
/system/non-packaged/data/user_launch> ls -l ~/config/settings/bootlock
-rw-r--r-- 1 user root 0 febr. 20 19:00 /boot/home/config/settings/bootlock
/system/non-packaged/data/user_launch>
I will bookmark this post, and later I set and activate it - actually I live alone and do not move my Haiku machine -especially as no user group here or necessity to meetup and need to secure with lock/unlock my screen.
However it will satisfy some member here who worried about securing access to their Haiku rig somehow.
Now let’s add a lock menu or something to the deskbar so that we can click the button to quickly lock instead of going into the screensaver preferences and pressing start screensaver.
There are other methods of starting the screensaver lock. The screen_blanker -l command can be run from pretty much anywhere. That means you could have a one line shell script with a link on your desktop or in the Deskbar. As briefly mentioned in the original post, you can also assign a global keyboard shortcut to run this command from within the Shortcuts preference app. During testing I have my win+l shortcut set to run /bin/screen_blanker -l
On a side note, it’s not actually necessary to leave the regular screensaver enabled if you only want to use this as a boot lock or on-demand lock screen. Once you have enabled the screen lock, configured the password options, and so on, you can turn the main screensaver checkbox off.
Alright, then that’s solved too. Then we actually have an okay security system that would pass. Like no one is after your Haiku system, Haiku isn’t designed for max security, and minimal security would pass for it. Then we just need to wait for Beta 6. Also, we should also set this as a default thing for Beta 6, so that people don’t need to set it up themselves, it comes with it out of the box.