nixpkgs/nixos/modules/services/x11/window-managers/bspwm.nix

78 lines
2.5 KiB
Nix
Raw Normal View History

2014-08-09 23:31:05 +02:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.xserver.windowManager.bspwm;
in
{
options = {
services.xserver.windowManager.bspwm = {
2016-11-13 16:21:06 +01:00
enable = mkEnableOption "bspwm";
package = mkOption {
type = types.package;
default = pkgs.bspwm;
defaultText = "pkgs.bspwm";
example = "pkgs.bspwm-unstable";
description = ''
bspwm package to use.
'';
};
configFile = mkOption {
type = with types; nullOr path;
example = "${pkgs.bspwm}/share/doc/bspwm/examples/bspwmrc";
default = null;
description = ''
Path to the bspwm configuration file.
If null, $HOME/.config/bspwm/bspwmrc will be used.
'';
};
2016-11-13 16:21:06 +01:00
sxhkd = {
package = mkOption {
type = types.package;
default = pkgs.sxhkd;
defaultText = "pkgs.sxhkd";
example = "pkgs.sxhkd-unstable";
description = ''
sxhkd package to use.
'';
};
2016-11-13 16:21:06 +01:00
configFile = mkOption {
type = with types; nullOr path;
example = "${pkgs.bspwm}/share/doc/bspwm/examples/sxhkdrc";
default = null;
description = ''
Path to the sxhkd configuration file.
If null, $HOME/.config/sxhkd/sxhkdrc will be used.
'';
};
};
};
2014-08-09 23:31:05 +02:00
};
config = mkIf cfg.enable {
services.xserver.windowManager.session = singleton {
2016-11-13 16:21:06 +01:00
name = "bspwm";
start = ''
export _JAVA_AWT_WM_NONREPARENTING=1
SXHKD_SHELL=/bin/sh ${cfg.sxhkd.package}/bin/sxhkd ${optionalString (cfg.sxhkd.configFile != null) "-c \"${cfg.sxhkd.configFile}\""} &
${cfg.package}/bin/bspwm ${optionalString (cfg.configFile != null) "-c \"${cfg.configFile}\""} &
2016-11-13 16:21:06 +01:00
waitPID=$!
'';
2014-08-09 23:31:05 +02:00
};
2016-11-13 16:21:06 +01:00
environment.systemPackages = [ cfg.package ];
2014-08-09 23:31:05 +02:00
};
2016-11-13 16:21:06 +01:00
imports = [
(mkRemovedOptionModule [ "services" "xserver" "windowManager" "bspwm-unstable" "enable" ]
"Use services.xserver.windowManager.bspwm.enable and set services.xserver.windowManager.bspwm.package to pkgs.bspwm-unstable to use the unstable version of bspwm.")
(mkRemovedOptionModule [ "services" "xserver" "windowManager" "bspwm" "startThroughSession" ]
"bspwm package does not provide bspwm-session anymore.")
(mkRemovedOptionModule [ "services" "xserver" "windowManager" "bspwm" "sessionScript" ]
"bspwm package does not provide bspwm-session anymore.")
];
2014-08-09 23:31:05 +02:00
}