pain and suffering

This commit is contained in:
tulg 2025-10-18 17:35:04 +03:00
commit 510db0f1d4
42 changed files with 2150 additions and 0 deletions

176
config/waybar/config Normal file
View file

@ -0,0 +1,176 @@
{
"layer": "top", // Waybar at top layer
"position": "top", // Waybar position (top|bottom|left|right)
"height": 40,
"width":1920,
"margin": "0 0 0 0",
"spacing":0,
// Choose the order of the modules
// Add according to your wishes: "custom/weather"
"modules-left": ["hyprland/workspaces", "hyprland/window"],
"modules-center": ["custom/network_traffic"],
"modules-right": ["backlight","temperature", "cpu", "memory", "battery", "pulseaudio", "network", "tray", "clock"],
// Modules configuration
"hyprland/workspaces": {
"format": "{icon}",
"on-click": "activate",
"all-outputs": true,
"sort-by-number": true,
"format-icons": {
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6",
"7": "7",
"8": "8",
"9": "9",
"10": "10",
"focused": "",
"default": ""
},
"on-scroll-up": "hyprctl dispatch workspace e+1",
"on-scroll-down": "hyprctl dispatch workspace e-1",
},
"hyprland/window": {
"format": "{}",
"icon":false,
"icon-size" : 20
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"tray": {
"icon-size": 20,
"spacing": 5
},
"clock": {
"tooltip-format": "<big>{:%A, %d.%B %Y }</big>\n<tt><small>{calendar}</small></tt>",
"format": " {:%a %d %b  %I:%M %p}", //12 hour format
//"format": " {:%a %d %b  %H:%M}", //24 hour format
"format-alt": " {:%d/%m/%Y  %H:%M:%S}",
//"max-length": 200
"interval": 1,
"on-click": "~/.config/waybar/scripts/OCV",
},
"cpu": {
"format": "🖳{usage}%",
"on-click": "foot -e htop"
},
"memory": {
"format": "🖴 {: >3}%",
"on-click": "foot -e htop"
},
"temperature": {
"thermal-zone": 7, // Check with: # cat /sys/class/hwmon/hwmon*/temp1_input
"hwmon-path": "/sys/class/hwmon/hwmon7/temp1_input",
"critical-threshold": 80,
"format-critical": "{temperatureC}°C ",
"format": "{temperatureC}°C "
},
"backlight": {
// "device": "acpi_video1",
"format": "{icon} {percent: >3}%",
"format-icons": ["", ""],
"on-scroll-down": "brightnessctl -c backlight set 1%-",
"on-scroll-up": "brightnessctl -c backlight set +1%",
"on-click": "~/.config/waybar/scripts/backlight-hint.sh"
},
"battery": {
"states": {
// "good": 95,
"warning": 30,
"critical": 15
},
"format": "{icon} {capacity: >3}%",
"format-icons": ["", "", "", "", ""]
// "format-good": "", // An empty format will hide the module
// "format-full": "",
//"format-icons": ["", "", "", "", "", "", "", "", "", ""]
//"format": "&#x202b;{icon}&#x202c; {capacity}%",
//"format-icons": ["ﱉ","ﱊ","ﱌ","ﱍ","ﱋ"]
},
"network": {
//"interface": "wlp0s20f3", // (Optional) To force the use of this interface "format-wifi": " {essid}",
"format": "⚠Disabled",
"format-wifi": "",
"format-ethernet": "",
"format-linked": "{ifname} (No IP)",
"format-disconnected": "⚠Disabled",
"format-alt": "{ifname}: {ipaddr}/{cidr}",
"family": "ipv4",
"tooltip-format-wifi": " {ifname} @ {essid}\nIP: {ipaddr}\nStrength: {signalStrength}%\nFreq: {frequency}MHz\nUp: {bandwidthUpBits} Down: {bandwidthDownBits}",
"tooltip-format-ethernet": " {ifname}\nIP: {ipaddr}\n up: {bandwidthUpBits} down: {bandwidthDownBits}",
//"min-length": 2,
//"max-length": 2,
"on-click": "nm-connection-editor"
},
"custom/updates": {
"format": "{} {icon}",
"return-type": "json",
"format-icons": {
"has-updates": "󱍷",
"updated": "󰂪",
"interval": 7200,
},
"exec-if": "which waybar-module-pacman-updates",
"exec": "waybar-module-pacman-updates",
"on-click": "foot -e update"
},
"custom/power": {
"format":"⏻",
"on-click": "nwgbar",
"tooltip": false,
},
"custom/keyboard-layout": {
"format": " Cheat", // Icon: keyboard
"on-click": "~/.config/waybar/scripts/keyhint.sh",
},
"custom/launcher": {
"format":" ",
"on-click": "exec nwg-drawer -c 7 -is 70 -spacing 23",
"tooltip": false,
},
"custom/network_traffic": {
"exec": "~/.config/waybar/scripts/network_traffic.sh",
"return-type": "json",
"format-ethernet": "{icon} {ifname} ⇣{bandwidthDownBytes} ⇡{bandwidthUpBytes}", // optional
},
"pulseaudio": {
"scroll-step": 3, // %, can be a float
"format": "{icon} {volume}% {format_source}",
"format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": " {icon} {format_source}",
"format-muted": " {format_source}",
//"format-source": "{volume}% ",
//"format-source-muted": "",
"format-source": "",
"format-source-muted": "",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
},
"on-click": "pavucontrol",
"on-click-right": "pactl set-source-mute @DEFAULT_SOURCE@ toggle"
},
// https://github.com/chubin/wttr.in
"custom/weather": {
"exec": "curl 'https://wttr.in/Essen?format=2'",
"interval": 900,
"on-click": "yad --html --uri='https://wttr.in/Essen' --center --fixed --width=1000 --height=680 --timeout=60 --timeout-indicator=right"
},
}

