hyprland: add volume control
This commit is contained in:
parent
7e54b6fa0f
commit
98d59e9517
@ -18,6 +18,9 @@ let
|
|||||||
in
|
in
|
||||||
if hasAttr key keyNames then keyNames."${key}" else key;
|
if hasAttr key keyNames then keyNames."${key}" else key;
|
||||||
|
|
||||||
|
wm-helpers = import ./wm-helpers.nix {inherit lib pkgs;};
|
||||||
|
inherit (wm-helpers) keysetting;
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
@ -196,6 +199,18 @@ in
|
|||||||
"$mod SHIFT, 9, movetoworkspace, 9"
|
"$mod SHIFT, 9, movetoworkspace, 9"
|
||||||
"$mod SHIFT, 0, movetoworkspace, 10"
|
"$mod SHIFT, 0, movetoworkspace, 10"
|
||||||
|
|
||||||
|
# Volume controls
|
||||||
|
",XF86AudioLowerVolume, exec, ${keysetting} volumeup"
|
||||||
|
",XF86AudioLowerVolume, exec, ${keysetting} volumedown"
|
||||||
|
",XF86AudioMute, exec, ${keysetting} mute"
|
||||||
|
",XF86AudioMicMute, exec, ${keysetting} micmute"
|
||||||
|
|
||||||
|
# brightness
|
||||||
|
",XF86KbdBrightnessDown, exec, ${keysetting} keydown"
|
||||||
|
",XF86KbdBrightnessUp, exec, ${keysetting} keyup"
|
||||||
|
",XF86MonBrightnessDown, exec, ${keysetting} mondown"
|
||||||
|
",XF86MonBrightnessUp, exec, ${keysetting} monup"
|
||||||
|
|
||||||
# Example special workspace (scratchpad)
|
# Example special workspace (scratchpad)
|
||||||
"$mod, S, togglespecialworkspace, magic"
|
"$mod, S, togglespecialworkspace, magic"
|
||||||
"$mod SHIFT, S, movetoworkspace, special:magic"
|
"$mod SHIFT, S, movetoworkspace, special:magic"
|
||||||
|
22
home/wm-helpers.nix
Normal file
22
home/wm-helpers.nix
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# TODO make this into a package
|
||||||
|
{ pkgs, ...}:
|
||||||
|
{
|
||||||
|
keysetting = pkgs.writeShellScript "keysetting" ''
|
||||||
|
wpctl=${pkgs.wireplumber}/bin/wpctl
|
||||||
|
notify_send=${pkgs.libnotify}/bin/notify-send
|
||||||
|
|
||||||
|
notifyvol () {
|
||||||
|
$notify_send "$(wpctl get-volume @DEFAULT_SINK@)"
|
||||||
|
}
|
||||||
|
|
||||||
|
setvol () {
|
||||||
|
$wpctl set-volume @DEFAULT_SINK@ "$1"
|
||||||
|
notifyvol
|
||||||
|
}
|
||||||
|
case "$1" in
|
||||||
|
volumeup) setvol 5%+ ;;
|
||||||
|
volumedown) setvol 5%- ;;
|
||||||
|
mute) $wpctl set-mute @DEFAULT_SINK@ toggle; notifyvol;;
|
||||||
|
esac
|
||||||
|
'';
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user