summary refs log tree commit diff
path: root/nixos/modules/services/x11/window-managers/bspwm.nix
blob: 03a1b7a72e88bbb441b51ad7dcc6cb5c96038070 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.services.xserver.windowManager.bspwm;
in

{
  options = {
    services.xserver.windowManager.bspwm = {
        enable = mkEnableOption "bspwm";
        startThroughSession = mkOption {
            type = with types; bool;
            default = false;
            description = "
                Start the window manager through the script defined in 
                sessionScript. Defaults to the the bspwm-session script
                provided by bspwm
            ";
        };
        sessionScript = mkOption {
            default = "${pkgs.bspwm}/bin/bspwm-session";
            defaultText = "(pkgs.bspwm)/bin/bspwm-session";
            description = "
                The start-session script to use. Defaults to the
                provided bspwm-session script from the bspwm package.

                Does nothing unless `bspwm.startThroughSession` is enabled
            ";
        };
    };
  };

  config = mkIf cfg.enable {
    services.xserver.windowManager.session = singleton {
      name = "bspwm";
      start = if cfg.startThroughSession
        then cfg.sessionScript
        else ''
            export _JAVA_AWT_WM_NONREPARENTING=1
            SXHKD_SHELL=/bin/sh ${pkgs.sxhkd}/bin/sxhkd -f 100 &
            ${pkgs.bspwm}/bin/bspwm
        '';
    };
    environment.systemPackages = [ pkgs.bspwm ];
  };
}