Lock screen i3lock

I will arrange conky things tomorrow or after xmas.

Sure - I can show

Keyboard Control:
  auto repeat:  on    key click percent:  0    LED mask:  00000002
  XKB indicators:
    00: Caps Lock:   off    01: Num Lock:    on     02: Scroll Lock: off
    03: Compose:     off    04: Kana:        off    05: Sleep:       off
    06: Suspend:     off    07: Mute:        off    08: Misc:        off
    09: Mail:        off    10: Charging:    off    11: Shift Lock:  off
    12: Group 2:     off    13: Mouse Keys:  off
  auto repeat delay:  660    repeat rate:  25
  auto repeating keys:  00ffffffdffffbbf
                        fadfffefffedffff
                        9fffffffffffffff
                        fff7ffffffffffff
  bell percent:  0    bell pitch:  400    bell duration:  100
Pointer Control:
  acceleration:  2/1    threshold:  4
Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  600    cycle:  600
Colors:
  default colormap:  0x20    BlackPixel:  0x0    WhitePixel:  0xffffff
Font Path:
  /usr/share/fonts/misc,/usr/share/fonts/TTF,/usr/share/fonts/Type1,/usr/share/fonts/100dpi,/usr/share/fonts/75dpi,built-ins
DPMS (Display Power Management Signaling):
  Standby: 600    Suspend: 600    Off: 600
  DPMS is Enabled
  Monitor is On

Rethinking.

At the time i was working with this dpms thing i desided to go the mabox way.
That means commands with xset, and not the use of the gui. (the gui though also uses dpms)

My experience is not good with the gui and mabox.
But that’s me.

So i left the gui. And removed it.

When there is more animo i could have a look to make something userfriendly.

At that time all was also new to me. And setup could be improved.

quick command.

# Set numlock on
xset -c "NumLock" 1

# Set numlock off
xset -c "NumLock" 0

For use with the Gui maybe someone else can help you with that.

:bird:

1 Like

I don’t think this can be all the same

it should go up and be different from each other.

like 100 200 300

the first lower than the second etc.

:bird:

I turned off gui as well yesterday.
Tomorrow I will try these things. But perhaps days after tomorrow - cos its xmas time :slight_smile:

So we have time. Its no problem, just I tried lock the screen, and after this problem generated these questions.

Thank you and Merry Xmas, :slight_smile:

ps.: I like Mabox, and Bunsen cos they are very fast.

1 Like

A present for under the tree. :christmas_tree:

Add the two scripts to your home bin and you can use (W-A-L) to change values for noblank.

It creates $HOME/.config/mabox/noblank.conf.


Name this script xset_600.sh

#!/bin/bash

CONF_FILE="$HOME/.config/mabox/noblank.conf"
if [ ! -f $CONF_FILE ]; then
cat <<EOF > ${CONF_FILE}
# Time before blanking
DELAY_xset=100
DELAY_suspend=700
DELAY_off=900
EOF
fi

source <(grep = "$CONF_FILE")
DMPS_delay="$(xset -q | awk '!/^[[:space:]]/ {i++}; i==6 {getline; if ($2 ~ /^[0-9]+$/) print $2; else exit}')"

if [ -z "$DMPS_delay" ]; then
echo "Error: Unable to retrieve DPMS delay value."
exit 1
else
xset dpms "$DELAY_xset" "$DELAY_suspend" "$DELAY_off"
# notify-send -i mbcc -t 5000 "Changed values:"
notify-send -i mbcc -t 10000 "Sleep time"   "set to <b>[ ${DELAY_xset} ]</b>"
notify-send -i mbcc -t 20000 "Suspend time" "set to <b>[ ${DELAY_suspend} ]</b>"
notify-send -i mbcc -t 30000 "Turning off"  "set to <b>[ ${DELAY_off} ][</b>"
fi

This script replaces jglockscreen from mabox.
I added the inteval time to it for Standby, Suspend and Off.

Name this jglockscreen

#!/bin/bash
# jglockscreen - configure betterlockscreen 
#
CONFIG_DIR="$HOME/.config/mbscreenlocker/"
SCRNLOCKCFG="$HOME/.config/mbscreenlocker/mbscreenlocker.conf"

CONF_DIR="$HOME/.config/mabox"
CONF_FILE_XSET="$CONF_DIR/noblank.conf"


# Make config directory if not exist
mkdir -p $CONFIG_DIR


if [ ! -f $CONF_FILE_XSET ]; then
cat <<EOF > ${CONF_FILE_XSETLOCKCFG}
# Time before blanking
DELAY_xset=100
DELAY_suspend=700
DELAY_off=900
EOF
fi


# Standby: 120    Suspend: 700    Off: 900
#  interval values for noblanking time (600 = 10 min)


