2018-02-05 21:31:56 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2019-03-03 03:04:41 -06:00
|
|
|
NAME="${0##*/}"
|
2019-03-03 17:25:39 -06:00
|
|
|
VER="0.7"
|
2018-02-20 07:55:53 -06:00
|
|
|
|
2018-12-02 22:19:37 -06:00
|
|
|
usage()
|
|
|
|
{
|
2019-03-03 17:25:39 -06:00
|
|
|
cat <<EOF
|
2018-06-30 20:43:00 -05:00
|
|
|
|
2018-11-05 00:19:12 -06:00
|
|
|
USAGE: $NAME [OPTIONS]
|
2018-07-15 00:11:15 -05:00
|
|
|
|
|
|
|
OPTIONS:
|
2018-06-30 20:43:00 -05:00
|
|
|
|
|
|
|
-h,--help Display this message
|
|
|
|
|
|
|
|
-v,--version Display script version
|
|
|
|
|
2018-12-14 17:53:11 -06:00
|
|
|
-r,--run Application launcher
|
2018-06-30 20:43:00 -05:00
|
|
|
|
2018-12-14 17:53:11 -06:00
|
|
|
-w,--window Switch between windows
|
2018-06-30 20:43:00 -05:00
|
|
|
|
2018-12-14 17:53:11 -06:00
|
|
|
-l,--logout System logout dialog
|
2018-06-30 20:43:00 -05:00
|
|
|
|
|
|
|
-b,--browser Browser search by keyword (requires surfraw)
|
|
|
|
|
2018-12-14 17:53:11 -06:00
|
|
|
-q,--qalculate Persistant calculator dialog (requires libqalculate)
|
|
|
|
|
|
|
|
-c,--clipboard Select previous clipboard entries (requires greenclip)
|
2018-06-30 20:43:00 -05:00
|
|
|
|
2018-11-05 00:19:12 -06:00
|
|
|
|
|
|
|
Without any options the run dialog will be opened.
|
2018-02-05 21:31:56 -06:00
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2019-03-03 03:04:41 -06:00
|
|
|
if (( $# == 0 )); then
|
|
|
|
rofi -modi run,drun -show drun -line-padding 4 -columns 2 -padding 50 -hide-scrollbar -show-icons -drun-icon-theme "ArchLabs-Light"
|
|
|
|
else
|
|
|
|
for arg in "$@"; do
|
|
|
|
case $arg in
|
|
|
|
-h|--help)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
-v|--version)
|
|
|
|
echo -e "$NAME -- Version $VER"
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
-r|--run)
|
|
|
|
rofi -modi run,drun -show drun -line-padding 4 -columns 2 -padding 50 -hide-scrollbar -show-icons -drun-icon-theme "ArchLabs-Light"
|
|
|
|
;;
|
|
|
|
-w|--window)
|
|
|
|
rofi -modi window -show window -hide-scrollbar -padding 50 -line-padding 4
|
|
|
|
;;
|
|
|
|
-q|--qalculate)
|
2019-03-03 17:25:39 -06:00
|
|
|
hash qalc >/dev/null 2>&1 || { echo "Requires 'libqalculate' installed"; exit 1; }
|
2019-03-03 03:04:41 -06:00
|
|
|
rofi -modi "calc:qalc +u8 -nocurrencies" -padding 50 -show "calc:qalc +u8 -nocurrencies" -line-padding 4 -hide-scrollbar
|
|
|
|
;;
|
|
|
|
-c|--clipboard)
|
2019-03-03 17:25:39 -06:00
|
|
|
hash greenclip >/dev/null 2>&1 || { echo "Requires 'greenclip' installed"; exit 1; }
|
2019-03-03 03:04:41 -06:00
|
|
|
rofi -modi "clipboard:greenclip print" -padding 50 -line-padding 4 -show "clipboard:greenclip print" -hide-scrollbar
|
|
|
|
;;
|
|
|
|
-b|--browser)
|
2019-03-03 17:25:39 -06:00
|
|
|
hash surfraw >/dev/null 2>&1 || { echo "Requires 'surfraw' installed"; exit 1; }
|
2019-03-03 03:04:41 -06:00
|
|
|
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')"
|
|
|
|
;;
|
|
|
|
-l|--logout)
|
2019-03-03 17:25:39 -06:00
|
|
|
if grep -q 'startx' $HOME/.*profile; then
|
2019-03-03 03:04:41 -06:00
|
|
|
ANS="$(rofi -sep "|" -dmenu -i -p 'System' -width 20 -hide-scrollbar -line-padding 4 -padding 20 -lines 3 <<< " Lock| Reboot| Shutdown")"
|
|
|
|
else
|
|
|
|
ANS="$(rofi -sep "|" -dmenu -i -p 'System' -width 20 -hide-scrollbar -line-padding 4 -padding 20 -lines 4 <<< " Lock| Logout| Reboot| Shutdown")"
|
|
|
|
fi
|
|
|
|
case "$ANS" in
|
|
|
|
*Lock) i3lock-fancy ;;
|
|
|
|
*Reboot) systemctl reboot ;;
|
|
|
|
*Shutdown) systemctl -i poweroff ;;
|
2019-08-22 19:06:35 -05:00
|
|
|
*Logout) session-logout >/dev/null 2>&1 || pkill -15 -t tty"$XDG_VTNR" Xorg ;;
|
2019-03-03 03:04:41 -06:00
|
|
|
esac
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
printf "\nOption does not exist: %s\n\n" "$arg"
|
|
|
|
exit 2
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
fi
|
2018-07-09 20:48:03 -05:00
|
|
|
|
2018-02-05 21:31:56 -06:00
|
|
|
exit 0
|