at master 2.0 kB view raw
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7 8with lib; 9 10let 11 cfg = config.services.xserver.windowManager.bspwm; 12in 13 14{ 15 options = { 16 services.xserver.windowManager.bspwm = { 17 enable = mkEnableOption "bspwm"; 18 19 package = mkPackageOption pkgs "bspwm" { }; 20 configFile = mkOption { 21 type = with types; nullOr path; 22 example = literalExpression ''"''${pkgs.bspwm}/share/doc/bspwm/examples/bspwmrc"''; 23 default = null; 24 description = '' 25 Path to the bspwm configuration file. 26 If null, $HOME/.config/bspwm/bspwmrc will be used. 27 ''; 28 }; 29 30 sxhkd = { 31 package = mkPackageOption pkgs "sxhkd" { }; 32 configFile = mkOption { 33 type = with types; nullOr path; 34 example = literalExpression ''"''${pkgs.bspwm}/share/doc/bspwm/examples/sxhkdrc"''; 35 default = null; 36 description = '' 37 Path to the sxhkd configuration file. 38 If null, $HOME/.config/sxhkd/sxhkdrc will be used. 39 ''; 40 }; 41 }; 42 }; 43 }; 44 45 config = mkIf cfg.enable { 46 services.xserver.windowManager.session = singleton { 47 name = "bspwm"; 48 start = '' 49 export _JAVA_AWT_WM_NONREPARENTING=1 50 SXHKD_SHELL=/bin/sh ${cfg.sxhkd.package}/bin/sxhkd ${ 51 optionalString (cfg.sxhkd.configFile != null) "-c ${escapeShellArg cfg.sxhkd.configFile}" 52 } & 53 ${cfg.package}/bin/bspwm ${ 54 optionalString (cfg.configFile != null) "-c ${escapeShellArg cfg.configFile}" 55 } & 56 waitPID=$! 57 ''; 58 }; 59 environment.systemPackages = [ cfg.package ]; 60 }; 61 62 imports = [ 63 (mkRemovedOptionModule [ 64 "services" 65 "xserver" 66 "windowManager" 67 "bspwm" 68 "startThroughSession" 69 ] "bspwm package does not provide bspwm-session anymore.") 70 (mkRemovedOptionModule [ 71 "services" 72 "xserver" 73 "windowManager" 74 "bspwm" 75 "sessionScript" 76 ] "bspwm package does not provide bspwm-session anymore.") 77 ]; 78}