STANDBY_int="50 100 120 250 300 450 500 600 0"
SUSPEND_int="620 650 700 750 800 850 0"
OFF_int="860 900 950 1000 1200 1500 2000 0"


# If config file not exist create one with defaults
if [ ! -f $SCRNLOCKCFG ]; then
cat <<EOF > ${SCRNLOCKCFG}
# Effect to use: dim, blur, dimblur or pixel
effect=pixel
# ScreenLocker program: betterlockscreen or i3lock
screenlocker=i3lock
EOF
fi

# read config variables from file
source <(grep = $SCRNLOCKCFG)
source <(grep = $CONF_FILE_XSET)

case $LANG in
    pl*)
    LOCK="Zablokuj ekran"
    GENIMGS="Generuj obrazy tƂa"
    LOCKER="Blokada ekranu <small>(super+l)</small>"
    TYPETO="wpisz hasƂo aby odblokować"
    SELECT_IMG="Wybierz obrazek"
    CACHE="UĆŒyj aktualnej tapety"
    EFFECT="Efekt (ustaw i wyprĂłbuj)"
    DIM="przyciemnienie"
    BLUR="rozmycie"
    DIMBLUR="przyciemnienie i rozmycie"
    PIXEL="pikseloza"
    DESK="Rozmyty pulpit"
    EDITCONF="Edytuj plik konfiguracyjny"
    LEFTPANEL="Lewy panel"
    ;;
    *)
    LOCK="Lock screen now" 
    GENIMGS="Update Images"
    LOCKER="ScreenLocker <small>(super+l)</small>"
    TYPETO="type password to unlock"
    SELECT_IMG="Select image file"
    CACHE="Cache current wallpaper for ScreenLock"
    EFFECT="Effect (set and run)"
    DIM="dim"
    BLUR="blur"
    DIMBLUR="dim and blur"
    PIXEL="pixel"
    DESK="Blurred desktop"
    EDITCONF="Edit config file"
    LEFTPANEL="Left panel"
    STANDBY="Standby"
    SUSPEND="Suspend"
    OFF="Turn Off"
    ;;
esac

. $HOME/.config/mabox/mabox.conf

me="jglockscreen -s"
#help='\nBased on Mabox forum member Shwaybo <a href="https://forum.maboxlinux.org/t/chwp-desktop-wallpaper-changer/496">idea</a>.\n\nchange wallpapers from a directory, never using the same picture twice until all the pictures have been shown, and rotating x number of seconds (configurable) before the next wallpaper change.\n'

out+=("^sep($LOCKER)")
out+=("^sep(<i><small>$TYPETO</small></i>")
#out+=("^sep(Betterlockscreen)")
out+=("$LOCK,mbscreenlocker")
out+=("^sep($GENIMGS)")
out+=("$SELECT_IMG,mbscreenlocker -s")
out+=("$CACHE,mbscreenlocker -c")
out+=("^sep(<i><small>$EFFECT</small></i>)")
if [ $effect == "dim" -a $screenlocker != "i3lock" ];then
out+=("<b>[ $DIM ]</b>,mb-setvar screenlocker=betterlockscreen $SCRNLOCKCFG;mb-setvar effect=dim $SCRNLOCKCFG;mbscreenlocker")
else
out+=("$DIM,mb-setvar screenlocker=betterlockscreen $SCRNLOCKCFG;mb-setvar effect=dim $SCRNLOCKCFG;mbscreenlocker")
fi
if [ $effect == "blur" -a $screenlocker != "i3lock" ];then
out+=("<b>[ $BLUR ]</b>,mb-setvar screenlocker=betterlockscreen $SCRNLOCKCFG;mb-setvar effect=blur $SCRNLOCKCFG;mbscreenlocker")
else
out+=("$BLUR,mb-setvar screenlocker=betterlockscreen $SCRNLOCKCFG;mb-setvar effect=blur $SCRNLOCKCFG;mbscreenlocker")
fi
if [ $effect == "dimblur" -a $screenlocker != "i3lock" ];then
out+=("<b>[ $DIMBLUR ]</b>,mb-setvar screenlocker=betterlockscreen $SCRNLOCKCFG;mb-setvar effect=dimblur $SCRNLOCKCFG;mbscreenlocker")
else
out+=("$DIMBLUR,mb-setvar screenlocker=betterlockscreen $SCRNLOCKCFG;mb-setvar effect=dimblur $SCRNLOCKCFG;mbscreenlocker")
fi
if [ $effect == "pixel" -a $screenlocker != "i3lock" ];then
out+=("<b>[ $PIXEL ]</b>,mb-setvar screenlocker=betterlockscreen $SCRNLOCKCFG;mb-setvar effect=pixel $SCRNLOCKCFG;mbscreenlocker")
else
out+=("$PIXEL,mb-setvar screenlocker=betterlockscreen $SCRNLOCKCFG;mb-setvar effect=pixel $SCRNLOCKCFG;mbscreenlocker")
fi
out+=("^sep()")
if [ $screenlocker = "i3lock" ];then
out+=("<b>[ $DESK ]</b>,mb-setvar screenlocker=i3lock $SCRNLOCKCFG;mbscreenlocker")
else
out+=("$DESK,mb-setvar screenlocker=i3lock $SCRNLOCKCFG;mbscreenlocker")
fi
out+=("^sep()")
out+=("$EDITCONF ,xdg-open $SCRNLOCKCFG")

