Fix swayidle command, add hibernation on lid close, fix env
The swayidle command in the service was straight up broken, this commit fixes that. Environment Variables set in the `session-variables` file are now correctly imported across the system. This fixes `EDITOR` defaulting to `nano`.
This commit is contained in:
parent
dc8257f31f
commit
6d1d683b23
|
@ -20,5 +20,6 @@ in
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
pub-solar.core.hibernation.enable = true;
|
pub-solar.core.hibernation.enable = true;
|
||||||
|
services.logind.lidSwitch = "hibernate";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
# https://github.com/swaywm/sway/wiki/Systemd-integration
|
# https://github.com/swaywm/sway/wiki/Systemd-integration
|
||||||
# Also, import the most important environment variables into the D-Bus and systemd
|
# Also, import the most important environment variables into the D-Bus and systemd
|
||||||
# user environments (e.g. required for screen sharing and Pinentry prompts):
|
# user environments (e.g. required for screen sharing and Pinentry prompts):
|
||||||
exec "systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target; exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemd-cat --identifier=sway sway"
|
exec "systemctl --user import-environment; systemctl --user start sway-session.target; exec dbus-update-activation-environment --systemd $IMPORT_ENVIRONMENT_ENV_LIST DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemd-cat --identifier=sway sway"
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
Documentation = [ "man:mako(1)" ];
|
Documentation = [ "man:mako(1)" ];
|
||||||
BindsTo = [ "sway-session.target" ];
|
BindsTo = [ "sway-session.target" ];
|
||||||
After = [ "sway-session.target" ];
|
After = [ "sway-session.target" ];
|
||||||
# ConditionEnvironment requires systemd v247 to work correctly
|
|
||||||
ConditionEnvironment = [ "WAYLAND_DISPLAY" ];
|
ConditionEnvironment = [ "WAYLAND_DISPLAY" ];
|
||||||
};
|
};
|
||||||
Service = {
|
Service = {
|
||||||
|
|
|
@ -10,17 +10,15 @@
|
||||||
Service = {
|
Service = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin";
|
Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin";
|
||||||
ExecStart = if psCfg.paranoia.enable then ''
|
ExecStart = ''${pkgs.swayidle}/bin/swayidle -w \
|
||||||
${pkgs.swayidle}/bin/swayidle -w \
|
after-resume 'swaymsg "output * dpms on"' \
|
||||||
timeout 120 'swaymsg "output * dpms off"' \
|
before-sleep 'swaylock-bg' '' + (if psCfg.paranoia.enable then '' \
|
||||||
timeout 150 'systemctl hibernate' \
|
timeout 120 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
|
||||||
'' else ''
|
timeout 150 'systemctl hibernate'
|
||||||
${pkgs.swayidle}/bin/swayidle -w \
|
'' else '' \
|
||||||
timeout 600 'swaylock-bg' \
|
timeout 600 'swaylock-bg'
|
||||||
timeout 900 'swaymsg "output * dpms off"' \
|
timeout 900 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"'
|
||||||
resume 'swaymsg "output * dpms on"' \
|
'');
|
||||||
before-sleep 'swaylock-bg'
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
Install = {
|
Install = {
|
||||||
WantedBy = [ "sway-session.target" ];
|
WantedBy = [ "sway-session.target" ];
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
Description = "Highly customizable Wayland bar for Sway and Wlroots based compositors.";
|
Description = "Highly customizable Wayland bar for Sway and Wlroots based compositors.";
|
||||||
Documentation = "https://github.com/Alexays/Waybar/wiki/";
|
Documentation = "https://github.com/Alexays/Waybar/wiki/";
|
||||||
BindsTo = [ "sway-session.target" ];
|
BindsTo = [ "sway-session.target" ];
|
||||||
After = [ "graphical-session-pre.target" "network-online.target" ];
|
After = [ "sway-session.target" "network-online.target" ];
|
||||||
Wants = [ "graphical-session-pre.target" "network-online.target" "blueman-applet.service" ];
|
Wants = [ "graphical-session-pre.target" "network-online.target" "blueman-applet.service" ];
|
||||||
|
ConditionEnvironment = [ "WAYLAND_DISPLAY" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
self: with self; ''
|
self: with self; ''
|
||||||
# first import environment variables from the login manager
|
# first import environment variables from the login manager
|
||||||
systemctl --user import-environment
|
systemctl --user import-environment $IMPORT_ENVIRONMENT_ENV_LIST DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP PATH;
|
||||||
# then start the service
|
# then start the service
|
||||||
exec systemctl --wait --user start sway.service
|
exec systemctl --wait --user start sway.service
|
||||||
''
|
''
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
psCfg = config.pub-solar;
|
psCfg = config.pub-solar;
|
||||||
wlroots = psCfg.graphical.wayland;
|
wlroots = psCfg.graphical.wayland;
|
||||||
|
@ -77,10 +77,22 @@ let
|
||||||
# TELEMETRY BS
|
# TELEMETRY BS
|
||||||
VUEDX_TELEMETRY = "off";
|
VUEDX_TELEMETRY = "off";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
envListNames = lib.attrsets.mapAttrsToList (name: value: name) variables;
|
||||||
|
|
||||||
|
# Here we merge an extra variable into the attrset called FULL_ENV_LIST.
|
||||||
|
# It's a list of the variable names defined above.
|
||||||
|
# We can use this to tell `systemctl import-environment` to import the full list above.
|
||||||
|
variablesWithMeta = lib.attrsets.zipAttrsWith (name: values: builtins.head values) [
|
||||||
|
variables
|
||||||
|
{ IMPORT_ENVIRONMENT_ENV_LIST = lib.lists.foldl (a: b: a + " " + b) "IMPORT_ENVIRONMENT_ENV_LIST" envListNames; }
|
||||||
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
home-manager = pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] {
|
home-manager = pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] {
|
||||||
home.sessionVariables = variables;
|
home.sessionVariables = variablesWithMeta;
|
||||||
systemd.user.sessionVariables = variables;
|
systemd.user.sessionVariables = variablesWithMeta;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environment.variables = variablesWithMeta;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue