#!/usr/bin/env bash # ABOUTME: Rofi-based settings menu that launches various system tools and scripts. # ABOUTME: Provides a searchable list of system utilities like VPN, sound, bluetooth, etc. declare -A LABELS declare -A COMMANDS ### # List of defined 'bangs' # launch programs # COMMANDS["apps"]="rofi -combi-modi window,drun -show combi" # LABELS["apps"]="" # open bookmarks # COMMANDS["bookmarks"]="~/.scripts/rofi-scripts-collection/rofi-surfraw-bookmarks.sh" # LABELS["bookmarks"]="" # search local files # COMMANDS[""]="moonarch-locate" # LABELS[""]="Locate" COMMANDS[""]="wlogout -P 1 -s -r 10 -c 10" LABELS[""]="Session Menu" # greenclip clipboard history # source: https://github.com/erebe/greenclip COMMANDS[""]='cliphist -db-path /run/user/1000/cliphist/db list | rofi -dmenu | cliphist -db-path /run/user/1000/cliphist/db decode | wl-copy' LABELS[""]="Clipboard" COMMANDS["󰖂"]='moonarch-vpn' LABELS["󰖂"]='VPN Connection Manager' COMMANDS[""]='waypaper' LABELS[""]='Wallpaper Settings' COMMANDS["󰗅"]='moonarch-volume' LABELS["󰗅"]='Sound Manager' #COMMANDS[""]='shortcuts module was removed' #LABELS[""]='Hotkey List' COMMANDS["󰍹"]='wdisplays' LABELS["󰍹"]='Display Setup' COMMANDS[""]='nwg-look' LABELS[""]='Appearance Settings' COMMANDS["󱘆"]='noisetorch' LABELS["󱘆"]='Audio Noise Reduction' COMMANDS["󰋋"]='$HOME/.local/share/headset-charge-indicator/headset-charge-indicator.py &' LABELS["󰋋"]='Headset Control' COMMANDS[""]='moonarch-bluetooth' LABELS[""]='Bluetooth Control' COMMANDS["󰛳"]='nm-applet --indicator &' LABELS["󰛳"]='Networker Manager' COMMANDS["󰴱"]='wl-color-picker' LABELS["󰴱"]='Color Picker' COMMANDS["󰚞"]='font-manager' LABELS["󰚞"]='Font Manager' COMMANDS["󱨑"]='gufw' LABELS["󱨑"]='Firewall Settings' COMMANDS[""]='env GTK_THEME=Adwaita:dark resources' LABELS[""]='System Resources' COMMANDS["󰓅"]='moonarch-cpugov' LABELS["󰓅"]='CPU Modes' COMMANDS["󰓅"]='hardinfo' LABELS["󰓅"]='System Profiler and Benchmark' COMMANDS["󰀠"]='alarm-clock-applet' LABELS["󰀠"]='Alarm & Timer' COMMANDS["󱓞"]='moonarch-launcher' LABELS["󱓞"]='App Launcher' ################################################################################ # do not edit below ################################################################################ ## # Generate menu ## function print_menu() { for key in ${!LABELS[@]} do # echo "$key ${LABELS}" echo "$key ${LABELS[$key]}" # my top version just shows the first field in labels row, not two words side by side done } ## # Show rofi. ## function start() { # print_menu | rofi -dmenu -p "?=>" title="MoonArch \ $USER \ $(date +"%H:%M") \ $(uptime -p | sed 's/up //')" print_menu | sort | rofi -theme /etc/xdg/rofi/settings-menu/settings-menu.rasi -show $title -dmenu -markup-rows -mesg "󰣇 $title" -i -p "rofi-bangs: " } # Run it value="$(start)" # Split input. # grab upto first space. choice=${value%%\ *} # graph remainder, minus space. input=${value:$((${#choice}+1))} ## # Cancelled? bail out ## if test -z ${choice} then exit fi # check if choice exists if test ${COMMANDS[$choice]+isset} then # Execute the choice ${COMMANDS[$choice]} else echo "Unknown command: ${choice}" | rofi -dmenu -p "error" fi