out+=("Noblank interval,^checkout(interval)")
out2+=("^tag(interval)")

out2+=("^sep($STANDBY ($DELAY_xset))")
for i in $STANDBY_int; do out2+=("$(printf "<tt> %4s</tt>,%s" "$i" "mb-setvar DELAY_xset=${i} $CONF_FILE_XSET; xset-600.sh;$me")");done

out2+=("^sep($SUSPEND ($DELAY_suspend) )")
for i in $SUSPEND_int; do out2+=("$(printf "<tt> %4s</tt>,%s" "$i" "mb-setvar DELAY_suspend=${i} $CONF_FILE_XSET; xset-600.sh;$me")");done

out2+=("^sep($OFF ($DELAY_off))")
for i in $OFF_int; do out2+=("$(printf "<tt> %4s</tt>,%s" "$i" "mb-setvar DELAY_off=${i} $CONF_FILE_XSET; xset-600.sh;$me")");done




### RUN
if [[ "$1" == "-s" ]]; then
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
. $HOME/.config/mabox/mabox.conf

out+=("^sep()")
out+=(" ⼜    $LEFTPANEL,mb-jgtools places")

if [[ $panels_heightpos == "top" ]]; then
MENU_VALIGN="top"
MENU_MARGIN_Y=${panels_topmargin:-0}
elif [[ $panels_heightpos == "bottom" ]]; then
MENU_VALIGN="bottom"
MENU_MARGIN_Y=${panels_topmargin:-0}
else 
    MENU_VALIGN="center"
fi
MENU_PADDING_TOP=${jgtools_padding:-0}
MENU_HALIGN="left"
jgmenu_icon_size=0
JGWIDTH=40
menu_margin_x=${submenu_spacing:-0}
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0

mkconfigfile

cat <<EOF > ${MENU_ITEMS}
$(printf '%s\n' "${out[@]}")
$(printf '%s\n' "${out2[@]}")
EOF

jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null

exit 0

fi
printf '%s\n' "${out[@]}"

if [[ $1 == "-r" ]]; then
case $LANG in
    pl*) REMOVE="UsuƄ to menu z panelu";;
    es*) REMOVE="Eliminar este menĂș del panel";;
    *) REMOVE="Remove this menu from panel";;
esac
printf '%s\n' "^sep()"
printf '%s\n' "<i>$REMOVE</i>,mb-setvar places_jglockscreen=false;mb-jgtools places"
fi
printf '%s\n' "${out2[@]}"
echo $effect
echo $screenlocker

Have fun. :santa:

:bird:

2 Likes

Thank you. I will try it, and write back editing this massage.

I wish you Merry Christmas. :slight_smile:

Sorry for the late answer - I was on holiday. :slight_smile:

I have tried it and working fine. The other solution which I tried was in the scripts that I put the original Mabox lockscreen - in this case Mabox use the same and this way is working too.

1 Like

Rethinking After Reading It Again

I’m not entirely sure about the explanation you give. :woozy_face:

When you say, “Mabox uses the same method, and this way works too.”

  • In short, you’re now using a copy of the default Mabox script from your ~/bin directory that you created yourself. :slight_smile:

Longer Explanation:
What you basically did above is this:

  • I gave you a copy of the original jglockscreen script from Mabox, located in /usr/bin/.
  • You then copied this script into your ~/bin folder with the adaptation noblank time.

All scripts in the ~/bin directory are prioritized over system scripts in directories like /usr/bin. This means your customized scripts are used first. If a script isn’t found in ~/bin, the system will fall back to the standard directories.

This allows you to use your own modifications without altering the original system scripts.


In other words, be aware that the jglockscreen script you’re using is now an adapted version of the original Mabox script.

Since this script is unlikely to change in the near future, it’s relatively safe to make small tweaks to fit your needs.

Rename or remove jglockscreen and you back to the default Mabox one.

:bird:

1 Like

I changed the screenlockscript.sh s content with this:

#!/bin/bash

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

And the lid.sh s content with this:

