diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2025-09-10 15:57:26 +0200 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2025-09-10 15:57:26 +0200 |
| commit | d20393e077b8d97b18f4a224ddcb20caf6dac23b (patch) | |
| tree | 337a8630deecdb50a2c879754e6b34b71575bbe0 /overlays | |
| parent | 9fab3828698199718a3d2f2faf8826f77d9258f7 (diff) | |
| download | nixos-d20393e077b8d97b18f4a224ddcb20caf6dac23b.tar nixos-d20393e077b8d97b18f4a224ddcb20caf6dac23b.tar.gz nixos-d20393e077b8d97b18f4a224ddcb20caf6dac23b.tar.bz2 nixos-d20393e077b8d97b18f4a224ddcb20caf6dac23b.tar.xz nixos-d20393e077b8d97b18f4a224ddcb20caf6dac23b.zip | |
...
Diffstat (limited to 'overlays')
| -rw-r--r-- | overlays/quickshell/pipewire.patch | 28 | ||||
| -rw-r--r-- | overlays/swayosd/default.nix | 13 | ||||
| -rw-r--r-- | overlays/swayosd/exponential.patch | 57 |
3 files changed, 28 insertions, 70 deletions
diff --git a/overlays/quickshell/pipewire.patch b/overlays/quickshell/pipewire.patch index 33025d8b..2d98eefc 100644 --- a/overlays/quickshell/pipewire.patch +++ b/overlays/quickshell/pipewire.patch | |||
| @@ -211,6 +211,34 @@ index 1a1f705..ee64858 100644 | |||
| 211 | bool | 211 | bool |
| 212 | setRouteProps(qint32 routeDevice, const std::function<void*(spa_pod_builder*)>& propsCallback); | 212 | setRouteProps(qint32 routeDevice, const std::function<void*(spa_pod_builder*)>& propsCallback); |
| 213 | 213 | ||
| 214 | diff --git i/src/services/pipewire/node.cpp w/src/services/pipewire/node.cpp | ||
| 215 | index 3e68149..4721a58 100644 | ||
| 216 | --- i/src/services/pipewire/node.cpp | ||
| 217 | +++ w/src/services/pipewire/node.cpp | ||
| 218 | @@ -145,6 +145,10 @@ void PwNode::initProps(const spa_dict* props) { | ||
| 219 | this->type = PwNodeType::VideoSink; | ||
| 220 | } else if (strcmp(mediaClass, "Video/Source") == 0) { | ||
| 221 | this->type = PwNodeType::VideoSource; | ||
| 222 | + } else if (strcmp(mediaClass, "Stream/Output/Video") == 0) { | ||
| 223 | + this->type = PwNodeType::VideoOutStream; | ||
| 224 | + } else if (strcmp(mediaClass, "Stream/Input/Video") == 0) { | ||
| 225 | + this->type = PwNodeType::VideoInStream; | ||
| 226 | } | ||
| 227 | } | ||
| 228 | |||
| 229 | diff --git i/src/services/pipewire/node.hpp w/src/services/pipewire/node.hpp | ||
| 230 | index 0d4c92e..ee6f223 100644 | ||
| 231 | --- i/src/services/pipewire/node.hpp | ||
| 232 | +++ w/src/services/pipewire/node.hpp | ||
| 233 | @@ -144,6 +144,8 @@ public: | ||
| 234 | // This is equivalent to the media class `Video/Sink` and is composed of the | ||
| 235 | // @@PwNodeType.Video and @@PwNodeType.Sink flags. | ||
| 236 | VideoSink = Video | Sink, | ||
| 237 | + VideoOutStream = Video | Sink | Stream, | ||
| 238 | + VideoInStream = Video | Source | Stream, | ||
| 239 | }; | ||
| 240 | Q_ENUM(Flag); | ||
| 241 | Q_DECLARE_FLAGS(Flags, Flag); | ||
| 214 | diff --git i/src/services/pipewire/qml.cpp w/src/services/pipewire/qml.cpp | 242 | diff --git i/src/services/pipewire/qml.cpp w/src/services/pipewire/qml.cpp |
| 215 | index 9efb17e..921d12a 100644 | 243 | index 9efb17e..921d12a 100644 |
| 216 | --- i/src/services/pipewire/qml.cpp | 244 | --- i/src/services/pipewire/qml.cpp |
diff --git a/overlays/swayosd/default.nix b/overlays/swayosd/default.nix deleted file mode 100644 index 5e715dae..00000000 --- a/overlays/swayosd/default.nix +++ /dev/null | |||
| @@ -1,13 +0,0 @@ | |||
| 1 | { final, prev, sources, ... }: { | ||
| 2 | swayosd = prev.swayosd.overrideAttrs (oldAttrs: rec { | ||
| 3 | inherit (sources.swayosd) version src; | ||
| 4 | cargoDeps = prev.rustPlatform.fetchCargoVendor { | ||
| 5 | inherit (oldAttrs) pname; | ||
| 6 | inherit version src; | ||
| 7 | hash = "sha256-J2sl6/4+bRWlkvaTJtFsMqvvOxYtWLRjJcYWcu0loRE="; | ||
| 8 | }; | ||
| 9 | patches = (oldAttrs.patches or []) ++ [ | ||
| 10 | ./exponential.patch | ||
| 11 | ]; | ||
| 12 | }); | ||
| 13 | } | ||
diff --git a/overlays/swayosd/exponential.patch b/overlays/swayosd/exponential.patch deleted file mode 100644 index eb90d739..00000000 --- a/overlays/swayosd/exponential.patch +++ /dev/null | |||
| @@ -1,57 +0,0 @@ | |||
| 1 | diff --git a/src/brightness_backend/brightnessctl.rs b/src/brightness_backend/brightnessctl.rs | ||
| 2 | index ccb0e11..740fdb6 100644 | ||
| 3 | --- a/src/brightness_backend/brightnessctl.rs | ||
| 4 | +++ b/src/brightness_backend/brightnessctl.rs | ||
| 5 | @@ -107,10 +107,21 @@ impl VirtualDevice { | ||
| 6 | } | ||
| 7 | } | ||
| 8 | |||
| 9 | - fn set_percent(&mut self, mut val: u32) -> anyhow::Result<()> { | ||
| 10 | - val = val.clamp(0, 100); | ||
| 11 | - self.current = self.max.map(|max| val * max / 100); | ||
| 12 | - let _: String = self.run(("set", &*format!("{val}%")))?; | ||
| 13 | + fn val_to_percent(&mut self, val: u32) -> u32 { | ||
| 14 | + return ((val as f64 / self.get_max() as f64).powf(0.25) * 100_f64).round() as u32; | ||
| 15 | + } | ||
| 16 | + fn percent_to_val(&mut self, perc: u32) -> u32 { | ||
| 17 | + return ((perc as f64 / 100_f64).powf(4_f64) * self.get_max() as f64).round() as u32; | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + fn set_percent(&mut self, val: u32) -> anyhow::Result<()> { | ||
| 21 | + let new = self.percent_to_val(val); | ||
| 22 | + self.set_val(new) | ||
| 23 | + } | ||
| 24 | + fn set_val(&mut self, val: u32) -> anyhow::Result<()> { | ||
| 25 | + let curr = val.clamp(0, self.get_max()); | ||
| 26 | + self.current = Some(curr); | ||
| 27 | + let _: String = self.run(("set", &*format!("{curr}")))?; | ||
| 28 | Ok(()) | ||
| 29 | } | ||
| 30 | } | ||
| 31 | @@ -134,20 +145,18 @@ impl BrightnessBackend for BrightnessCtl { | ||
| 32 | |||
| 33 | fn lower(&mut self, by: u32) -> anyhow::Result<()> { | ||
| 34 | let curr = self.get_current(); | ||
| 35 | - let max = self.get_max(); | ||
| 36 | - | ||
| 37 | - let curr = curr * 100 / max; | ||
| 38 | + let mut new = self.device.val_to_percent(curr).saturating_sub(by); | ||
| 39 | + new = self.device.percent_to_val(new).min(curr.saturating_sub(1)); | ||
| 40 | |||
| 41 | - self.device.set_percent(curr.saturating_sub(by)) | ||
| 42 | + self.device.set_val(new) | ||
| 43 | } | ||
| 44 | |||
| 45 | fn raise(&mut self, by: u32) -> anyhow::Result<()> { | ||
| 46 | let curr = self.get_current(); | ||
| 47 | - let max = self.get_max(); | ||
| 48 | - | ||
| 49 | - let curr = curr * 100 / max; | ||
| 50 | + let mut new = self.device.val_to_percent(curr) + by; | ||
| 51 | + new = self.device.percent_to_val(new).max(curr + 1); | ||
| 52 | |||
| 53 | - self.device.set_percent(curr + by) | ||
| 54 | + self.device.set_val(new) | ||
| 55 | } | ||
| 56 | |||
| 57 | fn set(&mut self, val: u32) -> anyhow::Result<()> { | ||