BIN
config/waybar/launcher.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

9
config/waybar/scripts/OCV Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash
yad --width=400 --height=200 \
--center \
--fixed \
--title="Calendar" \
--no-buttons \
yad \
--calendar

View file

@ -0,0 +1,12 @@
#!/bin/bash
yad --width=100 --height=100 \
--center \
--fixed \
--title="Backlight" \
--no-buttons \
--timeout=10 \
--timeout-indicator=bottom \
yad \
--text="\nScroll your mouse wheel to change \n the backlight of the monitor." \

View file

@ -0,0 +1,7 @@
#!/bin/sh
sleep 20
hyprctl keyword windowrule "workspace unset,nmtui-colors"
hyprctl keyword windowrule "workspace unset,calamares"
hyprctl keyword windowrule "workspace unset,keyhint.sh"
hyprctl keyword windowrule "workspace unset,firedragon"

View file

@ -0,0 +1,37 @@
#!/bin/sh
# "Change keyboard layout in" "~/.config/hypr/hyprland.conf" " " \
yad --width=530 --height=640 \
--center \
--fixed \
--title="Garuda Hyprland Keybindings" \
--no-buttons \
--list \
--column=Key: \
--column=Description: \
--column=Command: \
--timeout=60 \
--timeout-indicator=right \
"ESC" "close this app" "" "=" "modkey" "(set mod Mod4)" \
"+Shift+g" "G-hyprland" "implement G-Hyprland" \
"+enter/+t" "Terminal" "(foot)" \
"" "Application Menu" "(wofi)" \
"+Shift+d" "Full Launcher" "(nwggrid)" \
"+o" "" "Open Broswer" \
"+n" "" "Open Files" \
"+q" "close focused app" "(kill)" \
"+v" "clipboard manager" "(cliphist)" \
"+r" "Resize windows" "(resize)" \
"Print" "screenshot" "(grimblast)" \
"Shift+Print" "screenshot region" "(grimblast)" \
"+Print" "screenshot window" "(grimblast)" \
"+Shift+e" "power-menu" "(wofi)" \
"+Shift+c" "Change wallpaper" "(wpaperd)" \
"+f" "Fullscreen" "Toggles to full screen" \
"+Shift+f" "fullscreenstate" "Behave full screen without full screen" \
"+m" "maximize" "Hides all the windows other then focused window" \
"+Shift+Spacebar" "Float" "Toggle windows to float" \
"+p" "Dwindle effect" "pseudo" \
"+Shift+p" "Dwindle effect" "toggle split" \
"+i" "Calamares" "Install Garuda Hyprland" \
"" "" " Window closed in 60 sec."\

View file

