2023-03-27 19:17:25 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.xserver.windowManager.qtile;
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2022-04-15 01:41:22 +00:00
|
|
|
options.services.xserver.windowManager.qtile = {
|
2024-04-21 15:54:59 +00:00
|
|
|
enable = mkEnableOption "qtile";
|
2022-04-15 01:41:22 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
package = mkPackageOption pkgs "qtile-unwrapped" { };
|
2023-03-27 19:17:25 +00:00
|
|
|
|
|
|
|
configFile = mkOption {
|
|
|
|
type = with types; nullOr path;
|
|
|
|
default = null;
|
|
|
|
example = literalExpression "./your_config.py";
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2023-03-27 19:17:25 +00:00
|
|
|
Path to the qtile configuration file.
|
|
|
|
If null, $XDG_CONFIG_HOME/qtile/config.py will be used.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
backend = mkOption {
|
|
|
|
type = types.enum [ "x11" "wayland" ];
|
|
|
|
default = "x11";
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2023-04-12 12:48:02 +00:00
|
|
|
Backend to use in qtile: `x11` or `wayland`.
|
2023-03-27 19:17:25 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
extraPackages = mkOption {
|
|
|
|
type = types.functionTo (types.listOf types.package);
|
|
|
|
default = _: [];
|
|
|
|
defaultText = literalExpression ''
|
|
|
|
python3Packages: with python3Packages; [];
|
|
|
|
'';
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2023-03-27 19:17:25 +00:00
|
|
|
Extra Python packages available to Qtile.
|
|
|
|
An example would be to include `python3Packages.qtile-extras`
|
2023-05-24 13:37:59 +00:00
|
|
|
for additional unofficial widgets.
|
2023-03-27 19:17:25 +00:00
|
|
|
'';
|
|
|
|
example = literalExpression ''
|
|
|
|
python3Packages: with python3Packages; [
|
|
|
|
qtile-extras
|
|
|
|
];
|
|
|
|
'';
|
|
|
|
};
|
2024-06-05 15:53:02 +00:00
|
|
|
|
|
|
|
finalPackage = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
visible = false;
|
|
|
|
readOnly = true;
|
|
|
|
description = "The resulting Qtile package, bundled with extra packages";
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2024-06-05 15:53:02 +00:00
|
|
|
services.xserver.windowManager.qtile.finalPackage = pkgs.python3.withPackages (p:
|
|
|
|
[ (cfg.package.unwrapped or cfg.package) ] ++ (cfg.extraPackages p)
|
|
|
|
);
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
services.xserver.windowManager.session = [{
|
|
|
|
name = "qtile";
|
|
|
|
start = ''
|
2024-06-05 15:53:02 +00:00
|
|
|
${cfg.finalPackage}/bin/qtile start -b ${cfg.backend} \
|
2023-03-27 19:17:25 +00:00
|
|
|
${optionalString (cfg.configFile != null)
|
|
|
|
"--config \"${cfg.configFile}\""} &
|
2020-04-24 23:36:52 +00:00
|
|
|
waitPID=$!
|
|
|
|
'';
|
|
|
|
}];
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
environment.systemPackages = [
|
|
|
|
# pkgs.qtile is currently a buildenv of qtile and its dependencies.
|
|
|
|
# For userland commands, we want the underlying package so that
|
|
|
|
# packages such as python don't bleed into userland and overwrite intended behavior.
|
|
|
|
(cfg.package.unwrapped or cfg.package)
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|