mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-05 08:17:01 +00:00
commit
22be829197
2 changed files with 135 additions and 0 deletions
|
@ -40,6 +40,7 @@ let
|
|||
./modules/services/activate-system.nix
|
||||
./modules/services/khd
|
||||
./modules/services/kwm
|
||||
./modules/services/chunkwm.nix
|
||||
./modules/services/emacs.nix
|
||||
./modules/services/mopidy.nix
|
||||
./modules/services/nix-daemon.nix
|
||||
|
|
134
modules/services/chunkwm.nix
Normal file
134
modules/services/chunkwm.nix
Normal file
|
@ -0,0 +1,134 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.chunkwm;
|
||||
plugins = [
|
||||
"border"
|
||||
"ffm"
|
||||
"tiling"
|
||||
];
|
||||
in {
|
||||
options = {
|
||||
services.chunkwm.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether to enable the chunkwm window manager.";
|
||||
};
|
||||
|
||||
services.chunkwm.package = mkOption {
|
||||
type = types.package;
|
||||
example = pkgs.chunkwm;
|
||||
description = "This option specifies the chunkwm package to use";
|
||||
};
|
||||
|
||||
services.chunkwm.hotload = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to enable hotload";
|
||||
};
|
||||
|
||||
services.chunkwm.extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
example = ''
|
||||
chunkc tiling::rule --owner Emacs --state tile
|
||||
'';
|
||||
description = "Additional commands for chunkwmrc";
|
||||
};
|
||||
|
||||
services.chunkwm.plugins.dir = mkOption {
|
||||
type = types.path;
|
||||
default = "/run/current-system/sw/lib/chunkwm/plugins";
|
||||
description = "Chunkwm Plugins directory";
|
||||
};
|
||||
|
||||
services.chunkwm.plugins.list = mkOption {
|
||||
type = types.listOf (types.enum plugins);
|
||||
default = plugins;
|
||||
example = ["tiling"];
|
||||
description = "Chunkwm Plugins to enable";
|
||||
};
|
||||
|
||||
services.chunkwm.plugins."border".config = mkOption {
|
||||
type = types.lines;
|
||||
default = ''
|
||||
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
|
||||
'';
|
||||
description = "Optional border plugin configuration";
|
||||
};
|
||||
|
||||
services.chunkwm.plugins."tiling".config = mkOption {
|
||||
type = types.lines;
|
||||
default = ''
|
||||
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
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
security.accessibilityPrograms = [ "${cfg.package}/bin/chunkwm" ];
|
||||
|
||||
environment.etc."chunkwmrc".text = ''
|
||||
#!/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;
|
||||
|
||||
launchd.user.agents.chunkwm = {
|
||||
path = [ cfg.package config.environment.systemPath ];
|
||||
serviceConfig.ProgramArguments = [ "${cfg.package}/bin/chunkwm" ]
|
||||
++ [ "-c" "/etc/chunkwmrc" ];
|
||||
serviceConfig.RunAtLoad = true;
|
||||
serviceConfig.KeepAlive = true;
|
||||
serviceConfig.ProcessType = "Interactive";
|
||||
# serviceConfig.StandardOutPath = "/tmp/chunkwm.out";
|
||||
# serviceConfig.StandardErrorPath = "/tmp/chunkwm.err";
|
||||
};
|
||||
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue