{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.xsession.windowManager.fluxbox;
in {
meta.maintainers = [ maintainers.AndersonTorres ];
options = {
xsession.windowManager.fluxbox = {
enable = mkEnableOption "Fluxbox window manager";
package = mkOption {
type = types.package;
default = pkgs.fluxbox;
defaultText = literalExpression "pkgs.fluxbox";
description = "Package to use for running Fluxbox WM.";
};
init = mkOption {
type = types.lines;
default = "";
description = ''
Init configuration for Fluxbox, written to
~/.fluxbox/init. Look at the
fluxbox
1 manpage for details.
'';
};
apps = mkOption {
type = types.lines;
default = "";
description = ''
Apps configuration for Fluxbox, written to
~/.fluxbox/apps. Look at the
fluxbox
1 manpage for details.
'';
};
keys = mkOption {
type = types.lines;
default = "";
description = ''
Keyboard shortcuts configuration for Fluxbox, written to
~/.fluxbox/keys. Look at the
fluxbox-keys
1 manpage for details.
'';
};
menu = mkOption {
type = types.lines;
default = "";
description = ''
Menu configuration for Fluxbox, written to
~/.fluxbox/menu. Look at the
fluxbox-menu
1 manpage for details.
'';
};
slitlist = mkOption {
type = types.lines;
default = "";
description = ''
Slitlist configuration for Fluxbox, written to
~/.fluxbox/slitlist. Look at the
fluxbox
1 manpage for details.
'';
};
windowmenu = mkOption {
type = types.lines;
default = "";
description = ''
Window menu configuration for Fluxbox, written to
~/.fluxbox/windowmenu. Look at the
fluxbox-menu
1
manpage for details.
'';
};
extraCommandLineArgs = mkOption {
type = with types; listOf str;
default = [ ];
example = [ "-log" "/tmp/fluxbox.log" ];
description = ''
Extra command line arguments to pass to fluxbox.
Look at the
fluxbox
1 manpage for details.
'';
};
};
};
config = mkIf cfg.enable {
assertions = [
(hm.assertions.assertPlatform "xsession.windowManager.fluxbox" pkgs
platforms.linux)
];
home.packages = [ cfg.package ];
home.file = {
".fluxbox/init" = mkIf (cfg.init != "") { text = cfg.init; };
".fluxbox/apps" = mkIf (cfg.apps != "") { text = cfg.apps; };
".fluxbox/keys" = mkIf (cfg.keys != "") { text = cfg.keys; };
".fluxbox/menu" = mkIf (cfg.menu != "") { text = cfg.menu; };
".fluxbox/slitlist" = mkIf (cfg.slitlist != "") { text = cfg.slitlist; };
".fluxbox/windowmenu" =
mkIf (cfg.windowMenu != "") { text = cfg.windowmenu; };
};
xsession.windowManager.command = concatStringsSep " "
([ "${cfg.package}/bin/fluxbox" ]
++ escapeShellArgs (remove "" cfg.extraCommandLineArgs));
};
}