Change keybinding for recurrent-actions script
This commit is contained in:
39
scripts/.local/share/scripts/recurrent-actions
Executable file
39
scripts/.local/share/scripts/recurrent-actions
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
select_action() {
|
||||
action_content=(
|
||||
"System resources usage"
|
||||
"Connectivity test"
|
||||
"Kill emacs"
|
||||
"Sync doom emacs"
|
||||
"Start videocall"
|
||||
"Stop videocall"
|
||||
"Sync mail"
|
||||
)
|
||||
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" ;;
|
||||
"Kill emacs") execute_command "pkill emacs" ;;
|
||||
"Sync doom emacs") execute_command "$HOME/.emacs.d/bin/doom sync" ;;
|
||||
"Start videocall") execute_command "$script_folder/pulseaudio-mic-mute" && execute_command "$script_folder/videocall start" ;;
|
||||
"Stop videocall") execute_command "$script_folder/pulseaudio-mic-mute" && execute_command "$script_folder/videocall stop" ;;
|
||||
"Sync mail") execute_command "mbsync -a" && execute_command "notmuch new" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
script_folder="$HOME/.local/share/scripts"
|
||||
|
||||
select_action "$@"
|
||||
Reference in New Issue
Block a user