Implement a temporary popup window selection menu
This commit is contained in:
25
scripts/.local/share/scripts/popup-window
Executable file
25
scripts/.local/share/scripts/popup-window
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
select_action() {
|
||||
action_content=(
|
||||
"System resources usage"
|
||||
"Connectivity test"
|
||||
"Kill emacs"
|
||||
)
|
||||
action=$(printf '%s\n' "${action_content[@]}" | rofi -no-auto-select -i "$@" -dmenu -p "Choose an action")
|
||||
execute_action "$action"
|
||||
}
|
||||
|
||||
launch_kitty() {
|
||||
bash -c "kitty --class popup -- $1"
|
||||
}
|
||||
|
||||
execute_action() {
|
||||
case "$1" in
|
||||
"System resources usage") launch_kitty "htop" ;;
|
||||
"Connectivity test") launch_kitty "ping -c 2 freebsd.org" ;;
|
||||
"Kill emacs") launch_kitty "pkill emacs" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
select_action "$@"
|
||||
Reference in New Issue
Block a user