Clean up configs, remove bashrc conflicting with bash

This commit is contained in:
natemaia
2017-11-30 22:21:33 -08:00
parent 15fcfc4da1
commit eb0884e453
272 changed files with 7464 additions and 1239 deletions

19
home/bin/check-network Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
connected=""
disconnected=""
# Infinite loop
while true; do
if ping -c1 8.8.8.8 >/dev/null; then
echo "$connected"; sleep 5
else
echo "$disconnected"; sleep 1
echo "$connected"; sleep 1
fi
done

56
home/bin/check-updates Executable file
View File

@ -0,0 +1,56 @@
#!/usr/bin/env bash
# update checking script for polybar
# written by Nathaniel Maia
BAR_ICON=""
ICON=/usr/share/icons/gnome/32x32/apps/system-software-update.png
# Infinite loop
while true; do
# initial check
count=$(checkupdates | wc -l)
# notifications
if hash notify-send >/dev/null 2>&1; then
if [ $count -gt 50 ]; then
notify-send -u critical -i $ICON \
"You really need to update soon!!" "$count New package updates"
elif [ $count -gt 25 ]; then
notify-send -u normal -i $ICON \
"You should update soon" "$count New package updates"
elif [ $count -gt 5 ]; then
notify-send -u low -i $ICON \
"$count New package updates"
fi
fi
# while greater than 0 check every 8s
while [ "$count" -gt 0 ]; do
# update or updates
if [ $count -eq 1 ]; then
echo "$count Update"
elif [ $count -gt 1 ]; then
echo "$count Updates"
fi
sleep 8
count=$(checkupdates | wc -l)
done
# while no updates, check every 20 min
while [ "$count" -eq 0 ]; do
echo $BAR_ICON
sleep 1200
count=$(checkupdates | wc -l)
done
done

7
home/bin/killbar Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
killall -q polybar
while pgrep -u $UID -x polybar >/dev/null; do sleep 0.5; done
echo "Bars stopped..."

47
home/bin/launch-polybar Executable file
View File

@ -0,0 +1,47 @@
#!/usr/bin/env bash
#
# Polybar launcher script written by Nathaniel Maia for use in ArchLabs
#
# Will launch bars depending on WM and can reload openbox session
# Can also be used to reload openbox session with [--reload] or [-r]
# Enter your bar names here (seperated by spaces) eg BARS=(bar bar1 my-bar)
# This will be combined with CUR_WM eg. Openbox-bar, bspwm-bar, i3-bar
BARS=(bar)
CONF=$HOME/.config/polybar
CUR_WM=$(wmctrl -m | grep Name | cut -d " " -f2)
# used to reload openbox session
if [[ $1 == "--reload" ]] || [[ $1 == "-r" ]]; then
if [[ $CUR_WM == "Openbox" ]]; then
openbox --restart
al-compositor --restart
al-tint2restart
else
echo "[WARN]: Option [--reload] is meant for Openbox..."
fi
fi
# drop out if tint2 is running
if pgrep -x "tint2" >/dev/null; then
echo "Tint is running... Exiting"
exit 1
fi
# Terminate already running Bars
while pgrep -x polybar >/dev/null; do
killall -q polybar
sleep 0.5
done
# Launch each bar in BARS=() above
echo "Using $CUR_WM... Launching Bars"
for bar in "${BARS[@]}"; do
polybar -r --config=$CONF/config ${CUR_WM}-$bar &
done
echo "Bars launched..."

13
home/bin/rofi-logout Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
ANS=$(echo " lock| logout| reboot| shutdown" | rofi -sep "|" -dmenu -i -p 'System: ' "" -width 20 -hide-scrollbar -location 0 -yoffset -200 -font "xos4 Terminus 10" -eh 1 -line-padding 2 -padding 30 -no-config -lines 4 -color-enabled -color-window "#1F2326, #F1F1F1, #1F2326" -color-normal "#1F2326, #F1F1F1, #1F2326, #4E88CF, #1F2326")
if [[ "$ANS" == *lock ]]; then
i3lock-fancy
elif [[ "$ANS" == *logout ]]; then
i3-msg exit
elif [[ "$ANS" == *reboot ]]; then
systemctl reboot
elif [[ "$ANS" == *shutdown ]]; then
systemctl poweroff
fi

