From 14a892e627a375334a02381351f139d94ad7ecf3 Mon Sep 17 00:00:00 2001 From: ダカマ Date: Mon, 2 Jun 2025 13:08:46 +0200 Subject: First dump --- scriptlets/die-panel.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 scriptlets/die-panel.sh (limited to 'scriptlets/die-panel.sh') diff --git a/scriptlets/die-panel.sh b/scriptlets/die-panel.sh new file mode 100755 index 0000000..f20fc9c --- /dev/null +++ b/scriptlets/die-panel.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# Dependencies: bash>=3.2, coreutils, file + +# Makes the script more portable +readonly DIR="$HOME/stuf/customization/" + +# Optional icon to display before the text +# Insert the absolute path of the icon +# Recommended size is 24x24 px +declare -r ICON_ARRAY=( + "${DIR}/icons/dice/inverted-dice-1.png" + "${DIR}/icons/dice/inverted-dice-2.png" + "${DIR}/icons/dice/inverted-dice-3.png" + "${DIR}/icons/dice/inverted-dice-4.png" + "${DIR}/icons/dice/inverted-dice-5.png" + "${DIR}/icons/dice/inverted-dice-6.png" +) + +# Compute random die +DIE=$(( RANDOM % 6 )) + +# Panel +if [[ $(file -b "${ICON_ARRAY[DIE]}") =~ PNG|SVG ]]; then + INFO="${ICON_ARRAY[DIE]}xfce4-panel --plugin-event=genmon-14:refresh:bool:true" +fi + +# Tooltip +MORE_INFO="" +MORE_INFO+="$(( DIE + 1 ))" +MORE_INFO+="" + +# Panel Print +echo -e "${INFO}" + +# Tooltip Print +echo -e "${MORE_INFO}" -- cgit v1.2.3