sxhkd: extract module from playerctld
This commit is contained in:
parent
962f1cf796
commit
c06691c45f
2 changed files with 40 additions and 31 deletions
|
@ -2,14 +2,6 @@
|
|||
|
||||
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 = {
|
||||
|
@ -27,30 +19,14 @@ in
|
|||
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" ];
|
||||
};
|
||||
snowhawk.sxhkd.enable = lib.mkDefault true;
|
||||
|
||||
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";
|
||||
};
|
||||
services.sxhkd.keybindings =
|
||||
let playerctl = "${pkgs.playerctl}/bin/playerctl";
|
||||
in {
|
||||
"XF86AudioPlay" = "${playerctl} play-pause";
|
||||
"XF86AudioPrev" = "${playerctl} previous";
|
||||
"XF86AudioNext" = "${playerctl} next";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
33
home/modules/sxhkd.nix
Normal file
33
home/modules/sxhkd.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.snowhawk.sxhkd;
|
||||
in
|
||||
{
|
||||
options.snowhawk.sxhkd = {
|
||||
enable = lib.mkEnableOption "custom sxhkd home-manager module";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
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 =
|
||||
lib.concatStringsSep "\n" (lib.mapAttrsToList
|
||||
(hotkey: command:
|
||||
lib.optionalString (command != null) ''
|
||||
${hotkey}
|
||||
${command}
|
||||
'')
|
||||
config.services.sxhkd.keybindings);
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue