diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2026-09-24 11:38:12 +0200 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2026-09-24 11:38:12 +0200 |
| commit | 031cb3311d2e451d82ed2a2e2cc8bdc4c1545ff7 (patch) | |
| tree | 7bf808a934f716beb5a0b6ba54e3415a8c3b38ac /accounts/gkleen@skadhi/shell/quickshell | |
| parent | f74334ee91366e5a02cde8d52c27cea8cf3de9fb (diff) | |
| download | nixos-031cb3311d2e451d82ed2a2e2cc8bdc4c1545ff7.tar nixos-031cb3311d2e451d82ed2a2e2cc8bdc4c1545ff7.tar.gz nixos-031cb3311d2e451d82ed2a2e2cc8bdc4c1545ff7.tar.bz2 nixos-031cb3311d2e451d82ed2a2e2cc8bdc4c1545ff7.tar.xz nixos-031cb3311d2e451d82ed2a2e2cc8bdc4c1545ff7.zip | |
...
Diffstat (limited to 'accounts/gkleen@skadhi/shell/quickshell')
| -rw-r--r-- | accounts/gkleen@skadhi/shell/quickshell/Services/Brightness.qml | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/accounts/gkleen@skadhi/shell/quickshell/Services/Brightness.qml b/accounts/gkleen@skadhi/shell/quickshell/Services/Brightness.qml index 1f133f01..fc7a5355 100644 --- a/accounts/gkleen@skadhi/shell/quickshell/Services/Brightness.qml +++ b/accounts/gkleen@skadhi/shell/quickshell/Services/Brightness.qml | |||
| @@ -12,15 +12,14 @@ Singleton { | |||
| 12 | property string subsystem: "backlight" | 12 | property string subsystem: "backlight" |
| 13 | property string device: "amdgpu_bl1" | 13 | property string device: "amdgpu_bl1" |
| 14 | 14 | ||
| 15 | property real deadzone: 5268 | ||
| 16 | property real currBrightness | 15 | property real currBrightness |
| 17 | property real exponent: 1 | 16 | property real exponent: 1 |
| 18 | 17 | ||
| 19 | function calcCurrBrightness() { | 18 | function calcCurrBrightness() { |
| 20 | if (!currFile.loaded || !maxFile.loaded) | 19 | if (!currFile.loaded || !maxFile.loaded) |
| 21 | return undefined; | 20 | return undefined; |
| 22 | const curr = Number(currFile.text()) - deadzone; | 21 | const curr = Number(currFile.text()); |
| 23 | const max = Number(maxFile.text()) - deadzone; | 22 | const max = Number(maxFile.text()); |
| 24 | const val = Math.pow(curr / max, 1 / root.exponent); | 23 | const val = Math.pow(curr / max, 1 / root.exponent); |
| 25 | return val; | 24 | return val; |
| 26 | } | 25 | } |
| @@ -49,15 +48,15 @@ Singleton { | |||
| 49 | if (typeof prev === 'undefined' || Math.abs(root.currBrightness - prev) < 0.01) | 48 | if (typeof prev === 'undefined' || Math.abs(root.currBrightness - prev) < 0.01) |
| 50 | return; | 49 | return; |
| 51 | 50 | ||
| 52 | const max = Number(maxFile.text()) - deadzone; | 51 | const max = Number(maxFile.text()); |
| 53 | const actual = Number(currFile.text()) - deadzone; | 52 | const actual = Number(currFile.text()); |
| 54 | let curr = Math.max(0, Math.min(max, Math.pow(root.currBrightness, root.exponent) * max)); | 53 | let curr = Math.max(0, Math.min(max, Math.pow(root.currBrightness, root.exponent) * max)); |
| 55 | if (Math.round(curr) == actual && curr < actual) | 54 | if (Math.round(curr) == actual && curr < actual) |
| 56 | curr = Math.max(0, actual - 1); | 55 | curr = Math.max(0, actual - 1); |
| 57 | else if (Math.round(curr) == actual && curr > actual) | 56 | else if (Math.round(curr) == actual && curr > actual) |
| 58 | curr = Math.min(max, actual + 1); | 57 | curr = Math.min(max, actual + 1); |
| 59 | // root.currBrightness = Math.pow(curr / max, 1 / root.exponent); | 58 | // root.currBrightness = Math.pow(curr / max, 1 / root.exponent); |
| 60 | Custom.Systemd.setBrightness(root.subsystem, root.device, Math.round(curr) + deadzone); | 59 | Custom.Systemd.setBrightness(root.subsystem, root.device, Math.round(curr)); |
| 61 | } | 60 | } |
| 62 | 61 | ||
| 63 | FileView { | 62 | FileView { |
