From ad284493fc1b5f39792ad1ddcabf18dac13aea0a Mon Sep 17 00:00:00 2001
From: Luca Bilke <bilke@tralios.de>
Date: Tue, 27 Sep 2022 10:47:14 +0200
Subject: [PATCH 1/4] sb cleanup

---
 .local/bin/statusbar/sb-battery  | 33 ++++++++++++++++--------------
 .local/bin/statusbar/sb-clock    | 35 ++++++++++++++++----------------
 .local/bin/statusbar/sb-disk     |  2 +-
 .local/bin/statusbar/sb-internet | 33 +++++++++++++++++++++---------
 .local/bin/statusbar/sb-ip       |  2 +-
 .local/bin/statusbar/sb-upgrades | 15 ++++++++++++++
 6 files changed, 76 insertions(+), 44 deletions(-)
 create mode 100755 .local/bin/statusbar/sb-upgrades

diff --git a/.local/bin/statusbar/sb-battery b/.local/bin/statusbar/sb-battery
index d62b7d4b..1bd3f361 100755
--- a/.local/bin/statusbar/sb-battery
+++ b/.local/bin/statusbar/sb-battery
@@ -9,34 +9,37 @@ for battery in /sys/class/power_supply/BAT?*; do
 	[ -n "${capacity+x}" ] && printf " "
 	capacity="$(cat "$battery/capacity" 2>&1)"
 	case "$(cat "$battery/status" 2>&1)" in
-		"Full") icon=""; color="$green" ;;
-		"Charging") icon=""; color="$cyan" ;;
-		"Not charging") icon=""; color="$white" ;;
-		"Unknown") icon=""; color="$orange" ;;
+		"Full") icon=""; color="$green" ;;
+		"Charging") icon=""; color="$cyan" ;;
+		"Not charging") icon=""; color="$white" ;;
+		"Unknown") icon=""; color="$orange" ;;
 		"Discharging") 
       if [ "$capacity" -le 10 ]; then
-        icon=""; color="$red"
+        icon=""; color="$red"
       elif [ "$capacity" -le 20 ]; then
-        icon=""; color="$red"
+        icon=""; color="$red"
       elif [ "$capacity" -le 30 ]; then
-        icon=""; color="$white"
+        icon=""; color="$white"
       elif [ "$capacity" -le 40 ]; then
-        icon=""; color="$white"
+        icon=""; color="$white"
       elif [ "$capacity" -le 50 ]; then
-        icon=""; color="$white"
+        icon=""; color="$white"
       elif [ "$capacity" -le 60 ]; then
-        icon=""; color="$white"
+        icon=""; color="$white"
       elif [ "$capacity" -le 70 ]; then
-        icon=""; color="$white"
+        icon=""; color="$white"
       elif [ "$capacity" -le 80 ]; then
-        icon=""; color="$white"
+        icon=""; color="$white"
       elif [ "$capacity" -le 90 ]; then
-        icon=""; color="$white"
+        icon=""; color="$white"
+      elif [ "$capacity" -le 95 ]; then
+        icon=""; color="$white"
       else
-        icon=""; color="$white"
+        icon=""; color="$white"
       fi
+    
     ;;
 		*) exit 1 ;;
 	esac
-	printf "$color%s$reset %d%%" "$icon" "$capacity";
+	printf "$color%s$reset %d" "$icon" "$capacity";
 done && printf "\\n"
diff --git a/.local/bin/statusbar/sb-clock b/.local/bin/statusbar/sb-clock
index dee4f48b..a6065e3c 100755
--- a/.local/bin/statusbar/sb-clock
+++ b/.local/bin/statusbar/sb-clock
@@ -1,18 +1,19 @@
 #!/bin/sh
-clock=$(date '+%I')
-case "$clock" in
-	"00") icon="" ;;
-	"01") icon="" ;;
-	"02") icon="" ;;
-	"03") icon="" ;;
-	"04") icon="" ;;
-	"05") icon="" ;;
-	"06") icon="" ;;
-	"07") icon="" ;;
-	"08") icon="" ;;
-	"09") icon="" ;;
-	"10") icon="" ;;
-	"11") icon="" ;;
-	"12") icon="" ;;
-esac
-printf "%s \033[11m%s\033[10m %s\n" "$(date "+%H:%M")" "$icon" "$(date "+%d.%m.%Y")"
+# clock=$(date '+%I')
+# case "$clock" in
+# 	"00") icon="" ;;
+# 	"01") icon="" ;;
+# 	"02") icon="" ;;
+# 	"03") icon="" ;;
+# 	"04") icon="" ;;
+# 	"05") icon="" ;;
+# 	"06") icon="" ;;
+# 	"07") icon="" ;;
+# 	"08") icon="" ;;
+# 	"09") icon="" ;;
+# 	"10") icon="" ;;
+# 	"11") icon="" ;;
+# 	"12") icon="" ;;
+# esac
+# printf "%s \033[11m%s\033[10m %s\n" "$(date "+%H:%M")" "$icon" "$(date "+%d.%m.%Y")"
+date "+%H:%M "
diff --git a/.local/bin/statusbar/sb-disk b/.local/bin/statusbar/sb-disk
index 6c4bae3f..ef420e99 100755
--- a/.local/bin/statusbar/sb-disk
+++ b/.local/bin/statusbar/sb-disk
@@ -2,4 +2,4 @@
 # $1 should be drive mountpoint, otherwise assumed /.
 location=${1:-/}
 [ -d "$location" ] || exit
