mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 00:12:56 +00:00
bspwm module: refactor
This commit is contained in:
parent
8600e38bca
commit
293da497c3
@ -539,7 +539,6 @@
|
||||
./services/x11/window-managers/fluxbox.nix
|
||||
./services/x11/window-managers/icewm.nix
|
||||
./services/x11/window-managers/bspwm.nix
|
||||
./services/x11/window-managers/bspwm-unstable.nix
|
||||
./services/x11/window-managers/metacity.nix
|
||||
./services/x11/window-managers/none.nix
|
||||
./services/x11/window-managers/twm.nix
|
||||
|
@ -1,48 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.xserver.windowManager.bspwm-unstable;
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
services.xserver.windowManager.bspwm-unstable = {
|
||||
enable = mkEnableOption "bspwm-unstable";
|
||||
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-unstable}/bin/bspwm-session";
|
||||
defaultText = "(pkgs.bspwm-unstable)/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-unstable";
|
||||
start = if cfg.startThroughSession
|
||||
then cfg.sessionScript
|
||||
else ''
|
||||
export _JAVA_AWT_WM_NONREPARENTING=1
|
||||
SXHKD_SHELL=/bin/sh ${pkgs.sxhkd-unstable}/bin/sxhkd -f 100 &
|
||||
${pkgs.bspwm-unstable}/bin/bspwm
|
||||
'';
|
||||
};
|
||||
environment.systemPackages = [ pkgs.bspwm-unstable ];
|
||||
};
|
||||
}
|
@ -9,40 +9,69 @@ 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.
|
||||
enable = mkEnableOption "bspwm";
|
||||
|
||||
Does nothing unless `bspwm.startThroughSession` is enabled
|
||||
";
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
sxhkd = {
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.sxhkd;
|
||||
defaultText = "pkgs.sxhkd";
|
||||
example = "pkgs.sxhkd-unstable";
|
||||
description = ''
|
||||
sxhkd package to use.
|
||||
'';
|
||||
};
|
||||
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.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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
|
||||
'';
|
||||
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}\""}
|
||||
waitPID=$!
|
||||
'';
|
||||
};
|
||||
environment.systemPackages = [ pkgs.bspwm ];
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
};
|
||||
|
||||
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.")
|
||||
];
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ in
|
||||
imports = [
|
||||
./afterstep.nix
|
||||
./bspwm.nix
|
||||
./bspwm-unstable.nix
|
||||
./compiz.nix
|
||||
./dwm.nix
|
||||
./exwm.nix
|
||||
|
Loading…
Reference in New Issue
Block a user