Remove bar-wide clicks for polybar, update and cleanup some scripts

This commit is contained in:
natemaia 2018-06-30 18:43:00 -07:00
parent 87d834bc2e
commit 3f22a849bd
6 changed files with 116 additions and 77 deletions

View File

@ -57,10 +57,16 @@ module-margin = 0
padding-right = 0 padding-right = 0
padding-left = 0 padding-left = 0
separator = │ separator = │
scroll-up = pamixer -i 2
scroll-down = pamixer -d 2 ; shows which modules have click actions
click-middle = skippy-xd --activate-window-picker
double-click-left = networkmanager_dmenu
double-click-middle = skippy-xd --activate-window-picker
double-click-right = pavucontrol &
cursor-click = pointer cursor-click = pointer
; with the above these cause the entire bar to have click actions
; essentially defeating the purpose, so they are commented out
; scroll-up = pamixer -i 2
; scroll-down = pamixer -d 2
; click-middle = skippy-xd --activate-window-picker
; double-click-left = networkmanager_dmenu
; double-click-middle = skippy-xd --activate-window-picker
; double-click-right = pavucontrol &

View File

@ -2,17 +2,17 @@
# this file is executed when calling startx # this file is executed when calling startx
# To run a different WM, set session="WM" below, or run: # to start a different WM, set session="WM" below, or in console run:
# startx ~/.xinitrc WM # startx ~/.xinitrc WM
# Session to run if none passed via startx # session to run if none passed as first arg ($1)
session=${1:-openbox} session="${1:-openbox}"
# set environment wm for use in scripts # set environment wm for use in scripts
export WM="$session" export WM="$session"
# Default Arch xinit scripts # default arch xinit scripts
if [ -d /etc/X11/xinit/xinitrc.d ]; then if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*.sh; do for f in /etc/X11/xinit/xinitrc.d/*.sh; do
[ -x "$f" ] && . "$f" [ -x "$f" ] && . "$f"
@ -25,7 +25,8 @@ fi
[ -f ~/.Xresources ] && xrdb -merge ~/.Xresources [ -f ~/.Xresources ] && xrdb -merge ~/.Xresources
[ -f ~/.xprofile ] && source ~/.xprofile [ -f ~/.xprofile ] && source ~/.xprofile
# some things to start for awesome wm, other wm already have these started elsewhere # some things to start for awesome
# other wm already have these started elsewhere
if [[ $session == "awesome" ]]; then if [[ $session == "awesome" ]]; then
# keyring for storing passwords # keyring for storing passwords
@ -46,22 +47,22 @@ if [[ $session == "awesome" ]]; then
fi fi
# display timeout and sleep # display timeout and sleep
xset s 3600 3600 # xset s 3600 3600
xset dpms 3600 3700 4000 # xset dpms 3600 3700 4000
# keyboard repeat rate # keyboard repeat rate
xset r rate 400 50 # xset r rate 400 50
kbdrate -d 400 -r 50 # kbdrate -d 400 -r 50
# 1/1 mouse acceleration # 1/1 mouse acceleration (no acceleration)
xset m 1/1 # xset m 1/1
# Do NOT put commands below the exec lines # do NOT put commands below the exec lines
case $session in case $session in
i3|i3wm) exec i3 ;; i3|i3wm) exec i3 ;;
bsp|bspwm) exec bspwm ;; bsp|bspwm) exec bspwm ;;
xfce|xfce4) exec startxfce4 ;; xfce|xfce4) exec startxfce4 ;;
openbox) exec openbox-session ;; openbox) exec openbox-session ;;
awesome) exec awesome ;; awesome) exec awesome ;;
*) exec "$1" # Unknown, try running it *) exec "$session" # Unknown, try running it
esac esac

View File

@ -7,16 +7,20 @@ wireless_connected=""
ethernet_connected="" ethernet_connected=""
while true; do while true; do
if ping -c1 www.github.com &>/dev/null; then if ping -c1 archlabslinux.com &>/dev/null || ping -c1 bitbucket.org &>/dev/null || ping -c1 github.com &>/dev/null; then
# avoid checking what type of interface it is every loop
if (( count < 1 )); then if (( count < 1 )); then
ID="$(ip link | awk '/state UP/ {print $2}')" ID="$(ip link | awk '/state UP/ {print $2}')"
((count++)) ((count++))
fi fi
if [[ $ID == e* ]]; then if [[ $ID == e* ]]; then
echo "$ethernet_connected" ; sleep 20 echo "$ethernet_connected" ; sleep 20
else else
echo "$wireless_connected" ; sleep 20 echo "$wireless_connected" ; sleep 20
fi fi
else else
echo "$disconnected" ; sleep 0.6 echo "$disconnected" ; sleep 0.6
echo "$disconnected2" ; sleep 0.6 echo "$disconnected2" ; sleep 0.6

View File

@ -1,6 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
TRASH_DIRECTORY="$BLOCK_INSTANCE" TRASH_DIRECTORY="$BLOCK_INSTANCE"
if [[ $TRASH_DIRECTORY = "" ]]; then if [[ $TRASH_DIRECTORY = "" ]]; then
TRASH_DIRECTORY="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" TRASH_DIRECTORY="${XDG_DATA_HOME:-$HOME/.local/share}/Trash"
fi fi

View File

@ -1,78 +1,96 @@
#!/usr/bin/env bash #!/usr/bin/env bash
Name=$(basename "$0") NAME=$(basename "$0")
Version="0.2" VER="0.3"
_usage() { usage() {
cat <<- EOF cat <<- EOF
Usage: $Name [options] USAGE: $NAME [OPTIONS]
Options: OPTIONS:
-h Display this message
-v Display script version -h,--help Display this message
-q Persistant calculator dialog
-w Switch between open windows -v,--version Display script version
-r Program launcher & run dialog
-c Select previous clipboard entries -w,--window Switch between open windows
-b Browser search by keyword
-l Session logout choice -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.
EOF EOF
} }
# Handle command line arguments for arg in "$@"; do
while getopts ":hvqwcbrl" opt; do case $arg in
case $opt in -h|--help)
h) usage
_usage
exit 0 exit 0
;; ;;
v) -v|--version)
echo -e "$Name -- Version $Version" echo -e "$NAME -- Version $VER"
exit 0 exit 0
;; ;;
r) -r|--run)
rofi -modi run,drun -show drun -line-padding 4 \ rofi -modi run,drun -show drun -line-padding 4 \
-columns 2 -padding 50 -hide-scrollbar \ -columns 2 -padding 50 -hide-scrollbar \
-show-icons -drun-icon-theme "ArchLabs-Light" -show-icons -drun-icon-theme "ArchLabs-Light"
;; ;;
w) -w|--window)
rofi -modi window -show window -hide-scrollbar -padding 50 -line-padding 4 rofi -modi window -show window -hide-scrollbar -padding 50 -line-padding 4
;; ;;
q) -q|--qalculate)
! hash qalc &>/dev/null && { echo "Requires 'libqalculate' installed"; exit 1; }
rofi -modi "calc:qalc +u8 -nocurrencies" -padding 50 \ rofi -modi "calc:qalc +u8 -nocurrencies" -padding 50 \
-show "calc:qalc +u8 -nocurrencies" -line-padding 4 \ -show "calc:qalc +u8 -nocurrencies" -line-padding 4 \
-hide-scrollbar -hide-scrollbar
;; ;;
c) -c|--clipboard)
! hash greenclip &>/dev/null && { echo "Requires 'greenclip' installed"; exit 1; }
rofi -modi "clipboard:greenclip print" -padding 50 \ rofi -modi "clipboard:greenclip print" -padding 50 \
-line-padding 4 -show "clipboard:greenclip print" \ -line-padding 4 -show "clipboard:greenclip print" \
-hide-scrollbar -hide-scrollbar
;; ;;
b) -b|--browser)
surfraw -browser="$BROWSER" $(sr -elvi | awk -F'-' '{print $1}' \ ! hash surfraw &>/dev/null && { echo "Requires 'surfraw' installed"; exit 1; }
| sed '/:/d' | awk '{$1=$1};1' | rofi -hide-scrollbar \
-kb-row-select 'Tab' -kb-row-tab 'Control+space' \ surfraw -browser="$BROWSER" $(sr -elvi |
-dmenu -mesg 'Tab for Autocomplete' -i -p 'Web Search ' \ awk -F'-' '{print $1}' |
-padding 50 -line-padding 4) 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' \
-padding 50 -line-padding 4)
;; ;;
l) -l|--logout)
ANS=$(rofi -sep "|" -dmenu -i -p 'System ' "" -width 20 -hide-scrollbar \ ANS="$(rofi -sep "|" -dmenu -i -p 'System' -width 20 \
-line-padding 4 -padding 20 -lines 4 <<< " Lock| Logout| Reboot| Shutdown") -hide-scrollbar -line-padding 4 -padding 20 \
-lines 4 <<< " Lock| Logout| Reboot| Shutdown")"
case "$ANS" in case "$ANS" in
*Lock) i3lock-fancy ;; *Lock) i3lock-fancy ;;
*Logout) session-logout ;; *Logout) session-logout || pkill -15 -t tty"$XDG_VTNR" Xorg ;;
*Reboot) systemctl reboot ;; *Reboot) systemctl reboot ;;
*Shutdown) systemctl -i poweroff *Shutdown) systemctl -i poweroff
esac esac
;; ;;
*) *)
echo -e "Option does not exist: -$OPTARG" echo -e "Option does not exist: $arg"
_usage usage
exit 1 exit 1
esac esac
done done
shift $((OPTIND - 1))
exit 0 exit 0

View File

@ -1,35 +1,43 @@
#!/usr/bin/env bash #!/usr/bin/env bash
BAR_ICON="" BAR_ICON=""
ICON=/usr/share/icons/gnome/32x32/apps/system-software-update.png NOTIFY_ICON=/usr/share/icons/gnome/32x32/apps/system-software-update.png
total() { UPD=$(checkupdates | wc -l) ;} get_total_updates() { UPDATES=$(checkupdates | wc -l); }
while true; do while true; do
total # we don't want to check for updates for liveuser, after we want to remove this
[[ $(whoami) == "liveuser" ]] && { sleep 2000; continue; } || sed '/liveuser/d' $HOME/bin/updates.sh
get_total_updates
# notify user with varying levels of urgency depending on amount of updates
if hash notify-send &>/dev/null; then if hash notify-send &>/dev/null; then
if (( UPD > 50 )); then if (( UPDATES > 50 )); then
notify-send -u critical -i $ICON "You really need to update!!" "$UPD New packages" notify-send -u critical -i $NOTIFY_ICON "You really need to update!!" "$UPD New packages"
elif (( UPD > 25 )); then elif (( UPDATES > 25 )); then
notify-send -u normal -i $ICON "You should update soon" "$UPD New packages" notify-send -u normal -i $NOTIFY_ICON "You should update soon" "$UPD New packages"
elif (( UPD > 2 )); then elif (( UPDATES > 2 )); then
notify-send -u low -i $ICON "$UPD New packages" notify-send -u low -i $NOTIFY_ICON "$UPD New packages"
fi fi
fi fi
while (( UPD > 0 )); do # loop while updates are greater than zero
if (( UPD == 1 )); then # during which every 10 seconds another check for fresh updates is done
while (( UPDATES > 0 )); do
if (( UPDATES == 1 )); then
echo "$UPD Update" echo "$UPD Update"
elif (( UPD > 1 )); then elif (( UPDATES > 1 )); then
echo "$UPD Updates" echo "$UPD Updates"
fi fi
sleep 10 sleep 10
total get_total_updates
done done
while (( UPD == 0 )); do # when no updates are available we go into a much longer loop to save cpu time
# and only check once every 30 min for new updates
while (( UPDATES == 0 )); do
echo $BAR_ICON echo $BAR_ICON
sleep 1800 sleep 1800
total get_total_updates
done done
done done