Update and clean up user scripts
This commit is contained in:
parent
dcf56fc86a
commit
5be5c23629
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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..."
|
||||
|
@ -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..."
|
||||
|
@ -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"
|
||||
|
@ -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}}"
|
||||
|
@ -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
|
||||
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
|
||||
|
@ -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
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
if [[ $1 = "--toggle" ]] || [[ $1 = "-t" ]]; then
|
||||
if pgrep redshift > /dev/null 2>&1; then
|
||||
killall redshift
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user