From 564505447e19354e596f303ab562fedca576589d Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Sun, 3 Sep 2023 00:13:21 -0600 Subject: who knows lmao --- x/.xinitrc | 45 +++++++++++++------------- x/.xinitrc-docked | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++ x/.xinitrc-not-docked | 87 --------------------------------------------------- x/battery | 48 ++++++++++++++++++++++++++++ x/battery.pl | 48 ---------------------------- x/startdwm | 16 ++++++++++ x/startdwm.sh | 16 ---------- 7 files changed, 173 insertions(+), 173 deletions(-) create mode 100644 x/.xinitrc-docked delete mode 100644 x/.xinitrc-not-docked create mode 100755 x/battery delete mode 100755 x/battery.pl create mode 100755 x/startdwm delete mode 100755 x/startdwm.sh (limited to 'x') diff --git a/x/.xinitrc b/x/.xinitrc index dd30be4..8f20975 100644 --- a/x/.xinitrc +++ b/x/.xinitrc @@ -1,7 +1,7 @@ #!/bin/sh -# executed by startx -# for use when dingo is DOCKED -export DOCKED=true +# executed by startx-not-docked +# for use when dingo is NOT docked +export DOCKED=false # load xinitrc.d stuff @@ -40,21 +40,23 @@ fi # start notifications (dunst) /usr/bin/dunst & -# open picom compositor +# start picom compositor picom --config ~/.config/picom.conf & #spotifyd & -# set up monitors -sh ~/.config/screenlayout.sh & +# add network, battery, date and time to xsetroot +slstatus & -# set default audio device to be dock audio jack -pulseaudio -k & -pacmd set-default-sink alsa_output.usb-0c76_USB_PnP_Audio_Device-00.analog-stereo & +# reset backlight +light -S 30 & -# add weather, date and time to xsetroot -#sh ~/bin/xsetloop-docked.sh & -slstatus & +# set default audio device to be laptop speakers +# pacmd set-default-sink alsa_output.pci-0000_03_00.6.HiFi__hw_Generic_1__sink & +# pacmd set-sink-volume alsa_output.pci-0000_03_00.6.HiFi__hw_Generic_1__sink 0 & + +# set up wallpaper +feh --bg-fill ~/git/wallpapers-exorcist/gruvbox/mountains-2.jpg # apply Xresources xrdb -merge ~/.Xresources @@ -62,18 +64,17 @@ xrdb -merge ~/.Xresources # make cursor disappear after typing xbanish & -# enable numlock -numlockx & +# turn tearfree on +xrandr --output eDP --auto --set TearFree on --output HDMI-A-0 --set TearFree on & + +# run battery checker +~/bin/battery & # start keepassxc for passwords keepassxc ~/.passwords/Passwords.kdbx & -# set up wallpapers -#wallpapers.sh & -feh --bg-fill git/wallpapers-exorcist/gruvbox/mountains-2.jpg git/wallpapers-exorcist/gruvbox/mountains-2.jpg & - -# if unicomp keyboard detected, turn alt into super -if $(lsusb | grep -qi "Unicomp"); then +# if logitech keyboard detected, turn alt into super +if $(lsusb | grep -qi "Logitech Mechanical Keyboard"); then xmodmap -e "remove mod1 = Alt_L" xmodmap -e "remove mod4 = Super_L" xmodmap -e "add mod1 = Super_L" @@ -82,5 +83,5 @@ fi # start dwm redshift & -xset r rate 300 50 -exec /home/bryson/bin/startdwm.sh +xset r rate 300 80 +exec /home/bryson/bin/startdwm diff --git a/x/.xinitrc-docked b/x/.xinitrc-docked new file mode 100644 index 0000000..dd30be4 --- /dev/null +++ b/x/.xinitrc-docked @@ -0,0 +1,86 @@ +#!/bin/sh +# executed by startx +# for use when dingo is DOCKED +export DOCKED=true + +# load xinitrc.d stuff + +userresources=$HOME/.Xresources +usermodmap=$HOME/.Xmodmap +sysresources=/etc/X11/xinit/.Xresources +sysmodmap=/etc/X11/xinit/.Xmodmap + +# merge in defaults and keymaps + +if [ -f $sysresources ]; then + xrdb -merge $sysresources +fi + +if [ -f $sysmodmap ]; then + xmodmap $sysmodmap +fi + +if [ -f "$userresources" ]; then + xrdb -merge "$userresources" +fi + +if [ -f "$usermodmap" ]; then + xmodmap "$usermodmap" +fi + +# start some nice programs + +if [ -d /etc/X11/xinit/xinitrc.d ] ; then + for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do + [ -x "$f" ] && . "$f" + done + unset f +fi + +# start notifications (dunst) +/usr/bin/dunst & + +# open picom compositor +picom --config ~/.config/picom.conf & + +#spotifyd & + +# set up monitors +sh ~/.config/screenlayout.sh & + +# set default audio device to be dock audio jack +pulseaudio -k & +pacmd set-default-sink alsa_output.usb-0c76_USB_PnP_Audio_Device-00.analog-stereo & + +# add weather, date and time to xsetroot +#sh ~/bin/xsetloop-docked.sh & +slstatus & + +# apply Xresources +xrdb -merge ~/.Xresources + +# make cursor disappear after typing +xbanish & + +# enable numlock +numlockx & + +# start keepassxc for passwords +keepassxc ~/.passwords/Passwords.kdbx & + +# set up wallpapers +#wallpapers.sh & +feh --bg-fill git/wallpapers-exorcist/gruvbox/mountains-2.jpg git/wallpapers-exorcist/gruvbox/mountains-2.jpg & + +# if unicomp keyboard detected, turn alt into super +if $(lsusb | grep -qi "Unicomp"); then + xmodmap -e "remove mod1 = Alt_L" + xmodmap -e "remove mod4 = Super_L" + xmodmap -e "add mod1 = Super_L" + xmodmap -e "add mod4 = Alt_L" +fi + +# start dwm +redshift & +xset r rate 300 50 +exec /home/bryson/bin/startdwm.sh diff --git a/x/.xinitrc-not-docked b/x/.xinitrc-not-docked deleted file mode 100644 index b102bb6..0000000 --- a/x/.xinitrc-not-docked +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh -# executed by startx-not-docked -# for use when dingo is NOT docked -export DOCKED=false - -# load xinitrc.d stuff - -userresources=$HOME/.Xresources -usermodmap=$HOME/.Xmodmap -sysresources=/etc/X11/xinit/.Xresources -sysmodmap=/etc/X11/xinit/.Xmodmap - -# merge in defaults and keymaps - -if [ -f $sysresources ]; then - xrdb -merge $sysresources -fi - -if [ -f $sysmodmap ]; then - xmodmap $sysmodmap -fi - -if [ -f "$userresources" ]; then - xrdb -merge "$userresources" -fi - -if [ -f "$usermodmap" ]; then - xmodmap "$usermodmap" -fi - -# start some nice programs - -if [ -d /etc/X11/xinit/xinitrc.d ] ; then - for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do - [ -x "$f" ] && . "$f" - done - unset f -fi - -# start notifications (dunst) -/usr/bin/dunst & - -# start picom compositor -picom --config ~/.config/picom.conf & - -#spotifyd & - -# add network, battery, date and time to xsetroot -slstatus-not-docked & - -# reset backlight -light -S 50 & - -# set default audio device to be laptop speakers -pacmd set-default-sink alsa_output.pci-0000_03_00.6.HiFi__hw_Generic_1__sink & -pacmd set-sink-volume alsa_output.pci-0000_03_00.6.HiFi__hw_Generic_1__sink 0 & - -# set up wallpaper -feh --bg-fill ~/git/wallpapers-exorcist/gruvbox/mountains-2.jpg - -# apply Xresources -xrdb -merge ~/.Xresources - -# make cursor disappear after typing -xbanish & - -# turn tearfree on -xrandr --output eDP --auto --set TearFree on --output HDMI-A-0 --set TearFree on & - -# run battery checker -~/bin/battery.pl & - -# start keepassxc for passwords -keepassxc ~/.passwords/Passwords.kdbx & - -# if logitech keyboard detected, turn alt into super -if $(lsusb | grep -qi "Logitech Mechanical Keyboard"); then - xmodmap -e "remove mod1 = Alt_L" - xmodmap -e "remove mod4 = Super_L" - xmodmap -e "add mod1 = Super_L" - xmodmap -e "add mod4 = Alt_L" -fi - -# start dwm -redshift & -xset r rate 300 80 -exec /home/bryson/bin/startdwm.sh diff --git a/x/battery b/x/battery new file mode 100755 index 0000000..10a3673 --- /dev/null +++ b/x/battery @@ -0,0 +1,48 @@ +#!/usr/bin/env perl +$| = 1; + +my $CRITICAL = undef; +my $LOW = undef; +my $CHARGING = undef; +my $DEAD_LEVEL = 2; +my $CRITICAL_LEVEL = 5; +my $LOW_LEVEL = 10; + +while (1) { + my @acpi = split " ", `acpi | grep "Discharging" | grep -v "rate information"`; + my $battery_level = $acpi[3]; + my $status = $acpi[2]; + my $sent = undef; + $battery_level =~ s/%,//g; + $status =~ s/,//g; + + if ($status =~ "Discharging") { + $CHARGING = undef; + if (!$CRITICAL) { + if (int($battery_level) <= int($CRITICAL_LEVEL)) { + $CRITICAL = 'def'; + $sent = 'def'; + system "notify-send -i \"battery-empty-symbolic\" -t 0 -u critical \"BATTERY CRITICAL\" \"Battery level is ${battery_level}%\n\nCharge the system NOW.\"" + } + } if (!$LOW && !$sent) { + if (int($battery_level) <= int($LOW_LEVEL)) { + $LOW = 'def'; + $sent = 'def'; + system "notify-send -i \"battery-caution-symbolic\" -t 0 -u normal \"BATTERY LOW\" \"Battery level is ${battery_level}%\n\nCharge the system soon.\"" + } + } if (int($battery_level) <= int($DEAD_LEVEL)) { + system "notify-send -t 0 -u critical \"SHUTTING DOWN\" \"Battery level is too low. The system will shutdown in 2 minutes to prevent corruption.\n\nCharge the system NOW to cancel the shutdown.\""; + system "doas shutdown -Ph 2 &"; + } + } else { + if (!$CHARGING) { + $CHARGING = 'def'; + $CRITICAL = undef; + $LOW = undef; + system "doas shutdown -c"; + system "notify-send -t 3000 -i \"battery-good-charging-symbolic\" \"System is now charging\""; + } + } + + sleep 30; +} diff --git a/x/battery.pl b/x/battery.pl deleted file mode 100755 index b98707a..0000000 --- a/x/battery.pl +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env perl -$| = 1; - -my $CRITICAL = undef; -my $LOW = undef; -my $CHARGING = undef; -my $DEAD_LEVEL = 2; -my $CRITICAL_LEVEL = 5; -my $LOW_LEVEL = 10; - -while (1) { - my @acpi = split " ", `acpi | grep "Discharging" | grep -v "rate information"`; - my $battery_level = $acpi[3]; - my $status = $acpi[2]; - my $sent = undef; - $battery_level =~ s/%,//g; - $status =~ s/,//g; - - if ($status =~ "Discharging") { - $CHARGING = undef; - if (!$CRITICAL) { - if (int($battery_level) <= int($CRITICAL_LEVEL)) { - $CRITICAL = 'def'; - $sent = 'def'; - system "notify-send -i \"battery-empty\" -t 0 -u critical \"BATTERY CRITICAL\" \"Battery level is ${battery_level}%\n\nCharge the system NOW.\"" - } - } if (!$LOW && !$sent) { - if (int($battery_level) <= int($LOW_LEVEL)) { - $LOW = 'def'; - $sent = 'def'; - system "notify-send -i \"battery-caution\" -t 0 -u normal \"BATTERY LOW\" \"Battery level is ${battery_level}%\n\nCharge the system soon.\"" - } - } if (int($battery_level) <= int($DEAD_LEVEL)) { - system "notify-send -t 0 -u critical \"SHUTTING DOWN\" \"Battery level is too low. The system will shutdown in 2 minutes to prevent corruption.\n\nCharge the system NOW to cancel the shutdown.\""; - system "doas shutdown -Ph 2 &"; - } - } else { - if (!$CHARGING) { - $CHARGING = 'def'; - $CRITICAL = undef; - $LOW = undef; - system "doas shutdown -c"; - system "notify-send -t 3000 -i \"battery-good-charging\" \"System is now charging\""; - } - } - - sleep 30; -} diff --git a/x/startdwm b/x/startdwm new file mode 100755 index 0000000..496d79b --- /dev/null +++ b/x/startdwm @@ -0,0 +1,16 @@ +# stolen from https://wiki.archlinux.org/title/Dwm#Restart_dwm and therefore may be under the GNU Free Documentation License v1.3. +# relaunch DWM if the binary changes, otherwise bail +csum="" +new_csum=$(sha1sum $(which dwm)) +while true +do + if [ "$csum" != "$new_csum" ] + then + csum=$new_csum + dbus-launch dwm + else + exit 0 + fi + new_csum=$(sha1sum $(which dwm)) + sleep 0.5 +done diff --git a/x/startdwm.sh b/x/startdwm.sh deleted file mode 100755 index 496d79b..0000000 --- a/x/startdwm.sh +++ /dev/null @@ -1,16 +0,0 @@ -# stolen from https://wiki.archlinux.org/title/Dwm#Restart_dwm and therefore may be under the GNU Free Documentation License v1.3. -# relaunch DWM if the binary changes, otherwise bail -csum="" -new_csum=$(sha1sum $(which dwm)) -while true -do - if [ "$csum" != "$new_csum" ] - then - csum=$new_csum - dbus-launch dwm - else - exit 0 - fi - new_csum=$(sha1sum $(which dwm)) - sleep 0.5 -done -- cgit v1.2.3