-printf "\033[11m%s\033[10m\n" " $(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"
+printf "\033[11m\033[10m %s\n" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"
diff --git a/.local/bin/statusbar/sb-internet b/.local/bin/statusbar/sb-internet
index da4ef4d8..d6c518ed 100755
--- a/.local/bin/statusbar/sb-internet
+++ b/.local/bin/statusbar/sb-internet
@@ -1,15 +1,28 @@
 #!/bin/sh
-if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then
-  percent=$(tail -1 /proc/net/wireless | tr -s ' ' | cut -d ' ' -f3 | sed 's/\.//')
-  wifi_icon="直"
-elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then
-  grep -xq '0x1003' /sys/class/net/w*/flags && wifi_icon="睊" || wifi_icon=""
-else
-  wifi_icon=""
-  percent=""
+shift=""
+
+if ls /sys/class/net/w*/operstate 1>/dev/null 2>&1; then
+  for w in /sys/class/net/w*/operstate; do
+    percent="$(cat /proc/net/wireless | grep "$(basename "$(dirname $w)")" | tr -s ' ' | cut -d ' ' -f3 | tr -dc "[:digit:]")"
+    grep -vxq '0x1003' &&  wifi_icon="" || wifi_icon="$(sed "s/up/直/;s/down/睊/" $w | tr -d "[:space:]")"
+    printf "$shift\033[11m%s\033[10m %s" "$wifi_icon" "$percent"
+    shift=" "
+  done
 fi
 
-ls /sys/class/net/tun* 1> /dev/null 2>&1 && vpn_icon="$(sed "s/.*/嬨/" /sys/class/net/tun*/operstate 2>/dev/null)" || vpn_icon=""
+if ls /sys/class/net/e*/operstate 1>/dev/null 2>&1; then
+  for e in /sys/class/net/e*/operstate; do
+    if_icon="$(sed "s/down//;s/up//" $e)"
+    printf "$shift\033[11m%s\033[10m" "$if_icon"
+    shift=" "
+  done
+fi
 
-printf "%s%s%s%s\n" "$wifi_icon" "$percent" "$(sed "s/down//;s/up//;s/\n//" /sys/class/net/e*/operstate 2>/dev/null)" "$vpn_icon"
+if ls /sys/class/net/tun*/operstate 1>/dev/null 2>&1; then
+  for _ in /sys/class/net/tun*/operstate; do
+    printf "$shift\033[11m%s\033[10m" "嬨"
+    shift=" "
+  done
+fi
 
+printf "\n"
diff --git a/.local/bin/statusbar/sb-ip b/.local/bin/statusbar/sb-ip
index c1d912ed..6bb353ed 100755
--- a/.local/bin/statusbar/sb-ip
+++ b/.local/bin/statusbar/sb-ip
@@ -1,6 +1,6 @@
 #!/bin/sh
 # https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/
 loc_addr="$(ip route get 9.9.9.9 | head -1 | cut -d ' ' -f7)"
-pub_addr="$(curl icanhazip.com 2>/dev/null)" || exit
+pub_addr="$(curl ipv4.icanhazip.com 2>/dev/null)" || exit
 # flag="$(grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed 's/ flag: .*//')"
 printf "%s %s\n" "$loc_addr" "$pub_addr"
diff --git a/.local/bin/statusbar/sb-upgrades b/.local/bin/statusbar/sb-upgrades
new file mode 100755
index 00000000..6b8b5820
--- /dev/null
+++ b/.local/bin/statusbar/sb-upgrades
@@ -0,0 +1,15 @@
+#!/bin/sh
+vals=$(aptitude full-upgrade --simulate --assume-yes |\
+    grep -m1 '^[0-9]\+ packages upgraded,' |\
+    tr -cd '0-9 ' |\
+    tr ' ' '\n' |\
+    grep '[0-9]\+' |\
+    xargs echo)
+
+print=" "
+for i in $vals; do
+  [ $i != 0 ] && icon="\033[11m\033[10m"
+  print="$print$i/"
+done
+
+[ -n "$icon" ] && printf "$icon " && echo $print | sed 's/\/$//'

