2024-07-10 06:49:17 +00:00
|
|
|
{ lib, config, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.snowhawk.playerctl;
|
2024-07-13 00:15:01 +00:00
|
|
|
|
|
|
|
keybindingsStr = lib.concatStringsSep "\n" (lib.mapAttrsToList
|
|
|
|
(hotkey: command:
|
|
|
|
lib.optionalString (command != null) ''
|
|
|
|
${hotkey}
|
|
|
|
${command}
|
|
|
|
'')
|
2024-07-15 09:36:37 +00:00
|
|
|
config.services.sxhkd.keybindings);
|
2024-07-10 06:49:17 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options.snowhawk.playerctl = {
|
|
|
|
enable = lib.mkEnableOption "playerctl";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
2024-07-16 10:28:53 +00:00
|
|
|
systemd.user.services.playerctld = {
|
|
|
|
Unit = {
|
|
|
|
Description = "MPRIS media player daemon";
|
|
|
|
PartOf = [ "graphical-session.target" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
Install.WantedBy = [ "graphical-session.target" ];
|
|
|
|
|
|
|
|
Service = {
|
|
|
|
ExecStart = "${pkgs.playerctl}/bin/playerctld";
|
|
|
|
Type = "dbus";
|
|
|
|
BusName = "org.mpris.MediaPlayer2.playerctld";
|
|
|
|
};
|
|
|
|
};
|
2024-07-10 06:49:17 +00:00
|
|
|
|
|
|
|
home.packages = with pkgs; [
|
|
|
|
playerctl
|
|
|
|
];
|
|
|
|
|
2024-07-12 06:43:08 +00:00
|
|
|
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" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-07-13 00:15:01 +00:00
|
|
|
xdg.configFile."sxhkd/sxhkdrc".text = keybindingsStr;
|
|
|
|
|
2024-07-12 07:03:48 +00:00
|
|
|
services.sxhkd =
|
|
|
|
let
|
2024-07-13 00:44:48 +00:00
|
|
|
playerctl = "${pkgs.playerctl}/bin/playerctl";
|
2024-07-12 07:03:48 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
keybindings = {
|
2024-07-13 00:44:48 +00:00
|
|
|
"XF86AudioPlay" = "${playerctl} play-pause";
|
|
|
|
"XF86AudioPrev" = "${playerctl} previous";
|
|
|
|
"XF86AudioNext" = "${playerctl} next";
|
2024-07-12 07:03:48 +00:00
|
|
|
};
|
2024-07-10 06:49:17 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|