diff --git a/home/.xinitrc b/home/.xinitrc index 642994d9..1647c9cc 100755 --- a/home/.xinitrc +++ b/home/.xinitrc @@ -8,7 +8,6 @@ XDG_CONFIG_HOME="$HOME/.config" export XDG_CONFIG_HOME - if [ -d /etc/X11/xinit/xinitrc.d ]; then for f in /etc/X11/xinit/xinitrc.d/*; do [ -x "$f" ] && . "$f" @@ -16,7 +15,6 @@ if [ -d /etc/X11/xinit/xinitrc.d ]; then unset f fi - if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS"; then eval `dbus-launch --sh-syntax --exit-with-session` fi diff --git a/home/.xprofile b/home/.xprofile index a97db697..c3fbd6a7 100644 --- a/home/.xprofile +++ b/home/.xprofile @@ -1,7 +1,8 @@ # .xprofile -XDG_CONFIG_HOME="$HOME/.config" +XDG_CONFIG_HOME=$HOME/.config export XDG_CONFIG_HOME +export PATH=$HOME/bin:$PATH # include sbin in PATH if [ -d "/sbin" ] ; then @@ -12,11 +13,6 @@ if [ -d "/usr/sbin" ] ; then PATH="/usr/sbin:$PATH" fi -# set PATH so it includes user's private bin if it exists -if [ -d "$HOME/bin" ] ; then - PATH="$HOME/bin:$PATH" -fi - if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS"; then eval `dbus-launch --sh-syntax --exit-with-session` fi diff --git a/home/bin/check-network b/home/bin/check-network index 62bef4ee..58638b64 100755 --- a/home/bin/check-network +++ b/home/bin/check-network @@ -2,18 +2,11 @@ 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 diff --git a/home/bin/check-updates b/home/bin/check-updates index 782523c0..36126ae6 100755 --- a/home/bin/check-updates +++ b/home/bin/check-updates @@ -1,56 +1,36 @@ #!/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 diff --git a/home/bin/config_ui b/home/bin/config_ui index 2e4b9bd8..5da5b83c 100755 --- a/home/bin/config_ui +++ b/home/bin/config_ui @@ -2,10 +2,10 @@ import os -import gi -import yaml import struct import subprocess +import yaml +import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk, Pango @@ -58,11 +58,11 @@ class Selection(Gtk.EventBox): return None def selected(self, *args): - self.hbox.override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(*self.selected_colour)) + # self.hbox.override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(*self.selected)) return None def unselected(self, *args): - self.hbox.override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(*self.background)) + # self.hbox.override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(*self.selected)) return None @@ -110,15 +110,17 @@ def keypress(window, key): def main(): configs = load_configs() window = Gtk.Window() - window.modify_font( Pango.FontDescription('Ubuntu 10') ) - window.connect('leave-notify-event', Gtk.main_quit) + + window.modify_font(Pango.FontDescription('xos4 Terminus 9')) window.set_property('type-hint', Gdk.WindowTypeHint.SPLASHSCREEN) - window.set_property('skip-taskbar-hint', True) window.set_decorated(False) - window.set_title('bar-dropdown') - window.set_border_width(0) window.set_resizable(False) - window.stick() + + 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) @@ -130,11 +132,10 @@ def main(): box.pack_start(config, False, False, 0) scrolled.add(box) - window.add(scrolled) - window.set_size_request(200, 300) + window.set_size_request(200, 420) window.show_all() - window.move(10, 27) + window.move(10, 35) window.connect('key-press-event', keypress) window.set_events(Gdk.EventMask.BUTTON_PRESS_MASK) diff --git a/home/bin/killbar b/home/bin/killbar index 094e11de..c17dbc7d 100755 --- a/home/bin/killbar +++ b/home/bin/killbar @@ -1,7 +1,7 @@ #!/usr/bin/env bash killall -q polybar - -while pgrep -u $UID -x polybar >/dev/null; do sleep 0.5; done - +while pgrep -u $UID -x polybar >/dev/null; do + sleep 0.5 +done echo "Bars stopped..." diff --git a/home/bin/launch-polybar b/home/bin/launch-polybar index 6abde9c7..26c99897 100755 --- a/home/bin/launch-polybar +++ b/home/bin/launch-polybar @@ -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..." diff --git a/home/bin/rofi-gorice b/home/bin/rofi-gorice index 1fa6626f..6f1a38b0 100755 --- a/home/bin/rofi-gorice +++ b/home/bin/rofi-gorice @@ -1,2 +1,2 @@ #!/bin/bash -rofi -no-config -modi run,drun,window -show drun -eh 1 -width 50 -padding 30 -color-enabled -color-window "#2b303b, #8fa1b3, #2b303b" -color-normal "#2b303b, #8fa1b3, #2b303b, #8fa1b3, #2b303b" -sidebar-mode -font "Ubuntu Light 11" +rofi -no-config -modi run,drun,window -show drun -eh 1 -width 50 -padding 30 -sidebar-mode -font "Ubuntu Light 11" -color-enabled -color-window "#2b303b, #8fa1b3, #2b303b" -color-normal "#2b303b, #8fa1b3, #2b303b, #8fa1b3, #2b303b" diff --git a/home/bin/rofi-gorice.template b/home/bin/rofi-gorice.template index ea3e0b24..804a1640 100644 --- a/home/bin/rofi-gorice.template +++ b/home/bin/rofi-gorice.template @@ -1,2 +1,2 @@ #!/bin/bash -rofi -no-config -modi run,drun,window -show drun -eh 1 -width 50 -padding 30 -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}}" -sidebar-mode -font "Ubuntu Light 11" +rofi -no-config -modi run,drun,window -show drun -eh 1 -width 50 -padding 30 -sidebar-mode -font "Ubuntu Light 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}}" diff --git a/home/bin/rofi-logout b/home/bin/rofi-logout index 8cf76094..b21a92e2 100755 --- a/home/bin/rofi-logout +++ b/home/bin/rofi-logout @@ -1,11 +1,26 @@ #!/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") +CUR_WM=$(xprop -root | grep "_NET_WM_NAME(UTF8_STRING)" | cut -d " " -f 3 | sed 's/"//g' | awk '{print tolower($0)}') + +ANS=$(echo " lock| logout| reboot| shutdown" | rofi -sep "|" -dmenu -i -p 'System: ' "" -width 20 -hide-scrollbar -location 0 -yoffset -200 -font "Ubuntu 11" -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 + 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" == "bspwm" ]]; then + openbox --exit + else + echo "Unknown WM... Exiting" + exit 1 + fi elif [[ "$ANS" == *reboot ]]; then systemctl reboot elif [[ "$ANS" == *shutdown ]]; then diff --git a/home/bin/rofi-logout.template b/home/bin/rofi-logout.template index 34294169..ce62c979 100644 --- a/home/bin/rofi-logout.template +++ b/home/bin/rofi-logout.template @@ -1,11 +1,26 @@ #!/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}}") +CUR_WM=$(xprop -root | grep "_NET_WM_NAME(UTF8_STRING)" | cut -d " " -f 3 | sed 's/"//g' | awk '{print tolower($0)}') + +ANS=$(echo " lock| logout| reboot| shutdown" | rofi -sep "|" -dmenu -i -p 'System: ' "" -width 20 -hide-scrollbar -location 0 -yoffset -200 -font "Ubuntu 11" -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 + 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" == "bspwm" ]]; then + openbox --exit + else + echo "Unknown WM... Exiting" + exit 1 + fi elif [[ "$ANS" == *reboot ]]; then systemctl reboot elif [[ "$ANS" == *shutdown ]]; then diff --git a/home/bin/start-compton b/home/bin/start-compton index 98b439e1..c26eacce 100755 --- a/home/bin/start-compton +++ b/home/bin/start-compton @@ -2,14 +2,10 @@ start="al-compositor --start" restart="al-compositor --restart" - - if [ -e "${HOME}/.config/.composite_enabled" ]; then - if pgrep compton; then $restart else $start fi - fi diff --git a/home/bin/toggle-caffeine b/home/bin/toggle-caffeine index 85daf878..1203f7e9 100755 --- a/home/bin/toggle-caffeine +++ b/home/bin/toggle-caffeine @@ -1,44 +1,21 @@ #!/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 - + else 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 + else echo "%{F#FF0000}" - fi - - - # sleep interval... Change the responsiveness sleep 2 - done diff --git a/home/bin/toggle-compton b/home/bin/toggle-compton index 37a67a00..f4690ebb 100755 --- a/home/bin/toggle-compton +++ b/home/bin/toggle-compton @@ -6,21 +6,14 @@ 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 diff --git a/home/bin/toggle-polybar b/home/bin/toggle-polybar index fd5b702b..1b2c7c6d 100755 --- a/home/bin/toggle-polybar +++ b/home/bin/toggle-polybar @@ -1,11 +1,8 @@ #!/usr/bin/env bash - if pgrep -x polybar >/dev/null; then pkill polybar - else launch-polybar >/dev/null 2>&1 - fi diff --git a/home/bin/toggle-redshift b/home/bin/toggle-redshift index 85d0ca3f..44ebd7ad 100755 --- a/home/bin/toggle-redshift +++ b/home/bin/toggle-redshift @@ -1,6 +1,5 @@ #!/usr/bin/env bash - if [[ $1 = "--toggle" ]] || [[ $1 = "-t" ]]; then if pgrep redshift > /dev/null 2>&1; then killall redshift diff --git a/home/bin/toggle-termite b/home/bin/toggle-termite index 91936964..de3dda5a 100755 --- a/home/bin/toggle-termite +++ b/home/bin/toggle-termite @@ -1,14 +1,8 @@ #!/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