diff --git a/.config/lf/lfrc b/.config/lf/lfrc index d9800fbf..c4c598b6 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -86,7 +86,7 @@ cmd rsyncto ${{ clear; echo "rsync to where?" read dest for x in $fx; do - eval rsync -aAXHv \"$x\" \"$dest\" + eval rsync -aAXHv \"$x\" \"$dest\" done && notify-send "File(s) rsynced." "File(s) copies to $dest." }} @@ -121,8 +121,6 @@ cmd git_branch ${{ lf -remote "send $id cd \"$pwd_shell\"" }} - - cmd on-cd &{{ DIR=$(echo $PWD | sed "s|$HOME|~|") printf "\033]0; $DIR\007" > /dev/tty @@ -134,23 +132,23 @@ cmd on-quit ${{ printf "\033]0; $DIR\007" > /dev/tty }} -# cmd paste &{{ -# set -- $(cat ~/.local/share/lf/files) -# mode="$1" -# shift -# case "$mode" in -# copy) -# rsync -av --ignore-existing --progress -- "$@" . | -# stdbuf -i0 -o0 -e0 tr '\r' '\n' | -# while IFS= read -r line; do -# lf -remote "send $id echo $line" -# done -# ;; -# move) mv -n -- "$@" .;; -# esac -# rm ~/.local/share/lf/files -# lf -remote "send clear" -# }} +cmd paste &{{ + set -- $(cat ~/.local/share/lf/files) + mode="$1" + shift + case "$mode" in + copy) + rsync -av --ignore-existing --progress -- "$@" . | + stdbuf -i0 -o0 -e0 tr '\r' '\n' | + while IFS= read -r line; do + lf -remote "send $id echo $line" + done + ;; + move) mv -n -- "$@" .;; + esac + rm ~/.local/share/lf/files + lf -remote "send clear" +}} cmd share $curl -F"file=@$fx" https://0x0.snaile.de | xclip -r -selection c @@ -179,6 +177,7 @@ map I push A # after extension map i push A # before extension map c push A # new rename map B bulkrename +map b $cp "$f" "$f-COPY" # Kitty Specific map W $setsid -f $TERMINAL -e lf >/dev/null 2>&1 diff --git a/.config/lf/shortcutrc b/.config/lf/shortcutrc index 6bed745f..dab2fce7 100644 --- a/.config/lf/shortcutrc +++ b/.config/lf/shortcutrc @@ -2,12 +2,11 @@ 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/git" +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 Cco cd "/home/luca/Documents/Code" map Cms cd "/home/luca/Music" map Cpc cd "/home/luca/Pictures" map Cvd cd "/home/luca/Videos" diff --git a/.config/picom/picom.conf b/.config/picom/picom.conf index 63dfd8ad..a5d0fab7 100644 --- a/.config/picom/picom.conf +++ b/.config/picom/picom.conf @@ -5,11 +5,11 @@ shadow-opacity = 0.6; shadow-offset-x = -12; shadow-offset-y = -10; shadow-exclude = [ - "x = 10 && y = 10 && override_redirect = true", - "class_g *= 'slop'", - "_GTK_FRAME_EXTENTS@:c", - "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'", - "class_g = 'librewolf' && argb", + "x = 0 && y = 0 && override_redirect = true", + "class_g *= 'slop'", + "_GTK_FRAME_EXTENTS@:c", + "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'", + "class_g = 'librewolf-default' && argb" ]; # Fading @@ -32,21 +32,12 @@ blur-background-frame = true; blur-kern = "3x3box"; blur-strength = 4; blur-background-exclude = [ - "class_g *= 'slop'", - "_GTK_FRAME_EXTENTS@:c", - "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'", - "class_g = 'librewolf' && argb", + "class_g *= 'slop'", + "_GTK_FRAME_EXTENTS@:c", + "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'", + "class_g = 'librewolf-default' && argb" ]; -# Window type settings -wintypes: -{ - menu = { shadow = false; blur-background = false; }; - dropdown_menu = { shadow = false; blur-background = false; }; - popup_menu = { shadow = false; blur-background = false; }; - utility = { shadow = false; blur-background = false; }; -}; - # Other backend = "glx"; experimental-backends = true; diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 40eab97c..69a4fae7 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -5,38 +5,38 @@ # sudo not required for some system commands for command in mount umount sv pacman apt updatedb su shutdown poweroff reboot ; do - alias $command="sudo $command" + alias $command="sudo $command" done; unset command # Verbosity and settings that you pretty much just always are going to want. alias \ - cp="cp -iv" \ - mv="mv -iv" \ - rm="rm -vI" \ - bc="bc -ql" \ - mkd="mkdir -pv" \ - ffmpeg="ffmpeg -hide_banner" \ - exa="exa -abghHliS" \ + cp="cp -iv" \ + mv="mv -iv" \ + rm="rm -vI" \ + bc="bc -ql" \ + mkd="mkdir -pv" \ + ffmpeg="ffmpeg -hide_banner" \ + exa="exa -abghHliS" \ duf="duf -all" \ ls="ls -hN --color=auto --group-directories-first" \ - grep="grep --color=auto" \ - diff="diff --color=auto" \ + grep="grep --color=auto" \ + diff="diff --color=auto" \ # Colorize commands when possible. alias \ - ls="ls -hN --color=auto --group-directories-first" \ - grep="grep --color=auto" \ - diff="diff --color=auto" \ - ccat="highlight --out-format=ansi" \ + ls="ls -hN --color=auto --group-directories-first" \ + grep="grep --color=auto" \ + diff="diff --color=auto" \ + ccat="highlight --out-format=ansi" \ ip="ip -color=auto" # These common commands are just too long! Abbreviate them. alias \ - ka="killall" \ + ka="killall" \ e="$EDITOR" \ z="zathura" \ - p="pacman" \ + p="pacman" \ ar="apt remove" \ are="apt reinstall" \ ai="apt install" \ @@ -45,10 +45,10 @@ alias \ # Misc. alias \ - ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \ - weath="less -S ${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" \ - remvirt="virt-manager -c 'qemu+ssh://luca@192.168.178.200/system'" \ - vim="lvim" \ + ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \ + weath="less -S ${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" \ + remvirt="virt-manager -c 'qemu+ssh://luca@192.168.178.200/system'" \ + vim="lvim" \ wikidown='rclone sync cloud:files/luca/Notes ~/Documents/vimwiki' \ wikiup='rclone sync ~/Documents/vimwiki cloud:files/luca/Notes' \ cam="mpv --untimed --no-cache --no-osc --no-input-default-bindings --profile=low-latency --input-conf=/dev/null --title=webcam $(ls /dev/video[0,2,4,6,8] | tail -n 1)" \ diff --git a/.config/shell/bm-dirs b/.config/shell/bm-dirs index a2a87e1e..09775f33 100644 --- a/.config/shell/bm-dirs +++ b/.config/shell/bm-dirs @@ -3,12 +3,11 @@ h $HOME ch ${XDG_CACHE_HOME:-$HOME/.cache} cf ${XDG_CONFIG_HOME:-$HOME/.config} dt ${XDG_DATA_HOME:-$HOME/.local/share} -rr $HOME/.local/git +rr $HOME/.local/src sc $HOME/.local/bin mn /mnt dl ${XDG_DOWNLOAD_DIR:-$HOME/Downloads} dm ${XDG_DOCUMENTS_DIR:-$HOME/Documents} -co ${XDG_DOCUMENTS_DIR:-$HOME/Documents}/Code ms ${XDG_MUSIC_DIR:-$HOME/Music} pc ${XDG_PICTURES_DIR:-$HOME/Pictures} vd ${XDG_VIDEOS_DIR:-$HOME/Videos} diff --git a/.config/shell/bm-files b/.config/shell/bm-files index 5940e61e..f7f301ab 100644 --- a/.config/shell/bm-files +++ b/.config/shell/bm-files @@ -1,23 +1,23 @@ # These files automatically update when edited/saved in vim: -# keys filename description -bf ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-files # This file, a list of bookmarked files -bd ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs # A list of bookmarked directories similar to this file -cfx ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources # Colors, themes and variables for X11 -cfb ${XDG_HOME:-$HOME}/.local/src/dwmblocks/config.h # dwmblocks: the status bar for dwm +# keys filename description +bf ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-files # This file, a list of bookmarked files +bd ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs # A list of bookmarked directories similar to this file +cfx ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources # Colors, themes and variables for X11 +cfb ${XDG_HOME:-$HOME}/.local/src/dwmblocks/config.h # dwmblocks: the status bar for dwm # These do not update automatically, but on the next new instance of a program: -cfv ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/init.vim # vim/neovim config -cfz $ZDOTDIR/.zshrc # zsh (shell) config -cfa ${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc # aliases used by zsh (and potentially other shells) -cfp ${XDG_CONFIG_HOME:-$HOME/.config}/shell/profile # profile file for login settings for zsh -cfm ${XDG_CONFIG_HOME:-$HOME/.config}/mutt/muttrc # mutt (email client) config -cfn ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/config # newsboat (RSS reader) -cfu ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls # RSS urls for newsboat -cfmb ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/bindings # ncmpcpp (music player) keybinds file -cfmc ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/config # ncmpcpp (music player) config -cfl ${XDG_CONFIG_HOME:-$HOME/.config}/lf/lfrc # lf (file browser) config -cfL ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope # lf's scope/preview file -cfX ${XDG_CONFIG_HOME:-$HOME/.config}/sxiv/exec/key-handler # sxiv (image viewer) key/script handler +cfv ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/init.vim # vim/neovim config +cfz $ZDOTDIR/.zshrc # zsh (shell) config +cfa ${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc # aliases used by zsh (and potentially other shells) +cfp ${XDG_CONFIG_HOME:-$HOME/.config}/shell/profile # profile file for login settings for zsh +cfm ${XDG_CONFIG_HOME:-$HOME/.config}/mutt/muttrc # mutt (email client) config +cfn ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/config # newsboat (RSS reader) +cfu ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls # RSS urls for newsboat +cfmb ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/bindings # ncmpcpp (music player) keybinds file +cfmc ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/config # ncmpcpp (music player) config +cfl ${XDG_CONFIG_HOME:-$HOME/.config}/lf/lfrc # lf (file browser) config +cfL ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope # lf's scope/preview file +cfX ${XDG_CONFIG_HOME:-$HOME/.config}/sxiv/exec/key-handler # sxiv (image viewer) key/script handler diff --git a/.config/shell/profile b/.config/shell/profile index 0362a6bd..406f5717 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -235,6 +235,5 @@ ex=:\ [ "$(tty)" = "/dev/tty1" ] && ! pidof -s Xorg >/dev/null 2>&1 && exec startx "$XINITRC" [ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ] && setsid shortcuts >/dev/null 2>&1 -sudo -n loadkeys ${XDG_DATA_HOME:-$HOME/.local/share}/ttymaps.kmap 2>/dev/null - +# sudo -n loadkeys ${XDG_DATA_HOME:-$HOME/.local/share}/ttymaps.kmap 2>/dev/null diff --git a/.config/shell/shortcutrc b/.config/shell/shortcutrc index 2167f66b..7c6b0afc 100644 --- a/.config/shell/shortcutrc +++ b/.config/shell/shortcutrc @@ -3,12 +3,11 @@ alias h="cd /home/luca && tput cuu1;tput el" \ ch="cd /home/luca/.cache && tput cuu1;tput el" \ cf="cd /home/luca/.config && tput cuu1;tput el" \ dt="cd /home/luca/.local/share && tput cuu1;tput el" \ -rr="cd /home/luca/.local/git && tput cuu1;tput el" \ +rr="cd /home/luca/.local/src && tput cuu1;tput el" \ sc="cd /home/luca/.local/bin && tput cuu1;tput el" \ mn="cd /mnt && tput cuu1;tput el" \ dl="cd /home/luca/Downloads && tput cuu1;tput el" \ dm="cd /home/luca/Documents && tput cuu1;tput el" \ -co="cd /home/luca/Documents/Code && tput cuu1;tput el" \ ms="cd /home/luca/Music && tput cuu1;tput el" \ pc="cd /home/luca/Pictures && tput cuu1;tput el" \ vd="cd /home/luca/Videos && tput cuu1;tput el" \ diff --git a/.config/shell/zshnameddirrc b/.config/shell/zshnameddirrc index fa32793c..7e4b9271 100644 --- a/.config/shell/zshnameddirrc +++ b/.config/shell/zshnameddirrc @@ -2,12 +2,11 @@ hash -d h=/home/luca hash -d ch=/home/luca/.cache hash -d cf=/home/luca/.config hash -d dt=/home/luca/.local/share -hash -d rr=/home/luca/.local/git +hash -d rr=/home/luca/.local/src hash -d sc=/home/luca/.local/bin hash -d mn=/mnt hash -d dl=/home/luca/Downloads hash -d dm=/home/luca/Documents -hash -d co=/home/luca/Documents/Code hash -d ms=/home/luca/Music hash -d pc=/home/luca/Pictures hash -d vd=/home/luca/Videos diff --git a/.config/x11/xinitrc b/.config/x11/xinitrc index 7242b8fd..23da0288 100755 --- a/.config/x11/xinitrc +++ b/.config/x11/xinitrc @@ -13,51 +13,3 @@ if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile" ]; then else . "$HOME/.xprofile" fi - -# Start gpg-agent if not already running -if ! pgrep -x -u "${USER}" gpg-agent 1> /dev/null 2>&1; then - gpg-connect-agent /bye 1> /dev/null 2>&1 -fi - -# Set SSH to use gpg-agent (see 'man gpg-agent', section EXAMPLES) -unset SSH_AGENT_PID -if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then - # export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh" - SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" - export SSH_AUTH_SOCK -fi - -# Set GPG TTY as stated in 'man gpg-agent' -GPG_TTY="$(tty)" -export GPG_TTY - -# Refresh gpg-agent tty -gpg-connect-agent updatestartuptty /bye > /dev/null - -export XSECURELOCK_AUTH_BACKGROUND_COLOR="#24283b" -export XSECURELOCK_AUTH_FOREGROUND_COLOR="#c0caf5" -export XSECURELOCK_AUTH_WARNING_COLOR="#f7768e" -export XSECURELOCK_BACKGROUND_COLOR="#15161E" -export XSECURELOCK_DATETIME_FORMAT="%d.%m.%Y %H:%M" -export XSECURELOCK_PASSWORD_PROMPT="time_hex" -export XSECURELOCK_AUTH_TIMEOUT=10 -export XSECURELOCK_SHOW_DATETIME=1 -export XSECURELOCK_SAVER="saver_xscreensaver" -export XSECURELOCK_COMPOSITE_OBSCURER=0 -xset s 300 -xss-lock -- xsecurelock & - -# Set GPU settings -# gwe --hide-window & - -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 -setxkbmap -layout de -variant nodeadkeys -option caps:super - -setsid -f dwmblocks -setsid -f picom --experimental-backends - -# Start Console TDM -exec dwm - diff --git a/.config/x11/xprofile b/.config/x11/xprofile index 4b19949b..3415d07b 100755 --- a/.config/x11/xprofile +++ b/.config/x11/xprofile @@ -5,11 +5,57 @@ xrandr --dpi 109 --fb 4480x1633 \ setbg & # set the background with the `setbg` script xrdb ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources & xrdbpid=$! # Uncomment to use Xresources colors/settings on startup -autostart="checkup mpd dunst unclutter pipewire" - +autostart="checkup mpd dunst unclutter pipewire dwmblocks" for program in $autostart; do pidof -s "$program" || "$program" & done >/dev/null 2>&1 +pidof -s "picom" || picom --experimental-backends & + # Ensure that xrdb has finished running before moving on to start the WM/DE. [ -n "$xrdbpid" ] && wait "$xrdbpid" + +# Start gpg-agent if not already running +if ! pgrep -x -u "${USER}" gpg-agent 1> /dev/null 2>&1; then + gpg-connect-agent /bye 1> /dev/null 2>&1 +fi + +# Set SSH to use gpg-agent (see 'man gpg-agent', section EXAMPLES) +unset SSH_AGENT_PID +if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then + # export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh" + SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" + export SSH_AUTH_SOCK +fi + +# Set GPG TTY as stated in 'man gpg-agent' +GPG_TTY="$(tty)" +export GPG_TTY + +# Refresh gpg-agent tty +gpg-connect-agent updatestartuptty /bye > /dev/null + +export XSECURELOCK_AUTH_BACKGROUND_COLOR="#24283b" +export XSECURELOCK_AUTH_FOREGROUND_COLOR="#c0caf5" +export XSECURELOCK_AUTH_WARNING_COLOR="#f7768e" +export XSECURELOCK_BACKGROUND_COLOR="#15161E" +export XSECURELOCK_DATETIME_FORMAT="%d.%m.%Y %H:%M" +export XSECURELOCK_PASSWORD_PROMPT="time_hex" +export XSECURELOCK_AUTH_TIMEOUT=10 +export XSECURELOCK_SHOW_DATETIME=1 +export XSECURELOCK_SAVER="saver_xscreensaver" +export XSECURELOCK_COMPOSITE_OBSCURER=0 +xset s 300 +xss-lock -- xsecurelock & + +# Set GPU settings +# gwe --hide-window & + +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 +setxkbmap -layout de -variant nodeadkeys -option caps:super + +# Start Console TDM +exec dwm + diff --git a/.config/x11/xresources b/.config/x11/xresources index 990d8e2d..79042dee 100644 --- a/.config/x11/xresources +++ b/.config/x11/xresources @@ -9,7 +9,11 @@ Xcursor.theme: Fluent-dark-cursors !! DWM Settings dwm.bordernorm: #1D202F -dwm.bordersel: #414868 +dwm.bordersel: #414868; +dwm.font: NotoSans Nerd Font:style=Regular:pixelsize=14:antialias=true; + +!! dmenu settings +dmenu.font: NotoSans Nerd Font:style=Regular:pixelsize=14:antialias=true; /* name dark light */ /* black 0 8 */ diff --git a/.local/bin/ifinstalled b/.local/bin/ifinstalled deleted file mode 100755 index e9635c8d..00000000 --- a/.local/bin/ifinstalled +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# Some optional functions in LARBS require programs not installed by default. I -# use this little script to check to see if a command exists and if it doesn't -# it informs the user that they need that command to continue. This is used in -# various other scripts for clarity's sake. - -for x in "$@"; do - if ! which "$x" >/dev/null 2>&1 && ! pacman -Qq "$x" >/dev/null 2>&1; then - notify-send " $x" "must be installed for this function." && exit 1 ; - fi -done diff --git a/.local/bin/statusbar/sb-clock b/.local/bin/statusbar/sb-clock index 27450bf9..dee4f48b 100755 --- a/.local/bin/statusbar/sb-clock +++ b/.local/bin/statusbar/sb-clock @@ -15,4 +15,4 @@ case "$clock" in "11") icon="" ;; "12") icon="" ;; esac -printf "%s \033[11m%s\033[10m %s\n" "$(date "+%H:%M")" "$icon" "$(date "+%d.%M.%Y")" +printf "%s \033[11m%s\033[10m %s\n" "$(date "+%H:%M")" "$icon" "$(date "+%d.%m.%Y")" diff --git a/.local/bin/statusbar/sb-cpubars b/.local/bin/statusbar/sb-cpubars index c5525d9a..717cc83b 100755 --- a/.local/bin/statusbar/sb-cpubars +++ b/.local/bin/statusbar/sb-cpubars @@ -12,14 +12,14 @@ echo "$stats" | while read -r row; do case "$(echo "$old" | awk '{if ($1 == id) printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \ id="$id" total="$total" idle="$idle")" in - "0") printf "\033[32m▁\033[0m";; - "1") printf "\033[32m▂\033[0m";; - "2") printf "\033[32m▃\033[0m";; - "3") printf "\033[33m▄\033[0m";; - "4") printf "\033[33m▅\033[0m";; - "5") printf "\033[33m▆\033[0m";; - "6"|"7"|"8") printf "\033[31m▇\033[0m";; + "0") printf "\033[32m▁";; + "1") printf "\033[32m▂";; + "2") printf "\033[32m▃";; + "3") printf "\033[33m▄";; + "4") printf "\033[33m▅";; + "5") printf "\033[33m▆";; + "6"|"7"|"8") printf "\033[31m▇";; esac -done; printf "\\n" +done; printf "\033[0m\\n" echo "$stats" > "$cache" diff --git a/.local/bin/statusbar/sb-internet b/.local/bin/statusbar/sb-internet index 09b9651e..abc9fce9 100755 --- a/.local/bin/statusbar/sb-internet +++ b/.local/bin/statusbar/sb-internet @@ -1,7 +1,13 @@ #!/bin/sh +big="\033[11m" +norm="\033[10m" if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then - wifiicon="$(awk '/^\s*w/ { print "直", int($3 * 100 / 70) "% " }' /proc/net/wireless)" + percent="$(cat /proc/net/wireless | tail -1 | 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 && wifiicon="睊" || wifiicon=" " + grep -xq '0x1003' /sys/class/net/w*/flags && wifi_icon="睊" || wifi_icon="" fi -printf "%s%s%s%s\n" "$wifiicon" "$(sed "s/down/ /;s/up/ /" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/嬨/" /sys/class/net/tun*/operstate 2>/dev/null)" "$(ip route get 8.8.8.8 | sed 's/.*src \([^ ]*\).*/\1/;t;d')" + +ls /sys/class/net/tun* 1>/dev/null 2>&1 && vpn_icon="$(sed "s/.*/嬨/" /sys/class/net/tun*/operstate 2>/dev/null)" || vpn_icon="" + +printf "$big%s$norm %s $big%s%s$norm" "$wifi_icon" " $percent" "$(sed "s/down//;s/up//" /sys/class/net/e*/operstate 2>/dev/null | tr "\n" " " | xargs echo -n)" "$vpn_icon" diff --git a/.local/bin/statusbar/sb-ip b/.local/bin/statusbar/sb-ip new file mode 100755 index 00000000..3fd8c60a --- /dev/null +++ b/.local/bin/statusbar/sb-ip @@ -0,0 +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 ' ' -f3)" +pub_addr="$(curl snaile.de/ip 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" $loc_addr $pub_addr diff --git a/.local/bin/statusbar/sb-iplocate b/.local/bin/statusbar/sb-iplocate deleted file mode 100755 index d154d855..00000000 --- a/.local/bin/statusbar/sb-iplocate +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/ -ifinstalled "geoip" || exit -addr="$(curl snaile.de/ip 2>/dev/null)" || exit -grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed "s/flag: //;s/;.*//" diff --git a/.local/bin/statusbar/sb-volume b/.local/bin/statusbar/sb-volume index 335296b2..fa054f67 100755 --- a/.local/bin/statusbar/sb-volume +++ b/.local/bin/statusbar/sb-volume @@ -12,6 +12,6 @@ elif [ "$vol" -gt "0" ]; then elif [ "$vol" -eq "0" ]; then icon="" else - echo " \033[11m\033[10m  " && exit + echo "\033[11m\033[10m " && exit fi printf "\033[11m%s\033[10m %s" "$icon" "$vol"