From 92ada44d97606ed67c45298200471348032c2978 Mon Sep 17 00:00:00 2001 From: natemaia Date: Tue, 26 Dec 2017 15:03:54 -0800 Subject: [PATCH] Minor improvments to init & ~/bin scripts, remove numlock from autostarts --- home/.config/i3/config | 10 ++++++++-- home/.config/keypack | 2 +- home/.config/openbox/autostart | 4 ++-- home/.xprofile | 13 +++++++++---- home/bin/start-compton | 2 +- home/bin/toggle-caffeine | 14 +++++++++----- home/bin/toggle-compton | 13 ++++++++----- home/bin/toggle-polybar | 2 +- 8 files changed, 39 insertions(+), 21 deletions(-) diff --git a/home/.config/i3/config b/home/.config/i3/config index 3d7b4de9..09843903 100644 --- a/home/.config/i3/config +++ b/home/.config/i3/config @@ -77,10 +77,16 @@ set $Mon2 HDMI2 # run with reload exec_always --no-startup-id start-compton exec_always --no-startup-id al-polybar-session -exec_always --no-startup-id numlockx on exec_always --no-startup-id nitrogen --restore exec_always --no-startup-id xrdb -load ~/.Xresources -exec_always --no-startup-id pkill trayer; trayer --edge bottom --align left --heighttype pixel --height 18 --widthtype request --SetDockType false --expand true --transparent true --alpha 255 + +# Trayer +exec_always --no-startup-id pkill trayer; trayer --edge bottom \ + --align left --heighttype pixel --height 18 --widthtype request \ + --SetDockType false --expand true --transparent true --alpha 255 + +# If you have a numpad you may want to enable this +# exec_always --no-startup-id numlockx on # run once exec --no-startup-id xfsettingsd diff --git a/home/.config/keypack b/home/.config/keypack index c2ecfabf..a9eb49b1 100755 --- a/home/.config/keypack +++ b/home/.config/keypack @@ -20,7 +20,7 @@ do_setup() { sudo pacman-key --populate archlabs } -while ! [[ $(ping -c1 8.8.8.8) ]]; do +while ! [[ "$(ping -c1 8.8.8.8)" ]]; do sleep 1 done diff --git a/home/.config/openbox/autostart b/home/.config/openbox/autostart index 0377fe48..a3d2156d 100755 --- a/home/.config/openbox/autostart +++ b/home/.config/openbox/autostart @@ -2,8 +2,8 @@ al-compositor --start & #$HOME/.config/setup & -# enable numlock, comment out if you dont have a numpad -numlockx on & +# enable numlock, commented out for laptop users +#numlockx on & # restore wallpaper nitrogen --restore & diff --git a/home/.xprofile b/home/.xprofile index 52b7b071..140da36e 100755 --- a/home/.xprofile +++ b/home/.xprofile @@ -6,16 +6,21 @@ XDG_CONFIG_HOME=$HOME/.config export XDG_CONFIG_HOME # include ~/bin in path -export PATH=$HOME/bin:$PATH +if [ -d "$HOME/bin" ]; then + PATH=$HOME/bin:$PATH +fi # include sbin in PATH -if [ -d "/sbin" ] ; then +if [ -d "/sbin" ]; then PATH="/sbin:$PATH" fi -if [ -d "/usr/sbin" ] ; then + +# include sbin in PATH +if [ -d "/usr/sbin" ]; then PATH="/usr/sbin:$PATH" fi +# launch dbus if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS"; then - eval `dbus-launch --sh-syntax --exit-with-session` + eval $(dbus-launch --sh-syntax --exit-with-session) fi diff --git a/home/bin/start-compton b/home/bin/start-compton index 43ae92a2..13236121 100755 --- a/home/bin/start-compton +++ b/home/bin/start-compton @@ -1,7 +1,7 @@ #!/usr/bin/env bash -if [ "$(pidof compton)" ]; then +if [[ "$(pidof compton)" ]]; then al-compositor --restart else al-compositor --start diff --git a/home/bin/toggle-caffeine b/home/bin/toggle-caffeine index d267ca4a..fb559d28 100755 --- a/home/bin/toggle-caffeine +++ b/home/bin/toggle-caffeine @@ -4,15 +4,19 @@ on="" off="" # if the script is passed --toggle -if [[ $1 == *toggle* ]] && pgrep caffeine &>/dev/null; then - killall caffeine && exit 0 -elif [[ $1 == *toggle* ]]; then - caffeine && exit 0 +if [[ "$1" ]]; then + if [[ "$1" == *toggle* ]] && [[ "$(pidof caffeine)" ]]; then + killall caffeine + elif [[ "$1" == *toggle* ]]; then + caffeine & + fi + exit 0 fi + while true; do # caffeine is running - if pgrep caffeine &>/dev/null; then + if [[ "$(pidof caffeine)" ]]; then echo "%{F#0000FF}$on" else echo "%{F#FF0000}$off" diff --git a/home/bin/toggle-compton b/home/bin/toggle-compton index 0ac26e4f..ed0c91af 100755 --- a/home/bin/toggle-compton +++ b/home/bin/toggle-compton @@ -3,14 +3,17 @@ on="" off="" -if [[ $1 == *toggle* ]] && [[ $(pidof compton) ]]; then - al-compositor --stop && exit 0 -elif [[ $1 == *toggle* ]]; then - al-compositor --start && exit 0 +if [[ "$1" ]]; then + if [[ "$1" == *toggle* ]] && [[ "$(pidof compton)" ]]; then + al-compositor --stop + elif [[ "$1" == *toggle* ]]; then + al-compositor --start + fi + exit 0 fi while true; do - if [[ $(pidof compton) ]]; then + if [[ "$(pidof compton)" ]]; then echo "$on" else echo "%{F#888888}$off" diff --git a/home/bin/toggle-polybar b/home/bin/toggle-polybar index 37a9b9c2..08451f66 100755 --- a/home/bin/toggle-polybar +++ b/home/bin/toggle-polybar @@ -2,7 +2,7 @@ # small script to kill polybar if it is running # if it isnt running then start it the default session -if [[ $(pidof polybar) ]]; then +if [[ "$(pidof polybar)" ]]; then pkill polybar else al-polybar-session