2022-04-27 09:35:20 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
runXdgAutostart = config.services.xserver.desktopManager.runXdgAutostartIfNone;
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
{
|
2022-04-27 09:35:20 +00:00
|
|
|
options = {
|
|
|
|
services.xserver.desktopManager.runXdgAutostartIfNone = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2022-04-27 09:35:20 +00:00
|
|
|
Whether to run XDG autostart files for sessions without a desktop manager
|
|
|
|
(with only a window manager), these sessions usually don't handle XDG
|
|
|
|
autostart files by default.
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
Some services like {option}`i18n.inputMethod` and
|
|
|
|
{option}`service.earlyoom` use XDG autostart files to start.
|
|
|
|
If this option is not set to `true` and you are using
|
2022-04-27 09:35:20 +00:00
|
|
|
a window manager without a desktop manager, you need to manually start
|
2022-08-21 13:32:41 +00:00
|
|
|
them or running `dex` somewhere.
|
2022-04-27 09:35:20 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkMerge [
|
|
|
|
{
|
|
|
|
services.xserver.desktopManager.session = [
|
|
|
|
{
|
|
|
|
name = "none";
|
|
|
|
start = optionalString runXdgAutostart ''
|
|
|
|
/run/current-system/systemd/bin/systemctl --user start xdg-autostart-if-no-desktop-manager.target
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
(mkIf runXdgAutostart {
|
|
|
|
systemd.user.targets.xdg-autostart-if-no-desktop-manager = {
|
|
|
|
description = "Run XDG autostart files";
|
|
|
|
# From `plasma-workspace`, `share/systemd/user/plasma-workspace@.target`.
|
|
|
|
requires = [ "xdg-desktop-autostart.target" "graphical-session.target" ];
|
|
|
|
before = [ "xdg-desktop-autostart.target" "graphical-session.target" ];
|
|
|
|
bindsTo = [ "graphical-session.target" ];
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|