57 lines
1.3 KiB
Nix
57 lines
1.3 KiB
Nix
{ lib, config, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.snowhawk.playerctl;
|
|
|
|
keybindingsStr = lib.concatStringsSep "\n" (lib.mapAttrsToList
|
|
(hotkey: command:
|
|
lib.optionalString (command != null) ''
|
|
${hotkey}
|
|
${command}
|
|
'')
|
|
config.services.sxhkd.keybindings);
|
|
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
|
|
];
|
|
|
|
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" ];
|
|
};
|
|
|
|
xdg.configFile."sxhkd/sxhkdrc".text = keybindingsStr;
|
|
|
|
services.sxhkd =
|
|
let
|
|
playerctl = "${pkgs.playerctl}/bin/playerctl";
|
|
in
|
|
{
|
|
keybindings = {
|
|
"XF86AudioPlay" = "${playerctl} play-pause";
|
|
"XF86AudioPrev" = "${playerctl} previous";
|
|
"XF86AudioNext" = "${playerctl} next";
|
|
};
|
|
};
|
|
};
|
|
}
|