#!/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' COMMANDS["moonarch.de"]="fusermount3 -u $HOME/.sshfs/moonarch.de | mkdir -p $HOME/.sshfs/moonarch.de | sshfs docker@moonarch.de:/home/docker $HOME/.sshfs/moonarch.de | subl --launch-or-new-window $HOME/.sshfs/moonarch.de" LABELS["moonarch.de"]="moonarch.de" COMMANDS[""]='rofi -modi "clipboard:greenclip print" -show Clipboard' LABELS[""]="Clipboard" ################################################################################ # do not edit below ################################################################################ ## # Generate menu ## function print_menu() { for key in ${!LABELS[@]} do # echo "$key ${LABELS}" echo "${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 "?=>" print_menu | sort | rofi -show "Tools" -dmenu -mesg " Tools" -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