Large update to upgrade script, remove unneccessary configs, add additional and fixups

This commit is contained in:
natemaia
2017-12-07 20:20:42 -08:00
parent 9a63b6f701
commit d4c9ea73af
38 changed files with 505 additions and 617 deletions

View File

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

View File

@ -3,20 +3,20 @@
TRASH_DIRECTORY="${BLOCK_INSTANCE}"
if [[ "${TRASH_DIRECTORY}" = "" ]]; then
TRASH_DIRECTORY="${XDG_DATA_HOME:-${HOME}/.local/share}/Trash"
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
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"
# 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)
@ -28,5 +28,5 @@ echo "${TRASH_COUNT}"
echo ""
if [[ "${TRASH_COUNT}" -ge "${URGENT_VALUE}" ]]; then
exit 31
exit 31
fi

View File

@ -1,3 +1,8 @@
#!/bin/bash
#!/usr/bin/env bash
rofi -no-config -modi run,drun,window -show drun -eh 1 -line-padding 4 -show-icons -drun-icon-theme "ArchLabs-Light" -padding 50 -sidebar-mode -font "Ubuntu 11" -color-enabled -color-window "#2b303b, #8fa1b3, #2b303b" -color-normal "#2b303b, #8fa1b3, #2b303b, #8fa1b3, #2b303b"
rofi -no-config -modi run,drun,window -show drun \
-eh 1 -line-padding 4 -padding 50 -sidebar-mode \
-show-icons -drun-icon-theme "ArchLabs-Light" \
-font "Ubuntu 11" -color-enabled \
-color-window "#2b303b, #8fa1b3, #2b303b" \
-color-normal "#2b303b, #8fa1b3, #2b303b, #8fa1b3, #2b303b"

View File

@ -1,3 +1,8 @@
#!/bin/bash
#!/usr/bin/env bash
rofi -no-config -modi run,drun,window -show drun -eh 1 -line-padding 4 -show-icons -drun-icon-theme "ArchLabs-Light" -padding 50 -sidebar-mode -font "Ubuntu 11" -color-enabled -color-window "{{.Data.terminal_background}}, {{index .Data.terminal_colors 4}}, {{.Data.terminal_background}}" -color-normal "{{.Data.terminal_background}}, {{index .Data.terminal_colors 4}}, {{.Data.terminal_background}}, {{index .Data.terminal_colors 4}}, {{.Data.terminal_background}}"
rofi -no-config -modi run,drun,window -show drun \
-eh 1 -line-padding 4 -padding 50 -sidebar-mode \
-show-icons -drun-icon-theme "ArchLabs-Light" \
-font "Ubuntu 11" -color-enabled \
-color-window "{{.Data.terminal_background}}, {{index .Data.terminal_colors 4}}, {{.Data.terminal_background}}" \
-color-normal "{{.Data.terminal_background}}, {{index .Data.terminal_colors 4}}, {{.Data.terminal_background}}, {{index .Data.terminal_colors 4}}, {{.Data.terminal_background}}"

View File

@ -1,32 +1,26 @@
#!/usr/bin/env bash
if [[ "$(xprop -root | grep -i "openbox")" > /dev/null ]]; then
CUR_WM="openbox"
else
CUR_WM=$(xprop -root | grep "_NET_WM_NAME(UTF8_STRING)" | cut -d " " -f 3 | sed 's/"//g' | awk '{print tolower($0)}')
fi
question=$(echo " lock| logout| reboot| shutdown" | rofi -sep "|" \
-dmenu -i -p 'System: ' "" -width 20 -hide-scrollbar -font "Ubuntu 11" \
-eh 1 -line-padding 4 -padding 20 -no-config -lines 4 -color-enabled \
-color-window "#2b303b, #8fa1b3, #2b303b" \
-color-normal "#2b303b, #8fa1b3, #2b303b, #8fa1b3, #2b303b")
ANS=$(echo " lock| logout| reboot| shutdown" | rofi -sep "|" -dmenu -i -p 'System: ' "" -width 20 -hide-scrollbar -font "Ubuntu 11" -eh 1 -line-padding 4 -padding 20 -no-config -lines 4 -color-enabled -color-window "#1F2326, #F1F1F1, #1F2326" -color-normal "#1F2326, #F1F1F1, #1F2326, #4E88CF, #1F2326")
case $question in
*lock)
i3lock-fancy
;;
*logout)
session-logout
;;
*reboot)
systemctl reboot
;;
*shutdown)
systemctl poweroff
;;
*)
: # do nothing on wrong response
;;
esac
if [[ "$ANS" == *lock ]]; then
i3lock-fancy
elif [[ "$ANS" == *logout ]]; then
if [[ "$CUR_WM" == "i3" ]]; then
i3-msg exit
elif [[ "$CUR_WM" == "bspwm" ]]; then
for window_id in $(bspc query -W); do
bspc window $window_id -c
done
killall sxhkd
bspc quit
elif [[ "$CUR_WM" == "openbox" ]]; then
openbox --exit
else
echo "Unknown WM... Exiting"
exit 1
fi
elif [[ "$ANS" == *reboot ]]; then
systemctl reboot
elif [[ "$ANS" == *shutdown ]]; then
systemctl poweroff
fi

