Update users home folder, clean up some scripts and add comments

This commit is contained in:
natemaia
2017-12-17 10:06:39 -08:00
parent e322152f69
commit 662f7d9388
87 changed files with 2309 additions and 2364 deletions

View File

@ -4,7 +4,7 @@ connected=""
disconnected=""
while true; do
if ping -c1 8.8.8.8 >/dev/null; then
if [[ $(ping -c1 8.8.8.8) ]]; then
echo "$connected"; sleep 10
else
echo "$disconnected"; sleep 1

View File

@ -5,7 +5,7 @@ ICON=/usr/share/icons/gnome/32x32/apps/system-software-update.png
while true; do
count=$(checkupdates | wc -l)
if hash notify-send >/dev/null 2>&1; then
if hash notify-send &>/dev/null; then
if [[ $count > 50 ]]; then
notify-send -u critical -i $ICON \
"You really need to update soon!!" "$count New package updates"

View File

@ -23,8 +23,6 @@ class Selection(Gtk.EventBox):
self.background = background
self.selected_colour = selected
if not working:
name = 'x ' + name
text = Gtk.Label(name)
hbox = Gtk.HBox()
hbox.set_size_request(0, 30)
@ -45,38 +43,36 @@ class Selection(Gtk.EventBox):
hbox.pack_end(colour_widgets, False, True, 20)
self.hbox = hbox
self.connect('enter-notify-event', self.selected)
self.connect('leave-notify-event', self.unselected)
#self.connect('enter-notify-event', self.selected)
#self.connect('leave-notify-event', self.unselected)
self.connect('button-press-event', self.clicked)
self.add(self.hbox)
def clicked(self, widget, button):
def clicked(self, button):
_, index = button.get_button()
if index == 1:
proc = subprocess.run([PATH, 'load', self.name])
subprocess.run([PATH, 'load', self.name])
Gtk.main_quit()
return None
def selected(self, *args):
# self.hbox.override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(*self.selected))
return None
#def selected(self, *args):
# return None
def unselected(self, *args):
# self.hbox.override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(*self.selected))
return None
#def unselected(self, *args):
# return None
def load_configs():
broken = subprocess.check_output([PATH, 'check', GROUP])
broken = broken.decode('utf-8').split('\n')
output = []
path = '{}/.gorice/output.yaml'.format(os.environ['HOME'])
output = []
with open(path, 'r') as f:
data = yaml.load(f.read())
names = sorted(data['configs'])
for config in names:
info = data['configs'][config]
config, ext = os.path.splitext(config)
@ -111,18 +107,18 @@ def main():
configs = load_configs()
window = Gtk.Window()
window.modify_font(Pango.FontDescription('Ubuntu 11'))
window.modify_font(Pango.FontDescription('Ubuntu 10'))
window.set_property('type-hint', Gdk.WindowTypeHint.SPLASHSCREEN)
window.set_decorated(False)
window.set_resizable(False)
window.connect('leave-notify-event', Gtk.main_quit)
# window.set_property('skip-taskbar-hint', False)
# window.set_title('bar-dropdown')
# window.set_border_width(0)
# window.stick()
window.connect('delete-event', Gtk.main_quit)
#window.set_property('skip-taskbar-hint', False)
#window.set_title('bar-dropdown')
#window.set_border_width(0)
#window.stick()
scrolled = Gtk.ScrolledWindow()
scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)

View File

@ -7,20 +7,19 @@ question=$(echo " lock| logout| reboot| shutdown" | rofi -sep "|" \
-color-normal "#2b303b, #8fa1b3, #2b303b, #8fa1b3, #2b303b")
case $question in
*lock)
*lock)
i3lock-fancy
;;
*logout)
*logout)
session-logout
;;
*reboot)
*reboot)
systemctl reboot
;;
*shutdown)
*shutdown)
systemctl poweroff
;;
*)
: # do nothing on wrong response
*)
exit 0 # do nothing on wrong response
;;
esac

View File

@ -7,19 +7,19 @@ question=$(echo " lock| logout| reboot| shutdown" | rofi -sep "|" \
-color-normal "{{.Data.terminal_background}}, {{.Data.terminal_foreground}}, {{.Data.terminal_background}}, {{index .Data.terminal_colors 4}}, {{.Data.terminal_background}}")
case $question in
*lock)
*lock)
i3lock-fancy
;;
*logout)
*logout)
session-logout
;;
*reboot)
*reboot)
systemctl reboot
;;
*shutdown)
*shutdown)
systemctl poweroff
;;
*)
: # do nothing on wrong response
*)
exit 0 # do nothing on wrong response
;;
esac

View File

@ -1,36 +0,0 @@
#!/usr/bin/env bash
# check which wm were using, case insensitive
WMS=(bspwm i3 openbox)
for i in ${WMS[@]}; do
if [[ "$(wmctrl -m | grep -i name | awk '{print tolower($2)}')" == "$i" ]]; then
WM=$i && break
elif [[ "$(xprop -root -notype | grep "WM_NAME =" | tr -d '"' | awk '{print tolower($3)}')" == "$i" ]]; then
WM=$i && break
elif [[ "$(awk '{print tolower($0)}' <<< $XDG_CURRENT_DESKTOP)" == "$i" ]]; then
WM=$i && break
fi
done
# do the logout
case $WM in
i3)
i3-msg exit
;;
bspwm)
for window_id in $(bspc query -W); do
bspc window $window_id -c
done
killall sxhkd
bspc quit
;;
openbox)
openbox --exit
;;
*)
echo "WM not yet supported.. Exiting"
exit 0
;;
esac

View File