@ -0,0 +1,109 @@
#!/bin/bash
# network_traffic.sh [-tPOLLING_INTERVAL] [NETWORK_INTERFACE...]
getopts t: __ && shift
isecs=${OPTARG:-1}
ifaces=($@)
: ${rate_max:=1000000} # maximum transfer rate for {percent}, can be overridden setting the env var
# `snore` adapted from https://blog.dhampir.no/content/sleeping-without-a-subprocess-in-bash-and-how-to-sleep-forever
# without MacOS workaround, TODO: with _snore_fd initialized separatedly, also i dont touch IFS so dont bother with it
snore() {
local IFS
[[ -n "${_snore_fd:-}" ]] || { exec {_snore_fd}<> <(:); } 2>/dev/null
read ${1:+-t "$1"} -u $_snore_fd || :
}
human_readable() {
local hrunits=( B K M G T P )
local ndigits=${#1}
local idxunit=$(( (2 + ndigits) / 3 - 1))
local lentrim=$(( ndigits - (idxunit * 3 ) ))
echo ${1::$lentrim}${hrunits[$idxunit]}
}
exit_err() {
printf '{"text": "⚠ %s", "tooltip": "%s", "class": "error"}\n' "$@"
exit
}
if test ${#ifaces[@]} -gt 0; then
# sanity check the interface names
for iface in ${ifaces[@]}; do
test -h "/sys/class/net/${iface}" || exit_err "${iface}" "${iface} is not an existing network interface name"
done
else
# default to all interfaces except `lo`
ifaces=(/sys/class/net/*)
ifaces=(${ifaces[@]##*/})
ifaces=(${ifaces[@]^(eth|wlan|enp|wlp|eno)})
fi
# sanity check polling interval
if test ${isecs} -lt 1; then
exit_err "${isecs}" "${isecs} is not a valid polling interval"
fi
# NOTE: `snore` would take a decimal interval but bash arithmetic does not
#if test $(echo "${isecs} >= 0.2" |bc) -eq 0; then
# exit_err "${isecs}" "${isecs} is not a valid polling interval"
#fi
# NOTE: `/proc/net/dev` format is:
# interface:
# RX bytes packets errs drop fifo frame compressed multicast
# TX bytes packets errs drop fifo colls carrier compressed
# NOTE: array items are:
# 0=rx_bytes 1=rx_packets 2=rx_errs 3=rx_drop
# 4=tx_bytes 5=tx_packets 6=tx_errs 7=tx_drop
for iface in ${ifaces[@]} aggregate; do
declare -a traffic_prev_${iface} traffic_curr_${iface} traffic_delt_${iface}
declare -n traffic_prev=traffic_prev_${iface}
declare -n traffic_curr=traffic_curr_${iface}
declare -n traffic_delt=traffic_delt_${iface}
traffic_prev=( 0 0 0 0 0 0 0 0 )
traffic_curr=( 0 0 0 0 0 0 0 0 )
traffic_delt=( 0 0 0 0 0 0 0 0 )
done
# TODO: rearrange the loop, do not show bogus on first iteration
while snore ${isecs} ;do
tooltip=""
traffic_delt_aggregate=( 0 0 0 0 0 0 0 0 )
readarray -s2 proc_net_dev </proc/net/dev
while read -a data; do
iface=${data[0]%:}
test "${ifaces[*]}" = "${ifaces[*]//${iface}/}" && continue
declare -n traffic_prev=traffic_prev_${iface}
declare -n traffic_curr=traffic_curr_${iface}
declare -n traffic_delt=traffic_delt_${iface}
traffic_curr=(${data[@]:1:4} ${data[@]:9:4})
#FIXME: tooltip is delayed one iteration wrt main display (but why?)
#printf -v tooltip_hr_rx '%4s⇣' $(human_readable ${traffic_delt[0]})
#printf -v tooltip_hr_tx '%4s⇡' $(human_readable ${traffic_delt[4]})
#tooltip="${tooltip:+${tooltip}\r}${iface}\t${tooltip_hr_rx}\t${tooltip_hr_tx}"
for i in {0..7}; do
(( traffic_delt[i] = ( traffic_curr[i] - traffic_prev[i] ) / isecs ))
(( traffic_delt_aggregate[i] += traffic_delt[i] ))
done
traffic_prev=(${traffic_curr[@]})
done <<<"${proc_net_dev[@]}"
printf '{"text": "%4s⇣ %4s⇡", "tooltip": "%s", "percentage": %d}\n' \
$(human_readable ${traffic_delt_aggregate[0]}) \
$(human_readable ${traffic_delt_aggregate[4]}) \
"${tooltip}" \
$(( ( traffic_delt_aggregate[0] + traffic_delt_aggregate[4] ) / rate_max ))
#printf '{"text": "%5s⇣ %5s⇡", "alt": "%s", "tooltip": "%s", "class": "%s", "percentage": %d }\n' $(human_readable ${traffic_delt[0]}) $(human_readable ${traffic_delt[4]}) '_alt' '_tooltip' '_class' 0
done
# NOTE: in waybar config (do NOT use "interval"):
# "custom/network_traffic": {
# "exec": "~/.config/waybar/scripts/network_traffic.sh",
# "return-type": "json",
# "format": "Speed: {}", // optional
# },

187
config/waybar/style.css Normal file
View file

@ -0,0 +1,187 @@
/* =============================================================================
*
* Waybar configuration
*
* Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration
*
* =========================================================================== */
/* -----------------------------------------------------------------------------
* Keyframes
* -------------------------------------------------------------------------- */
/*
Polar Night
nord0 #2e3440
nord1 #3b4252
nord2 #434c5e
nord3 #4c566a
Snow Storm
nord4 #d8dee9
nord5 #e5e9f0
nord6 #eceff4
Frost
nord7 #8fbcbb
nord8 #88c0d0
nord9 #81a1c1
nord10 #5e81ac
Aurora
nord11 #bf616a
nord12 #d08770
nord13 #ebcb8b
nord14 #a3be8c
nord15 #b48ead
*/
/* -----------------------------------------------------------------------------
* Base styles
* -------------------------------------------------------------------------- */
/* Reset all styles */
* {
color:#a3be8c;
border: 0;
border-radius: 0;
padding: 0 0;
font-family:Symbols Nerd Font Mono;
font-size: 15px;
margin-right: 5px;
margin-left: 5px;
padding-bottom:2px;
}
window#waybar {
background:rgba (0, 0, 0, 0.5);
border-radius: 20px 20px 20px 20px;
color: #D3869B;
}
#workspaces button {
padding: 2px 0px;
border-bottom: 2px;
color: #D3869B;
border-color: #d8dee9;
border-style: solid;
margin-top:2px;
}
#workspaces button.active {
border-color: #D3869B;
}
#clock, #battery, #cpu, #memory,#idle_inhibitor, #temperature,#custom-keyboard-layout, #backlight, #network, #pulseaudio, #tray, #window,#custom-launcher,#custom-power,#custom-updates ,#custom-network_traffic,#custom-weather{
padding: 0 3px;
border-bottom: 2px;
border-style: solid;
}
/* -----------------------------------------------------------------------------
* Module styles
* -------------------------------------------------------------------------- */
#clock {
color:#a3be8c;
}
#backlight {
color: #ebcb8b;
}
#battery {
color: #d8dee9;
}
#battery.charging {
color: #81a1c1;
}
@keyframes blink {
to {
color: #4c566a;
background-color: #eceff4;
}
}
#battery.critical:not(.charging) {
background: #bf616a;
color: #eceff4;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#cpu {
color:#a3be8c ;
}
#memory {
color: #d3869b;
}
#network.disabled {
color:#bf616a;
}
#network{
color:#a3be8c;
}
#network.disconnected {
color: #bf616a;
}
#pulseaudio {
color: #b48ead;
}
#pulseaudio.muted {
color: #3b4252;
}
#temperature {
color: #8fbcbb;
}
#temperature.critical {
color: #bf616a;
}
#idle_inhibitor {
color: #ebcb8b;
}
#tray {
}
#custom-launcher{
font-size: 20px;
background-image: url('/home/tulg/.config/waybar/launcher.png');
background-position: center;
background-repeat: no-repeat;
background-size: contain;
border-style: hidden;
}
#custom-power{
border-style: hidden;
margin-top:2px;
}
#window{
border-style: hidden;
margin-top:1px;
color: #D3869B;
}
#custom-keyboard-layout{
color:#d08770;
}
#custom-network_traffic{
color:#d08770;
}