remove xtrakeys, add storage_menu

This commit is contained in:
Iris Lightshard 2023-03-07 22:20:48 -07:00
parent 4f05f8a6e4
commit e39753cb88
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398

43
storage_menu.sh Executable file
View file

@ -0,0 +1,43 @@
#!/bin/sh
IFS="
"
any=0
echo "<openbox_pipe_menu>"
for l in $(udiskie-info -a -o "{device_file} '{ui_id_label}' '{ui_id_uuid}' {is_filesystem} {is_luks} {is_mounted}"); do
IFS=" "
set -- $l
device=$1
label=$2
uuid=$3
fs=$4
luks=$5
mounted=$6
# set label to UUID if none
# and strip single quotes, which made tokenization simpler
if [ "${label}" = "''" ]; then
label=${uuid}
fi
label=$(echo "${label}" | sed -e s/\'//g)
# fs or luks should be true if we can mount it
if [ "${fs}" = "True" ] || [ "${luks}" = "True" ]; then
any=1
if [ "${mounted}" = "True" ]; then
echo "<item label=\"${device}: ${label} ⏏\">"
echo "<action name=\"Execute\"><execute>udiskie-umount ${device}</execute></action>"
echo "</item>"
else
echo "<item label=\"${device}: ${label}\">"
echo "<action name=\"Execute\"><execute>udiskie-mount ${device}</execute></action>"
echo "</item>"
fi
fi
done
if [ ${any} -eq 0 ]; then
echo "<separator label=\"none\"/>"
fi
echo "</openbox_pipe_menu>"