home-environment: make home.keyboard
optional
When set to `null` then the `xsession` module will not attempt to manage the keyboard settings.
This commit is contained in:
parent
6cd5c8fca5
commit
b6e1d82685
|
@ -139,9 +139,12 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
home.keyboard = mkOption {
|
home.keyboard = mkOption {
|
||||||
type = keyboardSubModule;
|
type = types.nullOr keyboardSubModule;
|
||||||
default = {};
|
default = {};
|
||||||
description = "Keyboard configuration.";
|
description = ''
|
||||||
|
Keyboard configuration. Set to <literal>null</literal> to
|
||||||
|
disable Home Manager keyboard management.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
home.sessionVariables = mkOption {
|
home.sessionVariables = mkOption {
|
||||||
|
|
|
@ -66,39 +66,43 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
systemd.user.services.setxkbmap = {
|
systemd.user = {
|
||||||
Unit = {
|
services = mkIf (config.home.keyboard != null) {
|
||||||
Description = "Set up keyboard in X";
|
setxkbmap = {
|
||||||
After = [ "graphical-session-pre.target" ];
|
Unit = {
|
||||||
PartOf = [ "graphical-session.target" ];
|
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" ];
|
targets.hm-graphical-session = {
|
||||||
};
|
Unit = {
|
||||||
|
Description = "Home Manager X session";
|
||||||
Service = {
|
Requires = [ "graphical-session-pre.target" ];
|
||||||
Type = "oneshot";
|
BindsTo = [ "graphical-session.target" ];
|
||||||
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}";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# 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" ];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue