33 lines
1.1 KiB
Bash
Executable File
33 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env zsh
|
|
|
|
function is-laptop-p {
|
|
[[ "${HOST}" == *-portable ]] || [[ "${HOST}" == *-laptop ]]
|
|
}
|
|
|
|
function is-desktop-p {
|
|
! is-laptop-p
|
|
}
|
|
|
|
# Format: label action condition
|
|
local entries=('Select system sound output' 'select-sound-output.sh' 'true'
|
|
"Enable or disable system sleep" 'system-sleep-menu.sh' 'true'
|
|
'Enable or disable TV' 'tv-power-menu.sh' 'is-desktop-p'
|
|
'Configure USB device access' 'usbguard-menu.py' 'pgrep usbguard-daemon'
|
|
'Power settings (restart and shutdown)' 'system-power-menu.sh' 'true'
|
|
'Login to captive portal protected WiFi' 'login-to-wifi.sh' 'is-laptop-p')
|
|
|
|
local entry_array=()
|
|
local enabled_entries=()
|
|
for ((i = 1; i <= ${#entries}; i+=3)); do
|
|
if eval "${entries[${i} + 2]}" >/dev/null 2>&1; then
|
|
entry_array[$((i / 3 + 1))]="${entries[i]}"
|
|
enabled_entries+=(${entries[@]:${i} - 1:3})
|
|
fi
|
|
done
|
|
|
|
choice="$(printf '%s\n' ${entry_array} | fuzzel --index -d)"
|
|
|
|
(( ${?} != 0 )) && exit
|
|
|
|
eval "${HOME}/scripts/system-menu/${enabled_entries["${choice}" * 3 + 2]}"
|