diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-06-06 21:05:11 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-06-06 21:05:11 +0200 |
commit | fcb8668fc5435ce5f306a8c218d7c1eb1f4d91e5 (patch) | |
tree | e7d947146b194115faec1418c0a7753b8ebc48f3 | |
parent | 7d1e8075b8f156f3f8c300326abf730a1a8f2875 (diff) |
More of Luke's scripts, some updates to alacritty and nvim
-rw-r--r-- | .config/alacritty/alacritty.yml | 2 | ||||
-rw-r--r-- | .config/fontconfig/fonts.conf | 35 | ||||
-rw-r--r-- | .config/nvim/lua/_true-zen/init.lua | 9 | ||||
-rw-r--r-- | .config/nvim/lua/settings.lua | 2 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-clock | 2 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-cpubars | 44 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-memory | 6 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-nettraf | 29 |
8 files changed, 118 insertions, 11 deletions
diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml index 6804615..ffa645f 100644 --- a/.config/alacritty/alacritty.yml +++ b/.config/alacritty/alacritty.yml @@ -70,7 +70,7 @@ env: window: padding: x: 16 - y: 16 + y: 0 # scrolling: # # Maximum number of lines in the scrollback buffer. # # Specifying '0' will disable scrolling. diff --git a/.config/fontconfig/fonts.conf b/.config/fontconfig/fonts.conf new file mode 100644 index 0000000..2d58803 --- /dev/null +++ b/.config/fontconfig/fonts.conf @@ -0,0 +1,35 @@ +<?xml version='1.0'?> +<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> +<fontconfig> + <alias> + <family>serif</family> + <prefer> + <family>Linux Libertine</family> + <family>Joy Pixels</family> + <family>Noto Color Emoji</family> + </prefer> + </alias> + <alias> + <family>sans-serif</family> + <prefer> + <family>Linux Biolinum</family> + <family>Joy Pixels</family> + <family>Noto Color Emoji</family> + </prefer> + </alias> + <alias> + <family>sans</family> + <prefer> + <family>Linux Biolinum</family> + <family>Joy Pixels</family> + <family>Noto Color Emoji</family> + </prefer> + </alias> + <alias> + <family>monospace</family> + <prefer> + <family>Noto Sans Mono</family> + <family>Liberation Mono</family> + </prefer> + </alias> +</fontconfig> diff --git a/.config/nvim/lua/_true-zen/init.lua b/.config/nvim/lua/_true-zen/init.lua index 1cad678..7608f41 100644 --- a/.config/nvim/lua/_true-zen/init.lua +++ b/.config/nvim/lua/_true-zen/init.lua @@ -21,7 +21,6 @@ require("true-zen").setup({ }, top = { hidden_showtabline = 0, - shown_showtabline = 2 }, left = { @@ -35,10 +34,10 @@ require("true-zen").setup({ }, ataraxis = { just_do_it_for_me = false, - left_padding = 5, - right_padding = 5, - top_padding = 1, - bottom_padding = 1 + left_padding = 64, + right_padding = 64, + top_padding = 0, + bottom_padding = 0 }, integrations = { integration_galaxyline = true, diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index 0639643..0e38be4 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -13,7 +13,7 @@ vim.o.pumheight = 10 -- Makes popup menu smaller vim.o.fileencoding = "utf-8" -- The encoding written to file vim.o.cmdheight = 2 -- More space for displaying messages vim.cmd('set colorcolumn=99999') -- fix indentline for now -vim.o.mouse = "r" -- Enable your mouse +vim.o.mouse = "a" -- Enable your mouse vim.o.splitbelow = true -- Horizontal splits will automatically be below vim.o.termguicolors = true -- set term gui colors most terminals support this vim.o.splitright = true -- Vertical splits will automatically be to the right diff --git a/.local/bin/statusbar/sb-clock b/.local/bin/statusbar/sb-clock index 85b7775..751a734 100755 --- a/.local/bin/statusbar/sb-clock +++ b/.local/bin/statusbar/sb-clock @@ -26,4 +26,4 @@ case $BLOCK_BUTTON in 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -date "+(%a) %d %b $icon%I:%M%p" +date "+%a %b %d $icon %I:%M%p" diff --git a/.local/bin/statusbar/sb-cpubars b/.local/bin/statusbar/sb-cpubars new file mode 100755 index 0000000..297424e --- /dev/null +++ b/.local/bin/statusbar/sb-cpubars @@ -0,0 +1,44 @@ +#!/bin/sh + +# Module showing CPU load as a changing bars. +# Just like in polybar. +# Each bar represents amount of load on one core since +# last run. + +# Cache in tmpfs to improve speed and reduce SSD load +cache=/tmp/cpubarscache + +case $BLOCK_BUTTON in + 2) setsid -f "$TERMINAL" -e htop ;; + 3) notify-send "🪨 CPU load module" "Each bar represents +one CPU core";; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +# id total idle +stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat) +[ ! -f $cache ] && echo "$stats" > "$cache" +old=$(cat "$cache") +printf "🪨" +echo "$stats" | while read -r row; do + id=${row%% *} + rest=${row#* } + total=${rest%% *} + idle=${rest##* } + + 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 "▁";; + "1") printf "▂";; + "2") printf "▃";; + "3") printf "▄";; + "4") printf "▅";; + "5") printf "▆";; + "6") printf "▇";; + "7") printf "█";; + "8") printf "█";; + esac +done; printf "\\n" +echo "$stats" > "$cache" diff --git a/.local/bin/statusbar/sb-memory b/.local/bin/statusbar/sb-memory index 216015a..d398085 100755 --- a/.local/bin/statusbar/sb-memory +++ b/.local/bin/statusbar/sb-memory @@ -1,12 +1,12 @@ #!/bin/sh case $BLOCK_BUTTON in - 1) notify-send "🧠 Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; + 1) notify-send " Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; 2) setsid -f "$TERMINAL" -e htop ;; - 3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total. + 3) notify-send " Memory module" "\- Shows Memory Used/Total. - Click to show memory hogs. - Middle click to open htop." ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -free --mebi | sed -n '2{p;q}' | awk '{printf ("🧠 %2.2fGiB\n", ( $3 / 1024))}' +free --mebi | sed -n '2{p;q}' | awk '{printf (" %2.2fGiB\n", ( $3 / 1024))}' diff --git a/.local/bin/statusbar/sb-nettraf b/.local/bin/statusbar/sb-nettraf new file mode 100755 index 0000000..eb7a73b --- /dev/null +++ b/.local/bin/statusbar/sb-nettraf @@ -0,0 +1,29 @@ +#!/bin/sh + +# Module showing network traffic. Shows how much data has been received (RX) or +# transmitted (TX) since the previous time this script ran. So if run every +# second, gives network traffic per second. + +case $BLOCK_BUTTON in + 1) setsid -f "$TERMINAL" -e bmon ;; + 3) notify-send "🌐 Network traffic module" "🔻: Traffic received +🔺: Traffic transmitted" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +update() { + sum=0 + for arg; do + read -r i < "$arg" + sum=$(( sum + i )) + done + cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/} + [ -f "$cache" ] && read -r old < "$cache" || old=0 + printf %d\\n "$sum" > "$cache" + printf %d\\n $(( sum - old )) +} + +rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes) +tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes) + +printf "🔻%4sB 🔺%4sB\\n" $(numfmt --to=iec $rx) $(numfmt --to=iec $tx) |