View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
ANS=$(echo " lock| logout| reboot| shutdown" | rofi -sep "|" -dmenu -i -p 'System: ' "" -width 20 -hide-scrollbar -location 0 -yoffset -200 -font "xos4 Terminus 10" -eh 1 -line-padding 4 -padding 30 -no-config -lines 4 -color-enabled -color-window "{{.Data.terminal_background}}, {{.Data.terminal_foreground}}, {{.Data.terminal_background}}" -color-normal "{{.Data.terminal_background}}, {{.Data.terminal_foreground}}, {{.Data.terminal_background}}, {{index .Data.terminal_colors 4}}, {{.Data.terminal_background}}")
if [[ "$ANS" == *lock ]]; then
i3lock-fancy
elif [[ "$ANS" == *logout ]]; then
i3-msg exit
elif [[ "$ANS" == *reboot ]]; then
systemctl reboot
elif [[ "$ANS" == *shutdown ]]; then
systemctl poweroff
fi

15
home/bin/start-compton Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
start="al-compositor --start"
restart="al-compositor --restart"
if [ -e "${HOME}/.config/.composite_enabled" ]; then
if pgrep compton; then
$restart
else
$start
fi
fi

44
home/bin/toggle-caffeine Executable file
View File

@ -0,0 +1,44 @@
#!/usr/bin/env bash
# if the script is passed --toggle
if [[ "$1" == *toggle* ]]; then
# if caffeine is running kill it
if pgrep caffeine >/dev/null; then
killall caffeine
else # otherwise start it and fork to background
caffeine &>/dev/null &
fi
# exit or get caught in the infinite loop
exit 0
fi
# infinite loop for polybar
while true; do
# caffeine is running
if pgrep caffeine >/dev/null; then
# Change Me
echo "%{F#0000FF}"
else # otherwise it must not be... LOL
# Change Me
echo "%{F#FF0000}"
fi
# sleep interval... Change the responsiveness
sleep 2
done

26
home/bin/toggle-compton Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
on=""
off=""
if [[ $1 == *toggle* ]]; then
if pgrep -x compton > /dev/null 2>&1; then
al-compositor --stop
else
al-compositor --start
fi
exit 0
fi
if pgrep -x compton > /dev/null 2>&1; then
echo "$on"
else
echo "%{F#888888}$off"
fi

11
home/bin/toggle-polybar Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
if pgrep -x polybar >/dev/null; then
pkill polybar
else
launch-polybar >/dev/null 2>&1
fi

28
home/bin/toggle-redshift Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env bash
if [[ $1 = "--toggle" ]] || [[ $1 = "-t" ]]; then
if pgrep redshift > /dev/null 2>&1; then
killall redshift
else
redshift &
fi
fi
icon=""
pgrep -x redshift &> /dev/null
if [[ $? -eq 0 ]]; then
temp=$(redshift -p 2>/dev/null | grep temp | cut -d' ' -f3)
temp=${temp//K/}
fi
if [[ -z $temp ]]; then
echo " $icon " # Greyed out (not running)
elif [[ $temp -ge 5000 ]]; then
echo "%{F#8039A0} $icon " # Blue
elif [[ $temp -ge 4000 ]]; then
echo "%{F#F203F0} $icon " # Yellow
else
echo "%{F#FF5B6C} $icon " # Orange
fi

14
home/bin/toggle-termite Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
MATCH=$(pgrep --full 'termite --title=work-term')
if ! $MATCH; then
pkill --full 'termite --title=work-term'
else
termite --title=work-term --class=work-term &
fi
exit 0

32
home/bin/trash Executable file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env bash
TRASH_DIRECTORY="${BLOCK_INSTANCE}"
if [[ "${TRASH_DIRECTORY}" = "" ]]; then
TRASH_DIRECTORY="${XDG_DATA_HOME:-${HOME}/.local/share}/Trash"
fi
# Left click
if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then
xdg-open "${TRASH_DIRECTORY}/files"
# Right click
elif [[ "${BLOCK_BUTTON}" -eq 3 ]]; then
# Delete all files permanently (unlink them)
rm -r "${TRASH_DIRECTORY}/files"
rm -r "${TRASH_DIRECTORY}/info"
# Create new directory
mkdir "${TRASH_DIRECTORY}/files"
mkdir "${TRASH_DIRECTORY}/info"
fi
TRASH_COUNT=$(ls -U -1 "${TRASH_DIRECTORY}/files" | wc -l)
URGENT_VALUE=30
echo "${TRASH_COUNT}"
echo "${TRASH_COUNT}"
echo ""
if [[ "${TRASH_COUNT}" -ge "${URGENT_VALUE}" ]]; then
exit 31
fi