xsession: deprecate xsession.windowManager
The intention is for the `xsession.windowManager` option to be available for full modules in the future. The option `xsession.windowManager.command` should now be used to specify the window manager startup command.
This commit is contained in:
parent
bcff7274f4
commit
23d3539fcb
2 changed files with 126 additions and 75 deletions
|
@ -232,12 +232,29 @@ in
|
||||||
tool in that NIX_AUTO_INSTALL is not supported.
|
tool in that NIX_AUTO_INSTALL is not supported.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
time = "2017-09-28T12:39:36+00:00";
|
time = "2017-09-28T12:39:36+00:00";
|
||||||
message = ''
|
message = ''
|
||||||
A new program module is available: 'programs.rofi';
|
A new program module is available: 'programs.rofi';
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time = "2017-09-28T21:39:45+00:00";
|
||||||
|
condition =
|
||||||
|
config.xsession.enable
|
||||||
|
&& config.xsession.windowManager.usesDeprecated;
|
||||||
|
message = ''
|
||||||
|
The 'xsession.windowManager' option is now deprecated,
|
||||||
|
please use 'xsession.windowManager.command' instead.
|
||||||
|
|
||||||
|
This change was made to prepare for window manager modules
|
||||||
|
under the 'xsession.windowManager' namespace. For example,
|
||||||
|
'xsession.windowManager.xmonad' and
|
||||||
|
'xsession.windowManager.i3'.
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,32 @@ let
|
||||||
|
|
||||||
cfg = config.xsession;
|
cfg = config.xsession;
|
||||||
|
|
||||||
|
# Hack to support xsession.windowManager.command option.
|
||||||
|
wmBaseModule = {
|
||||||
|
options = {
|
||||||
|
command = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
example = literalExample ''
|
||||||
|
let
|
||||||
|
xmonad = pkgs.xmonad-with-packages.override {
|
||||||
|
packages = self: [ self.xmonad-contrib self.taffybar ];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
"''${xmonad}/bin/xmonad";
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Window manager start command.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
usesDeprecated = mkOption {
|
||||||
|
internal = true;
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -16,16 +42,15 @@ in
|
||||||
enable = mkEnableOption "X Session";
|
enable = mkEnableOption "X Session";
|
||||||
|
|
||||||
windowManager = mkOption {
|
windowManager = mkOption {
|
||||||
type = types.str;
|
type =
|
||||||
example = literalExample ''
|
types.coercedTo
|
||||||
let
|
types.str
|
||||||
xmonad = pkgs.xmonad-with-packages.override {
|
(command: { inherit command; usesDeprecated = true; })
|
||||||
packages = self: [ self.xmonad-contrib self.taffybar ];
|
(types.submodule wmBaseModule);
|
||||||
};
|
description = ''
|
||||||
in
|
Window manager start command. DEPRECATED: Use
|
||||||
"''${xmonad}/bin/xmonad";
|
<varname>xsession.windowManager.command</varname> instead.
|
||||||
'';
|
'';
|
||||||
description = "Path to window manager to exec.";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
initExtra = mkOption {
|
initExtra = mkOption {
|
||||||
|
@ -36,75 +61,84 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable (mkMerge [
|
||||||
systemd.user.services.setxkbmap = {
|
(mkIf cfg.windowManager.usesDeprecated {
|
||||||
Unit = {
|
warnings = [
|
||||||
Description = "Set up keyboard in X";
|
("xsession.windowManager is deprecated, "
|
||||||
After = [ "graphical-session-pre.target" ];
|
+ "please use xsession.windowManager.command")
|
||||||
PartOf = [ "graphical-session.target" ];
|
];
|
||||||
|
})
|
||||||
|
|
||||||
|
{
|
||||||
|
systemd.user.services.setxkbmap = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Set up keyboard in X";
|
||||||
|
After = [ "graphical-session-pre.target" ];
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
Install = {
|
||||||
|
WantedBy = [ "graphical-session.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart =
|
||||||
|
let
|
||||||
|
args = concatStringsSep " " (
|
||||||
|
[
|
||||||
|
"-layout '${config.home.keyboard.layout}'"
|
||||||
|
"-variant '${config.home.keyboard.variant}'"
|
||||||
|
] ++
|
||||||
|
(map (v: "-option '${v}'") config.home.keyboard.options)
|
||||||
|
);
|
||||||
|
in
|
||||||
|
"${pkgs.xorg.setxkbmap}/bin/setxkbmap ${args}";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
Install = {
|
# A basic graphical session target for Home Manager.
|
||||||
WantedBy = [ "graphical-session.target" ];
|
systemd.user.targets.hm-graphical-session = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Home Manager X session";
|
||||||
|
Requires = [ "graphical-session-pre.target" ];
|
||||||
|
BindsTo = [ "graphical-session.target" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
home.file.".xsession" = {
|
||||||
Type = "oneshot";
|
mode = "555";
|
||||||
ExecStart =
|
text = ''
|
||||||
let
|
if [[ -e "$HOME/.profile" ]]; then
|
||||||
args = concatStringsSep " " (
|
. "$HOME/.profile"
|
||||||
[
|
fi
|
||||||
"-layout '${config.home.keyboard.layout}'"
|
|
||||||
"-variant '${config.home.keyboard.variant}'"
|
# If there are any running services from a previous session.
|
||||||
] ++
|
systemctl --user stop graphical-session.target graphical-session-pre.target
|
||||||
(map (v: "-option '${v}'") config.home.keyboard.options)
|
|
||||||
);
|
systemctl --user import-environment DBUS_SESSION_BUS_ADDRESS
|
||||||
in
|
systemctl --user import-environment DISPLAY
|
||||||
"${pkgs.xorg.setxkbmap}/bin/setxkbmap ${args}";
|
systemctl --user import-environment SSH_AUTH_SOCK
|
||||||
|
systemctl --user import-environment XAUTHORITY
|
||||||
|
systemctl --user import-environment XDG_DATA_DIRS
|
||||||
|
systemctl --user import-environment XDG_RUNTIME_DIR
|
||||||
|
systemctl --user import-environment XDG_SESSION_ID
|
||||||
|
|
||||||
|
systemctl --user start hm-graphical-session.target
|
||||||
|
|
||||||
|
${cfg.initExtra}
|
||||||
|
|
||||||
|
${cfg.windowManager.command}
|
||||||
|
|
||||||
|
systemctl --user stop graphical-session.target
|
||||||
|
systemctl --user stop graphical-session-pre.target
|
||||||
|
|
||||||
|
# Wait until the units actually stop.
|
||||||
|
while [[ -n "$(systemctl --user --no-legend --state=deactivating list-units)" ]]; do
|
||||||
|
sleep 0.5
|
||||||
|
done
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
]);
|
||||||
# A basic graphical session target for Home Manager.
|
|
||||||
systemd.user.targets.hm-graphical-session = {
|
|
||||||
Unit = {
|
|
||||||
Description = "Home Manager X session";
|
|
||||||
Requires = [ "graphical-session-pre.target" ];
|
|
||||||
BindsTo = [ "graphical-session.target" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
home.file.".xsession" = {
|
|
||||||
mode = "555";
|
|
||||||
text = ''
|
|
||||||
if [[ -e "$HOME/.profile" ]]; then
|
|
||||||
. "$HOME/.profile"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If there are any running services from a previous session.
|
|
||||||
systemctl --user stop graphical-session.target graphical-session-pre.target
|
|
||||||
|
|
||||||
systemctl --user import-environment DBUS_SESSION_BUS_ADDRESS
|
|
||||||
systemctl --user import-environment DISPLAY
|
|
||||||
systemctl --user import-environment SSH_AUTH_SOCK
|
|
||||||
systemctl --user import-environment XAUTHORITY
|
|
||||||
systemctl --user import-environment XDG_DATA_DIRS
|
|
||||||
systemctl --user import-environment XDG_RUNTIME_DIR
|
|
||||||
systemctl --user import-environment XDG_SESSION_ID
|
|
||||||
|
|
||||||
systemctl --user start hm-graphical-session.target
|
|
||||||
|
|
||||||
${cfg.initExtra}
|
|
||||||
|
|
||||||
${cfg.windowManager}
|
|
||||||
|
|
||||||
systemctl --user stop graphical-session.target
|
|
||||||
systemctl --user stop graphical-session-pre.target
|
|
||||||
|
|
||||||
# Wait until the units actually stop.
|
|
||||||
while [[ -n "$(systemctl --user --no-legend --state=deactivating list-units)" ]]; do
|
|
||||||
sleep 0.5
|
|
||||||
done
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue