Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[X1] Turn off the display when system is suspended #740

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions modules/hardware/common/qemu.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ in
ghaf.qemu.guivm = optionalAttrs (hasAttr "hardware" config.ghaf) {
microvm.qemu.extraArgs =
[
# Button
"-device"
"button"
# Battery
"-device"
"battery"
Expand Down
25 changes: 24 additions & 1 deletion modules/host/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Modules that should be only imported to host
#
{ lib, ... }:
{ lib, pkgs, ... }:
{
networking.hostName = lib.mkDefault "ghaf-host";

Expand All @@ -15,4 +15,27 @@
# To push logs to central location
../common/logging/client.nix
];

# Adding below systemd services to save power by turning off display when system is suspended / lid close
systemd.services.display-suspend = {
enable = true;
description = "Display Suspend Service";
serviceConfig = {
Type = "oneshot";
ExecStart = ''${pkgs.sshpass}/bin/sshpass -p ghaf ${pkgs.openssh}/bin/ssh -o StrictHostKeyChecking=no ghaf@gui-vm-debug WAYLAND_DISPLAY=/run/user/1000/wayland-0 wlopm --off \* '';
};
wantedBy = [ "sleep.target" ];
before = [ "sleep.target" ];
};

systemd.services.display-resume = {
enable = true;
description = "Display Resume Service";
serviceConfig = {
Type = "oneshot";
ExecStart = ''${pkgs.sshpass}/bin/sshpass -p ghaf ${pkgs.openssh}/bin/ssh -o StrictHostKeyChecking=no ghaf@gui-vm-debug WAYLAND_DISPLAY=/run/user/1000/wayland-0 wlopm --on \* '';
};
wantedBy = [ "suspend.target" ];
after = [ "suspend.target" ];
};
}