blob: f20fc9ca993ecaacf7726ac4797f73a22419a7d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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="<img>${ICON_ARRAY[DIE]}</img><click>xfce4-panel --plugin-event=genmon-14:refresh:bool:true</click>"
fi
# Tooltip
MORE_INFO="<tool>"
MORE_INFO+="$(( DIE + 1 ))"
MORE_INFO+="</tool>"
# Panel Print
echo -e "${INFO}"
# Tooltip Print
echo -e "${MORE_INFO}"
|