From c32ed90899dd1047bc8bab171a60d7de6f4af34f Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Sun, 11 Dec 2022 01:03:47 -0700 Subject: update stuff, add relevant x scripts --- bash/.bash/01-aliases.bash | 6 ++++- bash/.bash/03-boot.bash | 2 +- dunst/dunstrc | 8 +++---- dwm | 2 +- htop/htoprc | 12 +++++----- vim/.vimrc | 58 ++++++++++++++++++++++++++++++++-------------- x/.xinitrc | 2 +- x/.xinitrc-not-docked | 1 + x/battery.pl | 48 ++++++++++++++++++++++++++++++++++++++ x/startdwm.sh | 16 +++++++++++++ 10 files changed, 124 insertions(+), 31 deletions(-) create mode 100755 x/battery.pl create mode 100755 x/startdwm.sh diff --git a/bash/.bash/01-aliases.bash b/bash/.bash/01-aliases.bash index cae8190..94734e2 100644 --- a/bash/.bash/01-aliases.bash +++ b/bash/.bash/01-aliases.bash @@ -21,6 +21,8 @@ alias la='ls -a' alias ll='ls -lh' alias cp='cp -iv' alias mv='mv -iv' +alias rm='rm -vI' +alias diff='diff --color=auto' alias g++='g++ --std=c++20' alias vim='vim -p' alias gs='gs -dNOSAFER' @@ -51,8 +53,10 @@ alias ed='fzf --height=15 --layout=reverse | sed "s/^/\"/g;s/$/\"/g" | xargs -ro alias dj='python manage.py' alias smci='sudo make clean install' alias smi='sudo make install' -alias lib='xrandr --output HDMI-A-0 --auto --output eDP --off && xset r rate 300 50' +alias lib='xrandr --output HDMI-A-0 --auto --output eDP --off && xset r rate 300 50 && feh --bg-fill ~/git/wallpapers-exorcist/gruvbox/volcano-landscape.jpg' alias nolib='xrandr --output HDMI-A-0 --off --output eDP --auto' +alias keys='xset r rate 300 50' +alias gits='git status' # bash navigation alias aa='vim ~/.bash/01-aliases.bash; . ~/.bash_profile' diff --git a/bash/.bash/03-boot.bash b/bash/.bash/03-boot.bash index c821a28..333aaed 100644 --- a/bash/.bash/03-boot.bash +++ b/bash/.bash/03-boot.bash @@ -4,7 +4,7 @@ # startup scripts for systems bat_check() { - TEST=$(acpi | grep "Dis") + TEST=$(acpi | grep "Discharging" | grep -v "rate information") if [[ $? -eq 0 ]]; then echo "***********************************************************" diff --git a/dunst/dunstrc b/dunst/dunstrc index 7956a71..013420d 100644 --- a/dunst/dunstrc +++ b/dunst/dunstrc @@ -1,4 +1,4 @@ -# See dunst(5) for all configuration options +#See dunst(5) for all configuration options [global] ### Display ### @@ -258,7 +258,7 @@ # Uncomment this if you want to let notications appear under fullscreen # applications (default: overlay) - # layer = top + #layer = top # Set this to true to use X11 output on Wayland. force_xwayland = false @@ -398,8 +398,8 @@ # If the notification is already drawn, it won't get undrawn. # pushback: same as delay, but when switching into fullscreen, the notification will get # withdrawn from screen again and will get delayed like a new notification -#[fullscreen_delay_everything] -# fullscreen = delay +[fullscreen_delay_everything] + fullscreen = show #[fullscreen_show_critical] # msg_urgency = critical # fullscreen = show diff --git a/dwm b/dwm index c5738de..5416672 160000 --- a/dwm +++ b/dwm @@ -1 +1 @@ -Subproject commit c5738de01d3c8adccaf87842cd6efceafd795d98 +Subproject commit 54166726a7a266184041b04f3d9ad02ca0938b8a diff --git a/htop/htoprc b/htop/htoprc index 1ed5711..1f03b22 100644 --- a/htop/htoprc +++ b/htop/htoprc @@ -8,7 +8,7 @@ hide_userland_threads=0 shadow_other_users=0 show_thread_names=0 show_program_path=1 -highlight_base_name=0 +highlight_base_name=1 highlight_deleted_exe=1 highlight_megabytes=1 highlight_threads=1 @@ -19,17 +19,17 @@ strip_exe_from_cmdline=1 show_merged_command=0 header_margin=1 screen_tabs=1 -detailed_cpu_time=0 +detailed_cpu_time=1 cpu_count_from_one=0 show_cpu_usage=1 -show_cpu_frequency=0 -show_cpu_temperature=0 +show_cpu_frequency=1 +show_cpu_temperature=1 degree_fahrenheit=0 update_process_names=0 account_guest_in_cpu_meter=0 color_scheme=0 enable_mouse=1 -delay=15 +delay=7 hide_function_bar=0 header_layout=two_50_50 column_meters_0=LeftCPUs Memory Swap @@ -51,7 +51,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 IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE +screen:I/O=PID USER COMM IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE .sort_key=IO_RATE .tree_sort_key=PID .tree_view=0 diff --git a/vim/.vimrc b/vim/.vimrc index 1a88791..4ecd421 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -22,6 +22,7 @@ call plug#end() set nocompatible set ttymouse=sgr set number +set relativenumber set bg:dark set mouse=a set tabstop=2 softtabstop=2 shiftwidth=2 expandtab @@ -64,6 +65,9 @@ nnoremap q :q nnoremap ! :q! nnoremap x :wq nnoremap b :e# +nnoremap e :e +nnoremap u :tabp +nnoremap o :tabn nnoremap h :wincmd h nnoremap j :wincmd j nnoremap k :wincmd k @@ -71,7 +75,7 @@ nnoremap l :wincmd l nnoremap n :NERDTreeFocus nnoremap t :NERDTreeToggle nnoremap p :wincmd p -nnoremap v :set paste! number! +nnoremap v :set paste! number! relativenumber! nnoremap i :CocCommand clangd.switchSourceHeader " nerdtree stuff @@ -109,20 +113,40 @@ function! s:check_back_space() abort endfunction " lightline config -let g:lightline = { - \ 'colorscheme': 'gruvbox', - \ 'active': { - \ 'left': [ [ 'mode', 'paste' ], - \ [ 'filename', 'readonly', 'modified' ], - \ [ 'gitbranch'] ], - \ 'right': [ [ 'lineinfo' ], - \ [ 'fileformat', 'filetype' ], - \ [ 'percent' ] ] - \ }, - \ 'component_function': { - \ 'gitbranch': 'gitbranch#name' - \ }, - \ } -let g:lightline.component = { - \ 'close': ' %n | X ', } +if expand('$UID') == 0 + let g:lightline = { + \ 'colorscheme': 'molokai', + \ 'active': { + \ 'left': [ [ 'root', 'mode', 'paste' ], + \ [ 'filename', 'readonly', 'modified' ], + \ [ 'gitbranch'] ], + \ 'right': [ [ 'lineinfo' ], + \ [ 'fileformat', 'filetype' ], + \ [ 'percent' ] ] + \ }, + \ 'component_function': { + \ 'gitbranch': 'gitbranch#name' + \ }, + \ } + let g:lightline.component = { + \ 'close': ' %n | X ', + \ 'root': '!!root!!', } +else + let g:lightline = { + \ 'colorscheme': 'gruvbox', + \ 'active': { + \ 'left': [ [ 'mode', 'paste' ], + \ [ 'filename', 'readonly', 'modified' ], + \ [ 'gitbranch'] ], + \ 'right': [ [ 'lineinfo' ], + \ [ 'fileformat', 'filetype' ], + \ [ 'percent' ] ] + \ }, + \ 'component_function': { + \ 'gitbranch': 'gitbranch#name' + \ }, + \ } + let g:lightline.component = { + \ 'close': ' %n | X ', } +endif diff --git a/x/.xinitrc b/x/.xinitrc index efd3270..dee608b 100644 --- a/x/.xinitrc +++ b/x/.xinitrc @@ -46,7 +46,7 @@ fi #spotifyd & # set up monitors -sh ~/.screenlayout/screenlayout.sh & +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 & diff --git a/x/.xinitrc-not-docked b/x/.xinitrc-not-docked index 51aa3ae..b18ab1c 100644 --- a/x/.xinitrc-not-docked +++ b/x/.xinitrc-not-docked @@ -1,3 +1,4 @@ +#!/bin/sh # executed by startx-not-docked # for use when dingo is NOT docked export DOCKED=false diff --git a/x/battery.pl b/x/battery.pl new file mode 100755 index 0000000..b98707a --- /dev/null +++ b/x/battery.pl @@ -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\" -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.sh b/x/startdwm.sh new file mode 100755 index 0000000..4625951 --- /dev/null +++ b/x/startdwm.sh @@ -0,0 +1,16 @@ +# stolen from https://wiki.archlinux.org/title/Dwm#Restart_dwm +# 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