#!/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 -show run" LABELS["apps"]="" #ssh COMMANDS["ssh"]="rofi -show ssh" LABELS["ssh"]="" # change window COMMANDS["window"]="rofi -show window" LABELS["window"]="" # lock COMMANDS["lock"]="exec betterlockscreen --lock dim" LABELS["lock"]="" # roficlip COMMANDS["roficlip"]"exec roficlip" LABELS["roficlip"]="" # mpd #COMMANDS["mpd"]="~/.config/Scripts/rofi-mpd -a" #LABELS["mpd"]="" # googler #COMMANDS["googler"]="~/.config/Scripts/rofi-googler.sh" #LABELS["googler"]="" # open bookmarks COMMANDS["bookmarks"]="~/.config/Scripts/rofi-surfraw-bookmarks.sh" LABELS["bookmarks"]="" # search local files COMMANDS["locate"]="~/.config/Scripts/rofi-locate.sh" LABELS["locate"]="" # open custom web searches COMMANDS["websearch"]="~/.config/Scripts/rofi-surfraw-websearch.sh" LABELS["websearch"]="" # i3 switch workspace COMMANDS["workspace"]="~/.config/Scripts/i3_switch_workspace.sh" LABELS["workspace"]="" # show clipboard history # source: https://github.com/erebe/greenclip #COMMANDS["clipboard"]='rofi -modi "clipboard:greenclip print" -show clipboard' #LABELS["clipboard"]="" # references -------------------------- #COMMANDS[";sr2"]="chromium 'wikipedia.org/search-redirect.php?search=\" \${input}\"" #LABELS[";sr2"]="" #COMMANDS[";piratebay"]="chromium --disk-cache-dir=/tmp/cache http://thepiratebay.org/search/\" \${input}\"" #LABELS[";piratebay"]="" #COMMANDS[".bin"]="spacefm -r '/home/hate/bin'" #LABELS[".bin"]=".bin" #COMMANDS["#screenshot"]='/home/dka/bin/screenshot-scripts/myscreenshot.sh' #LABELS["#screenshot"]="screenshot" ################################################################################ # 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 "?=>" print_menu | sort | rofi -dmenu -mesg ">>> launch your collection of rofi scripts" -i -p " " } # 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