@ -1,5 +1,8 @@
#!/usr/bin/env bash
# this script will run polybar at boot
# and allow toggling via polybar or other means
# if it is not running and not enabled, enable it then start
if [ -e "$HOME/.config/.composite_enabled" ] && [ "$(pidof compton)" ]; then
al-compositor --restart
elif [ -e "$HOME/.config/.composite_enabled" ]; then
@ -10,5 +13,5 @@ else
al-compositor --start
else
al-compositor --restart
fi
fi
fi

View File

@ -1,16 +1,23 @@
#!/usr/bin/env bash
# Polybar launcher script written by Nathaniel Maia for use in ArchLabs
# Will launch bars depending on WM
# Will launch bars depending on WM
# Can also be used to reload openbox session with [--reload] or [-r]
# I reccomend using al-polyzen to set up a session for each wm
# then ditching this method and adding the following line to your autostart
# sleep 1; al-polybar-session &
# Enter your bar names here (seperated by spaces) eg. BARS=(bar bar1 my-bar)
# This will be combined with CUR_WM in WMS below eg. openbox-bar, bspwm-bar1, i3-my-bar etc.
# by default it is set up in WM-BAR naming format
# Enter your bar names here (seperated by spaces) eg. BARS=(bar1 bar2...)
# This will be combined with window manager from WMS below eg. openbox-bar1, openbox-bar2...
# by default it is set up in WM-BAR naming format eg. i3-bar, openbox-bar, bspwm-bar....
BARS=(bar)
CONFIG=$HOME/.config/polybar/config
WMS=(bspwm i3 openbox)
WMS=(bspwm i3 openbox xfce awesome)
############################################################################################
HELP="\nUSAGE:\n\tstart-polybar [OPTIONS]
\nOPTIONS:\n\t--reload, -r\tIf running in openbox, will reload the session
@ -25,7 +32,7 @@ for i in ${WMS[@]}; do
WM=$i && break
elif [[ "$(awk '{print tolower($0)}' <<< $XDG_CURRENT_DESKTOP)" == "$i" ]]; then
WM=$i && break
fi
fi
done
# check if passed options
@ -41,17 +48,11 @@ case "$@" in
;;
esac
# bail if tint2 is running
if [ "$(pidof tint2)" ]; then exit 0; fi
# kill running bars
while [ "$(pidof polybar)" ]; do
pkill polybar && sleep 0.5
done
# launch bars
for bar in "${BARS[@]}"; do
polybar -r --config=$CONFIG ${WM}-$bar &
@ -62,4 +63,3 @@ if [ "$(pidof polybar)" ]; then
else
echo "Bars Failed to Launch"
fi

View File

@ -1,5 +1,6 @@
#!/usr/bin/env bash
# will stop any running polybar instances
while [ "$(pidof polybar)" ]; do
pkill polybar && sleep 0.5
echo "Bars stopped..."

View File

@ -1,18 +1,21 @@
#!/usr/bin/env bash
on=""
off=""
# if the script is passed --toggle
if [[ $1 == *toggle* ]] && pgrep caffeine >/dev/null; then
if [[ $1 == *toggle* ]] && pgrep caffeine &>/dev/null; then
killall caffeine && exit 0
elif [[ $1 == *toggle* ]]; then
caffeine &>/dev/null && exit 0
caffeine && exit 0
fi
while true; do
# caffeine is running
if pgrep caffeine >/dev/null; then
echo "%{F#0000FF}"
if pgrep caffeine &>/dev/null; then
echo "%{F#0000FF}$on"
else
echo "%{F#FF0000}"
echo "%{F#FF0000}$off"
fi
sleep 2
done

View File

@ -3,18 +3,17 @@
on=""
off=""
if [[ $1 == *toggle* ]] && [ "$(pidof compton)" ]; then
if [[ $1 == *toggle* ]] && [[ $(pidof compton) ]]; then
al-compositor --stop && exit 0
elif [[ $1 == *toggle* ]]; then
al-compositor --start && exit 0
fi
while true; do
if [ "$(pidof compton)" ]; then
if [[ $(pidof compton) ]]; then
echo "$on"
else
echo "%{F#888888}$off"
fi
sleep 2
done

View File

@ -1,8 +1,9 @@
#!/usr/bin/env bash
if [ "$(pidof polybar)" ]; then
# small script to kill polybar if it is running
# if it isnt running then start it the default session
if [[ $(pidof polybar) ]]; then
pkill polybar
else
start-polybar
al-polybar-session
fi

View File

@ -1,16 +1,17 @@
#!/usr/bin/env bash
if [[ $1 = "--toggle" ]] || [[ $1 = "-t" ]]; then
if pgrep redshift >/dev/null; then
pkill redshift
else
redshift-gtk &
fi
exit 0
fi
icon=""
if [[ $1 = "--toggle" ]] || [[ $1 = "-t" ]]; then
if pgrep redshift >/dev/null; then
pkill redshift
else
redshift-gtk &
fi
exit 0
fi
while true; do
pgrep -x redshift &> /dev/null
if [[ $? -eq 0 ]]; then
@ -29,4 +30,3 @@ while true; do
fi
sleep 2
done

View File

@ -1,6 +1,11 @@
#!/usr/bin/env bash
if pgrep --full 'termite --title=work-term' >/dev/null; then
# will check if precisely this termite instance is running
# if it is, then kill it, otherwise launch a new termite with these settings
# This allows a "Toggle-able" terminal, by simply binding a key to
# "toggle-termite"
if pgrep --full 'termite --title=work-term' &>/dev/null; then
pkill --full 'termite --title=work-term'
else
termite --title=work-term --class=work-term &