diff --git a/eww/eww.yuck b/eww/eww.yuck index 6b919bb..05b2063 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.sh") +(deflisten workspaces :initial "[]" "~/.config/eww/scripts/get-workspaces") (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.sh") +(deflisten window :initial "..." "~/.config/eww/scripts/get-window-title") (defwidget window [] (box (label :text {window ?: ""}))) -(deflisten audio :initial "--" "~/.config/eww/scripts/get-audio.sh") +(deflisten audio :initial "--" "~/.config/eww/scripts/get-audio") (defwidget volume [] - (eventbox :cursor {audio.muted ? "pointer" : "row-resize"} :onscroll "~/.config/eww/scripts/adjust-volume.sh {}" :onclick "pactl set-sink-mute @DEFAULT_SINK@ toggle" + (eventbox :cursor {audio.muted ? "pointer" : "row-resize"} :onscroll "~/.config/eww/scripts/adjust-volume {}" :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.sh" :cursor "pointer" + (eventbox :onclick "~/.config/eww/scripts/swap-audio-source" :cursor "pointer" (label :text {audio.source} :class "audio-info"))) (defwidget audio_sink [] - (eventbox :onclick "~/.config/eww/scripts/swap-audio-sink.sh" :cursor "pointer" + (eventbox :onclick "~/.config/eww/scripts/swap-audio-sink" :cursor "pointer" (label :text {audio.sink} :class "audio-info"))) @@ -53,16 +53,22 @@ (label_circle :text "" :value {EWW_CPU.avg})) (defvar combined_interface true) -(deflisten interfaces :initial '{}' "~/.config/eww/scripts/network-statistics-shell.sh 5") +(deflisten interfaces :initial '{}' "~/.config/eww/scripts/network-statistics-shell 5") (defwidget network_speed [label interface] (eventbox :onclick "${EWW_CMD} update combined_interface=${!combined_interface}" :cursor {interfaces?.[interface]?.up ? "pointer" : ""} (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 [interface] - (network_speed :label "󰈀" :interface {interface})) -(defwidget wlan [interface] - (network_speed :label "" :interface {interface})) +(defwidget eth [] + (network_speed :label "󰈀" :interface "enp6s0")) +(defwidget wlan [] + (network_speed :label "" + {% if host.name == "chonk" %} + :interface "wlo1" + {% else %} + :interface "wlp1s0" + {% endif %} + )) (defwidget date [] (tooltip @@ -114,21 +120,18 @@ ;(defwidget colour_selector [] ;(clicker :text "" :command "uwsm-app -- hyprpicker -a")) (defwidget wallpaper [] - (clicker :text "󰸉" :command "~/.config/eww/scripts/wallpaper-shell.sh")) + (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.sh get") +(defpoll brightness :interval 60 "~/.config/eww/scripts/backlight get") (defwidget brightness [] - (eventbox :onscroll "~/.config/eww/scripts/backlight.sh {}" :cursor "row-resize" + (eventbox :onscroll "~/.config/eww/scripts/backlight {}" :cursor "row-resize" (label_value :text "󰌵" :value "${brightness}%"))) -(defpoll battery :interval 30 "~/.config/eww/scripts/get-battery.sh") +(defpoll battery :interval 30 "~/.config/eww/scripts/get-battery") (defwidget battery [] (label_value :text {battery.charging ? "󰂄" : battery.icon} :value "${battery.charge}%" :value_class {battery.charge < 30 ? "alert" : ""})) @@ -156,13 +159,11 @@ (box :class "right" :orientation "h" :space-evenly false :halign "end" (volume)(sep) (audio_source)(space) - (audio_sink)(sep) - (datetime)))) + (audio_sink)))) (defwidget right_bar [] (centerbox :class "bar" :orientation "h" (box :class "left" :orientation "h" :space-evenly false :halign "begin" - (workspaces :monitor "DP-1")(sep :class "no-left-pad") - (window)) + (workspaces :monitor "DP-1")) (systray :pack_direction "ltr" :icon-size 20) (box :class "right" :orientation "h" :space-evenly false :halign "end" (gametime)(space) @@ -173,58 +174,29 @@ (mountpoint :label "󰋊" :mount "/home/mbradley/hdd")(sep) (ram)(space) (cpu)(sep) - ;(wlan :interface "wlo1")(space) - (eth :interface "enp6s0")(sep) + (eth)(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 :class "no-left-pad") + (workspaces :monitor "eDP-1" :all true)(sep) (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)(space) - (docked)(sep) + (wallpaper)(sep) (ram)(space) (cpu)(sep) - (wlan :interface "wlp1s0")(space) + (wlan)(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 @@ -252,7 +224,7 @@ (right_bar)) (defwindow laptop - :monitor "eDP-1" + :monitor 0 :geometry (geometry :x "0px" :y "4px" :width "1912px" @@ -263,7 +235,7 @@ :focusable false (laptop_bar)) (defwindow laptop_left - :monitor "DP-3" + :monitor 1 :geometry (geometry :x "0px" :y "4px" :width "2552px" @@ -272,9 +244,9 @@ :stacking "fg" :exclusive true :focusable false - (laptop_left_bar)) + (laptop_bar)) (defwindow laptop_right - :monitor "DP-2" + :monitor 2 :geometry (geometry :x "0px" :y "4px" :width "2552px" @@ -283,4 +255,4 @@ :stacking "fg" :exclusive true :focusable false - (laptop_right_bar)) + (laptop_bar)) diff --git a/eww/scripts/adjust-volume b/eww/scripts/adjust-volume new file mode 100755 index 0000000..2dc9f06 --- /dev/null +++ b/eww/scripts/adjust-volume @@ -0,0 +1,12 @@ +#!/bin/env sh + +DELTA="1%" + +case "$1" in + "up") pactl set-sink-volume @DEFAULT_SINK@ +"$DELTA" + ;; + "down") pactl set-sink-volume @DEFAULT_SINK@ -"$DELTA" + ;; + *) exit 1 + ;; +esac diff --git a/eww/scripts/adjust-volume.sh b/eww/scripts/adjust-volume.sh deleted file mode 100755 index 9001c4f..0000000 --- a/eww/scripts/adjust-volume.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/env sh - -DELTA="1%" - -case "$1" in - 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 b/eww/scripts/backlight new file mode 100755 index 0000000..eb9b8c1 --- /dev/null +++ b/eww/scripts/backlight @@ -0,0 +1,14 @@ +#!/bin/env sh + +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 + ;; +esac diff --git a/eww/scripts/backlight.sh b/eww/scripts/backlight.sh deleted file mode 100755 index e634f88..0000000 --- a/eww/scripts/backlight.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/env sh - -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;; -esac diff --git a/eww/scripts/get-audio.sh b/eww/scripts/get-audio similarity index 100% rename from eww/scripts/get-audio.sh rename to eww/scripts/get-audio diff --git a/eww/scripts/get-audio-device-id.sh b/eww/scripts/get-audio-device-id similarity index 61% rename from eww/scripts/get-audio-device-id.sh rename to eww/scripts/get-audio-device-id index 7c29c8e..8b13c59 100755 --- a/eww/scripts/get-audio-device-id.sh +++ b/eww/scripts/get-audio-device-id @@ -11,9 +11,14 @@ 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/get-battery.sh b/eww/scripts/get-battery similarity index 100% rename from eww/scripts/get-battery.sh rename to eww/scripts/get-battery diff --git a/eww/scripts/get-window-title.sh b/eww/scripts/get-window-title similarity index 100% rename from eww/scripts/get-window-title.sh rename to eww/scripts/get-window-title diff --git a/eww/scripts/get-workspaces.sh b/eww/scripts/get-workspaces similarity index 100% rename from eww/scripts/get-workspaces.sh rename to eww/scripts/get-workspaces diff --git a/eww/scripts/network_statistics.py b/eww/scripts/network-statistics similarity index 75% rename from eww/scripts/network_statistics.py rename to eww/scripts/network-statistics index 2979bab..bf46e1f 100755 --- a/eww/scripts/network_statistics.py +++ b/eww/scripts/network-statistics @@ -9,14 +9,14 @@ from typing import Literal, NoReturn def get_interfaces() -> list[Path]: - return list(Path("/sys/class/net/").iterdir()) + return list(Path("/sys/class/net/").glob("*")) class TransferredBytes: def __init__(self, interface: Path, statistic: Literal["tx"] | Literal["rx"]) -> None: - self._statistic: Path = interface / f"statistics/{statistic}_bytes" - self._current: int = int(self._statistic.read_text()) - self._previous: int = self._current + self._statistic = interface / f"statistics/{statistic}_bytes" + self._current = int(self._statistic.read_text()) + self._previous = self._current def update(self) -> None: self._previous = self._current @@ -28,19 +28,17 @@ class TransferredBytes: class Status: def __init__(self, interface: Path) -> None: - self._statistic: Path = interface / "operstate" + self._statistic = interface / "operstate" def up(self) -> bool: return self._statistic.read_text().strip() == "up" def format_4_significant_digits(num: float) -> str: - assert num >= 1.0, "Doesn't properly handle numbers below 1" - if num < 999: - return f"{num:04.3g}" + if num < 100: + return f"{num:#.3g}" if num < 1000: - # Above doesn't nicely handle the special case in [999.5 1000) - return "0999" + return f" {num:.3g}" return f"{num:.4g}" @@ -58,10 +56,10 @@ def format_bytes(num: float) -> str: class Interface: def __init__(self, location: Path) -> None: - self._location: Path = location - self._tx: TransferredBytes = TransferredBytes(location, "tx") - self._rx: TransferredBytes = TransferredBytes(location, "rx") - self._status: Status = Status(location) + self._location = location + self._tx = TransferredBytes(location, "tx") + self._rx = TransferredBytes(location, "rx") + self._status = Status(location) @property def name(self) -> str: @@ -86,7 +84,7 @@ class Interface: class Statistics: def __init__(self) -> None: - self._interfaces: list[Interface] = [Interface(location) for location in get_interfaces()] + self._interfaces = [Interface(location) for location in get_interfaces()] def update(self) -> None: for interface in self._interfaces: diff --git a/eww/scripts/network-statistics-shell.sh b/eww/scripts/network-statistics-shell similarity index 67% rename from eww/scripts/network-statistics-shell.sh rename to eww/scripts/network-statistics-shell index 067c4b9..7ff6043 100755 --- a/eww/scripts/network-statistics-shell.sh +++ b/eww/scripts/network-statistics-shell @@ -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 -python -OO "$(dirname "$0")"/network_statistics.py "$@" +"$(dirname "$0")"/network-statistics $@ diff --git a/eww/scripts/swap-audio-sink.sh b/eww/scripts/swap-audio-sink similarity index 100% rename from eww/scripts/swap-audio-sink.sh rename to eww/scripts/swap-audio-sink diff --git a/eww/scripts/swap-audio-source.sh b/eww/scripts/swap-audio-source similarity index 100% rename from eww/scripts/swap-audio-source.sh rename to eww/scripts/swap-audio-source diff --git a/eww/scripts/wallpaper-shell.sh b/eww/scripts/wallpaper-shell similarity index 100% rename from eww/scripts/wallpaper-shell.sh rename to eww/scripts/wallpaper-shell diff --git a/hypr/framework.conf b/hypr/framework.conf index 1ccf214..cbbbaeb 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 = 3 + size = 5 passes = 1 } @@ -37,11 +37,11 @@ gestures { workspace = 1, monitor:DP-3, default:true workspace = 2, monitor:DP-2, default:true -workspace = 3, monitor:DP-3 -workspace = 4, monitor:DP-2 -workspace = 5, monitor:DP-3 -workspace = 6, monitor:DP-2 +workspace = 3, monitor:eDP-1, default:true +workspace = 4, monitor:DP-3 +workspace = 5, monitor:DP-2 +workspace = 6, monitor:eDP-1 workspace = 7, monitor:DP-3 workspace = 8, monitor:DP-2 -workspace = 9, monitor:DP-3 -workspace = 10 +workspace = 9, monitor:eDP-1 +workspace = 10, monitor:DP-3 diff --git a/hypr/hypridle.conf b/hypr/hypridle.conf index a43cabf..c721bc1 100644 --- a/hypr/hypridle.conf +++ b/hypr/hypridle.conf @@ -19,18 +19,18 @@ listener { } listener { - timeout = 480 + timeout = 270 + on-timeout = loginctl lock-session +} + +listener { + timeout = 300 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 %}