Compare
f94eb36f2dc8ccc756b22d4592ed98acbb8e37d1
..
8c57a511a35702ddf354f3cb52e04228a36bee82
· 1 commits
Commits
| Hash | Subject | Author | Date |
|---|---|---|---|
| 8c57a511 | fix simplebar bugs | Ryan Schanzenbacher |
@@ -4,7 +4,7 @@ with lib;
let
cfg = config.ryan.simple-bar;
- "simple-bar-upstream" = ./simple-bar-source
+ "simple-bar-upstream" = ./simple-bar-source;
in
{
options.ryan.simple-bar.enable = mkEnableOption "simple-bar";
@@ -68,7 +68,7 @@ export const Widget = React.memo(() => {
`pmset -g batt | head -1 | grep -q 'AC Power' && echo 'AC' || echo 'Batt'`,
refresh,
),
- Uebersicht.run(`pgrep caffeinate -d`),
+ Uebersicht.run(`pgrep caffeinate`),
Utils.cachedRun(
`pmset -g | awk '/lowpowermode|powermode/ {print $2; exit}'`,
refresh,
@@ -172,7 +172,7 @@ function getTransform(value) {
*/
async function toggleCaffeinate(system, caffeinate, option, pushMissive) {
const command =
- system === "x86_64" ? "caffeinate" : "arch -arch arm64 caffeinate";
+ system === "x86_64" ? "caffeinate -d" : "arch -arch arm64 caffeinate -d";
if (caffeinate.length === 0) {
Uebersicht.run(`${command} ${option} &`);
Utils.notification("Enabling caffeinate...", pushMissive);
@@ -58,7 +58,7 @@ export const Widget = React.memo(() => {
`osascript -e 'set v to get volume settings' -e 'output volume of v & output muted of v'`,
refresh,
);
- const parts = Utils.cleanupOutput(output).split(",");
+ const parts = Utils.cleanupOutput(output).split(", ");
setState({
volume: parts[0],
muted: parts[1],
@@ -71,11 +71,6 @@ export const Widget = React.memo(() => {
// Refresh the widget at the specified interval.
useWidgetRefresh(visible, getSound, refresh);
- // Update the sound settings when dragging ends.
- React.useEffect(() => {
- if (!dragging) setSound(volume);
- }, [dragging, volume]);
-
// Update the volume state when the fetched volume changes.
React.useEffect(() => {
setVolume((currentVolume) => {
@@ -106,8 +101,14 @@ export const Widget = React.memo(() => {
setVolume(value);
};
- const onMouseDown = () => setDragging(true);
- const onMouseUp = () => setDragging(false);
+ const onInteractionEnd = (e) => {
+ setDragging(false);
+ const finalVolume = parseInt(e.target.value, 10);
+ setSound(finalVolume);
+ };
+
+ // const onMouseDown = () => setDragging(true);
+ // const onMouseUp = () => setDragging(false);
const formattedVolume = `${volume.toString().padStart(2, "0")}%`;
@@ -133,8 +134,9 @@ export const Widget = React.memo(() => {
step="1"
value={volume}
className="sound__slider"
- onMouseDown={onMouseDown}
- onMouseUp={onMouseUp}
+ onMouseDown={() => setDragging(true)}
+ onMouseUp={onInteractionEnd}
+ onKeyUp={onInteractionEnd}
onChange={onChange}
/>
</div>
@@ -179,7 +179,7 @@
"showMic": true
},
"soundWidgetOptions": {
- "refreshFrequency": 20000,
+ "refreshFrequency": 5000,
"showOnDisplay": "",
"showIcon": true
},