mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
autotiling: init module
This commit is contained in:
parent
7afeff9d81
commit
ac16cc25c6
5 changed files with 151 additions and 0 deletions
9
modules/misc/news/2025/10/2025-10-11_14-06-00.nix
Normal file
9
modules/misc/news/2025/10/2025-10-11_14-06-00.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
time = "2025-10-11T14:06:00+00:00";
|
||||
condition = pkgs.stdenv.hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new service is available: 'services.autotiling'.
|
||||
autotiling is a script for Sway and i3 to automatically switch the horizontal / vertical window split orientation.
|
||||
'';
|
||||
}
|
||||
70
modules/services/autotiling.nix
Normal file
70
modules/services/autotiling.nix
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
|
||||
cfg = config.services.autotiling;
|
||||
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ lib.hm.maintainers.swarsel ];
|
||||
|
||||
options.services.autotiling = {
|
||||
enable = lib.mkEnableOption "enable autotiling service";
|
||||
package = lib.mkPackageOption pkgs "autotiling" { };
|
||||
|
||||
extraArgs = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
example = [
|
||||
"--workspaces"
|
||||
"8"
|
||||
"9"
|
||||
];
|
||||
description = ''
|
||||
Extra arguments to pass to autotiling.
|
||||
'';
|
||||
};
|
||||
|
||||
systemdTarget = mkOption {
|
||||
type = types.str;
|
||||
default = "graphical-session.target";
|
||||
description = ''
|
||||
Systemd target to bind to.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "services.autotiling" pkgs lib.platforms.linux)
|
||||
];
|
||||
|
||||
systemd.user.services.autotiling = {
|
||||
Unit = {
|
||||
Description = "Split orientation manager";
|
||||
PartOf = [ cfg.systemdTarget ];
|
||||
After = [ cfg.systemdTarget ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "simple";
|
||||
Restart = "always";
|
||||
ExecStart = "${lib.getExe cfg.package} ${lib.escapeShellArgs cfg.extraArgs}";
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ cfg.systemdTarget ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue