1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-15 17:50:53 +00: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:
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

3
.github/CODEOWNERS vendored
View file

@ -214,6 +214,9 @@
/modules/services/clipmenu.nix @DamienCassou /modules/services/clipmenu.nix @DamienCassou
/modules/services/devilspie2.nix @dawidsowa
/tests/modules/services/devilspie2 @dawidsowa
/modules/services/dropbox.nix @eyJhb /modules/services/dropbox.nix @eyJhb
/tests/modules/services/dropbox @eyJhb /tests/modules/services/dropbox @eyJhb

View file

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

View file

@ -114,6 +114,7 @@ import nmt {
./modules/programs/waybar ./modules/programs/waybar
./modules/programs/xmobar ./modules/programs/xmobar
./modules/services/barrier ./modules/services/barrier
./modules/services/devilspie2
./modules/services/dropbox ./modules/services/dropbox
./modules/services/emacs ./modules/services/emacs
./modules/services/fluidsynth ./modules/services/fluidsynth

View 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

View 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'
'';
};
}

View file

@ -0,0 +1 @@
{ devilspie2-configuration = ./configuration.nix; }