pinwheel: Rebind media player keys to control last active player

By leveraging `playerctld` that is aware of the last used player
This commit is contained in:
Alexander Heldt
2023-11-07 11:43:03 +01:00
parent 222226b7ed
commit da7c34e31c
2 changed files with 21 additions and 19 deletions

View File

@@ -39,10 +39,28 @@ in
", XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-"
", XF86AudioMute, exec, ${toggle-output-mute}"
", XF86AudioMicMute, exec, ${toggle-input-mute}"
"$mod ALT, LEFT, exec, ${pkgs.playerctl}/bin/playerctl -p playerctld previous"
"$mod ALT, RIGHT, exec, ${pkgs.playerctl}/bin/playerctl -p playerctld next"
"$mod ALT, DOWN, exec, ${pkgs.playerctl}/bin/playerctl -p playerctld play-pause"
];
};
};
home.packages = [ pkgs.pavucontrol ];
home.packages = [
pkgs.pavucontrol
pkgs.playerctl
];
};
systemd.user.services.playerctld = {
unitConfig = {
Description = "starts playerctld daemon";
};
wantedBy = [ "default.target" ];
serviceConfig = {
ExecStart = "${pkgs.playerctl}/bin/playerctld";
};
};
}

View File

@@ -1,22 +1,6 @@
{ pkgs, lib, config, ... }:
let
hyprlandEnabled = config.mod.hyprland.enable;
in
{ pkgs, ... }:
{
home-manager.users.alex = {
home.packages = with pkgs; [
spotify
playerctl
];
wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled {
settings = {
bind = [
"$mod ALT, LEFT, exec, ${pkgs.playerctl}/bin/playerctl -p spotify previous"
"$mod ALT, RIGHT, exec, ${pkgs.playerctl}/bin/playerctl -p spotify next"
"$mod ALT, DOWN, exec, ${pkgs.playerctl}/bin/playerctl -p spotify play-pause"
];
};
};
home.packages = [ pkgs.spotify ];
};
}