Remove bar-wide clicks for polybar, update and cleanup some scripts
This commit is contained in:
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user