meta: Replace custom scripts with swayosd

No idea why I didn't do this before but this significantly simplifies
things and makes the experience nicer overall.
This commit is contained in:
Donovan Glover 2024-07-10 22:28:28 -04:00
parent 0879043b17
commit e4c968bf75
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
3 changed files with 11 additions and 54 deletions

View File

@ -9,9 +9,6 @@ let
osu-backgrounds = callPackage ../packages/osu-backgrounds.nix { };
raiseVolumeScript = "hypr/raise-volume.fish";
lowerVolumeScript = "hypr/lower-volume.fish";
muteScript = "hypr/mute.fish";
gapsScript = "hypr/gaps.fish";
randomBackgroundScript = "hypr/random-bg.fish";
swapBackgroundScript = "hypr/swap-bg.fish";
@ -275,12 +272,12 @@ in
];
bindl = [
", XF86AudioMute, exec, ~/.config/${muteScript} Volume @DEFAULT_AUDIO_SINK@"
", XF86AudioRaiseVolume, exec, ~/.config/${raiseVolumeScript}"
", XF86AudioLowerVolume, exec, ~/.config/${lowerVolumeScript}"
", XF86AudioMicMute, exec, ~/.config/${muteScript} Microphone @DEFAULT_AUDIO_SOURCE@"
", XF86MonBrightnessDown, exec, brightnessctl set 5%- && ${vars.notifySend} \"Decreased brightness to\" \"$(brightnessctl get)\""
", XF86MonBrightnessUp, exec, brightnessctl set +5% && ${vars.notifySend} \"Increased brightness to\" \"$(brightnessctl get)\""
", XF86AudioMute, exec, swayosd-client --output-volume mute-toggle"
", XF86AudioRaiseVolume, exec, swayosd-client --output-volume raise"
", XF86AudioLowerVolume, exec, swayosd-client --output-volume lower"
", XF86AudioMicMute, exec, swayosd-client --input-volume mute-toggle"
", XF86MonBrightnessDown, exec, swayosd-client --brightness lower"
", XF86MonBrightnessUp, exec, swayosd-client --brightness raise"
", XF86Display, exec, ~/.config/${monitorScript}"
", XF86WLAN, exec, sleep 0.2 && ${vars.notifySend} \"WiFi\" \"$(nmcli radio wifi)\""
];
@ -306,49 +303,6 @@ in
'';
};
xdg.configFile.${raiseVolumeScript} = {
executable = true;
text = /* fish */ ''
#!/usr/bin/env fish
wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+
set VOL $(math "$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | choose 1) * 100")
${vars.notifySend} "Raised volume to" "$VOL%"
'';
};
xdg.configFile.${lowerVolumeScript} = {
executable = true;
text = /* fish */ ''
#!/usr/bin/env fish
wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
set VOL $(math "$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | choose 1) * 100")
${vars.notifySend} "Lowered volume to" "$VOL%"
'';
};
xdg.configFile.${muteScript} = {
executable = true;
text = /* fish */ ''
#!/usr/bin/env fish
wpctl set-mute "$argv[2]" toggle
set SINK $(wpctl get-volume "$argv[2]")
if test -n "$(echo $SINK | choose 2)"
${vars.notifySend} "$argv[1]" "Muted"
else
${vars.notifySend} "$argv[1]" "$(math "$(echo $SINK | choose 1) * 100")%"
end
'';
};
xdg.configFile.${setBackgroundScript} = {
executable = true;
text = /* fish */ ''

View File

@ -54,8 +54,8 @@ in
{
type = "script";
cmd = "~/.config/${volumeScript}";
on_click_left = "~/.config/hypr/raise-volume.fish";
on_click_right = "~/.config/hypr/lower-volume.fish";
on_click_left = "swayosd-client --output-volume raise";
on_click_right = "swayosd-client --output-volume lower";
mode = "watch";
}
{

3
home/swayosd.nix Normal file
View File

@ -0,0 +1,3 @@
{
services.swayosd.enable = true;
}