From 883c28d41652ce2b15830a53557190330c781603 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Tue, 30 Jan 2024 08:39:30 +0100 Subject: [PATCH] sway: Add systemd module for wayvnc --- home-manager/modules/sway/default.nix | 31 ++++++++++++++++++++++----- users/erwin/work.nix | 3 ++- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/home-manager/modules/sway/default.nix b/home-manager/modules/sway/default.nix index 5f435b9..239bbc8 100644 --- a/home-manager/modules/sway/default.nix +++ b/home-manager/modules/sway/default.nix @@ -12,7 +12,9 @@ with lib; let in { options.eboskma.programs.sway = { - enable = mkEnableOption "Enable sway"; + enable = mkEnableOption "sway"; + wayvnc = mkEnableOption "wayvnc"; + lock-wallpaper = mkOption { description = "Wallpaper to use for the lockscreen"; type = types.path; @@ -333,10 +335,29 @@ in }; }; - systemd.user.targets.tray = { - Unit = { - Description = "Home Manager System Tray"; - Requires = [ "graphical-session-pre.target" ]; + systemd.user = { + services = { + wayvnc = mkIf cfg.wayvnc { + Unit = { + Description = "VNC server for wlroots based Wayland compositors"; + After = [ "sway-session.target" ]; + }; + + Service = { + ExecStart = "${pkgs.wayvnc}/bin/wayvnc 0.0.0.0"; + Restart = "on-failure"; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + }; + }; + targets.tray = { + Unit = { + Description = "Home Manager System Tray"; + Requires = [ "graphical-session-pre.target" ]; + }; }; }; }; diff --git a/users/erwin/work.nix b/users/erwin/work.nix index fd9d914..b07b0fb 100644 --- a/users/erwin/work.nix +++ b/users/erwin/work.nix @@ -146,6 +146,7 @@ in starship.enable = true; sway = { enable = true; + wayvnc = true; lock-wallpaper = ../../wallpapers/river-3840.png; output = { "DP-1" = { @@ -173,7 +174,7 @@ in }; startup = [ { command = "${ewwDaemon} --restart open bar-work"; always = true; } - { command = "${pkgs.wayvnc}/bin/wayvnc 0.0.0.0"; always = true; } + # { command = "${pkgs.wayvnc}/bin/wayvnc 0.0.0.0"; always = true; } ]; workspaceOutputs = workspacePartition; extraKeybindings = {