2018-02-05 21:31:56 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-06-30 20:43:00 -05:00
|
|
|
NAME=$(basename "$0")
|
2018-08-18 15:16:42 -05:00
|
|
|
VER="0.4"
|
2018-02-20 07:55:53 -06:00
|
|
|
|
2018-06-30 20:43:00 -05:00
|
|
|
usage() {
|
2018-02-05 21:31:56 -06:00
|
|
|
cat <<- EOF
|
2018-06-30 20:43:00 -05:00
|
|
|
|
2018-07-15 00:11:15 -05:00
|
|
|
USAGE: $NAME [OPTIONS]
|
|
|
|
|
|
|
|
OPTIONS:
|
2018-06-30 20:43:00 -05:00
|
|
|
|
|
|
|
-h,--help Display this message
|
|
|
|
|
|
|
|
-v,--version Display script version
|
|
|
|
|
|
|
|
-w,--window Switch between open windows
|
|
|
|
|
|
|
|
-r,--run Program launcher & run dialog
|
|
|
|
|
|
|
|
-q,--qalculate Persistant calculator dialog (requires libqalculate)
|
|
|
|
|
|
|
|
-c,--clipboard Select previous clipboard entries (requires greenclip)
|
|
|
|
|
|
|
|
-b,--browser Browser search by keyword (requires surfraw)
|
|
|
|
|
|
|
|
-l,--logout Session logout dialog
|
|
|
|
|
|
|
|
Without any options -r,--run will be opened.
|
2018-02-05 21:31:56 -06:00
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2018-06-30 20:43:00 -05:00
|
|
|
for arg in "$@"; do
|
|
|
|
case $arg in
|
2018-08-18 15:16:42 -05:00
|
|
|
-h|--help) usage; exit 0 ;;
|
|
|
|
-v|--version) echo -e "$NAME -- Version $VER"; exit 0 ;;
|
2018-06-30 20:43:00 -05:00
|
|
|
-r|--run)
|
2018-02-05 21:31:56 -06:00
|
|
|
rofi -modi run,drun -show drun -line-padding 4 \
|
|
|
|
-columns 2 -padding 50 -hide-scrollbar \
|
|
|
|
-show-icons -drun-icon-theme "ArchLabs-Light"
|
|
|
|
;;
|
2018-06-30 20:43:00 -05:00
|
|
|
-w|--window)
|
2018-06-17 01:17:43 -05:00
|
|
|
rofi -modi window -show window -hide-scrollbar -padding 50 -line-padding 4
|
2018-02-05 21:31:56 -06:00
|
|
|
;;
|
2018-06-30 20:43:00 -05:00
|
|
|
-q|--qalculate)
|
2018-08-18 15:16:42 -05:00
|
|
|
hash qalc &>/dev/null || { echo "Requires 'libqalculate' installed"; exit 1; }
|
2018-06-30 20:43:00 -05:00
|
|
|
|
2018-02-05 21:31:56 -06:00
|
|
|
rofi -modi "calc:qalc +u8 -nocurrencies" -padding 50 \
|
|
|
|
-show "calc:qalc +u8 -nocurrencies" -line-padding 4 \
|
|
|
|
-hide-scrollbar
|
|
|
|
;;
|
2018-06-30 20:43:00 -05:00
|
|
|
-c|--clipboard)
|
2018-08-18 15:16:42 -05:00
|
|
|
hash greenclip &>/dev/null || { echo "Requires 'greenclip' installed"; exit 1; }
|
2018-06-30 20:43:00 -05:00
|
|
|
|
2018-02-05 21:31:56 -06:00
|
|
|
rofi -modi "clipboard:greenclip print" -padding 50 \
|
|
|
|
-line-padding 4 -show "clipboard:greenclip print" \
|
|
|
|
-hide-scrollbar
|
|
|
|
;;
|
2018-06-30 20:43:00 -05:00
|
|
|
-b|--browser)
|
2018-08-18 15:16:42 -05:00
|
|
|
hash surfraw &>/dev/null || { echo "Requires 'surfraw' installed"; exit 1; }
|
2018-06-30 20:43:00 -05:00
|
|
|
|
2018-08-18 15:16:42 -05:00
|
|
|
surfraw -browser="$BROWSER" $(sr -elvi | awk -F'-' '{print $1}' |
|
|
|
|
sed '/:/d' | awk '{$1=$1};1' |
|
2018-06-30 20:43:00 -05:00
|
|
|
rofi -hide-scrollbar -kb-row-select 'Tab' \
|
2018-07-09 20:48:03 -05:00
|
|
|
-kb-row-tab 'Control+space' -dmenu \
|
|
|
|
-mesg 'Tab for Autocomplete' -i -p 'Web Search' \
|
|
|
|
-padding 50 -line-padding 4) ;;
|
2018-06-30 20:43:00 -05:00
|
|
|
-l|--logout)
|
|
|
|
ANS="$(rofi -sep "|" -dmenu -i -p 'System' -width 20 \
|
|
|
|
-hide-scrollbar -line-padding 4 -padding 20 \
|
|
|
|
-lines 4 <<< " Lock| Logout| Reboot| Shutdown")"
|
2018-02-05 21:31:56 -06:00
|
|
|
case "$ANS" in
|
|
|
|
*Lock) i3lock-fancy ;;
|
2018-06-30 20:43:00 -05:00
|
|
|
*Logout) session-logout || pkill -15 -t tty"$XDG_VTNR" Xorg ;;
|
2018-02-05 21:31:56 -06:00
|
|
|
*Reboot) systemctl reboot ;;
|
2018-05-18 22:36:34 -05:00
|
|
|
*Shutdown) systemctl -i poweroff
|
2018-07-09 20:48:03 -05:00
|
|
|
esac ;;
|
|
|
|
*) echo; echo "Option does not exist: $arg"; echo; exit 2
|
2018-02-05 21:31:56 -06:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2018-07-09 20:48:03 -05:00
|
|
|
(( $# == 0 )) && "$0" -r
|
|
|
|
|
2018-02-05 21:31:56 -06:00
|
|
|
exit 0
|