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 --- alacritty/alacritty.yml | 6 ++-- bash/.bash/01-aliases.bash | 2 +- bash/.bash/02-prompt.bash | 17 +++++---- bash/.bash/03-boot.bash | 43 +++++++---------------- bash/.bash_profile | 1 + htop/htoprc | 16 +++++---- tmux/tmux.conf | 2 +- update.sh | 4 +-- vim/colors/gruvbox | 2 +- vscode/settings.json | 16 ++++++--- 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 --------- 17 files changed, 226 insertions(+), 229 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 diff --git a/alacritty/alacritty.yml b/alacritty/alacritty.yml index df55e76..552b034 100644 --- a/alacritty/alacritty.yml +++ b/alacritty/alacritty.yml @@ -28,7 +28,7 @@ font: # family: Scientifica style: Bold Italic - size: 11 + size: 13.5 offset: x: 0 @@ -36,7 +36,7 @@ font: window: padding: - x: 7 + x: 10 y: 7 opacity: 0.70 @@ -100,7 +100,7 @@ mouse: # Gruvbox dark colors: primary: - background: '#282828' + background: '#202020' # background: '#3c3836' # background: '#32302f' # background: '#000000' diff --git a/bash/.bash/01-aliases.bash b/bash/.bash/01-aliases.bash index 511503c..3786b8f 100644 --- a/bash/.bash/01-aliases.bash +++ b/bash/.bash/01-aliases.bash @@ -61,7 +61,7 @@ alias keys='xset r rate 300 50' alias gits='git status' alias mac="rm -rf __MACOSX/; rm \$(find . -name '.DS_Store')" alias super='xmodmap -e "remove mod1 = Alt_L"; xmodmap -e "remove mod4 = Super_L"; xmodmap -e "add mod1 = Super_L"; xmodmap -e "add mod4 = Alt_L"' -alias make-kernel='sudo genkernel --kernel-config=/proc/config.gz all && sudo grub-mkconfig -o /boot/grub/grub.cfg' +alias make-kernel='sudo genkernel --luks --lvm --install --kernel-config=/proc/config.gz --microcode=intel all && sudo grub-mkconfig -o /boot/grub/grub.cfg' # bash navigation alias aa='vim ~/.bash/01-aliases.bash; . ~/.bash_profile' diff --git a/bash/.bash/02-prompt.bash b/bash/.bash/02-prompt.bash index 8181d33..035f216 100644 --- a/bash/.bash/02-prompt.bash +++ b/bash/.bash/02-prompt.bash @@ -48,8 +48,10 @@ color4='\e[38;5;226m' function exit_code() { local ERROR="$?" if [[ ERROR -ne 0 ]]; then - echo -n '\['"$RED"'\]'"$ERROR"'\['"$dgray"'\]!' + echo -n ''"$dgray"'\]/\['"$RED"'\]'"$ERROR"'\['"$dgray"'\]\\' # echo -n '\['"$RED"'\]'"$ERROR"' ' + else + echo -n ''"$dgray"'\]/\['"$LCYAN"'\]'"$ERROR"'\['"$dgray"'\]\\' fi } @@ -77,7 +79,7 @@ function _git_prompt() { fi if ! [[ "$branch" =~ local ]]; then # echo -n '\['"$color"'\] ('"$ansi"''"$branch"') ' - echo -n '\['"$dgray"'\]#\['"$color"'\]'"$branch"''"$ansi"'' + echo -n '\['"$dgray"'\](\['"$color"'\]'"$branch"''"$ansi"'\['"$dgray"'\])' fi fi } @@ -116,15 +118,18 @@ export -f _git_prompt # export _PS1="\[$lgray\][ \[$LMAGENTA\]\h\[$lgray\] ] \[$LYELLOW\]\d, \[$LRED\]\T" # export _PS2="\[$lgray\]{ \[$CYAN\]\w\[$lgray\] }" -# bryson@dingo:/current/path:master +# bryson@hostname:/current/path:master # $ -# -export _PS1="\[$LBLUE\]\u\[$dgray\]@\[$LGREEN\]\h\[$dgray\]:\[$LYELLOW\]\w" +# export _PS1="\[$LBLUE\]\u\[$dgray\]@\[$LGREEN\]\h\[$dgray\]:\[$LYELLOW\]\w" + +# hostname[/current/path]{12:00:00}[255](master) +# $ +export _PS1="\[$LGREEN\]\h\[$dgray\][\[$LYELLOW\]\w\[$dgray\]]<\[$LBLUE\]\u\[$dgray\]>{\[$LMAGENTA\]\@\[$dgray\]}" # define x titlebar TITLEBAR='\[\033]0;\u@\h:\w ($(history 1 | cut -c 8-))\]' # apply prompt and functions # export PROMPT_COMMAND='export PS1="$TITLEBAR$(exit_code)${_PS1}\n${_PS2}$(_git_prompt)\n\[$NC\]\$ ";history -a' -export PROMPT_COMMAND='export PS1="$TITLEBAR$(exit_code)${_PS1}$(_git_prompt)\n\[$NC\]\$ ";history -a' +export PROMPT_COMMAND='export PS1="$TITLEBAR${_PS1}$(exit_code)$(_git_prompt)\n\[$NC\]\$ ";history -a' diff --git a/bash/.bash/03-boot.bash b/bash/.bash/03-boot.bash index 333aaed..952dd83 100644 --- a/bash/.bash/03-boot.bash +++ b/bash/.bash/03-boot.bash @@ -3,49 +3,30 @@ # 03-boot.bash # startup scripts for systems -bat_check() { - TEST=$(acpi | grep "Discharging" | grep -v "rate information") - - if [[ $? -eq 0 ]]; then - echo "***********************************************************" - echo " WARNING" - echo "***********************************************************" - echo "Power supply is not plugged in." - echo "Make sure it is plugged in to avoid a random shutdown." - read -rs -N 1 -p "Press [Enter] to continue, any other key to return..." input; - if grep -q "$input" <<< ""; then - echo "" - else - return 1 - fi - fi -} - # run startup script if tty # for dingo -if [[ $TERM == 'linux' && $(hostname) == 'dingo' ]]; then +if [[ $TERM == 'linux' && $(hostname) == 'landseer' ]]; then cat ~/bin/house.txt printf "\n${CYAN}Welcome back Bryson :)\n\n" - printf "${LGREEN}What should dingo do?\n${magenta}" - echo -e '\td: start docked\n\tn: start not docked\n\tq: shutdown\n\tr: reboot\n\tl: logout\n\tb: bash\n\n' + printf "${LGREEN}What should landseer do?\n${magenta}" + echo -e "\tn: start x\n\tq: shutdown\n\tr: reboot\n\tl: logout\n\tb: bash\n\n" while read -rs -N 1 key; do printf "${NC}" case $key in - d) bat_check && startx ;; - n) nstartx.sh ;; - q) echo "Are you sure you want to shutdown? (y/n)"; - read -rs -N 1 key2; case $key2 in y) doas shutdown -Ph now ;; esac; ;; - r) echo "Are you sure you want to reboot? (y/n)"; - read -rs -N 1 key3; case $key3 in y) doas reboot ;; esac; ;; - l) logout ;; - b) break ;; + n) startx ;; + q) echo "Are you sure you want to shutdown? (y/n)"; + read -rs -N 1 key2; case $key2 in y) doas shutdown -Ph now ;; esac; ;; + r) echo "Are you sure you want to reboot? (y/n)"; + read -rs -N 1 key3; case $key3 in y) doas reboot ;; esac; ;; + l) logout ;; + b) break ;; [h?]) echo "$USAGE";; esac clear cat ~/bin/house.txt - printf "\n${LGREEN}What should dingo do now?\n${magenta}" - echo -e '\td: start docked\n\tn: start not docked\n\tq: shutdown\n\tr: reboot\n\tl: logout\n\tb: bash\n\n' + printf "\n${LGREEN}What should landseer do?\n${magenta}" + echo -e "\tn: start x\n\tq: shutdown\n\tr: reboot\n\tl: logout\n\tb: bash\n\n" done fi diff --git a/bash/.bash_profile b/bash/.bash_profile index c93170e..dba61c3 100644 --- a/bash/.bash_profile +++ b/bash/.bash_profile @@ -12,6 +12,7 @@ fi export EDITOR=/usr/bin/vim export TERMINAL=/usr/bin/alacritty export BROWSER=/usr/bin/librewolf-bin +export XZ_OPT='-9 -T0 -M 32000000000' export PATH complete -cf doas diff --git a/htop/htoprc b/htop/htoprc index 1f03b22..eb3f12b 100644 --- a/htop/htoprc +++ b/htop/htoprc @@ -1,15 +1,17 @@ # Beware! This file is rewritten by htop when settings are changed in the interface. # The parser is also very primitive, and not human-friendly. -htop_version=3.2.1 +htop_version=3.2.2 config_reader_min_version=3 fields=0 48 17 18 38 39 40 2 46 47 49 1 hide_kernel_threads=1 hide_userland_threads=0 +hide_running_in_container=0 shadow_other_users=0 show_thread_names=0 show_program_path=1 highlight_base_name=1 highlight_deleted_exe=1 +shadow_distribution_path_prefix=0 highlight_megabytes=1 highlight_threads=1 highlight_changes=0 @@ -19,7 +21,7 @@ strip_exe_from_cmdline=1 show_merged_command=0 header_margin=1 screen_tabs=1 -detailed_cpu_time=1 +detailed_cpu_time=0 cpu_count_from_one=0 show_cpu_usage=1 show_cpu_frequency=1 @@ -32,10 +34,10 @@ enable_mouse=1 delay=7 hide_function_bar=0 header_layout=two_50_50 -column_meters_0=LeftCPUs Memory Swap -column_meter_modes_0=1 1 1 -column_meters_1=RightCPUs Tasks LoadAverage Uptime -column_meter_modes_1=1 2 2 2 +column_meters_0=AllCPUs2 +column_meter_modes_0=1 +column_meters_1=CPU Memory Swap Hostname System DateTime Tasks LoadAverage Uptime +column_meter_modes_1=1 1 1 2 2 2 2 2 2 tree_view=0 sort_key=46 tree_sort_key=0 @@ -51,7 +53,7 @@ screen:Main=PID USER PRIORITY NICE M_VIRT M_RESIDENT M_SHARE STATE PERCENT_CPU P .sort_direction=-1 .tree_sort_direction=1 .all_branches_collapsed=0 -screen:I/O=PID USER COMM IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE +screen:I/O=PID USER IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE Command .sort_key=IO_RATE .tree_sort_key=PID .tree_view=0 diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 1b0d4fe..3ad9c80 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -1,4 +1,4 @@ -set -g prefix M-Space +set -g prefix C-a set -g visual-activity on set -g status-style fg=white,bg=black set-window-option -g window-status-bell-style fg=white,bg=red,bold diff --git a/update.sh b/update.sh index 8a19b61..42e119c 100755 --- a/update.sh +++ b/update.sh @@ -13,8 +13,8 @@ cp -r ~/.vim/after ./vim cp ~/.xinitrc* ./x cp ~/.Xresources ./x cp ~/.Xmodmap ./x -cp ~/bin/battery.pl ./x -cp ~/bin/startdwm.sh ./x +cp ~/bin/battery ./x +cp ~/bin/startdwm ./x cp ~/.config/VSCodium/User/settings.json ./vscode # other config files diff --git a/vim/colors/gruvbox b/vim/colors/gruvbox index bf2885a..f1ecde8 160000 --- a/vim/colors/gruvbox +++ b/vim/colors/gruvbox @@ -1 +1 @@ -Subproject commit bf2885a95efdad7bd5e4794dd0213917770d79b7 +Subproject commit f1ecde848f0cdba877acb0c740320568252cc482 diff --git a/vscode/settings.json b/vscode/settings.json index 78fc3e4..d56cfdb 100644 --- a/vscode/settings.json +++ b/vscode/settings.json @@ -11,9 +11,13 @@ }, "editor.fontFamily": "'JetBrains Mono'", "java.configuration.runtimes": [ + // { + // "name": "JavaSE-1.8", + // "path": "/usr/local/java/jdk-8", + // }, { - "name": "JavaSE-1.8", - "path": "/usr/local/java/jdk-8", + "name": "JavaSE-17", + "path": "/usr/lib/jvm/openjdk-bin-17", "default": true } ], @@ -25,7 +29,7 @@ "extensions.autoCheckUpdates": false, "extensions.autoUpdate": "onlyEnabledExtensions", "typescript.disableAutomaticTypeAcquisition": true, - "workbench.colorTheme": "Gruvbox Dark Medium", + "workbench.colorTheme": "Gruvbox Dark Hard", "editor.cursorBlinking": "solid", "editor.tabSize": 2, "keyboard.dispatch": "keyCode", @@ -40,6 +44,7 @@ "vim.hlsearch": true, "workbench.startupEditor": "none", "workbench.sideBar.location": "right", + "window.restoreWindows": "none", "vim.normalModeKeyBindingsNonRecursive": [ { "before": ["", "h"], @@ -65,5 +70,8 @@ "workbench.action.navigateRight" ] } - ] + ], + "debug.onTaskErrors": "showErrors", + "explorer.confirmDelete": false, + "window.zoomLevel": 1 } \ No newline at end of file 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