From 30bb35a49cfdc7a082a2c48bad9451d851949490 Mon Sep 17 00:00:00 2001
From: Luca Bilke <bilke@tralios.de>
Date: Tue, 27 Sep 2022 10:47:50 +0200
Subject: [PATCH 2/4] new shortcut handling for lf

---
 .local/bin/shortcuts | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/.local/bin/shortcuts b/.local/bin/shortcuts
index 032388e5..ef3cb197 100755
--- a/.local/bin/shortcuts
+++ b/.local/bin/shortcuts
@@ -6,28 +6,25 @@ bmfiles="${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-files"
 # Output locations. Unactivated progs should go to /dev/null.
 shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc"
 zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc"
-lf_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/lf/shortcutrc"
-ranger_shortcuts="/dev/null"
-qute_shortcuts="/dev/null"
-fish_shortcuts="/dev/null"
-vifm_shortcuts="/dev/null"
+lf_tags="${XDG_DATA_HOME:-$HOME/.local/share}/lf/shortcut-tags"
+tmp="/tmp/shortcut-tmp"
 
 # Remove, prepare files
-rm -f "$lf_shortcuts" "$ranger_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" 2>/dev/null
-printf "# vim: filetype=sh\\n" > "$fish_shortcuts"
+rm -f "$shell_shortcuts" "$lf_tags" "$zsh_named_dirs" 2>/dev/null
 printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
-printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts"
 
 # Format the `directories` file in the correct syntax and sent it to all three configs.
 eval "echo \"$(cat "$bmdirs")\"" | \
 awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
