2017-06-29 05:24:02 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.chunkwm;
|
2018-08-24 21:55:38 +00:00
|
|
|
plugins = [ "border" "ffm" "tiling" ];
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2017-06-29 05:24:02 +00:00
|
|
|
options = {
|
|
|
|
services.chunkwm.enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2024-04-14 21:02:32 +00:00
|
|
|
description = "Whether to enable the chunkwm window manager.";
|
2017-06-29 05:24:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.chunkwm.package = mkOption {
|
|
|
|
type = types.package;
|
2021-10-23 13:05:52 +00:00
|
|
|
example = literalExpression "pkgs.chunkwm";
|
2024-04-14 21:02:32 +00:00
|
|
|
description = "This option specifies the chunkwm package to use.";
|
2017-06-29 05:24:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.chunkwm.hotload = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
2024-04-14 21:02:32 +00:00
|
|
|
description = "Whether to enable hotload.";
|
2017-06-29 05:24:02 +00:00
|
|
|
};
|
|
|
|
|
2017-07-03 09:45:02 +00:00
|
|
|
services.chunkwm.extraConfig = mkOption {
|
|
|
|
type = types.lines;
|
2017-10-19 20:16:09 +00:00
|
|
|
default = "";
|
|
|
|
example = ''chunkc tiling::rule --owner Emacs --state tile'';
|
2024-04-14 21:02:32 +00:00
|
|
|
description = "Additional commands for {file}`chunkwmrc`.";
|
2017-06-29 05:24:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.chunkwm.plugins.dir = mkOption {
|
|
|
|
type = types.path;
|
|
|
|
default = "/run/current-system/sw/lib/chunkwm/plugins";
|
2024-04-14 21:02:32 +00:00
|
|
|
description = "Chunkwm Plugins directory.";
|
2017-06-29 05:24:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.chunkwm.plugins.list = mkOption {
|
2017-07-03 09:45:02 +00:00
|
|
|
type = types.listOf (types.enum plugins);
|
|
|
|
default = plugins;
|
|
|
|
example = ["tiling"];
|
2024-04-14 21:02:32 +00:00
|
|
|
description = "Chunkwm Plugins to enable.";
|
2017-06-29 05:24:02 +00:00
|
|
|
};
|
|
|
|
|
2017-07-03 09:45:02 +00:00
|
|
|
services.chunkwm.plugins."border".config = mkOption {
|
2017-06-29 05:24:02 +00:00
|
|
|
type = types.lines;
|
2017-10-19 20:16:09 +00:00
|
|
|
default = ''chunkc set focused_border_color 0xffc0b18b'';
|
2024-04-14 21:02:32 +00:00
|
|
|
description = "Optional border plugin configuration.";
|
2017-07-03 09:45:02 +00:00
|
|
|
};
|
2017-06-29 05:24:02 +00:00
|
|
|
|
2017-07-03 09:45:02 +00:00
|
|
|
services.chunkwm.plugins."tiling".config = mkOption {
|
|
|
|
type = types.lines;
|
2017-10-19 20:16:09 +00:00
|
|
|
example = ''chunkc set global_desktop_mode bsp'';
|
2024-04-14 21:02:32 +00:00
|
|
|
description = "Optional tiling plugin configuration.";
|
2017-10-19 20:16:09 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
services.chunkwm.plugins."border".config = mkDefault ''
|
|
|
|
chunkc set focused_border_color 0xffc0b18b
|
|
|
|
chunkc set focused_border_width 4
|
|
|
|
chunkc set focused_border_radius 0
|
|
|
|
chunkc set focused_border_skip_floating 0
|
|
|
|
'';
|
|
|
|
|
|
|
|
services.chunkwm.plugins."tiling".config = mkDefault ''
|
2017-07-03 09:45:02 +00:00
|
|
|
chunkc set global_desktop_mode bsp
|
|
|
|
chunkc set 2_desktop_mode monocle
|
|
|
|
chunkc set 5_desktop_mode float
|
|
|
|
|
|
|
|
chunkc set 1_desktop_tree ~/.chunkwm_layouts/dev_1
|
|
|
|
|
|
|
|
chunkc set global_desktop_offset_top 25
|
|
|
|
chunkc set global_desktop_offset_bottom 15
|
|
|
|
chunkc set global_desktop_offset_left 15
|
|
|
|
chunkc set global_desktop_offset_right 15
|
|
|
|
chunkc set global_desktop_offset_gap 15
|
|
|
|
|
|
|
|
chunkc set 1_desktop_offset_top 25
|
|
|
|
chunkc set 1_desktop_offset_bottom 15
|
|
|
|
chunkc set 1_desktop_offset_left 15
|
|
|
|
chunkc set 1_desktop_offset_right 15
|
|
|
|
chunkc set 1_desktop_offset_gap 15
|
|
|
|
|
|
|
|
chunkc set 3_desktop_offset_top 15
|
|
|
|
chunkc set 3_desktop_offset_bottom 15
|
|
|
|
chunkc set 3_desktop_offset_left 15
|
|
|
|
chunkc set 3_desktop_offset_right 15
|
|
|
|
|
|
|
|
chunkc set desktop_padding_step_size 10.0
|
|
|
|
chunkc set desktop_gap_step_size 5.0
|
|
|
|
|
|
|
|
chunkc set bsp_spawn_left 1
|
|
|
|
chunkc set bsp_optimal_ratio 1.618
|
|
|
|
chunkc set bsp_split_mode optimal
|
|
|
|
chunkc set bsp_split_ratio 0.66
|
|
|
|
|
|
|
|
chunkc set window_focus_cycle monitor
|
|
|
|
chunkc set mouse_follows_focus 1
|
|
|
|
chunkc set window_float_next 0
|
|
|
|
chunkc set window_float_center 1
|
|
|
|
chunkc set window_region_locked 1
|
2017-10-19 20:16:09 +00:00
|
|
|
'';
|
2017-06-29 05:24:02 +00:00
|
|
|
|
2018-01-04 20:36:22 +00:00
|
|
|
environment.etc."chunkwmrc".source = pkgs.writeScript "etc-chunkwmrc" (
|
|
|
|
''
|
|
|
|
#!/bin/bash
|
|
|
|
chunkc core::plugin_dir ${toString cfg.plugins.dir}
|
|
|
|
chunkc core::hotload ${if cfg.hotload then "1" else "0"}
|
|
|
|
''
|
|
|
|
+ concatMapStringsSep "\n" (p: "# Config for chunkwm-${p} plugin\n"+cfg.plugins.${p}.config or "# Nothing to configure") cfg.plugins.list
|
|
|
|
+ concatMapStringsSep "\n" (p: "chunkc core::load "+p+".so") cfg.plugins.list
|
|
|
|
+ "\n" + cfg.extraConfig
|
|
|
|
);
|
2017-06-29 05:24:02 +00:00
|
|
|
|
|
|
|
launchd.user.agents.chunkwm = {
|
2017-07-03 09:45:02 +00:00
|
|
|
path = [ cfg.package config.environment.systemPath ];
|
2018-08-24 21:55:38 +00:00
|
|
|
serviceConfig.ProgramArguments = [ "${getOutput "out" cfg.package}/bin/chunkwm" ]
|
2017-07-03 09:45:02 +00:00
|
|
|
++ [ "-c" "/etc/chunkwmrc" ];
|
2017-06-29 05:24:02 +00:00
|
|
|
serviceConfig.RunAtLoad = true;
|
|
|
|
serviceConfig.KeepAlive = true;
|
|
|
|
serviceConfig.ProcessType = "Interactive";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|