Cursor theme/size handling

This commit is contained in:
2026-03-26 14:30:29 +01:00
parent e9b3d6c8fa
commit e81442be7f
3 changed files with 142 additions and 15 deletions

41
usr/bin/jgcursor Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/bash
# jgcursor pipemenu to configure cursor theme and size
# To hook it into some menu use:
# Cursor,^pipe(jgcursor)
GTK3RC="$HOME/.config/gtk-3.0/settings.ini"
case $LANG in
pl*)
_CURSOR="Kursor"
_THEME="motyw"
_SIZE="rozmiar"
;;
*)
_CURSOR="Cursor"
_THEME="theme"
_SIZE="size"
;;
esac
read CURTHEME <<< "$(rg gtk-cursor-theme-name ${GTK3RC} | cut -d'=' -f2)"
read CURSIZE <<< "$(rg gtk-cursor-theme-size ${GTK3RC} | cut -d'=' -f2)"
o+=("<big> 󰇀</big> $_CURSOR: <b>$CURTHEME</b> $_SIZE: <b>$CURSIZE</b>")
o+=("^sep($_THEME)")
while read -r line; do
lin=${line::-8}
li=${lin##*/}
[[ "${CURTHEME}" = "${li}" ]] && o+=("<big>綠</big> <b>${li}</b>") || o+=("<big>祿</big> ${li},mb-cursor theme ${li}")
done < <(find /usr/share/icons ~/.local/share/icons ~/.icons -type d -name "cursors")
o+=("^sep($_SIZE)")
for c in 16 24 32 48 64;do
[[ "${CURSIZE}" == "${c}" ]] && o+=("<big>綠</big> <b>${c}</b>") || o+=("<big>祿</big> ${c},mb-cursor size ${c}")
done
printf "%s\n" "${o[@]}"

View File

@@ -3,6 +3,7 @@
# #
COLORIZER_CONF="$HOME/.config/colorizer/colorizer.conf" COLORIZER_CONF="$HOME/.config/colorizer/colorizer.conf"
AREA_CFG="$HOME/.config/areaclick.conf" AREA_CFG="$HOME/.config/areaclick.conf"
GTK3RC="$HOME/.config/gtk-3.0/settings.ini"
source ${COLORIZER_CONF} source ${COLORIZER_CONF}
me="jgdesktops -s" me="jgdesktops -s"
@@ -13,7 +14,7 @@ case $LANG in
ACTIVE="bieżący" ACTIVE="bieżący"
GOTO="Idź do..." GOTO="Idź do..."
WINKILL="Zabijacz Okien" WINKILL="Zabijacz Okien"
CLOSEALL_GR="Z wdziękiem <b>zamknij wszystkie okna</b> na..." CLOSEALL_GR="<b>Zamknij wszystkie okna</b> na..."
CLOSEALL="Zamknij wszystkie okna na..." CLOSEALL="Zamknij wszystkie okna na..."
DESKTOP="Pulpicie" DESKTOP="Pulpicie"
ALL_DESK="Wszystkich pulpitach" ALL_DESK="Wszystkich pulpitach"
@@ -23,7 +24,7 @@ case $LANG in
CONKY_TOGGLE="Włącz/Wyłącz Conky" CONKY_TOGGLE="Włącz/Wyłącz Conky"
PICOM_TOGGLE="Włącz/Wyłącz Picom" PICOM_TOGGLE="Włącz/Wyłącz Picom"
DESKMNGR="Menadżer sesji pulpitowych" DESKMNGR="Menadżer sesji pulpitowych"
WALLCHANGER="Tapetu oraz <b>stylizacja</b> pulpitu" WALLCHANGER="Tapeta oraz <b>stylizacja</b> pulpitu"
DESKGRID="Desktop Grid" DESKGRID="Desktop Grid"
SCREEN_RES="Ustawienia ekranu" SCREEN_RES="Ustawienia ekranu"
ENABLE="Włącz" ENABLE="Włącz"
@@ -37,6 +38,8 @@ case $LANG in
RUNNING="(uruchomiona)" RUNNING="(uruchomiona)"
STOPPED="(zatrzymana)" STOPPED="(zatrzymana)"
MONITORBLANK="<b>Wygaszanie</b> monitora" MONITORBLANK="<b>Wygaszanie</b> monitora"
_CURSOR="Kursor"
_SIZE="rozmiar"
ON="(włączone)" ON="(włączone)"
OFF="(wyłączone)" OFF="(wyłączone)"
WMTWEAKS="Ulepszenia Menadżera Okien" WMTWEAKS="Ulepszenia Menadżera Okien"
@@ -90,6 +93,8 @@ case $LANG in
RUNNING="(running)" RUNNING="(running)"
STOPPED="(stopped)" STOPPED="(stopped)"
MONITORBLANK="Monitor <b>blanking</b>" MONITORBLANK="Monitor <b>blanking</b>"
_CURSOR="Cursor"
_SIZE="size"
ON="(on)" ON="(on)"
OFF="(off)" OFF="(off)"
WMTWEAKS="Window Manager tweaks" WMTWEAKS="Window Manager tweaks"
@@ -143,6 +148,8 @@ case $LANG in
RUNNING="(running)" RUNNING="(running)"
STOPPED="(stopped)" STOPPED="(stopped)"
MONITORBLANK="Monitor <b>blanking</b>" MONITORBLANK="Monitor <b>blanking</b>"
_CURSOR="Cursor"
_SIZE="size"
ON="(on)" ON="(on)"
OFF="(off)" OFF="(off)"
WMTWEAKS="Window Manager tweaks" WMTWEAKS="Window Manager tweaks"
@@ -239,22 +246,22 @@ else
out+=("<big>󰄱</big> $TINT2 <i>$STOPPED</i>,mb-tint2-session &>/dev/null;$me") out+=("<big>󰄱</big> $TINT2 <i>$STOPPED</i>,mb-tint2-session &>/dev/null;$me")
fi fi
if pidof conky &>/dev/null; then if pidof conky &>/dev/null; then
out+=("<big>󰄲</big> $CONKY <i>$RUNNING</i>,conky_toggle;$me") out+=("<big>󰄲</big> $CONKY <i>$RUNNING</i> <span bgcolor='#333333' color='#d3d3d3'> <small> - c</small> </span>,conky_toggle;$me")
else else
out+=("<big>󰄱</big> $CONKY <i>$STOPPED</i>,conky_toggle;$me") out+=("<big>󰄱</big> $CONKY <i>$STOPPED</i> <span bgcolor='#333333' color='#d3d3d3'> <small> - c</small> </span>,conky_toggle;$me")
fi fi
if pidof picom &>/dev/null; then if pidof picom &>/dev/null; then
out+=("<big>󰄲</big> $PICOM <i>$RUNNING</i>,compton_toggle;$me") out+=("<big>󰄲</big> $PICOM <i>$RUNNING</i> <span bgcolor='#333333' color='#d3d3d3'> <small> - p</small> </span>,compton_toggle;$me")
else else
out+=("<big>󰄱</big> $PICOM <i>$STOPPED</i>,compton_toggle;$me") out+=("<big>󰄱</big> $PICOM <i>$STOPPED</i> <span bgcolor='#333333' color='#d3d3d3'> <small> - p</small> </span>,compton_toggle;$me")
fi
if command -v mcorners &> /dev/null;then
if [[ -f /tmp/mcorners.lck ]]; then
out+=("<big>󰄲</big> $MCORNERS <i>$RUNNING</i>,mcorners --stop;$me")
else
out+=("<big>󰄱</big> $MCORNERS <i>$STOPPED</i>,mcorners -tl 'jgdesktops -s' -l 'mb-jgtools places' -tr 'mb-music -s' -bl 'colorizer -s' -br 'skippy-xd-fix' -r 'mb-jgtools right' -iof;$me")
fi
fi fi
#if command -v mcorners &> /dev/null;then
# if [[ -f /tmp/mcorners.lck ]]; then
# out+=("<big>󰄲</big> $MCORNERS <i>$RUNNING</i>,mcorners --stop;$me")
# else
# out+=("<big>󰄱</big> $MCORNERS <i>$STOPPED</i>,mcorners -tl 'jgdesktops -s' -l 'mb-jgtools places' -tr 'mb-music -s' -bl 'colorizer -s' -br 'skippy-xd-fix' -r 'mb-jgtools right' -iof;$me")
# fi
#fi
if command -v cortile &> /dev/null;then if command -v cortile &> /dev/null;then
if pidof cortile &>/dev/null; then if pidof cortile &>/dev/null; then
out+=("<big>󰄲</big> $CORTILE <i>$RUNNING</i>,cortilectl stop") out+=("<big>󰄲</big> $CORTILE <i>$RUNNING</i>,cortilectl stop")
@@ -267,10 +274,37 @@ out+=("^sep()")
# CURSORS
read CURTHEME <<< "$(rg gtk-cursor-theme-name ${GTK3RC} | cut -d'=' -f2)"
read CURSIZE <<< "$(rg gtk-cursor-theme-size ${GTK3RC} | cut -d'=' -f2)"
out+=("<big> 󰇀</big> $_CURSOR: <b>$CURTHEME</b> $_SIZE: <b>$CURSIZE</b>,^checkout(mcursor)")
out2+=("^tag(mcursor)")
out2+=("^sep($_CURSOR)")
while read -r line; do
lin=${line::-8}
li=${lin##*/}
[[ "${CURTHEME}" = "${li}" ]] && out2+=("<big>綠</big> <b>${li}</b>") || out2+=("<big>祿</big> ${li},mb-cursor theme ${li}")
#out2+=("${li}")
done < <(find /usr/share/icons ~/.local/share/icons ~/.icons -type d -name "cursors")
out2+=("^sep($_SIZE)")
for c in 16 24 32 48 64;do
[[ "${CURSIZE}" == "${c}" ]] && out2+=("<big>綠</big> <b>${c}</b>") || out2+=("<big>祿</big> ${c},mb-cursor size ${c}")
done
out+=("^sep()")
# MONITOR BLANKING
if (xset q|grep --quiet "DPMS is Enabled");then if (xset q|grep --quiet "DPMS is Enabled");then
out+=("<big>󰷛</big> $MONITORBLANK <i>$ON</i>,noblank;$me") out+=("<big>󰷛</big> $MONITORBLANK <i>$ON</i> <span bgcolor='#333333' color='#d3d3d3'> <small> - A - b</small> </span>,noblank;$me")
else else
out+=("<big>󰍹</big> $MONITORBLANK <i>$OFF</i>,noblank;$me") out+=("<big>󰍹</big> $MONITORBLANK <i>$OFF</i> <span bgcolor='#333333' color='#d3d3d3'> <small> - A - b</small> </span>,noblank;$me")
fi fi

52
usr/bin/mb-cursor Executable file
View File

@@ -0,0 +1,52 @@
#!/bin/bash
# mb-cursor - set cursor size
GTK3RC="$HOME"/.config/gtk-3.0/settings.ini
XRES="$HOME/.Xresources"
## szukanie kursorow.
## find /usr/share/icons ~/.local/share/icons ~/.icons -type d -name "cursors"
theme() {
if grep Xcursor.theme ${XRES};then
sd "^Xcursor.theme:.*$" "Xcursor.theme: ${1}" ${XRES}
else
echo "Xcursor.theme: ${1}" >> ${XRES}
fi
## for GTK3
sd "^gtk-cursor-theme-name.*$" "gtk-cursor-theme-name=${1}" ${GTK3RC}
sleep .5
xrdb -merge ~/.Xresources
sleep .5
openbox --restart
}
size() {
# 16 24 32 48 64
case "$1" in
16|24|32|48|64)
### for XRES
if grep Xcursor.size ${XRES};then
sd "^Xcursor.size:.*$" "Xcursor.size: ${1}" ${XRES}
else
echo "Xcursor.size: ${1}" >> ${XRES}
fi
## for GTK3
sd "^gtk-cursor-theme-size.*$" "gtk-cursor-theme-size=${1}" ${GTK3RC}
#sleep 1
#bl-reload-gtk23
sleep .5
xrdb -merge ~/.Xresources
sleep .5
openbox --restart
;;
*)
echo "Wrong size. Must be 12 24 32 48 64"
;;
esac
}
case "$1" in
theme) theme "$2";;
size) size "$2";;
esac