From fd953c5191677355b789ea636f61de5a83fbf38c Mon Sep 17 00:00:00 2001 From: awy Date: Tue, 27 Aug 2024 17:36:26 +0300 Subject: stuff --- .config/waybar/config | 14 ++++++++----- .config/waybar/style.css | 4 ++++ .local/bin/start-portal | 7 +++++++ .local/bin/statusbar/sb-clock | 12 ++++++++++- .local/bin/statusbar/sb-doppler | 7 ++----- .local/bin/statusbar/sb-microphone | 38 ++++++++++++++++++++++------------ .local/bin/statusbar/sb-nettraf | 16 +++++++++++---- .local/bin/statusbar/sb-volume | 42 ++++++++++++++++++++++++-------------- 8 files changed, 97 insertions(+), 43 deletions(-) create mode 100755 .local/bin/start-portal diff --git a/.config/waybar/config b/.config/waybar/config index 96c66c5..0fd19e5 100644 --- a/.config/waybar/config +++ b/.config/waybar/config @@ -5,7 +5,7 @@ "reload_style_on_change": true, "modules-left": ["hyprland/workspaces", "hyprland/window"], "modules-center": [], - "modules-right": ["custom/memory","custom/doppler","custom/forecast","custom/nettraf","custom/microphone","custom/volume","custom/clock","custom/internet"], + "modules-right": ["custom/memory","custom/doppler","custom/forecast","custom/nettraf","custom/microphone","custom/volume","custom/clock","custom/internet","tray"], "hyprland/window": { "format": "{}", @@ -58,7 +58,8 @@ "signal": 16, "exec" : "sb-nettraf", "interval" : 1, - "on-click": "", + "on-click": "sb-nettraf 1", + "on-click-right": "sb-nettraf 3" }, "custom/microphone" : { @@ -66,9 +67,10 @@ "format": "{}", "signal": 8, "exec" : "sb-microphone", - "on-click": "wpctl set-mute @DEFAULT_SOURCE@ toggle; pkill -RTMIN+8 waybar", + "on-click-middle": "wpctl set-mute @DEFAULT_SOURCE@ toggle; pkill -RTMIN+8 waybar", "on-scroll-up": "wpctl set-volume @DEFAULT_SOURCE@ 0.01+; pkill -RTMIN+8 waybar", "on-scroll-down": "wpctl set-volume @DEFAULT_SOURCE@ 0.01-; pkill -RTMIN+8 waybar", + "on-click-right": "sb-microphone 3", }, "custom/volume" : { @@ -76,9 +78,10 @@ "format": "{}", "signal": 10, "exec" : "sb-volume", - "on-click": "wpctl set-mute @DEFAULT_SINK@ toggle; pkill -RTMIN+10 waybar", + "on-click-middle": "wpctl set-mute @DEFAULT_SINK@ toggle; pkill -RTMIN+10 waybar", "on-scroll-up": "wpctl set-volume @DEFAULT_SINK@ 0.01+; pkill -RTMIN+10 waybar", "on-scroll-down": "wpctl set-volume @DEFAULT_SINK@ 0.01-; pkill -RTMIN+10 waybar", + "on-click-right": "sb-volume 3", }, "custom/clock" : { @@ -87,7 +90,8 @@ "signal": 1, "exec" : "sb-clock", "interval" : 60, - "on-click": "", + "on-click": "sb-clock 1", + "on-click-right": "sb-clock 3", }, "custom/internet" : { diff --git a/.config/waybar/style.css b/.config/waybar/style.css index 1da7c10..9c03fd3 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -39,5 +39,9 @@ tooltip { } #custom-internet { + margin-right: 5px; +} + +#tray { margin-right: 15px; } diff --git a/.local/bin/start-portal b/.local/bin/start-portal new file mode 100755 index 0000000..4fe3003 --- /dev/null +++ b/.local/bin/start-portal @@ -0,0 +1,7 @@ +#!/bin/dash + +killall "xdg-desktop-portal" "xdg-desktop-portal-hyprland" "xdg-desktop-portal-wlr" +sleep "2" +"/lib/xdg-desktop-portal-hyprland" & +sleep "2" +"/lib/xdg-desktop-portal" & diff --git a/.local/bin/statusbar/sb-clock b/.local/bin/statusbar/sb-clock index bdf3590..67ad409 100755 --- a/.local/bin/statusbar/sb-clock +++ b/.local/bin/statusbar/sb-clock @@ -18,4 +18,14 @@ case "$clock" in "12") icon="πŸ•›" ;; esac -date "+%b %d (%a) $icon %H:%M" +if [ ! -n "$1" ]; then + date "+%b %d (%a) $icon %H:%M" +else + if [ "$1" -eq 1 ]; then + notify-send "This Month" "$(cal | sed "s/\<$(date +'%e'|tr -d ' ')\>/&<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" + elif [ "$1" -eq 3 ]; then + notify-send "πŸ“… Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` +- Middle click opens calcurse if installed" + fi +fi + diff --git a/.local/bin/statusbar/sb-doppler b/.local/bin/statusbar/sb-doppler index f9bb8fe..aad82c4 100755 --- a/.local/bin/statusbar/sb-doppler +++ b/.local/bin/statusbar/sb-doppler @@ -4,17 +4,14 @@ showdoppler() { hyprctl dispatch exec "[float; size 800 800;]" 'curl -s https://meteoinfo.ru/hmc-output/rmap/phenomena.gif | imv - -H 1200 -W 1200' } -sendnotif() { - notify-send "πŸ—ΊοΈ Doppler RADAR module" "\- Left click for local Doppler RADAR. -- Middle click to update RADAR location." -} if [ ! -n "$1" ]; then echo πŸŒ… else if [ "$1" -eq 1 ]; then showdoppler elif [ "$1" -eq 3 ]; then - sendnotif + notify-send "πŸ—ΊοΈ Doppler RADAR module" "\- Left click for local Doppler RADAR. +- You need to manually edit the url in the script to change location." fi fi diff --git a/.local/bin/statusbar/sb-microphone b/.local/bin/statusbar/sb-microphone index e07e0de..01a44cf 100755 --- a/.local/bin/statusbar/sb-microphone +++ b/.local/bin/statusbar/sb-microphone @@ -1,12 +1,7 @@ #!/bin/sh - +var=$1 mic="$(wpctl get-volume @DEFAULT_SOURCE@)" -# If muted, print πŸ”‡ and exit. -[ "$mic" != "${mic%\[MUTED\]}" ] && echo ο„± && exit - -mic="${mic#Volume: }" - split() { # For ommiting the . without calling and external program. IFS=$2 @@ -14,11 +9,28 @@ split() { printf '%s' "$@" } -mic="$(printf "%.0f" "$(split "$mic" ".")")" - -case 1 in - $((mic >= 1)) ) icon="πŸŽ™οΈ" ;; - * ) echo ο„± && exit ;; -esac +sig() { + if [ ! -n "$var" ]; then + if [ -n "$flag" ] ; then + echo "$icon" + else + case 1 in + $((mic >= 1)) ) icon="πŸŽ™οΈ" ;; + * ) echo ο„± && exit ;; + esac + echo "$icon $mic%" + fi + else + if [ "$var" -eq 3 ]; then + notify-send "🎀 Microphone module" "\- Shows volume πŸŽ™οΈ, ο„± if muted. +- Middle click to mute. +- Scroll to change." + fi + fi + exit +} -echo "$icon $mic%" +[ "$mic" != "${mic%\[MUTED\]}" ] && icon="ο„±" && flag=1 && sig +mic="${mic#Volume: }" +mic="$(printf "%.0f" "$(split "$mic" ".")")" +sig diff --git a/.local/bin/statusbar/sb-nettraf b/.local/bin/statusbar/sb-nettraf index 88df9bd..c9aa417 100755 --- a/.local/bin/statusbar/sb-nettraf +++ b/.local/bin/statusbar/sb-nettraf @@ -16,7 +16,15 @@ update() { 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 $tx) +if [ ! -n "$1" ]; then + 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 $tx) +else + if [ "$1" -eq 1 ]; then + hyprctl dispatch exec "[float; size 1800 1300;]" 'kitty -e sh -c "bmon"' + elif [ "$1" -eq 3 ]; then + notify-send "🌐 Network traffic module" "πŸ”»: Traffic received +πŸ”Ί: Traffic transmitted" + fi +fi diff --git a/.local/bin/statusbar/sb-volume b/.local/bin/statusbar/sb-volume index e3501d1..06dd23a 100755 --- a/.local/bin/statusbar/sb-volume +++ b/.local/bin/statusbar/sb-volume @@ -1,12 +1,7 @@ #!/bin/sh - +var=$1 vol="$(wpctl get-volume @DEFAULT_SINK@)" -# If muted, print πŸ”‡ and exit. -[ "$vol" != "${vol%\[MUTED\]}" ] && echo πŸ”‡ && exit - -vol="${vol#Volume: }" - split() { # For ommiting the . without calling and external program. IFS=$2 @@ -14,13 +9,30 @@ split() { printf '%s' "$@" } -vol="$(printf "%.0f" "$(split "$vol" ".")")" - -case 1 in - $((vol >= 70)) ) icon="πŸ”Š" ;; - $((vol >= 30)) ) icon="πŸ”‰" ;; - $((vol >= 1)) ) icon="πŸ”ˆ" ;; - * ) echo πŸ”‡ && exit ;; -esac +sig() { + if [ ! -n "$var" ]; then + if [ -n "$flag" ] ; then + echo "$icon" + else + case 1 in + $((vol >= 70)) ) icon="πŸ”Š" ;; + $((vol >= 30)) ) icon="πŸ”‰" ;; + $((vol >= 1)) ) icon="πŸ”ˆ" ;; + * ) echo πŸ”‡ && exit ;; + esac + echo "$icon $vol%" + fi + else + if [ "$var" -eq 3 ]; then + notify-send "πŸ“’ Volume module" "\- Shows volume πŸ”Š, πŸ”‡ if muted. +- Middle click to mute. +- Scroll to change." + fi + fi + exit +} -echo "$icon $vol%" +[ "$vol" != "${vol%\[MUTED\]}" ] && icon="πŸ”‡" && flag=1 && sig +vol="${vol#Volume: }" +vol="$(printf "%.0f" "$(split "$vol" ".")")" +sig -- cgit v1.2.3