diff options
| author | Ryan Schanzenbacher <ryan@rschanz.org> | 2026-07-09 22:38:13 -0400 |
|---|---|---|
| committer | Ryan Schanzenbacher <ryan@rschanz.org> | 2026-07-09 22:38:13 -0400 |
| commit | 8c57a511a35702ddf354f3cb52e04228a36bee82 (patch) | |
| tree | 37f63e1ce2ee05a5350f3fc1396de47b38c6d34e | |
| parent | f94eb36f2dc8ccc756b22d4592ed98acbb8e37d1 (diff) | |
fix simplebar bugs
4 files changed, 16 insertions, 14 deletions
diff --git a/users/ryan/modules/simple-bar/default.nix b/users/ryan/modules/simple-bar/default.nix index a309f61..e05fe08 100644 --- a/users/ryan/modules/simple-bar/default.nix +++ b/users/ryan/modules/simple-bar/default.nix | |||
| @@ -4,7 +4,7 @@ with lib; | |||
| 4 | 4 | ||
| 5 | let | 5 | let |
| 6 | cfg = config.ryan.simple-bar; | 6 | cfg = config.ryan.simple-bar; |
| 7 | "simple-bar-upstream" = ./simple-bar-source | 7 | "simple-bar-upstream" = ./simple-bar-source; |
| 8 | in | 8 | in |
| 9 | { | 9 | { |
| 10 | options.ryan.simple-bar.enable = mkEnableOption "simple-bar"; | 10 | options.ryan.simple-bar.enable = mkEnableOption "simple-bar"; |
diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/components/data/battery.jsx b/users/ryan/modules/simple-bar/simple-bar-source/lib/components/data/battery.jsx index 1f08af6..bfef8f0 100755 --- a/users/ryan/modules/simple-bar/simple-bar-source/lib/components/data/battery.jsx +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/components/data/battery.jsx | |||
| @@ -68,7 +68,7 @@ export const Widget = React.memo(() => { | |||
| 68 | `pmset -g batt | head -1 | grep -q 'AC Power' && echo 'AC' || echo 'Batt'`, | 68 | `pmset -g batt | head -1 | grep -q 'AC Power' && echo 'AC' || echo 'Batt'`, |
| 69 | refresh, | 69 | refresh, |
| 70 | ), | 70 | ), |
| 71 | Uebersicht.run(`pgrep caffeinate -d`), | 71 | Uebersicht.run(`pgrep caffeinate`), |
| 72 | Utils.cachedRun( | 72 | Utils.cachedRun( |
| 73 | `pmset -g | awk '/lowpowermode|powermode/ {print $2; exit}'`, | 73 | `pmset -g | awk '/lowpowermode|powermode/ {print $2; exit}'`, |
| 74 | refresh, | 74 | refresh, |
| @@ -172,7 +172,7 @@ function getTransform(value) { | |||
| 172 | */ | 172 | */ |
| 173 | async function toggleCaffeinate(system, caffeinate, option, pushMissive) { | 173 | async function toggleCaffeinate(system, caffeinate, option, pushMissive) { |
| 174 | const command = | 174 | const command = |
| 175 | system === "x86_64" ? "caffeinate" : "arch -arch arm64 caffeinate"; | 175 | system === "x86_64" ? "caffeinate -d" : "arch -arch arm64 caffeinate -d"; |
| 176 | if (caffeinate.length === 0) { | 176 | if (caffeinate.length === 0) { |
| 177 | Uebersicht.run(`${command} ${option} &`); | 177 | Uebersicht.run(`${command} ${option} &`); |
| 178 | Utils.notification("Enabling caffeinate...", pushMissive); | 178 | Utils.notification("Enabling caffeinate...", pushMissive); |
diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/components/data/sound.jsx b/users/ryan/modules/simple-bar/simple-bar-source/lib/components/data/sound.jsx index 7301426..a3c5cab 100755 --- a/users/ryan/modules/simple-bar/simple-bar-source/lib/components/data/sound.jsx +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/components/data/sound.jsx | |||
| @@ -58,7 +58,7 @@ export const Widget = React.memo(() => { | |||
| 58 | `osascript -e 'set v to get volume settings' -e 'output volume of v & output muted of v'`, | 58 | `osascript -e 'set v to get volume settings' -e 'output volume of v & output muted of v'`, |
| 59 | refresh, | 59 | refresh, |
| 60 | ); | 60 | ); |
| 61 | const parts = Utils.cleanupOutput(output).split(","); | 61 | const parts = Utils.cleanupOutput(output).split(", "); |
| 62 | setState({ | 62 | setState({ |
| 63 | volume: parts[0], | 63 | volume: parts[0], |
| 64 | muted: parts[1], | 64 | muted: parts[1], |
| @@ -71,11 +71,6 @@ export const Widget = React.memo(() => { | |||
| 71 | // Refresh the widget at the specified interval. | 71 | // Refresh the widget at the specified interval. |
| 72 | useWidgetRefresh(visible, getSound, refresh); | 72 | useWidgetRefresh(visible, getSound, refresh); |
| 73 | 73 | ||
| 74 | // Update the sound settings when dragging ends. | ||
| 75 | React.useEffect(() => { | ||
| 76 | if (!dragging) setSound(volume); | ||
| 77 | }, [dragging, volume]); | ||
| 78 | |||
| 79 | // Update the volume state when the fetched volume changes. | 74 | // Update the volume state when the fetched volume changes. |
| 80 | React.useEffect(() => { | 75 | React.useEffect(() => { |
| 81 | setVolume((currentVolume) => { | 76 | setVolume((currentVolume) => { |
| @@ -106,8 +101,14 @@ export const Widget = React.memo(() => { | |||
| 106 | setVolume(value); | 101 | setVolume(value); |
| 107 | }; | 102 | }; |
| 108 | 103 | ||
| 109 | const onMouseDown = () => setDragging(true); | 104 | const onInteractionEnd = (e) => { |
| 110 | const onMouseUp = () => setDragging(false); | 105 | setDragging(false); |
| 106 | const finalVolume = parseInt(e.target.value, 10); | ||
| 107 | setSound(finalVolume); | ||
| 108 | }; | ||
| 109 | |||
| 110 | // const onMouseDown = () => setDragging(true); | ||
| 111 | // const onMouseUp = () => setDragging(false); | ||
| 111 | 112 | ||
| 112 | const formattedVolume = `${volume.toString().padStart(2, "0")}%`; | 113 | const formattedVolume = `${volume.toString().padStart(2, "0")}%`; |
| 113 | 114 | ||
| @@ -133,8 +134,9 @@ export const Widget = React.memo(() => { | |||
| 133 | step="1" | 134 | step="1" |
| 134 | value={volume} | 135 | value={volume} |
| 135 | className="sound__slider" | 136 | className="sound__slider" |
| 136 | onMouseDown={onMouseDown} | 137 | onMouseDown={() => setDragging(true)} |
| 137 | onMouseUp={onMouseUp} | 138 | onMouseUp={onInteractionEnd} |
| 139 | onKeyUp={onInteractionEnd} | ||
| 138 | onChange={onChange} | 140 | onChange={onChange} |
| 139 | /> | 141 | /> |
| 140 | </div> | 142 | </div> |
diff --git a/users/ryan/modules/simple-bar/simplebarrc b/users/ryan/modules/simple-bar/simplebarrc index 5c5153d..1494208 100644 --- a/users/ryan/modules/simple-bar/simplebarrc +++ b/users/ryan/modules/simple-bar/simplebarrc | |||
| @@ -179,7 +179,7 @@ | |||
| 179 | "showMic": true | 179 | "showMic": true |
| 180 | }, | 180 | }, |
| 181 | "soundWidgetOptions": { | 181 | "soundWidgetOptions": { |
| 182 | "refreshFrequency": 20000, | 182 | "refreshFrequency": 5000, |
| 183 | "showOnDisplay": "", | 183 | "showOnDisplay": "", |
| 184 | "showIcon": true | 184 | "showIcon": true |
| 185 | }, | 185 | }, |
