Update and clean up user scripts

This commit is contained in:
natemaia
2017-12-01 23:06:11 -08:00
parent dcf56fc86a
commit 5be5c23629
17 changed files with 62 additions and 122 deletions

View File

@ -1,24 +1,13 @@
#!/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
# 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
CONFIG=$HOME/.config/polybar/config
CUR_WM=$(xprop -root | grep "_NET_WM_NAME(UTF8_STRING)" | cut -d " " -f 3 | sed 's/"//g' | awk '{print tolower($0)}')
if [[ $1 == "--reload" ]] || [[ $1 == "-r" ]]; then
if [[ $CUR_WM == "Openbox" ]]; then
if [[ $CUR_WM == "openbox" ]]; then
openbox --restart
al-compositor --restart
al-tint2restart
@ -27,21 +16,18 @@ if [[ $1 == "--reload" ]] || [[ $1 == "-r" ]]; then
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 &
polybar -r --config=$CONFIG ${CUR_WM}-$bar &
done
echo "Bars launched..."