View File

@ -1,32 +1,25 @@
#!/usr/bin/env bash
if [[ "$(xprop -root | grep -i "openbox")" > /dev/null ]]; then
CUR_WM="openbox"
else
CUR_WM=$(xprop -root | grep "_NET_WM_NAME(UTF8_STRING)" | cut -d " " -f 3 | sed 's/"//g' | awk '{print tolower($0)}')
fi
question=$(echo " lock| logout| reboot| shutdown" | rofi -sep "|" \
-dmenu -i -p 'System: ' "" -width 20 -hide-scrollbar -font "Ubuntu 11" \
-eh 1 -line-padding 4 -padding 20 -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}}")
ANS=$(echo " lock| logout| reboot| shutdown" | rofi -sep "|" -dmenu -i -p 'System: ' "" -width 20 -hide-scrollbar -font "Ubuntu 11" -eh 1 -line-padding 4 -padding 20 -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
if [[ "$CUR_WM" == "i3" ]]; then
i3-msg exit
elif [[ "$CUR_WM" == "bspwm" ]]; then
for window_id in $(bspc query -W); do
bspc window $window_id -c
done
killall sxhkd
bspc quit
elif [[ "$CUR_WM" == "openbox" ]]; then
openbox --exit
else
echo "Unknown WM... Exiting"
exit 1
fi
elif [[ "$ANS" == *reboot ]]; then
systemctl reboot
elif [[ "$ANS" == *shutdown ]]; then
systemctl poweroff
fi
case $question in
*lock)
i3lock-fancy
;;
*logout)
session-logout
;;
*reboot)
systemctl reboot
;;
*shutdown)
systemctl poweroff
;;
*)
: # do nothing on wrong response
;;
esac

36
home/bin/session-logout Executable file
View File

@ -0,0 +1,36 @@
#!/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,44 +1,53 @@
#!/usr/bin/env bash
#
# Polybar launcher script written by Nathaniel Maia for use in ArchLabs
# Will launch bars depending on WM
# 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
# 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
BARS=(bar)
CONFIG=$HOME/.config/polybar/config
WMS=(bspwm i3 openbox)
HELP="\nUSAGE:\n\tstart-polybar [OPTIONS]
\nOPTIONS:\n\t--reload, -r\tIf running in openbox, will reload the session
\t--help, -h\tPrint this usage message and exit
\n\tWith no options the script will stop and reload polybar"
if [[ "$(xprop -root | grep -i "openbox")" > /dev/null ]]; then
CUR_WM="openbox"
else
CUR_WM=$(xprop -root | grep "_NET_WM_NAME(UTF8_STRING)" | cut -d " " -f 3 | sed 's/"//g' | awk '{print tolower($0)}')
fi
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
# Reload openbox session
if [[ $1 == "--reload" ]] && [[ $CUR_WM == "openbox" ]]; then
openbox --restart
al-compositor --restart
al-tint2restart
elif [[ $1 == "--reload" ]]; then
echo "[WARN]: Option [--reload] is meant for Openbox..."
fi
case "$@" in
*help|-h)
echo -e $HELP && exit 0
;;
*reload|-r)
if [[ "$CUR_WM" == "openbox" ]]; then
openbox --restart
al-compositor --restart && al-tint2restart
fi
;;
*)
:
;;
esac
# Drop out if tint2 is running
if pgrep tint2 >/dev/null; then
echo "Tint is running... Exiting"
exit 0
echo "Tint is running... Exiting" && exit 0
else
# Terminate already running Bars
while pgrep polybar >/dev/null; do
pkill polybar
sleep 0.5
pkill 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=$CONFIG ${CUR_WM}-$bar &

View File

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

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash
# 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
elif [[ $1 == *toggle* ]]; then
caffeine &>/dev/null && exit 0
fi

View File

@ -9,8 +9,12 @@ elif [[ $1 == *toggle* ]]; then
al-compositor --start && exit 0
fi
if pgrep compton >/dev/null; then
echo "$on"
else
echo "%{F#888888}$off"
fi
while true; do
if pgrep compton >/dev/null; then
echo "$on"
else
echo "%{F#888888}$off"
fi
sleep 2
done

View File

@ -4,25 +4,29 @@ if [[ $1 = "--toggle" ]] || [[ $1 = "-t" ]]; then
if pgrep redshift >/dev/null; then
pkill redshift
else
redshift &
redshift-gtk &
fi
exit 0
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
while true; do
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
sleep 2
done