Last active
November 13, 2023 09:22
-
-
Save naranyala/a3f51184a297cc395a6caf8e5eca1227 to your computer and use it in GitHub Desktop.
global menu with rofi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare -A opt | |
opt["001"]="key-for-system-auth" | |
opt["002"]="key-for-system-run" | |
opt["003"]="key-for-system-apps" | |
opt["004"]="key-for-direct-websearch" | |
opt["005"]="key-for-emoji-selector" | |
opt["006"]="key-for-color-picker" | |
opt["007"]="key-for-handle-wifi" | |
declare -A act | |
act["π System Auth | M-<Escape"]=${opt["001"]} | |
act["πΉ System Run | M-r"]=${opt["002"]} | |
act["π± System Apps | M-d"]=${opt["003"]} | |
act["π Direct Web Search | M-s"]=${opt["004"]} | |
act["π Emoji Selector | M-e"]=${opt["005"]} | |
act["π¨ Color Picker | M-x"]=${opt["006"]} | |
act["πΆ Handle wi-fi | M-c"]=${opt["007"]} | |
run_rofi() { | |
selected_option=$(printf '%s\n' "${!act[@]}" | rofi -dmenu -p "Select an option: ") | |
if [ -n "$selected_option" ]; then | |
action="${act[$selected_option]}" | |
echo "$action" | |
else | |
echo "No option selected or canceled." | |
fi | |
} | |
run_cmd() { | |
case $1 in | |
--opt-001-system-auth) | |
bash "$HOME/bin/rofi-showmenu-authsystem.sh" | |
;; | |
--opt-002-system-run) | |
rofi -show run | |
;; | |
--opt-003-system-apps) | |
rofi -show drun | |
;; | |
--opt-004-direct-websearch) | |
bash "$HOME/bin/rofi-showmenu-websearch-custom.sh" | |
;; | |
--opt-005-emoji-selector) | |
rofimoji | |
;; | |
--opt-006-color-picker) | |
bash "$HOME/bin/rofi-colorpicker.sh" | |
;; | |
--opt-007-handle-wifi) | |
bash "$HOME/bin/rofi-handle-wifi-connection.sh" | |
;; | |
*) | |
echo "Invalid option" | |
;; | |
esac | |
} | |
chosen="$(run_rofi)" | |
case ${chosen} in | |
${opt["001"]}) run_cmd --opt-001-system-auth ;; | |
${opt["002"]}) run_cmd --opt-002-system-run ;; | |
${opt["003"]}) run_cmd --opt-003-system-apps ;; | |
${opt["004"]}) run_cmd --opt-004-direct-websearch ;; | |
${opt["005"]}) run_cmd --opt-005-emoji-selector ;; | |
${opt["006"]}) run_cmd --opt-006-color-picker ;; | |
${opt["007"]}) run_cmd --opt-007-handle-wifi ;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment