Update rofi_run with more flags

This commit is contained in:
natemaia 2020-04-24 19:17:13 -07:00
parent 12fd7719fd
commit c3649ac74e

View File

@ -1,7 +1,12 @@
#!/bin/bash
NAME="${0##*/}"
VER="0.72"
VER="0.8"
OPTS=(
-padding 50
-line-padding 4
-hide-scrollbar
)
usage()
{
@ -15,7 +20,9 @@ usage()
-v,--version Display script version
-r,--run Application launcher
-r,--run Run launcher
-d,--drun Desktop application launcher
-w,--window Switch between windows
@ -34,7 +41,7 @@ EOF
}
if (( $# == 0 )); then
rofi -modi run,drun -show drun -line-padding 4 -columns 2 -padding 50 -hide-scrollbar -show-icons -drun-icon-theme "ArchLabs-Dark"
rofi -show run -columns 2 "${OPTS[@]}"
else
for arg in "$@"; do
case $arg in
@ -46,27 +53,32 @@ else
echo -e "$NAME -- Version $VER"
exit 0
;;
-d|--drun)
rofi -modi drun -show drun -columns 2 "${OPTS[@]}" -show-icons -drun-icon-theme "ArchLabs-Dark"
;;
-r|--run)
rofi -modi run,drun -show drun -line-padding 4 -columns 2 -padding 50 -hide-scrollbar -show-icons -drun-icon-theme "ArchLabs-Dark"
rofi -show run -columns 2 "${OPTS[@]}"
;;
-w|--window)
rofi -modi window -show window -hide-scrollbar -padding 50 -line-padding 4
rofi -show window "${OPTS[@]}"
;;
-q|--qalculate)
hash qalc >/dev/null 2>&1 || { echo "Requires 'libqalculate' installed"; exit 1; }
rofi -modi "calc:qalc +u8 -nocurrencies" -padding 50 -show "calc:qalc +u8 -nocurrencies" -line-padding 4 -hide-scrollbar
rofi -modi "calc:qalc +u8 -nocurrencies" -show "calc:qalc +u8 -nocurrencies" "${OPTS[@]}"
;;
-c|--clipboard)
hash greenclip >/dev/null 2>&1 || { echo "Requires 'greenclip' installed"; exit 1; }
rofi -modi "clipboard:greenclip print" -padding 50 -line-padding 4 -show "clipboard:greenclip print" -hide-scrollbar
rofi -modi "clipboard:greenclip print" -show "clipboard:greenclip print" "${OPTS[@]}"
;;
-b|--browser)
hash surfraw >/dev/null 2>&1 || { echo "Requires 'surfraw' installed"; exit 1; }
surfraw -browser="$BROWSER" "$(sr -elvi | awk -F'-' '{print $1}' | sed '/:/d' | awk '{$1=$1};1' |
rofi -hide-scrollbar -kb-row-select 'Tab' -kb-row-tab 'Control+space' -dmenu -mesg 'Tab for Autocomplete' -i -p 'Web Search')"
rofi -hide-scrollbar -kb-row-select 'Tab' -kb-row-tab 'Control+space' \
-dmenu -mesg 'Tab for Autocomplete' -i -p 'Web Search')"
;;
-l|--logout)
case "$(rofi -sep "|" -dmenu -i -p 'System' -width 20 -hide-scrollbar -line-padding 4 -padding 20 -lines 4 <<< " Lock| Logout| Reboot| Shutdown")" in
case "$(rofi -sep "|" -dmenu -i -p 'System' -width 20 -hide-scrollbar \
-line-padding 4 -padding 20 -lines 4 <<< " Lock| Logout| Reboot| Shutdown")" in
*Lock) i3lock-fancy ;;
*Reboot) systemctl reboot ;;
*Shutdown) systemctl -i poweroff ;;