diff options
-rw-r--r-- | .bashrc | 13 | ||||
-rw-r--r-- | .config/alacritty/alacritty.yml | 43 | ||||
-rw-r--r-- | .repos/dwm/config.h | 8 | ||||
-rwxr-xr-x | .scripts/checkapts | 13 | ||||
-rwxr-xr-x | .scripts/inputset | 4 | ||||
-rwxr-xr-x | .scripts/oath | 6 | ||||
-rwxr-xr-x | .scripts/pi | 7 | ||||
-rwxr-xr-x | .scripts/pomo | 122 | ||||
-rwxr-xr-x | .scripts/softpanic | 3 | ||||
-rwxr-xr-x | .scripts/stats | 29 | ||||
-rwxr-xr-x | .scripts/takeover | 4 | ||||
-rwxr-xr-x | .scripts/term | 3 | ||||
-rwxr-xr-x | .scripts/timer | 57 | ||||
-rwxr-xr-x | .scripts/whatamidoing | 8 | ||||
-rw-r--r-- | .vimrc | 9 | ||||
-rw-r--r-- | .xinitrc | 12 | ||||
-rw-r--r-- | README.md | 6 |
17 files changed, 187 insertions, 160 deletions
@@ -6,7 +6,8 @@ export TERMINAL=$TERM export PAGER=less export BROWSER=firefox export SSH_ASKPASS=ssh-askpass -export PS1='\[\e]0;\us terminal\a\][\W] ' +#export PS1='\[\e]0;\us terminal\a\][\W] ' +export PS1='$(alacritty msg config window.title="$PWD")[\W] ' export LC_CTYPE="en_US.UTF-8" @@ -20,7 +21,7 @@ export CLICOLOR=1 export UNCRUSTIFY_CONFIG=$HOME/.uncrustify.cfg -export ASAN_OPTIONS=verify_asan_link_order=0 +#export ASAN_OPTIONS=verify_asan_link_order=0 umask 027 @@ -48,6 +49,8 @@ alias gch='git checkout' disasm() { objdump -drwC -Mintel "$1" | less; } disasmc() { objdump -drwC -Mintel --visualize-jumps=color "$1" | less -r; } +vg() { valgrind --trace-children=yes --track-fds=yes --log-fd=2 --error-limit=no --leak-check=full --show-possibly-lost=yes --track-origins=yes --show-reachable=yes "$@"; } + set -o noclobber # no > misuse; >| instead #set -o nounset set -o notify @@ -86,3 +89,9 @@ e() { stty susp undef bind -x '"\C-z":"fg"' + +[ -f "/home/melvin/.ghcup/env" ] && source "/home/melvin/.ghcup/env" # ghcup-env + +#[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh +#eval "$(atuin init bash)" +[ -f /opt/miniconda3/etc/profile.d/conda.sh ] && source /opt/miniconda3/etc/profile.d/conda.sh diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml new file mode 100644 index 0000000..4698add --- /dev/null +++ b/.config/alacritty/alacritty.yml @@ -0,0 +1,43 @@ +env: + TERM: xterm-256color + +window: + opacity: 1 + dynamic_title: false + +colors: + primary: + background: '0x000000' + foreground: '0xcccccc' + + # Normal colors + normal: + black: '0x000000' + red: '0xc50f1f' + green: '0x13a10e' + yellow: '0xc19c00' + blue: '0x0037da' + magenta: '0x881798' + cyan: '0x3a96dd' + white: '0xcccccc' + + # Bright colors + bright: + black: '0x767676' + red: '0xe74856' + green: '0x16c60c' + yellow: '0xf9f1a5' + blue: '0x3b78ff' + magenta: '0xb4009e' + cyan: '0x61d6d6' + white: '0xf2f2f2' + +font: + size: 19.0 + normal: + family: Iosevka Term Nerd Font Complete Mono + +key_bindings: + #- { key: N, mods: Control, action: CreateNewWindow } + - { key: K, mods: Alt|Shift, action: IncreaseFontSize } + - { key: J, mods: Alt|Shift, action: DecreaseFontSize } diff --git a/.repos/dwm/config.h b/.repos/dwm/config.h index 4e5e0ab..26e3439 100644 --- a/.repos/dwm/config.h +++ b/.repos/dwm/config.h @@ -34,6 +34,7 @@ const char *spcmd8[] = {"term", "-t", "sptop", "-e", "htop", NULL }; const char *spcmd9[] = {"term", "-t", "spnode", "-e", "node", NULL }; const char *spcmd10[] = {"term", "-t", "spvim", "-e", "vim", NULL }; const char *spcmd11[] = {"term", "-t", "spcalc2", "-e", "octave-cli", "-q", NULL }; +const char *spcmd12[] = {"alacritty", "-t", "spkill", "-e", "bash", "-c", "bash -l -c '. ~/.bashrc; k'", NULL }; static Sp scratchpads[] = { /* name cmd */ {"spterm1", spcmd0}, @@ -48,6 +49,7 @@ static Sp scratchpads[] = { {"spnode", spcmd9}, {"spvim", spcmd10}, {"spcalc2", spcmd11}, + {"spkill", spcmd12}, }; /* tagging */ @@ -70,6 +72,7 @@ static const Rule rules[] = { { NULL, NULL, "spnode", SPTAG(9), 1, -1 }, { NULL, NULL, "spvim", SPTAG(10), 1, -1 }, { NULL, NULL, "spcalc2", SPTAG(11), 1, -1 }, + { NULL, NULL, "spkill", SPTAG(12), 1, -1 }, }; /* layout(s) */ @@ -145,6 +148,7 @@ static Key keys[] = { { MODKEY|ShiftMask, XK_apostrophe,togglescratch,{.ui = 9} }, { MODKEY, XK_v, togglescratch, {.ui = 10} }, { MODKEY, XK_o, togglescratch, {.ui = 11} }, + { MODKEY|ShiftMask, XK_k, togglescratch, {.ui = 12} }, TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) @@ -167,7 +171,7 @@ static Key keys[] = { { 0, XF86XK_WLAN, spawn, SHCMD("wifi off") }, //{ 0, XF86XK_WakeUp, spawn, SHCMD("scrot") }, { 0, XF86XK_Display, spawn, SHCMD("screen") }, - { 0, XF86XK_Favorites, spawn, SHCMD("slock") }, + { 0, XF86XK_Favorites, spawn, SHCMD("softpanic") }, { MODKEY, XF86XK_Favorites, spawn, SHCMD("panic") }, }; @@ -179,6 +183,8 @@ static Button buttons[] = { { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[1]} }, { ClkWinTitle, 0, Button2, zoom, {0} }, { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkStatusText, 0, Button4, spawn, SHCMD("timer inc") }, + { ClkStatusText, 0, Button5, spawn, SHCMD("timer dec") }, { ClkClientWin, MODKEY, Button1, movemouse, {0} }, { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, diff --git a/.scripts/checkapts b/.scripts/checkapts deleted file mode 100755 index 3319c23..0000000 --- a/.scripts/checkapts +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -flat=$(curl "https://tl1host.eu/SWTUE/ajax/privroom/search?languageId=1&s_Group=T%C3%BCbingen&s_Einzugsbereich=-1&s_ZimmerArt=3&s_Mietobergrenze=500&s_AnzahlZimmer=1" | jq length) -apt=$(curl "https://tl1host.eu/SWTUE/ajax/privroom/search?languageId=1&s_Group=T%C3%BCbingen&s_Einzugsbereich=-1&s_ZimmerArt=2&s_Mietobergrenze=500&s_AnzahlZimmer=1" | jq length) - -if [ $flat -ne 0 ] || [ $apt -ne 0 ]; then - export XAUTHORITY=/home/melvin/.Xauthority - export DISPLAY=:0 - export XDG_RUNTIME_DIR=/run/user/1000 - export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus - - notify-send -u critical "Interessante StuWe Wohnung!" "tl1host/#privateroom" -fi diff --git a/.scripts/inputset b/.scripts/inputset index 2354df3..eab50ca 100755 --- a/.scripts/inputset +++ b/.scripts/inputset @@ -2,11 +2,11 @@ setxkbmap -rules evdev -model evdev -layout us -variant altgr-intl -option "caps:swapescape" xmodmap -e "keysym Menu = Super_R" -xset r rate 300 50 +xset r rate 300 100 xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 0 xinput set-prop "pointer:Logitech MX Master 2S" "libinput High Resolution Wheel Scroll Enabled" 0 -xinput set-prop "TPPS/2 Elan TrackPoint" "libinput Accel Speed" 0.4 +xinput set-prop "TPPS/2 Elan TrackPoint" "libinput Accel Speed" 0.6 xinput set-prop "TPPS/2 Elan TrackPoint" "libinput Accel Profile Enabled" 1 0 #echo -n 1 | sudo tee /sys/devices/platform/i8042/serio1/serio2/press_to_select diff --git a/.scripts/oath b/.scripts/oath new file mode 100755 index 0000000..054c7d6 --- /dev/null +++ b/.scripts/oath @@ -0,0 +1,6 @@ +#!/bin/env bash + +sel=$(ykman oath accounts list | dmenu) +code=$(ykman oath accounts code "$sel" | awk '{print $NF}') +printf "%s" "$code" | clip +notify-send "$sel" "$code" & diff --git a/.scripts/pi b/.scripts/pi new file mode 100755 index 0000000..0085c70 --- /dev/null +++ b/.scripts/pi @@ -0,0 +1,7 @@ +#!/bin/bash + +PI="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989" + +read IN + +diff <(echo "${PI:0:$((${#IN} + 5))}" | sed 's/./\0\n/g') <(echo "$IN" | sed 's/./\0\n/g') diff --git a/.scripts/pomo b/.scripts/pomo deleted file mode 100755 index b10b49b..0000000 --- a/.scripts/pomo +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/bash - -### Send desktop notifications -## Params: header {String} - Notification highlighted text -## Params: body {String} - Notification complementary text -## Returns: {Void} -function notify() { - header=$1 - body=$2 - notify-send -u critical -t 0 -a pomo "${header:?}" "${body:?}" -} - -### Show a countdown timer and a message and updates without -### cleaning the whole screen -## Params: seconds {Number} - Countdown time in seconds -## Params: message {String} - Timer description -## Returns: {String} - "hh:mm:ss - $message" -function countdown(){ - secs=$1 - shift - message=$* - while [ $secs -gt -1 ] - do - sleep 1 & - printf "\r%s - %02d:%02d:%02d" "$message" $((secs/3600)) $(((secs/60)%60)) $((secs%60)) - secs=$(( $secs - 1 )) - wait - done - echo -} - -### Transforms minutes into seconds -## Params: minutes {Number} - Ammount of minutes to be transformed to seconds -## Returns: {Number} - Seconds -function minutes_to_seconds() { - minutes=$1 - echo $(($minutes * 60)) -} - -### Add minutes to current time -## Params: minutes {Number} - Ammounts of minutes to be added -## Returns: {Date} - Current date plus minutes -function current_time_plus_minutes() { - minutes=$1 - date -d "$minutes minutes" +'%H:%M' -} - -### Display a summary of the settings defined by the user -## Params: focus_minutes {Number} - Ammount of minutes to last a focus period -## Params: break_minutes {Number} - Ammount of minutes to last a break period -## Params: long_break_minutes {Number} - Ammount of minutes to last a long break period -## Params: breaks_until_long {Number} - Ammount of breaks until a long break period starts -## Returns: {String} - Formatted summary of the settings -function display_summary() { - focus_minutes=$1 - break_minutes=$2 - long_break_minutes=$3 - breaks_until_long=$4 - - echo "╔════════════════╦════════╗" - echo "║ FOCUS ║ $(printf "%03d\n" $focus_minutes) ║" - echo "║ BREAK ║ $(printf "%03d\n" $break_minutes) ║" - echo "║ LONG BREAK ║ $(printf "%03d\n" $long_break_minutes) ║" - echo "║ BREAKS TL LONG ║ $(printf "%03d\n" $breaks_until_long) ║" - echo "╚════════════════╩════════╝" -} - -### Display a help message -## Returns: {String} - Formatted help message with all available settings and options -function display_help() { - echo "Usage: `basename $0` [options] [focus] [break] [long_break] [breaks_until_long]" - echo " options -h: display help message" - echo " focus Minutes of focus until break | Default = 25" - echo " break Minutes of break until focus | Default = 5" - echo " long_break Minutes of long break until focus | Default = 15" - echo " breaks_until_long Number of breaks until long break | Default = 4" -} - -### Controls the application flow, parse arguments, show the countdown and notifications -## Params: focus_minutes {Number} - Ammount of minutes to last a focus period -## Params: break_minutes {Number} - Ammount of minutes to last a break period -## Params: long_break_minutes {Number} - Ammount of minutes to last a long break period -## Params: breaks_until_long {Number} - Ammount of breaks until a long break period starts -## Returns: {Void} -function main() { - focus_minutes=${1-25} # default = 25 - break_minutes=${2-5} # default = 5 - long_break_minutes=${3-15} # default = 15 - breaks_until_long=${4-4} # default = 4 - - focus_seconds=$(minutes_to_seconds $focus_minutes) - break_seconds=$(minutes_to_seconds $break_minutes) - long_break_seconds=$(minutes_to_seconds $long_break_minutes) - - - display_summary $focus_minutes $break_minutes $long_break_minutes $breaks_until_long - - - while true; do - for (( i=1; i<=$breaks_until_long; i++ )); do - countdown "$focus_seconds" "FOCUS TIME" - notify "BREAK: $break_minutes MINUTES" "Focus time at $(current_time_plus_minutes $break_minutes)" - - if [ $(($i)) -ne $breaks_until_long ]; then - countdown $break_seconds "BREAK TIME" - notify "FOCUS: $focus_minutes MINUTES" "Break time at $(current_time_plus_minutes $focus_minutes)" - else - notify "LONG BREAK: $long_break_minutes MINUTES" "Focus time at $(current_time_plus_minutes $long_break_minutes)" - fi - done - countdown $long_break_seconds "LONG BREAK TIME" - notify "FOCUS: $focus_minutes MINUTES" "Break time at $(current_time_plus_minutes $focus_minutes)" - done -} - -## Help message -if [ "$1" == "-h" ]; then - display_help - exit 0 -fi - -main $1 $2 $3 $4 diff --git a/.scripts/softpanic b/.scripts/softpanic index 7268d7c..4c7dbf0 100755 --- a/.scripts/softpanic +++ b/.scripts/softpanic @@ -1,5 +1,8 @@ #!/bin/sh +killall keepassxc +killall ssh + wifi off slock wifi on diff --git a/.scripts/stats b/.scripts/stats index 8e4012a..7a050b2 100755 --- a/.scripts/stats +++ b/.scripts/stats @@ -1,22 +1,29 @@ #!/bin/sh -net="$(hasnet && echo up || echo down)" -temp="$(awk '{print $2 "°C"}' /proc/acpi/ibm/thermal)" -battery="$(cat /sys/class/power_supply/BAT0/capacity)%" -charging="$(awk '{print $1*10^-6 "W"}' /sys/class/power_supply/BAT0/power_now)" time=$(date +'%d.%m | %H:%M') -weather=$(weather text) +what="$(whatamidoing)" +timer=$(timer get) +temp="$(awk '{print $2 "°C"}' /proc/acpi/ibm/thermal)" mem=$(free -m | awk '/^Mem:/{printf("%.1fGb\n",$3/1000)}') swap=$(free -m | awk '/^Swap:/{printf("%.1fGb\n",$3/1000)}') -cpu=$(awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else printf "%.1f%", (($2+$4-u1) * 100 / (t-t1)); }' <(grep 'cpu ' /proc/stat) <(sleep .5; grep 'cpu ' /proc/stat)) +weather=$(weather text) +charging="$(awk '{print $1*10^-6 "W"}' /sys/class/power_supply/BAT0/power_now)" +net="$(hasnet && echo up || echo down)" +battery="$(cat /sys/class/power_supply/BAT0/capacity)%" +if [ "$1" = "quick" ]; then + echo "$battery ($charging) | $temp | $mem | $swap | $net | $weather | $timer | $what | $time" + exit 0 +fi + +cpu=$(awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else printf "%.1f%", (($2+$4-u1) * 100 / (t-t1)); }' <(grep 'cpu ' /proc/stat) <(sleep .5; grep 'cpu ' /proc/stat)) mouse=$(upower -d | grep -m 1 -A 10 mouse | awk '/percentage/{printf("| M%s ",$2)}') if bluetooth | grep -q on; then -btdev=$(bluetoothctl info) -btname=$(echo "$btdev" | awk '/Name/{$1=""; printf("|%s",$0)}') -btbat=$(echo "$btdev" | awk '/Battery/{printf(" %s ",$4)}') -bt="$btname$btbat" + btdev=$(bluetoothctl info) + btname=$(echo "$btdev" | awk '/Name/{$1=""; printf("|%s",$0)}') + btbat=$(echo "$btdev" | awk '/Battery/{printf(" %s ",$4)}') + bt="$btname$btbat" fi -echo "$battery ($charging) $mouse$bt| $temp | $cpu | $mem | $swap | $net | $weather | $time" +echo "$battery ($charging) $mouse$bt| $temp | $cpu | $mem | $swap | $net | $weather | $timer | $what | $time" diff --git a/.scripts/takeover b/.scripts/takeover new file mode 100755 index 0000000..45ea695 --- /dev/null +++ b/.scripts/takeover @@ -0,0 +1,4 @@ +#!/bin/sh + +setxkbmap -rules evdev -model evdev -layout de +xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1 diff --git a/.scripts/term b/.scripts/term index 184d341..69703df 100755 --- a/.scripts/term +++ b/.scripts/term @@ -7,4 +7,5 @@ else EXTRA="-tMelvins terminal" fi -alacritty msg create-window "${EXTRA}" $@ +#alacritty msg create-window "${EXTRA}" $@ +alacritty msg create-window $@ diff --git a/.scripts/timer b/.scripts/timer index 9ce6ba5..4a60a84 100755 --- a/.scripts/timer +++ b/.scripts/timer @@ -1,6 +1,55 @@ #!/bin/sh -time=$(printf "\\n" | dmenu -p "How many minutes?") -echo "sleeping for ${time}min" -sleep $((time * 60)) -notify-send "Timer" "${time}min are up!" +TIMER_PATH="/home/melvin/.timer" + +if [ "$1" = "run" ]; then + # relax if zero at start + if [ "$(cat "$TIMER_PATH")" -le "0" ]; then + echo "$TIMER_PATH" | entr -npz true + fi + + while true; do + curr=$(cat "$TIMER_PATH") + next=$((curr - 5)) + echo $next | tee "$TIMER_PATH" + + if [ "$next" -le "0" ]; then + notify-send "Timer ended" + echo 0 | tee "$TIMER_PATH" + echo "$TIMER_PATH" | entr -npz true + fi + + sleep 5 + done +elif [ "$1" = "get" ]; then + curr=$(cat "$TIMER_PATH") + if [ "$curr" -gt "3600" ]; then + str="$((curr / 3600)):$(((curr % 3600) / 60))h" + elif [ "$curr" -gt "60" ]; then + str="$((curr / 60)):$((curr % 60))m" + else + str="${curr}s" + fi + echo "$str" +elif [ "$1" = "set" ]; then + num=$(printf "%s" "$2" | head -c-1) + unit=$(printf "%s" "$2" | tail -c1) + if [ "$unit" = "h" ]; then + secs=$((num * 3600)) + elif [ "$unit" = "m" ]; then + secs=$((num * 60)) + else + secs=$num + fi + echo "$secs" | tee "$TIMER_PATH" +elif [ "$1" = "inc" ]; then + curr=$(cat "$TIMER_PATH") + next=$((curr + 300)) + echo $next | tee "$TIMER_PATH" + xsetroot -name "$(stats quick)" +elif [ "$1" = "dec" ]; then + curr=$(cat "$TIMER_PATH") + next=$((curr - 300)) + echo $next | tee "$TIMER_PATH" + xsetroot -name "$(stats quick)" +fi diff --git a/.scripts/whatamidoing b/.scripts/whatamidoing new file mode 100755 index 0000000..3c65677 --- /dev/null +++ b/.scripts/whatamidoing @@ -0,0 +1,8 @@ +#!/bin/sh +# arbtt files have limited read access (good!) ==> write current tag to file using cronjob + +if [ "$1" = "sync" ]; then + /home/melvin/.cabal/bin/arbtt-stats --logfile=/home/melvin/.arbtt/capture.log --categorizefile=/home/melvin/.arbtt/categorize.cfg -f '$sampleage < 0:01' | tail -n 1 | awk '{print $1}' >/home/melvin/.arbtt/current +else + cat /home/melvin/.arbtt/current +fi @@ -172,12 +172,19 @@ let g:ale_fixers.java = ['google_java_format'] let g:ale_fixers.tex = ['latexindent'] let g:ale_fixers.python = ['black'] let g:ale_fixers.r = ['styler'] +let g:ale_fixers.rust = ['rustfmt'] let g:ale_linters = {} +let g:ale_linters.haskell = ['hlint'] let g:ale_linters.sh = ['shellcheck'] let g:ale_linters.javascript = ['xo'] let g:ale_linters.r = ['lintr'] -let g:ale_linters.python = ['pycodestyle'] +let g:ale_linters.python = ['ruff'] +nmap <silent> <leader>j :ALENext<cr> +nmap <silent> <leader>k :ALEPrevious<cr> +nmap <silent> <leader>d :ALEDetail<cr> + +" let g:ale_markdown_pandoc_options = '-s -t gfm -' let g:ale_markdown_pandoc_options = '-s -f markdown+yaml_metadata_block -t markdown -' let g:ale_virtualtext_cursor = 'disabled' @@ -1,9 +1,10 @@ xbanish & lxsession & +dunst & inputset & -while true; do xsetroot -name "$(stats)"; sleep 5; done & +while true; do xsetroot -name "$(stats)"; sleep 10; done & while true; do weather get; sleep 600; done & for f in /etc/X11/xinit/xinitrc.d/?*.sh; do @@ -15,6 +16,9 @@ unset f redshift -l 48.5:9.1 & touchegg & +eval `ssh-agent -s` + +xset +fp /usr/share/fonts/local xset s 1200 xset dpms 1200 1200 1200 xss-lock -- slock & @@ -29,6 +33,10 @@ alacritty & sleep 0.5 xdotool search --onlyvisible --class Alacritty windowunmap %@ +timer run & + #obsidian & -dbus-run-session dwm + +setsid -f arbtt-capture +exec dbus-run-session dwm #exec dbus-launch dwm @@ -1,3 +1,7 @@ # .files -These are my personal dotfiles of my main PC and all my other devices. You probably shouldn't use these, as the configs are **very** specific to my PC usage. +These are my personal dotfiles of my main PC and all my other devices. +You probably shouldn’t use these, as the configs are quite specific to +my PC usage. + +Interesting files might be `.scripts/*` and `.vimrc` |