Lock screen i3lock

Hi,
Now Mobox uses i3lock. My problem is the same as in this topic.

https://forum.maboxlinux.org/t/powermanagement-lock-screen-when-system-is-going-to-sleep-solved/237

I can lock my screen, but the lid of my comp doesnt. I got the message “None of the screen runs successfully…”

Thank you for your help. :slight_smile:
Best regards
j

Hi @horvjoe,

A while back, I created a guide about handling lid close action and locking the screen with betterlockscreen.
Since you’re using i3lock, here’s a quick tip to adapt the guide to your setup:

Wherever you see:

/usr/bin/betterlockscreen --lock

replace it with:

/usr/bin/i3lock

Here’s the link to the guide:

Shortcut (W-A-l), start jgmenu screenlocker.
For changing screenlocker from i3lock to betterlockscreen, go to edit config file.


:bird:

Thank you,
I made as You suggest, but I have problem.

  1. In the part 1 section there is a spelling error

yay xxs-lock

  1. I made all the scripts, and they are working. In my system xss-lock and i3lock can be found in the /bin directory not in the /usr/bin. So I changed the directory lines.
  2. I started the acpid service, checked and its working.

My problem is in the next comment.

1 Like

My problem:
If I edit the autostart config file to run the lockscreen.sh (I made it executable), and put this into it:

#!/bin/bash

while true; do
	xss-lock -- betterlockscreen --lock 
  # Sleep for 1 second
  sleep 1
done

The rest of the autostart processes (thunderbird, numlock, opensnitch, dropbox, conky) wont start - they are on the Mabox XDG autostart editor.

I turned off powermanagement service.

Thank you :slight_smile:

How do you invoke your script (lockscreen.sh) ? And from where?

Autostart - Mabox Linux Manual

I found the solution…

I made a lockscreen.desktop entry for the script in the /home/usr/.config/autostart/, and it works fine.

But I dont understand - if I put it into and edit the autostart file manually, why do not start the desktop entries in the //home/usr/.config/autostart/ directory???

Thank you :slight_smile:

I don’t know how you invoked it from ~/.config/openbox/autostart.

Running this script in the background should work fine from there
Something like:

lockscreen.sh &
1 Like

I screwed…
/home/usr/.config/autostart/lockscreen.desktop

[Desktop Entry]
Name=Lockscreen
Comment=Lockscreen script
Icon=
Exec=/etc/acpi/lockscreen.sh
Terminal=false
Type=Application
Hidden=false

After this - in the gui can be make it start with a tick.

No, you did not. The important thing is you made it - one way or another :slight_smile:

Oh my… I forgot the “&” thats why stopped the autostart config file…

Im so beginner…
Thank you for your help - Im really appreciate it. :slight_smile:
Thank you very much. :slight_smile:

1 Like

Don’t be so modest, you did great. I see an advanced user here.
Enjoy tinkering :smiley:

1 Like

Hi @horvjoe ,
I forgot about the typo xxs-lock. I have to change that. Thanks.

How one can add a script to autostart. The easy way.

You add this line somewhere halfway at the list. At least not as last one.

(lockscreen.sh) &

Thats it. From now it will start from boot.

A wee bit more xtra info:
I put it between () because now you can also choose to give it a sleep time if needed.

(sleep 5s; locksceen.sh) &

A good nice .desktop is good too though :wink:

:bird:

1 Like

Changed xxs with xss. thanks
:bird:

1 Like

I put it into my autostart config. Looks like this now:


## Screenlock
(sleep 5s; /etc/acpi/locksceen.sh) &

## Panel
(sleep 1s && mb-tint2-session) &

## Background
(sleep 2s && nitrogen --restore) &

## Optionally enable file manager in daemon mode for automounting
(sleep 1s && pcmanfm -d) &

## Optionally disable touchpad
#/usr/bin/synclient TouchpadOff=1 &

## Mabox scripts - DO NOT DISABLE 
(sleep 1s && mabox-obstart startopenbox) &

## Numlock ON
numlockx &

That is the eof.

