nixos/home/modules/playerctl.nix

33 lines
785 B
Nix

{ lib, config, pkgs, ... }:
let
cfg = config.snowhawk.playerctl;
in
{
options.snowhawk.playerctl = {
enable = lib.mkEnableOption "playerctl";
};
config = lib.mkIf cfg.enable {
services.playerctld.enable = true;
systemd.user.services.playerctld = {
Unit.PartOf = lib.mkForce [ "graphical-session.target" ];
Install.WantedBy = lib.mkForce [ "graphical-session.target" ];
};
home.packages = with pkgs; [
playerctl
];
snowhawk.sxhkd.enable = lib.mkDefault true;
services.sxhkd.keybindings =
let playerctl = "${pkgs.playerctl}/bin/playerctl";
in {
"XF86AudioPlay" = "${playerctl} play-pause";
"XF86AudioPrev" = "${playerctl} previous";
"XF86AudioNext" = "${playerctl} next";
};
};
}