145 lines
3.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# author: unknown
# sentby: MoreChannelNoise (https://www.youtube.com/user/MoreChannelNoise)
# editby: gotbletu (https://www.youtube.com/user/gotbletu)
# demo: https://www.youtube.com/watch?v=kxJClZIXSnM
# info: this is a script to launch other rofi scripts,
# saves us the trouble of binding multiple hotkeys for each script,
# when we can just use one hotkey for everything.
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[""]="~/.config/rofi/locate/rofi-locate.sh"
# 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 list | rofi -dmenu | cliphist decode | wl-copy'
LABELS[""]="Clipboard"
COMMANDS["󰖂"]='~/.config/rofi/nm-vpn/nm-vpn.sh'
LABELS["󰖂"]='VPN Connection Manager'
COMMANDS[""]='waypaper'
LABELS[""]='Wallpaper Settings'
COMMANDS["󰗅"]='~/.config/rofi/volume/volume.sh'
LABELS["󰗅"]='Sound Manager'
#COMMANDS[""]='~/.config/rofi/shortcuts/shortcuts.sh'
#LABELS[""]='Hotkey List'
COMMANDS["󰍹"]='wdisplays'
LABELS["󰍹"]='Display Setup'
COMMANDS[""]='nwg-look'
LABELS[""]='Appearance Settings'
COMMANDS["󱘆"]='noisetorch'
LABELS["󱘆"]='Audio Noise Reduction'
COMMANDS["󰋋"]='/home/dom/.local/share/headset-charge-indicator/headset-charge-indicator.py &'
LABELS["󰋋"]='Headset Control'
COMMANDS[""]='~/.config/rofi/bluetooth/bluetooth.sh'
LABELS[""]='Bluetooth Control'
COMMANDS["󰛳"]='nm-applet --indicator &'
LABELS["󰛳"]='Networker Manager'
COMMANDS["󰴱"]='hyprpicker -f hex -a'
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["󰓅"]='$HOME/.config/rofi/cpugov/rofi-cpugov.sh'
LABELS["󰓅"]='CPU Modes'
COMMANDS["󰓅"]='hardinfo'
LABELS["󰓅"]='System Profiler and Benchmark'
COMMANDS["󰀠"]='alarm-clock-applet'
LABELS["󰀠"]='Alarm & Timer'
COMMANDS["󱓞"]='~/.config/rofi/launcher/launcher.sh'
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 $HOME/.config/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
eval echo "Executing: ${COMMANDS[$choice]}"
eval ${COMMANDS[$choice]}
else
eval $choice | rofi
# prefer my above so I can use this same script to also launch apps like geany or leafpad etc (DK)
# echo "Unknown command: ${choice}" | rofi -dmenu -p "error"
fi