Compare commits
5 commits
fd62f649d0
...
3630cc2bf5
Author | SHA1 | Date | |
---|---|---|---|
3630cc2bf5 | |||
abbd3df78b | |||
287df92d65 | |||
448bdfc231 | |||
33bee6e5fb |
17 changed files with 113 additions and 95 deletions
92
eww/eww.yuck
92
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,22 +53,16 @@
|
|||
(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
|
||||
(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
|
||||
|
@ -120,18 +114,21 @@
|
|||
;(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)
|
||||
(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")
|
||||
(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" : ""}))
|
||||
|
||||
|
@ -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))
|
||||
|
|
|
@ -1,12 +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
|
9
eww/scripts/adjust-volume.sh
Executable file
9
eww/scripts/adjust-volume.sh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/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
|
|
@ -1,14 +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
|
10
eww/scripts/backlight.sh
Executable file
10
eww/scripts/backlight.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/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
|
|
@ -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
|
|
@ -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 "$@"
|
|
@ -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,17 +28,19 @@ 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"
|
||||
|
||||
|
||||
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}"
|
||||
|
||||
|
||||
|
@ -56,10 +58,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 +86,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:
|
|
@ -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
|
||||
|
|
|
@ -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 %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue