#!/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"]="dmenu_run -i -m 0 -fn 'Inconsolata:size=10' -nb '#222222' -nf '#bbbbbb' -sb '#005577' -sf '#eeeeee'"
|
|
LABELS["apps"]=""
|
|
|
|
# clipboard
|
|
COMMANDS["clipboard"]="greenclip print | dmenu -i -l 10 -m 0 -fn 'Inconsolata:size=10' -nb '#222222' -nf '#bbbbbb' -sb '#005577' -sf '#eeeeee' -p 'clipboard: ' | xclip -selection clipboard"
|
|
LABELS["clipboard"]=""
|
|
|
|
# search local files
|
|
COMMANDS["emoji"]="~/.bin/dmenu-scripts/dmenu-emoji"
|
|
LABELS["emoji"]=""
|
|
|
|
# mount drives
|
|
COMMANDS["mount"]="sudo ~/.bin/dmenu-scripts/dmenu-mount"
|
|
LABELS["mount"]=""
|
|
|
|
# umount drives
|
|
COMMANDS["unmount"]="sudo ~/.bin/dmenu-scripts/dmenu-mount unmount"
|
|
LABELS["unmount"]=""
|
|
|
|
# shutdown
|
|
COMMANDS["shutdown"]="sudo ~/.bin/dmenu-scripts/dmenu-shutdown"
|
|
LABELS["shutdown"]=""
|
|
|
|
# PDF man pages
|
|
COMMANDS["man"]="~/.bin/dmenu-scripts/dmenu-man"
|
|
LABELS["man"]=""
|
|
|
|
# locate files
|
|
COMMANDS["locate"]="~/.bin/dmenu-scripts/dmenu-locate"
|
|
LABELS["locate"]=""
|
|
|
|
################################################################################
|
|
# 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 | sort | dmenu -i -m 0 -fn "Inconsolata:size=10" -nb "#222222" -nf "#bbbbbb" -sb "#005577" -sf "#eeeeee" -p "dmenu 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 ${COMMANDS[$choice]}
|
|
else
|
|
eval $choice | dmenu
|
|
fi
|