-	printf(\"%s=\42cd %s && tput cuu1;tput el\42 \\\\\n\",\$1,\$2)             >> \"$shell_shortcuts\" ;
-	printf(\"hash -d %s=%s \n\",\$1,\$2)                  >> \"$zsh_named_dirs\"  ;
-	printf(\"map C%s cd \42%s\42 \n\",\$1,\$2)            >> \"$lf_shortcuts\" }"
+	printf(\"%s=\42cd %s && tput cuu1;tput el\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ;
+	printf(\"hash -d %s=%s \n\",\$1,\$2)                           >> \"$zsh_named_dirs\"  ;
+	printf(\"%s:\52\n\",\$2)                                       > \"$tmp\" }"
 
 # Format the `files` file in the correct syntax and sent it to both configs.
 eval "echo \"$(cat "$bmfiles")\"" | \
 awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
-	printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2)       >> \"$shell_shortcuts\" ;
-	printf(\"hash -d %s=%s \n\",\$1,\$2)                  >> \"$zsh_named_dirs\"  ;
-	printf(\"map E%s \$\$EDITOR \42%s\42 \n\",\$1,\$2)    >> \"$lf_shortcuts\" }"
+	printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2)    >> \"$shell_shortcuts\" ;
+	printf(\"hash -d %s=%s \n\",\$1,\$2)               >> \"$zsh_named_dirs\"  ;
+	printf(\"%s:\52\n\",\$2)                            > \"$tmp\" }"
+
+mv $tmp $lf_tags

From af545f793665eb876ecce5c5519c5fd0b7c2b941 Mon Sep 17 00:00:00 2001
From: Luca Bilke <bilke@tralios.de>
Date: Tue, 27 Sep 2022 10:49:02 +0200
Subject: [PATCH 3/4] new shortcut handling for lf

---
 .config/lf/lfrc       |  5 +----
 .config/lf/shortcutrc | 26 --------------------------
 2 files changed, 1 insertion(+), 30 deletions(-)
 delete mode 100644 .config/lf/shortcutrc

diff --git a/.config/lf/lfrc b/.config/lf/lfrc
index edcc0503..d2fff08e 100644
--- a/.config/lf/lfrc
+++ b/.config/lf/lfrc
@@ -154,7 +154,7 @@ cmd share $curl -F"file=@$fx" https://0x0.snaile.de | xclip -r -selection c
 
 # Bindings
 map <c-t> $lf -remote "send $id select '$(fzf)'"
-map <c-f> $lf -remote "send $id select '$(cat ${XDG_DATA_HOME:-$HOME/.local/share}/lf/tags | sed 's/:\*$//' | fzf)'" 
+map <c-f> $lf -remote "send $id select '$(cat ${XDG_DATA_HOME:-$HOME/.local/share}/lf/*tags | sed 's/:\*$//' | fzf)'" 
 map J $dir=$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf) && lf -remote "send $id cd $(eval echo $dir)"
 map D trash
 map <c-d> delete
@@ -186,6 +186,3 @@ map gh
 
 # Kitty Specific
 map W $setsid -f $TERMINAL -e lf >/dev/null 2>&1
-
-# source directory shortcuts
-source "~/.config/lf/shortcutrc"
diff --git a/.config/lf/shortcutrc b/.config/lf/shortcutrc
deleted file mode 100644
index a991de77..00000000
--- a/.config/lf/shortcutrc
+++ /dev/null
@@ -1,26 +0,0 @@
-map Ch cd "/home/luca" 
-map Cch cd "/home/luca/.cache" 
-map Ccf cd "/home/luca/.config" 
-map Cdt cd "/home/luca/.local/share" 
-map Crr cd "/home/luca/.local/src" 
-map Csc cd "/home/luca/.local/bin" 
-map Cmn cd "/mnt" 
-map Cdl cd "/home/luca/Downloads" 
-map Cdm cd "/home/luca/Documents" 
-map Cms cd "/home/luca/Music" 
-map Cpc cd "/home/luca/Pictures" 
-map Cvd cd "/home/luca/Videos" 
-map Cdot cd "/home/luca/.local/share/dotfiles" 
-map Ebf $$EDITOR "/home/luca/.config/shell/bm-files" 
-map Ebd $$EDITOR "/home/luca/.config/shell/bm-dirs" 
-map Ecfx $$EDITOR "/home/luca/.config/x11/xresources" 
-map EcfX $$EDITOR "/home/luca/.config/x11/xprofile" 
-map Ecfb $$EDITOR "/home/luca/.local/src/dwmblocks/config.h" 
-map Ecfk $$EDITOR "/home/luca/.config/kitty/kitty.conf" 
-map EcfK $$EDITOR "/home/luca/.config/kitty/kittyfullscreen.conf" 
-map Ecfv $$EDITOR "/home/luca/.config/lvim/config.lua" 
-map Ecfz $$EDITOR "/home/luca/.config/zsh/.zshrc" 
-map Ecfa $$EDITOR "/home/luca/.config/shell/aliasrc" 
-map Ecfp $$EDITOR "/home/luca/.config/shell/profile" 
-map Ecfl $$EDITOR "/home/luca/.config/lf/lfrc" 
-map EcfL $$EDITOR "/home/luca/.config/lf/preview" 

From f504cc7c40747549335713ddf1a4e6f567b1a59e Mon Sep 17 00:00:00 2001
From: Luca Bilke <bilke@tralios.de>
Date: Tue, 27 Sep 2022 10:49:07 +0200
Subject: [PATCH 4/4] minor fixes

---
 .config/lvim/config.lua | 9 +++++++++
 .local/bin/compiler     | 2 +-
 .local/bin/remaps       | 2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/.config/lvim/config.lua b/.config/lvim/config.lua
index 1073203d..0dee284f 100644
--- a/.config/lvim/config.lua
+++ b/.config/lvim/config.lua
@@ -20,6 +20,7 @@ vim.opt.foldlevelstart                    = 99
 vim.opt.foldexpr                          = "nvim_treesitter#foldexpr()"
 lvim.format_on_save                       = false
 lvim.line_wrap_cursor_movement            = false
+lvim.transparent_window                   = true
 
 -- Vimwiki Settings
 vim.g.vimwiki_ext2syntax = { ['.Rmd'] = 'markdown', ['.rmd'] = 'markdown', ['.md'] = 'markdown',
@@ -47,6 +48,14 @@ formatters.setup {
   { command = "black", filetypes = { "python" } },
 }
 
+local linters = require "lvim.lsp.null-ls.linters"
+linters.setup {
+  {
+    command = "shellcheck",
+    args = { "--severity", "warning" },
+  },
+}
+
 -- Autocommands (https://neovim.io/doc/user/autocmd.html)
 vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" }, {
   pattern = "*",
diff --git a/.local/bin/compiler b/.local/bin/compiler
index 9127087d..539204b4 100755
--- a/.local/bin/compiler
+++ b/.local/bin/compiler
@@ -36,7 +36,7 @@ case "$ext" in
 	cs) mcs "$file" && mono "$base".exe ;;
 	go) go run "$file" ;;
 	h) sudo make install ;;
-	java) javac -d classes "$file" && java -cp classes "${1%.*}" ;;
+	java) java -d classes "$file" && java -cp classes "${1%.*}" ;;
 	m) octave "$file" ;;
 	md)	if  [ -x "$(command -v lowdown)" ]; then
 			lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept > "$base".pdf
diff --git a/.local/bin/remaps b/.local/bin/remaps
index 8e1bd7d9..145c7e92 100755
--- a/.local/bin/remaps
+++ b/.local/bin/remaps
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-setxkbmap -layout de,us -variant nodeadkeys,dvp -option caps:super -option terminate:ctrl_alt_bksp
+setxkbmap -layout de,us -variant nodeadkeys,dvorak -option caps:super -option terminate:ctrl_alt_bksp
 xset r rate 300 50
 killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
 xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock