Last active
May 8, 2025 00:33
-
-
Save JJRcop/bf9ad4ff304e1ec81218bf8dbced9e4e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Executes gtklock with pcmanfm-qt's configured wallpaper, as well as | |
| # setting the lock theme to a dark or light variant depending on overall | |
| # brightness of background. | |
| # Requires GraphicsMagick or ImageMagick to detect wallpaper | |
| # brightness. | |
| # Configure your LXQt Session Settings to use this as your custom | |
| # screen lock command. | |
| WALLPAPER=$(awk -F = '$1 == "Wallpaper" {print $2; exit}' < $XDG_CONFIG_HOME/pcmanfm-qt/lxqt/settings.conf) | |
| if [ -x /usr/bin/gm ]; then | |
| CONVERT="gm convert" | |
| elif [ -x /usr/bin/convert ]; then | |
| CONVERT=convert | |
| fi | |
| # Lock theme if wallpaper is bright. | |
| LOCK_THEME=Breeze | |
| if [ -n "$CONVERT" ] && ($CONVERT $WALLPAPER -gravity Center -resize 1x1 txt:- | awk -F[\(\)] '{FS = "[ ,]+"; $0 = $2; exit (($1 + $2 + $3) / 765 > 0.5)}'); then | |
| # Lock theme if wallpaper is dark. | |
| LOCK_THEME=Breeze-Dark | |
| fi | |
| exec gtklock --gtk-theme $LOCK_THEME --background $WALLPAPER |
Author
JJRcop
commented
May 7, 2025

Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment