From e81442be7fcd29e748172f614448dfe2deddbdec Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Thu, 26 Mar 2026 14:30:29 +0100 Subject: [PATCH] Cursor theme/size handling --- usr/bin/jgcursor | 41 +++++++++++++++++++++++++++++ usr/bin/jgdesktops | 64 +++++++++++++++++++++++++++++++++++----------- usr/bin/mb-cursor | 52 +++++++++++++++++++++++++++++++++++++ 3 files changed, 142 insertions(+), 15 deletions(-) create mode 100755 usr/bin/jgcursor create mode 100755 usr/bin/mb-cursor diff --git a/usr/bin/jgcursor b/usr/bin/jgcursor new file mode 100755 index 0000000..2c92fdd --- /dev/null +++ b/usr/bin/jgcursor @@ -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+=(" 󰇀 $_CURSOR: $CURTHEME $_SIZE: $CURSIZE") +o+=("^sep($_THEME)") +while read -r line; do + +lin=${line::-8} +li=${lin##*/} +[[ "${CURTHEME}" = "${li}" ]] && o+=(" ${li}") || o+=(" ${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+=(" ${c}") || o+=(" ${c},mb-cursor size ${c}") +done + +printf "%s\n" "${o[@]}" + diff --git a/usr/bin/jgdesktops b/usr/bin/jgdesktops index 636559f..c4f98c5 100755 --- a/usr/bin/jgdesktops +++ b/usr/bin/jgdesktops @@ -3,6 +3,7 @@ # COLORIZER_CONF="$HOME/.config/colorizer/colorizer.conf" AREA_CFG="$HOME/.config/areaclick.conf" +GTK3RC="$HOME/.config/gtk-3.0/settings.ini" source ${COLORIZER_CONF} me="jgdesktops -s" @@ -13,7 +14,7 @@ case $LANG in ACTIVE="bieżący" GOTO="Idź do..." WINKILL="Zabijacz Okien" - CLOSEALL_GR="Z wdziękiem zamknij wszystkie okna na..." + CLOSEALL_GR="Zamknij wszystkie okna na..." CLOSEALL="Zamknij wszystkie okna na..." DESKTOP="Pulpicie" ALL_DESK="Wszystkich pulpitach" @@ -23,7 +24,7 @@ case $LANG in CONKY_TOGGLE="Włącz/Wyłącz Conky" PICOM_TOGGLE="Włącz/Wyłącz Picom" DESKMNGR="Menadżer sesji pulpitowych" - WALLCHANGER="Tapetu oraz stylizacja pulpitu" + WALLCHANGER="Tapeta oraz stylizacja pulpitu" DESKGRID="Desktop Grid" SCREEN_RES="Ustawienia ekranu" ENABLE="Włącz" @@ -37,6 +38,8 @@ case $LANG in RUNNING="(uruchomiona)" STOPPED="(zatrzymana)" MONITORBLANK="Wygaszanie monitora" + _CURSOR="Kursor" + _SIZE="rozmiar" ON="(włączone)" OFF="(wyłączone)" WMTWEAKS="Ulepszenia Menadżera Okien" @@ -90,6 +93,8 @@ case $LANG in RUNNING="(running)" STOPPED="(stopped)" MONITORBLANK="Monitor blanking" + _CURSOR="Cursor" + _SIZE="size" ON="(on)" OFF="(off)" WMTWEAKS="Window Manager tweaks" @@ -143,6 +148,8 @@ case $LANG in RUNNING="(running)" STOPPED="(stopped)" MONITORBLANK="Monitor blanking" + _CURSOR="Cursor" + _SIZE="size" ON="(on)" OFF="(off)" WMTWEAKS="Window Manager tweaks" @@ -239,22 +246,22 @@ else out+=("󰄱 $TINT2 $STOPPED,mb-tint2-session &>/dev/null;$me") fi if pidof conky &>/dev/null; then -out+=("󰄲 $CONKY $RUNNING,conky_toggle;$me") +out+=("󰄲 $CONKY $RUNNING  - c ,conky_toggle;$me") else -out+=("󰄱 $CONKY $STOPPED,conky_toggle;$me") +out+=("󰄱 $CONKY $STOPPED  - c ,conky_toggle;$me") fi if pidof picom &>/dev/null; then -out+=("󰄲 $PICOM $RUNNING,compton_toggle;$me") +out+=("󰄲 $PICOM $RUNNING  - p ,compton_toggle;$me") else -out+=("󰄱 $PICOM $STOPPED,compton_toggle;$me") -fi -if command -v mcorners &> /dev/null;then - if [[ -f /tmp/mcorners.lck ]]; then - out+=("󰄲 $MCORNERS $RUNNING,mcorners --stop;$me") - else - out+=("󰄱 $MCORNERS $STOPPED,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 +out+=("󰄱 $PICOM $STOPPED  - p ,compton_toggle;$me") fi +#if command -v mcorners &> /dev/null;then +# if [[ -f /tmp/mcorners.lck ]]; then +# out+=("󰄲 $MCORNERS $RUNNING,mcorners --stop;$me") +# else +# out+=("󰄱 $MCORNERS $STOPPED,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 pidof cortile &>/dev/null; then out+=("󰄲 $CORTILE $RUNNING,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+=(" 󰇀 $_CURSOR: $CURTHEME $_SIZE: $CURSIZE,^checkout(mcursor)") +out2+=("^tag(mcursor)") +out2+=("^sep($_CURSOR)") +while read -r line; do + +lin=${line::-8} +li=${lin##*/} +[[ "${CURTHEME}" = "${li}" ]] && out2+=(" ${li}") || out2+=(" ${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+=(" ${c}") || out2+=(" ${c},mb-cursor size ${c}") +done + +out+=("^sep()") +# MONITOR BLANKING if (xset q|grep --quiet "DPMS is Enabled");then -out+=("󰷛 $MONITORBLANK $ON,noblank;$me") +out+=("󰷛 $MONITORBLANK $ON  - A - b ,noblank;$me") else -out+=("󰍹 $MONITORBLANK $OFF,noblank;$me") +out+=("󰍹 $MONITORBLANK $OFF  - A - b ,noblank;$me") fi diff --git a/usr/bin/mb-cursor b/usr/bin/mb-cursor new file mode 100755 index 0000000..9730772 --- /dev/null +++ b/usr/bin/mb-cursor @@ -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