devilspie2: add module (#1477)

Co-authored-by: Sumner Evans <me@sumnerevans.com>
Co-authored-by: Nicolas Berbiche <nicolas@normie.dev>
This commit is contained in:
dawidsowa 2021-07-05 22:29:34 +02:00 committed by GitHub
parent ac319fd314
commit 97d183e2e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 98 additions and 0 deletions

View file

@ -159,6 +159,7 @@ let
(loadModule ./services/cbatticon.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/clipmenu.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/compton.nix { })
(loadModule ./services/devilspie2.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/dropbox.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/dunst.nix { })
(loadModule ./services/dwm-status.nix { condition = hostPlatform.isLinux; })

View file

@ -0,0 +1,42 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.devilspie2;
in {
meta.maintainers = [ maintainers.dawidsowa ];
options = {
services.devilspie2 = {
enable = mkEnableOption ''
Devilspie2, a window matching utility, allowing the user to
perform scripted actions on windows as they are created'';
config = mkOption {
type = types.lines;
default = "";
description = ''
Content of file placed in the devilspie2 config directory.
'';
example = ''
if (get_window_class() == "Gnome-terminal") then
make_always_on_top();
end
'';
};
};
};
config = mkIf cfg.enable {
systemd.user.services.devilspie2 = {
Service.ExecStart = "${pkgs.devilspie2}/bin/devilspie2";
Unit = {
Description = "devilspie2";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install.WantedBy = [ "graphical-session.target" ];
};
xdg.configFile."devilspie2/config.lua".text = cfg.config;
};
}