dotfiles/scripts/.local/share/scripts/recurrent-actions

34 lines
792 B
Bash
Executable File

#!/usr/bin/env bash
select_action() {
action_content=(
"System resources usage"
"Connectivity test"
"Reload doom emacs"
"Sync mail"
"Restart Waybar"
)
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_command() {
bash -c "$1"
}
execute_action() {
case "$1" in
"System resources usage") launch_kitty "htop" ;;
"Connectivity test") launch_kitty "ping -c 2 freebsd.org" ;;
"Reload doom emacs") execute_command "$HOME/.emacs.d/bin/doom sync" ;;
"Sync mail") execute_command "/home/coolneng/.local/share/scripts/mail-sync -a" ;;
"Restart Waybar") execute_command "pkill waybar; waybar &" ;;
esac
}
select_action "$@"