#!/bin/bash

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

It was just a attempt, but its working too. After I undo the changes and tried you method. :slight_smile:

1 Like

So I have bought a new laptop, and I installed a new system. I did the above mentioned things - and its working fine.
But
:

  • in this version of Mabox I cant setup the display delay, when turn it off, and so. I cant find the solution. So everything is on default 600sec. I need some help.
  • Because I have turned off the Power management system (because its need of I3lock - for the lid closing) I cant turn off or adjust my keyboard lights.

For monitor blanking we have script to toggle it, bound to Super + Alt + b
If you like to change blanking time see man xset.

Something like (to set monitor blank time to one hour):

xset dpms 3600 3600 3600

You can put your preferred command to ~/.config/openbox/autostart script.
Don’t forget to run commands in the background (by adding & sign at the end).

To query current settings run:

xset q
1 Like

When writing @napcok already answerd. :wink: this is my answer.

In terminal do.

xset -q

OUTPUT like this.

Keyboard Control:
  auto repeat:  on    key click percent:  0    LED mask:  00000002
  XKB indicators:
    00: Caps Lock:   off    01: Num Lock:    on     02: Scroll Lock: off
    03: Compose:     off    04: Kana:        off    05: Sleep:       off
    06: Suspend:     off    07: Mute:        off    08: Misc:        off
    09: Mail:        off    10: Charging:    off    11: Shift Lock:  off
    12: Group 2:     off    13: Mouse Keys:  off
  auto repeat delay:  250    repeat rate:  25
  auto repeating keys:  00ffffffdffffbbf
                        fadfffefffedffff
                        9fffffffffffffff
                        fff7ffffffffffff
  bell percent:  0    bell pitch:  400    bell duration:  100
Pointer Control:
  acceleration:  2/1    threshold:  4
Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  600    cycle:  600
Colors:
  default colormap:  0x20    BlackPixel:  0x0    WhitePixel:  0xffffff
Font Path:
  /usr/share/fonts/misc,/usr/share/fonts/TTF,/usr/share/fonts/OTF,/usr/share/fonts/Type1,/usr/share/fonts/100dpi,/usr/share/fonts/75dpi,built-ins
DPMS (Display Power Management Signaling):
  Standby: 300    Suspend: 700    Off: 900
  DPMS is Enabled
  Monitor is On

It will show powermanagment output.

set standby suspend off with

xset dpms <standby> <suspend> <off>
xset dpms 300 600 900

The first number needs to be lower than the next one. Like example.
600 = 10 min.

In previous post i posted two scripts.
Put them in ~/bin dir and you can use W-A-L to change values.
Also let xset600.sh start at boot. ~/.config/openbox/autostart

Suspend and off need to be done manualy.
When set them allways use the 3 numbers like this.

xset dpms 100 300 600

Hope you can follow it. Most answers are in this post.

:bird:

1 Like

Thank you.
I thought that,

xset dpms 300 600 900

will permanently set standby, suspend, off times, and I didnt understand that every reboot I got back the default values. I understand now.

Thank you. :slight_smile:

I put the 2 scripts into (xset_600.sh and jglockscreen) home/joe/bin.
I set xset_600.sh to be executive and I something screwed again. Partly working.
Set autostart

#Screenblanking
/home/joe/bin/xset_600.sh &

I cant reach it the from lockscreen, and if I press W-A-L buttons - notthing happens :confused:
I dont have this menu in lockscreen.

This script is needed too


When you place this custom script with the same name in /home/joe/bin it will use this one instead of the Mabox one.

Check which one is in use with


which jglockscreen

Output should be your home bin dir instead of /usr/bin/.

Try again the hotkey W-A-l.

:bird:

1 Like

Note: If you want another values list, edit this part.

STANDBY_int="50 100 120 250 300 450 500 600 0"
SUSPEND_int="620 650 700 750 800 850 0"
OFF_int="860 900 950 1000 1200 1500 2000 0"
1 Like

Thank you for your help.

I put ‘jglockscreen’ and ‘xset_600.sh’ into /home/joe/bin.

‘which jglockscreen’
Output is ‘usr/bin’.

With the new jglockscreen putted in your home bin the output of which jglockscreen should be /home/joe/bin.

Did you do

chmod +x script.sh

to make the scripts executable


Yep. I havent done. I gave to xset_600.sh but not for the jglockscreen - becaus it hasnt got .sh extension. Its working.

You are right. Its an script aswell. I learned today again something new. :slight_smile:
Thank you very much.

When a file starts with


#!/bin/bash

it is a bash script. No need for .sh.
This is how Mabox uses the scripts.

Good to hear it is working now


:bird:

1 Like

Thank you for your patience and your help. I really appreciate. :+1:

1 Like