nixos/home/modules/playerctl.nix

47 lines
965 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;
home.packages = with pkgs; [
playerctl
];
systemd.user.services.sxhkd = {
Unit = {
Description = "sxhkd service";
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "exec";
ExecStart = "${pkgs.sxhkd}/bin/sxhkd";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
services.sxhkd =
let
playerctlcmd = "${pkgs.playerctl}/bin/playerctl";
in
{
enable = true;
keybindings = {
"XF86AudioPlay" = "${playerctlcmd} play-pause";
"XF86AudioPrev" = "${playerctlcmd} previous";
"XF86AudioNext" = "${playerctlcmd} next";
};
};
};
}