From 36d2211220596cac384cd4d8bedc48e55cd57047 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Thu, 11 May 2023 10:32:36 -0500 Subject: [PATCH] Mic colors --- common/fish/key-bindings.fish | 1 + os/linux/eww/eww.scss | 8 ++++ os/linux/eww/eww.yuck | 79 +++++++++++++++++------------------ os/linux/hypr/hyprland.conf | 21 +++++----- 4 files changed, 58 insertions(+), 51 deletions(-) diff --git a/common/fish/key-bindings.fish b/common/fish/key-bindings.fish index 82e9f04..a12605b 100644 --- a/common/fish/key-bindings.fish +++ b/common/fish/key-bindings.fish @@ -1,4 +1,5 @@ function fish_user_key_bindings + set --export SKIM_TMUX_HEIGHT "" command -q sk && functions | grep skim_key_bindings &>/dev/null && skim_key_bindings fish_vi_key_bindings insert --no-erase diff --git a/os/linux/eww/eww.scss b/os/linux/eww/eww.scss index 0917714..1e54c74 100644 --- a/os/linux/eww/eww.scss +++ b/os/linux/eww/eww.scss @@ -67,4 +67,12 @@ $rosewater: #f5e0dc; .bar>* { padding-left: 10px; padding-right: 10px; +} + +.mic .live { + color: #f38ba8; +} + +.mic .muted { + color: #74c7ec; } \ No newline at end of file diff --git a/os/linux/eww/eww.yuck b/os/linux/eww/eww.yuck index 12569ed..1267406 100644 --- a/os/linux/eww/eww.yuck +++ b/os/linux/eww/eww.yuck @@ -2,24 +2,33 @@ (centerbox :orientation "h" (sidestuff) (box) - (music) - ) -) + (music))) + +(defwindow bar + :monitor 2 + :stacking "fg" + :exclusive true + :geometry + (geometry + :x "0%" + :y "0%" + :width "100%" + :height "31px" + :anchor "bottom center") + (bar)) (defwidget sidestuff [] - (box :class "sidestuff" :orientation "h" :space-evenly false :halign "start" :spacing 10 + (box :class "sidestuff" :orientation "h" :space-evenly false :halign "start" :spacing 20 time - ; TODO: get these to align properly - (metric :label " " - :value volume - :onchange "pamixer --set-volume {}%") - (metric :label " " - :value {EWW_RAM.used_mem_perc} - :onchange "") - (metric :label "󰋊" - :value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)} - :onchange "") - )) + ; TODO: idle inhibitor? + ; TODO: get these to align properly? + (box :class "mic" (box :class {micMuted == "false" ? "muted" : "live"} {micMuted == "false" ? " " : " "})) + {"󰕾 " + volume} + {" " + cpu} + {" " + ram} + ; TODO: brightness + ; TODO: battery + )) (defwidget music [] (box :class "music" @@ -28,36 +37,24 @@ :space-evenly false {music != "" ? "${music}" : ""})) - -(defwidget metric [label value onchange] - (box :orientation "h" - :class "metric" - :space-evenly false - (box :class "label" label) - (scale :min 0 - :max 101 - :active {onchange != ""} - :value value - :onchange onchange))) - - - (deflisten music :initial "" "playerctl --follow metadata --format '{{ title }} by {{ artist }}' || true") +; convert these to `deflisten`s as well because polling is very silly (defpoll volume :interval "1s" "pamixer --get-volume") -(defpoll time :interval "10s" - "date '+%a %b %d %H:%M:%S'") +(defpoll micVolume :interval "10s" + "pamixer --default-source --get-volume") -(defwindow bar - :monitor 2 - :stacking "fg" - :exclusive true - :geometry (geometry :x "0%" - :y "0%" - :width "100%" - :height "31px" - :anchor "bottom center") - (bar)) +(defpoll micMuted :interval "1s" + "pamixer --default-source --get-mute") + +(defpoll cpu :interval "1s" + "mpstat -o JSON | jq -r '(100 - .sysstat.hosts[0].statistics[0][\"cpu-load\"][0].idle | round | tostring)+\"%\"'") + +(defpoll ram :interval "1s" + "free | grep Mem | awk '{printf \"%.0f%\", $3/$2 * 100.0}'") + +(defpoll time :interval "1s" + "date '+%a %b %d %H:%M:%S'") diff --git a/os/linux/hypr/hyprland.conf b/os/linux/hypr/hyprland.conf index de164ae..e94b4a5 100644 --- a/os/linux/hypr/hyprland.conf +++ b/os/linux/hypr/hyprland.conf @@ -89,8 +89,10 @@ animations { dwindle { # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more - pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below - preserve_split = yes # you probably want this + # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + pseudotile = yes + preserve_split = yes + no_gaps_when_only = true } master { @@ -119,16 +121,15 @@ gestures { $mainMod = SUPER # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more -bind = $mainMod, Q, exec, wezterm -bind = $mainMod, ret, exec, wezterm bind = $mainMod, return, exec, wezterm -bind = $mainMod SHIFT, return, exec, wezterm +bind = $mainMod SHIFT, return, exec, wezterm start --always-new-process bind = $mainMod, U, exec, firefox bind = $mainMod, space, exec, wofi --show drun bind = $mainMod, C, killactive, bind = $mainMod, M, exit, bind = $mainMod, E, exec, dolphin -bind = $mainMod, V, togglefloating, +bind = $mainMod, F, togglefloating, +bind = $mainMod SHIFT, F, fullscreen, bind = $mainMod, R, exec, wofi --show drun bind = $mainMod, S, pseudo, # dwindle bind = $mainMod, P, togglesplit, # dwindle @@ -143,10 +144,10 @@ bind = $mainMod, l, movefocus, r bind = $mainMod, k, movefocus, u bind = $mainMod, j, movefocus, d -bind = $mainMod SHIFT, H, movewindow, l -bind = $mainMod SHIFT, L, movewindow, r -bind = $mainMod SHIFT, K, movewindow, u -bind = $mainMod SHIFT, J, movewindow, d +bind = $mainMod SHIFT, H, swapwindow, l +bind = $mainMod SHIFT, L, swapwindow, r +bind = $mainMod SHIFT, K, swapwindow, u +bind = $mainMod SHIFT, J, swapwindow, d bind = $mainMod SHIFT, V, exec, pamixer --default-source --toggle-mute bind = , XF86AudioMicMute, exec, pamixer --default-source --toggle-mute