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
|
let
|
||||||
cfg = config.snowhawk.playerctl;
|
cfg = config.snowhawk.playerctl;
|
||||||
|
|
||||||
keybindingsStr = lib.concatStringsSep "\n" (lib.mapAttrsToList
|
|
||||||
(hotkey: command:
|
|
||||||
lib.optionalString (command != null) ''
|
|
||||||
${hotkey}
|
|
||||||
${command}
|
|
||||||
'')
|
|
||||||
config.services.sxhkd.keybindings);
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.snowhawk.playerctl = {
|
options.snowhawk.playerctl = {
|
||||||
|
@ -27,30 +19,14 @@ in
|
||||||
playerctl
|
playerctl
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.user.services.sxhkd = {
|
snowhawk.sxhkd.enable = lib.mkDefault true;
|
||||||
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.keybindings =
|
||||||
|
let playerctl = "${pkgs.playerctl}/bin/playerctl";
|
||||||
services.sxhkd =
|
in {
|
||||||
let
|
"XF86AudioPlay" = "${playerctl} play-pause";
|
||||||
playerctl = "${pkgs.playerctl}/bin/playerctl";
|
"XF86AudioPrev" = "${playerctl} previous";
|
||||||
in
|
"XF86AudioNext" = "${playerctl} next";
|
||||||
{
|
|
||||||
keybindings = {
|
|
||||||
"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