#!/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[@]}"