mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
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:
parent
ac319fd314
commit
97d183e2e4
7 changed files with 98 additions and 0 deletions
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -214,6 +214,9 @@
|
|||
|
||||
/modules/services/clipmenu.nix @DamienCassou
|
||||
|
||||
/modules/services/devilspie2.nix @dawidsowa
|
||||
/tests/modules/services/devilspie2 @dawidsowa
|
||||
|
||||
/modules/services/dropbox.nix @eyJhb
|
||||
/tests/modules/services/dropbox @eyJhb
|
||||
|
||||
|
|
|
@ -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; })
|
||||
|
|
42
modules/services/devilspie2.nix
Normal file
42
modules/services/devilspie2.nix
Normal 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;
|
||||
};
|
||||
}
|
|
@ -114,6 +114,7 @@ import nmt {
|
|||
./modules/programs/waybar
|
||||
./modules/programs/xmobar
|
||||
./modules/services/barrier
|
||||
./modules/services/devilspie2
|
||||
./modules/services/dropbox
|
||||
./modules/services/emacs
|
||||
./modules/services/fluidsynth
|
||||
|
|
11
tests/modules/services/devilspie2/config.lua
Normal file
11
tests/modules/services/devilspie2/config.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
if (get_window_class() == "Gnome-terminal") then
|
||||
make_always_on_top();
|
||||
end
|
||||
|
||||
if string.match(get_window_name(), "LibreOffice Writer") then
|
||||
maximize();
|
||||
end
|
||||
|
||||
if (get_window_class()=="Org.gnome.Nautilus") then
|
||||
set_window_geometry(1600,300,900,700);
|
||||
end
|
39
tests/modules/services/devilspie2/configuration.nix
Normal file
39
tests/modules/services/devilspie2/configuration.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{ config, pkgs, ... }: {
|
||||
config = {
|
||||
services.devilspie2 = {
|
||||
enable = true;
|
||||
|
||||
config = ''
|
||||
if (get_window_class() == "Gnome-terminal") then
|
||||
make_always_on_top();
|
||||
end
|
||||
|
||||
if string.match(get_window_name(), "LibreOffice Writer") then
|
||||
maximize();
|
||||
end
|
||||
|
||||
if (get_window_class()=="Org.gnome.Nautilus") then
|
||||
set_window_geometry(1600,300,900,700);
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(self: super: { devilspie2 = pkgs.writeScriptBin "dummy-devilspie2" ""; })
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
configlua=home-files/.config/devilspie2/config.lua
|
||||
|
||||
assertFileExists $configlua
|
||||
|
||||
assertFileContent $configlua ${./config.lua}
|
||||
|
||||
serviceFile=home-files/.config/systemd/user/devilspie2.service
|
||||
|
||||
assertFileExists $serviceFile
|
||||
|
||||
assertFileRegex $serviceFile 'ExecStart=.*/bin/devilspie2'
|
||||
'';
|
||||
};
|
||||
}
|
1
tests/modules/services/devilspie2/default.nix
Normal file
1
tests/modules/services/devilspie2/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ devilspie2-configuration = ./configuration.nix; }
|
Loading…
Reference in a new issue