So yesterday it worked fine - at the end of the config. And I tried to find i3lock config file, and tried to config i3lock not to lock screen after 10 minutes, and not to get grey screen, but blur - like system uses. I run i3lock from terminal, and tried switches - but cant find this options - of course read through the manual as well.

Now it doesn’t work. When I close the lid - the system suspends, but when I open it, no screen lock. :confused: I cant find the solutions, and the reason.

It looks like you mixing up Part 1 and Part 2 in the manual.

Start over with part2.

Follow PART 2 step by step. Exact path, etc.

  • Don’t change names of scripts.
  • The only change you can make is betterlockcsreen for i3lock.

Try that. I quess that fill fix it.

:bird:

1 Like

Yes - it was a typo… thank you. Works fine.

So my next question is how to configure i3lock. I have read through the manual - but I would like to change a longer lock time and blur the screen as its in the Mabox system.

I looked through .config, and other places - but I cant find anything. :confused:

Thank you :slight_smile:

1 Like

Hi @horvjoe ,

Nice that the lid close works.

For i3lock.

Like blur can be done with hotkey (W-A-L).


There is also an option to edit config and change locker.

# ScreenLocker program: betterlockscreen or i3lock
screenlocker=betterlockscreen

The interval for blanking screen i don’t know how to change that from mabox menu.
I created my own way’s for it.

  • Do it manual with the folowing…

This command gives an overview of the energie settings.

xset -q

This line is in your interest

Standby: 100    Suspend: 700    Off: 900

Repeat this command after change the value to your liking.

xset dpms 100 700 900

The 100 (standby) is the one you want to change.

:bird:


Preview: personal menu for delay blanking screen.

1 Like

I saw the Screen locker menu, but I thought its for the system locker (which I can start from the Exit menu), cos if I lock the screnn from the Exit menu its lock with blurring. While when its hung up its a grey screen. It went to grey after locking - but havent restarted. Tomorrow - its late now. :slight_smile:

I set from the Screen locker menu the blur, and thank you for the Xset config. I use the gui - but now its disabled (by me).

I have 2 more questions - these are the lasts.

  1. Is it possible when I open the lid the numlock will On again?
  2. Is it possible that mpv blocks the screen locking while I watch movies?

Thank you for your help :slight_smile:

ps: Nice menu,

1 Like

Unfortuanly i don’t use a laptop at the moment, so i can’t reproduce numlock situation.

Numlock should stay the same. Can’t give an answer to that.


About mpv.

Try this: Put this script in autostart, to start at boot.

dpms-mpv.sh

#!/bin/bash

while true; do
    # Check if Stremio is running
    if pgrep -x "mpv" > /dev/null; then
	# Disable DPMS blanking
      xset s off -dpms
fi
    # Wait for X seconds before checking again
    sleep 5
done

Add line to autostart…

(sleep 7s && dpms-mpv.sh) &

Mabox hotkey Toggle dpms [on of ] = (W-A-B).

Personaly i have in conky and tint2 an icon that shows me the status.

When i have more time i can make a post about the complete setup for blanking.


A quick one for now.

Name it : noblank-conky.sh and put in the ~/bin dir.

#!/bin/bash

DELAY="$(xset q | grep "Standby" |  awk '{ print $2 }')"

function DPMS_check {
	! xset q | grep Enabled > /dev/null
}

if DPMS_check
then 
    printf "\${voffset -20}\${font FontAwesome:style=Solid:pixelsize=17}\${color red}\${goto 27}\uf0f4\${font}"
else 
    printf "\${voffset -20}\${font FontAwesome:style=Solid:pixelsize=17}\${color orange}\${goto 27}\uf0f4\${font}"

Put this line in one of your favorite conky. At the top somewhere.

${goto 15}${execpi 2 noblank-conky.sh}${color}${voffset +20}

It need probably some edit, for position of the icon.

${goto 15}
${voffset +20}

Blanking = on (interval 100)

blanking = off

Hope this helps a bit to find out your way.

:bird:

1 Like

I checked mpv with noblank.

For me the screen does not blank when play mpv or firefox video. Fullscreen or not doesn’t matter.

Can you show the output of this.

xset -q

The post above should not be needed for mpv.

:bird: