From 33bee6e5fb85d5743212660203d1b7224d260f70 Mon Sep 17 00:00:00 2001 From: Michael Bradley Date: Sun, 22 Jun 2025 13:12:21 -0400 Subject: [PATCH 1/5] Framework Hyprland adjustments Better defaults for when docked --- hypr/framework.conf | 14 +++++++------- hypr/hypridle.conf | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/hypr/framework.conf b/hypr/framework.conf index cbbbaeb..1ccf214 100644 --- a/hypr/framework.conf +++ b/hypr/framework.conf @@ -5,7 +5,7 @@ monitor = eDP-1, 2880x1920@120, 0x0, 1.5 decoration { blur { enabled = true - size = 5 + size = 3 passes = 1 } @@ -37,11 +37,11 @@ gestures { workspace = 1, monitor:DP-3, default:true workspace = 2, monitor:DP-2, default:true -workspace = 3, monitor:eDP-1, default:true -workspace = 4, monitor:DP-3 -workspace = 5, monitor:DP-2 -workspace = 6, monitor:eDP-1 +workspace = 3, monitor:DP-3 +workspace = 4, monitor:DP-2 +workspace = 5, monitor:DP-3 +workspace = 6, monitor:DP-2 workspace = 7, monitor:DP-3 workspace = 8, monitor:DP-2 -workspace = 9, monitor:eDP-1 -workspace = 10, monitor:DP-3 +workspace = 9, monitor:DP-3 +workspace = 10 diff --git a/hypr/hypridle.conf b/hypr/hypridle.conf index c721bc1..a43cabf 100644 --- a/hypr/hypridle.conf +++ b/hypr/hypridle.conf @@ -19,18 +19,18 @@ listener { } listener { - timeout = 270 - on-timeout = loginctl lock-session -} - -listener { - timeout = 300 + timeout = 480 on-timeout = hyprctl dispatch dpms off on-resume = hyprctl dispatch dpms on } listener { timeout = 600 + on-timeout = loginctl lock-session +} + +listener { + timeout = 1200 on-timeout = systemctl suspend } {% endif %} From 448bdfc23171eb04e4b76a058282272b0d1469d9 Mon Sep 17 00:00:00 2001 From: Michael Bradley Date: Sun, 22 Jun 2025 13:32:57 -0400 Subject: [PATCH 2/5] Customize Framework docked bars --- eww/eww.yuck | 70 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 21 deletions(-) diff --git a/eww/eww.yuck b/eww/eww.yuck index 05b2063..90a9884 100644 --- a/eww/eww.yuck +++ b/eww/eww.yuck @@ -59,16 +59,10 @@ (tooltip (graph :value {interfaces?.[interface]?.combined_raw ?: 0} :thickness 2 :time-range 60000 :dynamic true :line-style "round" :width 60 :height 20) (label_value :text label :value {(interfaces?.[interface]?.up ?: false) ? (combined_interface ? interfaces?.[interface]?.combined : "󰶡${interfaces?.[interface]?.rx} 󰶣${interfaces?.[interface]?.tx}") : "dc"} :value_class {(interfaces?.[interface]?.up ?: false) ? "" : "disabled"})))) -(defwidget eth [] - (network_speed :label "󰈀" :interface "enp6s0")) -(defwidget wlan [] - (network_speed :label "" - {% if host.name == "chonk" %} - :interface "wlo1" - {% else %} - :interface "wlp1s0" - {% endif %} - )) +(defwidget eth [interface] + (network_speed :label "󰈀" :interface {interface})) +(defwidget wlan [interface] + (network_speed :label "" :interface {interface})) (defwidget date [] (tooltip @@ -123,6 +117,9 @@ (clicker :text "󰸉" :command "~/.config/eww/scripts/wallpaper-shell")) (defwidget sunset [] (clicker :text "" :command "python -OO ~/scripts/sunset.py")) +(defvar docked false) +(defwidget docked [] + (clicker :text {docked ? "󰌢" : "󰛧"} :command "${EWW_CMD} update docked=${!docked} ; hyprctl keyword monitor eDP-1,${docked ? "" : "disabled"}")) (defpoll brightness :interval 60 "~/.config/eww/scripts/backlight get") @@ -159,11 +156,13 @@ (box :class "right" :orientation "h" :space-evenly false :halign "end" (volume)(sep) (audio_source)(space) - (audio_sink)))) + (audio_sink)(sep) + (datetime)))) (defwidget right_bar [] (centerbox :class "bar" :orientation "h" (box :class "left" :orientation "h" :space-evenly false :halign "begin" - (workspaces :monitor "DP-1")) + (workspaces :monitor "DP-1")(sep :class "no-left-pad") + (window)) (systray :pack_direction "ltr" :icon-size 20) (box :class "right" :orientation "h" :space-evenly false :halign "end" (gametime)(space) @@ -174,29 +173,58 @@ (mountpoint :label "󰋊" :mount "/home/mbradley/hdd")(sep) (ram)(space) (cpu)(sep) - (eth)(sep) + ;(wlan :interface "wlo1")(space) + (eth :interface "enp6s0")(sep) (datetime)(sep) (power)))) (defwidget laptop_bar [] (centerbox :class "bar" :orientation "h" (box :class "left" :orientation "h" :space-evenly false :halign "begin" - (workspaces :monitor "eDP-1" :all true)(sep) + (workspaces :monitor "eDP-1" :all true)(sep :class "no-left-pad") (window)) (systray :pack_direction "ltr" :icon-size 20) (box :class "right" :orientation "h" :space-evenly false :halign "end" (weather)(sep) ;(colour_selector)(space) (sunset)(space) - (wallpaper)(sep) + (wallpaper)(space) + (docked)(sep) (ram)(space) (cpu)(sep) - (wlan)(space) + (wlan :interface "wlp1s0")(space) (battery)(sep) (brightness)(space) (volume)(sep) (datetime)(sep) (power)))) +(defwidget laptop_left_bar [] + (centerbox :class "bar" :orientation "h" + (box :class "left" :orientation "h" :space-evenly false :halign "begin" + (workspaces :monitor "DP-3" :all true)(sep :class "no-left-pad") + (window)) + (box) + (box :class "right" :orientation "h" :space-evenly false :halign "end" + (volume)(sep) + (datetime)))) +(defwidget laptop_right_bar [] + (centerbox :class "bar" :orientation "h" + (box :class "left" :orientation "h" :space-evenly false :halign "begin" + (workspaces :monitor "DP-2" :all true)(sep :class "no-left-pad") + (window)) + (systray :pack_direction "ltr" :icon-size 20) + (box :class "right" :orientation "h" :space-evenly false :halign "end" + (weather)(sep) + (sunset)(space) + (wallpaper)(space) + (docked)(sep) + (ram)(space) + (cpu)(sep) + (eth :interface "enp193s0f3u2")(space) + (battery)(sep) + (volume)(sep) + (datetime)(sep) + (power)))) (defwindow left @@ -224,7 +252,7 @@ (right_bar)) (defwindow laptop - :monitor 0 + :monitor "eDP-1" :geometry (geometry :x "0px" :y "4px" :width "1912px" @@ -235,7 +263,7 @@ :focusable false (laptop_bar)) (defwindow laptop_left - :monitor 1 + :monitor "DP-3" :geometry (geometry :x "0px" :y "4px" :width "2552px" @@ -244,9 +272,9 @@ :stacking "fg" :exclusive true :focusable false - (laptop_bar)) + (laptop_left_bar)) (defwindow laptop_right - :monitor 2 + :monitor "DP-2" :geometry (geometry :x "0px" :y "4px" :width "2552px" @@ -255,4 +283,4 @@ :stacking "fg" :exclusive true :focusable false - (laptop_bar)) + (laptop_right_bar)) From 287df92d65b8cdce2fab3513abfd9d1c3658ff0f Mon Sep 17 00:00:00 2001 From: Michael Bradley Date: Sun, 22 Jun 2025 14:25:02 -0400 Subject: [PATCH 3/5] Give EWW scripts proper extensions --- eww/eww.yuck | 22 +++++++++---------- .../{adjust-volume => adjust-volume.sh} | 0 eww/scripts/{backlight => backlight.sh} | 0 ...audio-device-id => get-audio-device-id.sh} | 0 eww/scripts/{get-audio => get-audio.sh} | 0 eww/scripts/{get-battery => get-battery.sh} | 0 .../{get-window-title => get-window-title.sh} | 0 .../{get-workspaces => get-workspaces.sh} | 0 ...tics-shell => network-statistics-shell.sh} | 0 ...twork-statistics => network-statistics.py} | 0 .../{swap-audio-sink => swap-audio-sink.sh} | 0 ...swap-audio-source => swap-audio-source.sh} | 0 .../{wallpaper-shell => wallpaper-shell.sh} | 0 13 files changed, 11 insertions(+), 11 deletions(-) rename eww/scripts/{adjust-volume => adjust-volume.sh} (100%) rename eww/scripts/{backlight => backlight.sh} (100%) rename eww/scripts/{get-audio-device-id => get-audio-device-id.sh} (100%) rename eww/scripts/{get-audio => get-audio.sh} (100%) rename eww/scripts/{get-battery => get-battery.sh} (100%) rename eww/scripts/{get-window-title => get-window-title.sh} (100%) rename eww/scripts/{get-workspaces => get-workspaces.sh} (100%) rename eww/scripts/{network-statistics-shell => network-statistics-shell.sh} (100%) rename eww/scripts/{network-statistics => network-statistics.py} (100%) rename eww/scripts/{swap-audio-sink => swap-audio-sink.sh} (100%) rename eww/scripts/{swap-audio-source => swap-audio-source.sh} (100%) rename eww/scripts/{wallpaper-shell => wallpaper-shell.sh} (100%) diff --git a/eww/eww.yuck b/eww/eww.yuck index 90a9884..6b919bb 100644 --- a/eww/eww.yuck +++ b/eww/eww.yuck @@ -16,7 +16,7 @@ (label :text " " :class "space")) -(deflisten workspaces :initial "[]" "~/.config/eww/scripts/get-workspaces") +(deflisten workspaces :initial "[]" "~/.config/eww/scripts/get-workspaces.sh") (defwidget workspaces [monitor ?all] (box :space-evenly false :class "workspaces" (for workspace in workspaces @@ -24,20 +24,20 @@ (label :text {workspace.name}))))) -(deflisten window :initial "..." "~/.config/eww/scripts/get-window-title") +(deflisten window :initial "..." "~/.config/eww/scripts/get-window-title.sh") (defwidget window [] (box (label :text {window ?: ""}))) -(deflisten audio :initial "--" "~/.config/eww/scripts/get-audio") +(deflisten audio :initial "--" "~/.config/eww/scripts/get-audio.sh") (defwidget volume [] - (eventbox :cursor {audio.muted ? "pointer" : "row-resize"} :onscroll "~/.config/eww/scripts/adjust-volume {}" :onclick "pactl set-sink-mute @DEFAULT_SINK@ toggle" + (eventbox :cursor {audio.muted ? "pointer" : "row-resize"} :onscroll "~/.config/eww/scripts/adjust-volume.sh {}" :onclick "pactl set-sink-mute @DEFAULT_SINK@ toggle" (label_value :text {audio.muted ? "󰝟" : "󰕾"} :value "${audio.volume}%" :value_class {audio.muted ? "muted" : ""}))) (defwidget audio_source [] - (eventbox :onclick "~/.config/eww/scripts/swap-audio-source" :cursor "pointer" + (eventbox :onclick "~/.config/eww/scripts/swap-audio-source.sh" :cursor "pointer" (label :text {audio.source} :class "audio-info"))) (defwidget audio_sink [] - (eventbox :onclick "~/.config/eww/scripts/swap-audio-sink" :cursor "pointer" + (eventbox :onclick "~/.config/eww/scripts/swap-audio-sink.sh" :cursor "pointer" (label :text {audio.sink} :class "audio-info"))) @@ -53,7 +53,7 @@ (label_circle :text "" :value {EWW_CPU.avg})) (defvar combined_interface true) -(deflisten interfaces :initial '{}' "~/.config/eww/scripts/network-statistics-shell 5") +(deflisten interfaces :initial '{}' "~/.config/eww/scripts/network-statistics-shell.sh 5") (defwidget network_speed [label interface] (eventbox :onclick "${EWW_CMD} update combined_interface=${!combined_interface}" :cursor {interfaces?.[interface]?.up ? "pointer" : ""} (tooltip @@ -114,7 +114,7 @@ ;(defwidget colour_selector [] ;(clicker :text "" :command "uwsm-app -- hyprpicker -a")) (defwidget wallpaper [] - (clicker :text "󰸉" :command "~/.config/eww/scripts/wallpaper-shell")) + (clicker :text "󰸉" :command "~/.config/eww/scripts/wallpaper-shell.sh")) (defwidget sunset [] (clicker :text "" :command "python -OO ~/scripts/sunset.py")) (defvar docked false) @@ -122,13 +122,13 @@ (clicker :text {docked ? "󰌢" : "󰛧"} :command "${EWW_CMD} update docked=${!docked} ; hyprctl keyword monitor eDP-1,${docked ? "" : "disabled"}")) -(defpoll brightness :interval 60 "~/.config/eww/scripts/backlight get") +(defpoll brightness :interval 60 "~/.config/eww/scripts/backlight.sh get") (defwidget brightness [] - (eventbox :onscroll "~/.config/eww/scripts/backlight {}" :cursor "row-resize" + (eventbox :onscroll "~/.config/eww/scripts/backlight.sh {}" :cursor "row-resize" (label_value :text "󰌵" :value "${brightness}%"))) -(defpoll battery :interval 30 "~/.config/eww/scripts/get-battery") +(defpoll battery :interval 30 "~/.config/eww/scripts/get-battery.sh") (defwidget battery [] (label_value :text {battery.charging ? "󰂄" : battery.icon} :value "${battery.charge}%" :value_class {battery.charge < 30 ? "alert" : ""})) diff --git a/eww/scripts/adjust-volume b/eww/scripts/adjust-volume.sh similarity index 100% rename from eww/scripts/adjust-volume rename to eww/scripts/adjust-volume.sh diff --git a/eww/scripts/backlight b/eww/scripts/backlight.sh similarity index 100% rename from eww/scripts/backlight rename to eww/scripts/backlight.sh diff --git a/eww/scripts/get-audio-device-id b/eww/scripts/get-audio-device-id.sh similarity index 100% rename from eww/scripts/get-audio-device-id rename to eww/scripts/get-audio-device-id.sh diff --git a/eww/scripts/get-audio b/eww/scripts/get-audio.sh similarity index 100% rename from eww/scripts/get-audio rename to eww/scripts/get-audio.sh diff --git a/eww/scripts/get-battery b/eww/scripts/get-battery.sh similarity index 100% rename from eww/scripts/get-battery rename to eww/scripts/get-battery.sh diff --git a/eww/scripts/get-window-title b/eww/scripts/get-window-title.sh similarity index 100% rename from eww/scripts/get-window-title rename to eww/scripts/get-window-title.sh diff --git a/eww/scripts/get-workspaces b/eww/scripts/get-workspaces.sh similarity index 100% rename from eww/scripts/get-workspaces rename to eww/scripts/get-workspaces.sh diff --git a/eww/scripts/network-statistics-shell b/eww/scripts/network-statistics-shell.sh similarity index 100% rename from eww/scripts/network-statistics-shell rename to eww/scripts/network-statistics-shell.sh diff --git a/eww/scripts/network-statistics b/eww/scripts/network-statistics.py similarity index 100% rename from eww/scripts/network-statistics rename to eww/scripts/network-statistics.py diff --git a/eww/scripts/swap-audio-sink b/eww/scripts/swap-audio-sink.sh similarity index 100% rename from eww/scripts/swap-audio-sink rename to eww/scripts/swap-audio-sink.sh diff --git a/eww/scripts/swap-audio-source b/eww/scripts/swap-audio-source.sh similarity index 100% rename from eww/scripts/swap-audio-source rename to eww/scripts/swap-audio-source.sh diff --git a/eww/scripts/wallpaper-shell b/eww/scripts/wallpaper-shell.sh similarity index 100% rename from eww/scripts/wallpaper-shell rename to eww/scripts/wallpaper-shell.sh From abbd3df78bbf9e9f1d875fb551c7a2b4126e4cd6 Mon Sep 17 00:00:00 2001 From: Michael Bradley Date: Sun, 22 Jun 2025 14:34:42 -0400 Subject: [PATCH 4/5] Minor EWW script cleanup --- eww/scripts/adjust-volume.sh | 9 +++------ eww/scripts/backlight.sh | 12 ++++-------- eww/scripts/get-audio-device-id.sh | 15 +++++---------- eww/scripts/network-statistics-shell.sh | 2 +- eww/scripts/network-statistics.py | 20 ++++++++++---------- 5 files changed, 23 insertions(+), 35 deletions(-) diff --git a/eww/scripts/adjust-volume.sh b/eww/scripts/adjust-volume.sh index 2dc9f06..9001c4f 100755 --- a/eww/scripts/adjust-volume.sh +++ b/eww/scripts/adjust-volume.sh @@ -3,10 +3,7 @@ DELTA="1%" case "$1" in - "up") pactl set-sink-volume @DEFAULT_SINK@ +"$DELTA" - ;; - "down") pactl set-sink-volume @DEFAULT_SINK@ -"$DELTA" - ;; - *) exit 1 - ;; + up) pactl set-sink-volume @DEFAULT_SINK@ +"$DELTA";; + down) pactl set-sink-volume @DEFAULT_SINK@ -"$DELTA";; + *) exit 1;; esac diff --git a/eww/scripts/backlight.sh b/eww/scripts/backlight.sh index eb9b8c1..e634f88 100755 --- a/eww/scripts/backlight.sh +++ b/eww/scripts/backlight.sh @@ -3,12 +3,8 @@ DELTA="1%" case "$1" in - up) brightnessctl -m -c backlight set +"$DELTA" - ;; - down) brightnessctl -m -c backlight set "$DELTA"- - ;; - get) brightnessctl -m -c backlight get - ;; - *) echo "Unrecognized command"; exit 1 - ;; + up) brightnessctl -m -c backlight set +"$DELTA";; + down) brightnessctl -m -c backlight set "$DELTA"-;; + get) brightnessctl -m -c backlight get;; + *) echo "Unrecognized command"; exit 1;; esac diff --git a/eww/scripts/get-audio-device-id.sh b/eww/scripts/get-audio-device-id.sh index 8b13c59..7c29c8e 100755 --- a/eww/scripts/get-audio-device-id.sh +++ b/eww/scripts/get-audio-device-id.sh @@ -11,14 +11,9 @@ get_or_default() { } case "$1" in - "headphones") echo "$DEFAULT_HEADPHONES" # TODO: Figure out generic regex string to match headphones - ;; - "speakers") get_or_default 'sinks' 'HiFi__Headphones__sink' "$DEFAULT_SPEAKERS" - ;; - "headphone_mic") echo "$DEFAULT_HEADPHONE_MIC" # TODO: Figure out generic regex string to match headphone mic - ;; - "blue_mic") get_or_default 'sources' 'Generic_Blue_Microphones[a-zA-Z0-9_.\\-]+\\.analog-stereo$' "$DEFAULT_BLUE_MIC" - ;; - *) echo "Device name '$1' not recognized"; exit 1 - ;; + headphones) echo "$DEFAULT_HEADPHONES";; # TODO: Figure out generic regex string to match headphones + speakers) get_or_default 'sinks' 'HiFi__Headphones__sink' "$DEFAULT_SPEAKERS";; + headphone_mic) echo "$DEFAULT_HEADPHONE_MIC";; # TODO: Figure out generic regex string to match headphone mic + blue_mic) get_or_default 'sources' 'Generic_Blue_Microphones[a-zA-Z0-9_.\\-]+\\.analog-stereo$' "$DEFAULT_BLUE_MIC";; + *) echo "Device name '$1' not recognized"; exit 1;; esac diff --git a/eww/scripts/network-statistics-shell.sh b/eww/scripts/network-statistics-shell.sh index 7ff6043..57cd8ba 100755 --- a/eww/scripts/network-statistics-shell.sh +++ b/eww/scripts/network-statistics-shell.sh @@ -1,4 +1,4 @@ #!/bin/env sh # EWW doesn't seem to like listening to Python scripts directly, but this wrapper seems to work fine -"$(dirname "$0")"/network-statistics $@ +"$(dirname "$0")"/network-statistics "$@" diff --git a/eww/scripts/network-statistics.py b/eww/scripts/network-statistics.py index bf46e1f..6d7a06b 100755 --- a/eww/scripts/network-statistics.py +++ b/eww/scripts/network-statistics.py @@ -9,14 +9,14 @@ from typing import Literal, NoReturn def get_interfaces() -> list[Path]: - return list(Path("/sys/class/net/").glob("*")) + return list(Path("/sys/class/net/").iterdir()) class TransferredBytes: def __init__(self, interface: Path, statistic: Literal["tx"] | Literal["rx"]) -> None: - self._statistic = interface / f"statistics/{statistic}_bytes" - self._current = int(self._statistic.read_text()) - self._previous = self._current + self._statistic: Path = interface / f"statistics/{statistic}_bytes" + self._current: int = int(self._statistic.read_text()) + self._previous: int = self._current def update(self) -> None: self._previous = self._current @@ -28,7 +28,7 @@ class TransferredBytes: class Status: def __init__(self, interface: Path) -> None: - self._statistic = interface / "operstate" + self._statistic: Path = interface / "operstate" def up(self) -> bool: return self._statistic.read_text().strip() == "up" @@ -56,10 +56,10 @@ def format_bytes(num: float) -> str: class Interface: def __init__(self, location: Path) -> None: - self._location = location - self._tx = TransferredBytes(location, "tx") - self._rx = TransferredBytes(location, "rx") - self._status = Status(location) + self._location: Path = location + self._tx: TransferredBytes = TransferredBytes(location, "tx") + self._rx: TransferredBytes = TransferredBytes(location, "rx") + self._status: Status = Status(location) @property def name(self) -> str: @@ -84,7 +84,7 @@ class Interface: class Statistics: def __init__(self) -> None: - self._interfaces = [Interface(location) for location in get_interfaces()] + self._interfaces: list[Interface] = [Interface(location) for location in get_interfaces()] def update(self) -> None: for interface in self._interfaces: From 3630cc2bf509776708831f35ac29733072202cc0 Mon Sep 17 00:00:00 2001 From: Michael Bradley Date: Sun, 22 Jun 2025 14:59:23 -0400 Subject: [PATCH 5/5] Stop EWW network statistics changing width --- eww/scripts/network-statistics-shell.sh | 2 +- .../{network-statistics.py => network_statistics.py} | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) rename eww/scripts/{network-statistics.py => network_statistics.py} (94%) diff --git a/eww/scripts/network-statistics-shell.sh b/eww/scripts/network-statistics-shell.sh index 57cd8ba..067c4b9 100755 --- a/eww/scripts/network-statistics-shell.sh +++ b/eww/scripts/network-statistics-shell.sh @@ -1,4 +1,4 @@ #!/bin/env sh # EWW doesn't seem to like listening to Python scripts directly, but this wrapper seems to work fine -"$(dirname "$0")"/network-statistics "$@" +python -OO "$(dirname "$0")"/network_statistics.py "$@" diff --git a/eww/scripts/network-statistics.py b/eww/scripts/network_statistics.py similarity index 94% rename from eww/scripts/network-statistics.py rename to eww/scripts/network_statistics.py index 6d7a06b..2979bab 100755 --- a/eww/scripts/network-statistics.py +++ b/eww/scripts/network_statistics.py @@ -35,10 +35,12 @@ class Status: def format_4_significant_digits(num: float) -> str: - if num < 100: - return f"{num:#.3g}" + assert num >= 1.0, "Doesn't properly handle numbers below 1" + if num < 999: + return f"{num:04.3g}" if num < 1000: - return f" {num:.3g}" + # Above doesn't nicely handle the special case in [999.5 1000) + return "0999" return f"{num:.4g}"