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-left = 0
separator = │
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 &
; shows which modules have click actions
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
# 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
# Session to run if none passed via startx
session=${1:-openbox}
# session to run if none passed as first arg ($1)
session="${1:-openbox}"
# set environment wm for use in scripts
export WM="$session"
# Default Arch xinit scripts
# default arch xinit scripts
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*.sh; do
[ -x "$f" ] && . "$f"
@ -25,7 +25,8 @@ fi
[ -f ~/.Xresources ] && xrdb -merge ~/.Xresources
[ -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
# keyring for storing passwords
@ -46,22 +47,22 @@ if [[ $session == "awesome" ]]; then
fi
# display timeout and sleep
xset s 3600 3600
xset dpms 3600 3700 4000
# xset s 3600 3600
# xset dpms 3600 3700 4000
# keyboard repeat rate
xset r rate 400 50
kbdrate -d 400 -r 50
# xset r rate 400 50
# kbdrate -d 400 -r 50
# 1/1 mouse acceleration
xset m 1/1
# 1/1 mouse acceleration (no acceleration)
# xset m 1/1
# Do NOT put commands below the exec lines
# do NOT put commands below the exec lines
case $session in
i3|i3wm) exec i3 ;;
bsp|bspwm) exec bspwm ;;
i3|i3wm) exec i3 ;;
bsp|bspwm) exec bspwm ;;
xfce|xfce4) exec startxfce4 ;;
openbox) exec openbox-session ;;
awesome) exec awesome ;;
*) exec "$1" # Unknown, try running it
openbox) exec openbox-session ;;
awesome) exec awesome ;;
*) exec "$session" # Unknown, try running it
esac

View File

@ -7,16 +7,20 @@ wireless_connected=""
ethernet_connected=""
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
ID="$(ip link | awk '/state UP/ {print $2}')"
((count++))
fi
if [[ $ID == e* ]]; then
echo "$ethernet_connected" ; sleep 20
else
echo "$wireless_connected" ; sleep 20
fi
else
echo "$disconnected" ; sleep 0.6
echo "$disconnected2" ; sleep 0.6

View File

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

View File

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

View File

@ -1,35 +1,43 @@
#!/usr/bin/env bash
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
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 (( UPD > 50 )); then
notify-send -u critical -i $ICON "You really need to update!!" "$UPD New packages"
elif (( UPD > 25 )); then
notify-send -u normal -i $ICON "You should update soon" "$UPD New packages"
elif (( UPD > 2 )); then
notify-send -u low -i $ICON "$UPD New packages"
if (( UPDATES > 50 )); then
notify-send -u critical -i $NOTIFY_ICON "You really need to update!!" "$UPD New packages"
elif (( UPDATES > 25 )); then
notify-send -u normal -i $NOTIFY_ICON "You should update soon" "$UPD New packages"
elif (( UPDATES > 2 )); then
notify-send -u low -i $NOTIFY_ICON "$UPD New packages"
fi
fi
while (( UPD > 0 )); do
if (( UPD == 1 )); then
# loop while updates are greater than zero
# during which every 10 seconds another check for fresh updates is done
while (( UPDATES > 0 )); do
if (( UPDATES == 1 )); then
echo "$UPD Update"
elif (( UPD > 1 )); then
elif (( UPDATES > 1 )); then
echo "$UPD Updates"
fi
sleep 10
total
get_total_updates
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
sleep 1800
total
get_total_updates
done
done