From edf45b7be5f233fc44a53f77dff540660f1b4a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Schwarz=C3=A4ugl?= Date: Tue, 7 Oct 2025 19:31:48 +0200 Subject: [PATCH] chore[work]: make app startup consistent --- SwarselSystems.org | 247 ++++++++++++++++-- modules/home/common/anki-tray.nix | 27 ++ modules/home/common/blueman-applet.nix | 7 + modules/home/common/element-tray.nix | 27 ++ .../home/common/network-manager-applet.nix | 8 + modules/home/common/niri.nix | 10 +- modules/home/common/obsidian-tray.nix | 27 ++ modules/home/common/sway.nix | 10 +- modules/home/common/vesktop-tray.nix | 27 ++ modules/home/optional/work.nix | 67 ++++- profiles/home/personal/default.nix | 7 +- 11 files changed, 418 insertions(+), 46 deletions(-) create mode 100644 modules/home/common/anki-tray.nix create mode 100644 modules/home/common/blueman-applet.nix create mode 100644 modules/home/common/element-tray.nix create mode 100644 modules/home/common/network-manager-applet.nix create mode 100644 modules/home/common/obsidian-tray.nix create mode 100644 modules/home/common/vesktop-tray.nix diff --git a/SwarselSystems.org b/SwarselSystems.org index 4ce21c1..c3cd341 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -13370,6 +13370,159 @@ The `extraConfig` section here CANNOT be reindented. This has something to do wi } #+end_src +***** blueman-applet + +#+begin_src nix-ts :tangle modules/home/common/blueman-applet.nix + { lib, config, ... }: + { + options.swarselmodules.blueman-applet = lib.mkEnableOption "enable blueman applet for tray"; + config = lib.mkIf config.swarselmodules.blueman-applet { + services.blueman-applet.enable = true; + }; + } +#+end_src + +***** network-manager-applet + +#+begin_src nix-ts :tangle modules/home/common/network-manager-applet.nix + { lib, config, ... }: + { + options.swarselmodules.nm-applet = lib.mkEnableOption "enable network manager applet for tray"; + config = lib.mkIf config.swarselmodules.nm-applet { + services.network-manager-applet.enable = true; + xsession.preferStatusNotifierItems = true; # needed for indicator icon to show + }; + } +#+end_src + +***** obsidian service for tray + +#+begin_src nix-ts :tangle modules/home/common/obsidian-tray.nix + { lib, config, pkgs, ... }: + { + options.swarselmodules.obsidian-tray = lib.mkEnableOption "enable obsidian applet for tray"; + config = lib.mkIf config.swarselmodules.obsidian-tray { + + systemd.user.services.obsidian-applet = { + Unit = { + Description = "Obsidian applet"; + Requires = [ "tray.target" ]; + After = [ + "graphical-session.target" + "tray.target" + ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = "${pkgs.obsidian}/bin/obsidian"; + }; + }; + }; + + } +#+end_src + +***** anki service for tray + +#+begin_src nix-ts :tangle modules/home/common/anki-tray.nix + { lib, config, pkgs, ... }: + { + options.swarselmodules.anki-tray = lib.mkEnableOption "enable anki applet for tray"; + config = lib.mkIf config.swarselmodules.anki-tray { + + systemd.user.services.anki-applet = { + Unit = { + Description = "Anki applet"; + Requires = [ "tray.target" ]; + After = [ + "graphical-session.target" + "tray.target" + ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = "${pkgs.anki-bin}/bin/anki-bin"; + }; + }; + + }; + } +#+end_src + +***** element service for tray + +#+begin_src nix-ts :tangle modules/home/common/element-tray.nix + { lib, config, pkgs, ... }: + { + options.swarselmodules.element-tray = lib.mkEnableOption "enable element applet for tray"; + config = lib.mkIf config.swarselmodules.element-tray { + + systemd.user.services.element-applet = { + Unit = { + Description = "Element applet"; + Requires = [ "tray.target" ]; + After = [ + "graphical-session.target" + "tray.target" + ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = "${pkgs.element-desktop}/bin/element-desktop --hidden --enable-features=useozoneplatform --ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; + }; + }; + }; + + } +#+end_src + +***** vesktop service for tray + +#+begin_src nix-ts :tangle modules/home/common/vesktop-tray.nix + { lib, config, pkgs, ... }: + { + options.swarselmodules.vesktop-tray = lib.mkEnableOption "enable vesktop applet for tray"; + config = lib.mkIf config.swarselmodules.vesktop-tray { + + systemd.user.services.vesktop-applet = { + Unit = { + Description = "Vesktop applet"; + Requires = [ "tray.target" ]; + After = [ + "graphical-session.target" + "tray.target" + ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = "${pkgs.vesktop}/bin/vesktop --start-minimized --enable-speech-dispatcher --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime"; + }; + }; + }; + + } +#+end_src + **** Sway :PROPERTIES: :CUSTOM_ID: h:02df9dfc-d1af-4a37-a7a0-d8da0af96a20 @@ -13407,11 +13560,11 @@ Currently, I am too lazy to explain every option here, but most of it is very se type = lib.types.listOf (lib.types.attrsOf lib.types.str); default = [ # { command = "nextcloud --background"; } - { command = "vesktop --start-minimized --enable-speech-dispatcher --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime"; } - { command = "element-desktop --hidden --enable-features=UseOzonePlatform --ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; } - { command = "anki"; } - { command = "obsidian"; } - { command = "nm-applet"; } + # { command = "vesktop --start-minimized --enable-speech-dispatcher --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime"; } + # { command = "element-desktop --hidden --enable-features=useozoneplatform --ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; } + # { command = "anki"; } + # { command = "obsidian"; } + # { command = "nm-applet"; } # { command = "feishin"; } ]; }; @@ -13998,11 +14151,11 @@ Currently, I am too lazy to explain every option here, but most of it is very se "Mod+Shift+0".action = move-column-to-index 0; }; spawn-at-startup = [ - { command = [ "vesktop" "--start-minimized" "--enable-speech-dispatcher" "--ozone-platform-hint=auto" "--enable-features=WaylandWindowDecorations" "--enable-wayland-ime" ]; } - { command = [ "element-desktop" "--hidden" "--enable-features=UseOzonePlatform" "--ozone-platform=wayland" "--disable-gpu-driver-bug-workarounds" ]; } - { command = [ "anki" ]; } - { command = [ "obsidian" ]; } - { command = [ "nm-applet" ]; } + # { command = [ "vesktop" "--start-minimized" "--enable-speech-dispatcher" "--ozone-platform-hint=auto" "--enable-features=WaylandWindowDecorations" "--enable-wayland-ime" ]; } + # { command = [ "element-desktop" "--hidden" "--enable-features=UseOzonePlatform" "--ozone-platform=wayland" "--disable-gpu-driver-bug-workarounds" ]; } + # { command = [ "anki" ]; } + # { command = [ "obsidian" ]; } + # { command = [ "nm-applet" ]; } { command = [ "niri" "msg" "action" "focus-workspace" "2" ]; } ]; workspaces = { @@ -14783,11 +14936,54 @@ The rest of the settings is at [[#h:bbf2ecb6-c8ff-4462-b5d5-d45b28604ddf][work]] }; }; - systemd.user.services.pizauth.Service = { - ExecStartPost = [ - "${pkgs.toybox}/bin/sleep 1" - "//bin/sh -c '${lib.getExe pkgs.pizauth} restore < ${homeDir}/.pizauth.state'" - ]; + systemd.user.services = { + pizauth.Service = { + ExecStartPost = [ + "${pkgs.toybox}/bin/sleep 1" + "//bin/sh -c '${lib.getExe pkgs.pizauth} restore < ${homeDir}/.pizauth.state'" + ]; + }; + + teams-applet = { + Unit = { + Description = "teams applet"; + Requires = [ "tray.target" ]; + After = [ + "graphical-session.target" + "tray.target" + ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = "${pkgs.stable.teams-for-linux}/bin/teams-for-linux --disableGpu=true --minimized=true --trayIconEnabled=true"; + }; + }; + + onepassword-applet = { + Unit = { + Description = "1password applet"; + Requires = [ "tray.target" ]; + After = [ + "graphical-session.target" + "tray.target" + ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = "${pkgs._1password-gui}/bin/1password"; + }; + }; + }; swarselservices.pizauth = { @@ -14864,14 +15060,14 @@ The rest of the settings is at [[#h:bbf2ecb6-c8ff-4462-b5d5-d45b28604ddf][work]] swarselsystems = { startup = [ # { command = "nextcloud --background"; } - { command = "vesktop --start-minimized --enable-speech-dispatcher --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime"; } - { command = "element-desktop --hidden --enable-features=UseOzonePlatform --ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; } - { command = "anki"; } - { command = "obsidian"; } - { command = "nm-applet"; } + # { command = "vesktop --start-minimized --enable-speech-dispatcher --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime"; } + # { command = "element-desktop --hidden --enable-features=UseOzonePlatform --ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; } + # { command = "anki"; } + # { command = "obsidian"; } + # { command = "nm-applet"; } # { command = "feishin"; } - { command = "teams-for-linux --disableGpu=true --minimized=true --trayIconEnabled=true"; } - { command = "1password"; } + # { command = "teams-for-linux --disableGpu=true --minimized=true --trayIconEnabled=true"; } + # { command = "1password"; } ]; monitors = { work_back_middle = rec { @@ -17661,7 +17857,12 @@ This holds modules that are to be used on most hosts. These are also the most im gpgagent = lib.mkDefault true; gammastep = lib.mkDefault true; spicetify = lib.mkDefault true; - + blueman-applet = lib.mkDefault true; + nm-applet = lib.mkDefault true; + obsidian-tray = lib.mkDefault true; + anki-tray = lib.mkDefault true; + element-tray = lib.mkDefault true; + vesktop-tray = lib.mkDefault true; }; }; diff --git a/modules/home/common/anki-tray.nix b/modules/home/common/anki-tray.nix new file mode 100644 index 0000000..3cb0f64 --- /dev/null +++ b/modules/home/common/anki-tray.nix @@ -0,0 +1,27 @@ +{ lib, config, pkgs, ... }: +{ + options.swarselmodules.anki-tray = lib.mkEnableOption "enable anki applet for tray"; + config = lib.mkIf config.swarselmodules.anki-tray { + + systemd.user.services.anki-applet = { + Unit = { + Description = "Anki applet"; + Requires = [ "tray.target" ]; + After = [ + "graphical-session.target" + "tray.target" + ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = "${pkgs.anki-bin}/bin/anki-bin"; + }; + }; + + }; +} diff --git a/modules/home/common/blueman-applet.nix b/modules/home/common/blueman-applet.nix new file mode 100644 index 0000000..26e5edd --- /dev/null +++ b/modules/home/common/blueman-applet.nix @@ -0,0 +1,7 @@ +{ lib, config, ... }: +{ + options.swarselmodules.blueman-applet = lib.mkEnableOption "enable blueman applet for tray"; + config = lib.mkIf config.swarselmodules.blueman-applet { + services.blueman-applet.enable = true; + }; +} diff --git a/modules/home/common/element-tray.nix b/modules/home/common/element-tray.nix new file mode 100644 index 0000000..8f8ba76 --- /dev/null +++ b/modules/home/common/element-tray.nix @@ -0,0 +1,27 @@ +{ lib, config, pkgs, ... }: +{ + options.swarselmodules.element-tray = lib.mkEnableOption "enable element applet for tray"; + config = lib.mkIf config.swarselmodules.element-tray { + + systemd.user.services.element-applet = { + Unit = { + Description = "Element applet"; + Requires = [ "tray.target" ]; + After = [ + "graphical-session.target" + "tray.target" + ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = "${pkgs.element-desktop}/bin/element-desktop --hidden --enable-features=useozoneplatform --ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; + }; + }; + }; + +} diff --git a/modules/home/common/network-manager-applet.nix b/modules/home/common/network-manager-applet.nix new file mode 100644 index 0000000..a237ef7 --- /dev/null +++ b/modules/home/common/network-manager-applet.nix @@ -0,0 +1,8 @@ +{ lib, config, ... }: +{ + options.swarselmodules.nm-applet = lib.mkEnableOption "enable network manager applet for tray"; + config = lib.mkIf config.swarselmodules.nm-applet { + services.network-manager-applet.enable = true; + xsession.preferStatusNotifierItems = true; # needed for indicator icon to show + }; +} diff --git a/modules/home/common/niri.nix b/modules/home/common/niri.nix index 16f173b..e90219c 100644 --- a/modules/home/common/niri.nix +++ b/modules/home/common/niri.nix @@ -182,11 +182,11 @@ "Mod+Shift+0".action = move-column-to-index 0; }; spawn-at-startup = [ - { command = [ "vesktop" "--start-minimized" "--enable-speech-dispatcher" "--ozone-platform-hint=auto" "--enable-features=WaylandWindowDecorations" "--enable-wayland-ime" ]; } - { command = [ "element-desktop" "--hidden" "--enable-features=UseOzonePlatform" "--ozone-platform=wayland" "--disable-gpu-driver-bug-workarounds" ]; } - { command = [ "anki" ]; } - { command = [ "obsidian" ]; } - { command = [ "nm-applet" ]; } + # { command = [ "vesktop" "--start-minimized" "--enable-speech-dispatcher" "--ozone-platform-hint=auto" "--enable-features=WaylandWindowDecorations" "--enable-wayland-ime" ]; } + # { command = [ "element-desktop" "--hidden" "--enable-features=UseOzonePlatform" "--ozone-platform=wayland" "--disable-gpu-driver-bug-workarounds" ]; } + # { command = [ "anki" ]; } + # { command = [ "obsidian" ]; } + # { command = [ "nm-applet" ]; } { command = [ "niri" "msg" "action" "focus-workspace" "2" ]; } ]; workspaces = { diff --git a/modules/home/common/obsidian-tray.nix b/modules/home/common/obsidian-tray.nix new file mode 100644 index 0000000..b6863c3 --- /dev/null +++ b/modules/home/common/obsidian-tray.nix @@ -0,0 +1,27 @@ +{ lib, config, pkgs, ... }: +{ + options.swarselmodules.obsidian-tray = lib.mkEnableOption "enable obsidian applet for tray"; + config = lib.mkIf config.swarselmodules.obsidian-tray { + + systemd.user.services.obsidian-applet = { + Unit = { + Description = "Obsidian applet"; + Requires = [ "tray.target" ]; + After = [ + "graphical-session.target" + "tray.target" + ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = "${pkgs.obsidian}/bin/obsidian"; + }; + }; + }; + +} diff --git a/modules/home/common/sway.nix b/modules/home/common/sway.nix index a903b0a..6977c49 100644 --- a/modules/home/common/sway.nix +++ b/modules/home/common/sway.nix @@ -25,11 +25,11 @@ in type = lib.types.listOf (lib.types.attrsOf lib.types.str); default = [ # { command = "nextcloud --background"; } - { command = "vesktop --start-minimized --enable-speech-dispatcher --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime"; } - { command = "element-desktop --hidden --enable-features=UseOzonePlatform --ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; } - { command = "anki"; } - { command = "obsidian"; } - { command = "nm-applet"; } + # { command = "vesktop --start-minimized --enable-speech-dispatcher --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime"; } + # { command = "element-desktop --hidden --enable-features=useozoneplatform --ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; } + # { command = "anki"; } + # { command = "obsidian"; } + # { command = "nm-applet"; } # { command = "feishin"; } ]; }; diff --git a/modules/home/common/vesktop-tray.nix b/modules/home/common/vesktop-tray.nix new file mode 100644 index 0000000..1d258d7 --- /dev/null +++ b/modules/home/common/vesktop-tray.nix @@ -0,0 +1,27 @@ +{ lib, config, pkgs, ... }: +{ + options.swarselmodules.vesktop-tray = lib.mkEnableOption "enable vesktop applet for tray"; + config = lib.mkIf config.swarselmodules.vesktop-tray { + + systemd.user.services.vesktop-applet = { + Unit = { + Description = "Vesktop applet"; + Requires = [ "tray.target" ]; + After = [ + "graphical-session.target" + "tray.target" + ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = "${pkgs.vesktop}/bin/vesktop --start-minimized --enable-speech-dispatcher --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime"; + }; + }; + }; + +} diff --git a/modules/home/optional/work.nix b/modules/home/optional/work.nix index 54e50fe..ef5ca2d 100644 --- a/modules/home/optional/work.nix +++ b/modules/home/optional/work.nix @@ -390,11 +390,54 @@ in }; }; - systemd.user.services.pizauth.Service = { - ExecStartPost = [ - "${pkgs.toybox}/bin/sleep 1" - "//bin/sh -c '${lib.getExe pkgs.pizauth} restore < ${homeDir}/.pizauth.state'" - ]; + systemd.user.services = { + pizauth.Service = { + ExecStartPost = [ + "${pkgs.toybox}/bin/sleep 1" + "//bin/sh -c '${lib.getExe pkgs.pizauth} restore < ${homeDir}/.pizauth.state'" + ]; + }; + + teams-applet = { + Unit = { + Description = "teams applet"; + Requires = [ "tray.target" ]; + After = [ + "graphical-session.target" + "tray.target" + ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = "${pkgs.stable.teams-for-linux}/bin/teams-for-linux --disableGpu=true --minimized=true --trayIconEnabled=true"; + }; + }; + + onepassword-applet = { + Unit = { + Description = "1password applet"; + Requires = [ "tray.target" ]; + After = [ + "graphical-session.target" + "tray.target" + ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = "${pkgs._1password-gui}/bin/1password"; + }; + }; + }; swarselservices.pizauth = { @@ -471,14 +514,14 @@ in swarselsystems = { startup = [ # { command = "nextcloud --background"; } - { command = "vesktop --start-minimized --enable-speech-dispatcher --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime"; } - { command = "element-desktop --hidden --enable-features=UseOzonePlatform --ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; } - { command = "anki"; } - { command = "obsidian"; } - { command = "nm-applet"; } + # { command = "vesktop --start-minimized --enable-speech-dispatcher --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime"; } + # { command = "element-desktop --hidden --enable-features=UseOzonePlatform --ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; } + # { command = "anki"; } + # { command = "obsidian"; } + # { command = "nm-applet"; } # { command = "feishin"; } - { command = "teams-for-linux --disableGpu=true --minimized=true --trayIconEnabled=true"; } - { command = "1password"; } + # { command = "teams-for-linux --disableGpu=true --minimized=true --trayIconEnabled=true"; } + # { command = "1password"; } ]; monitors = { work_back_middle = rec { diff --git a/profiles/home/personal/default.nix b/profiles/home/personal/default.nix index 6cb38ec..45cb791 100644 --- a/profiles/home/personal/default.nix +++ b/profiles/home/personal/default.nix @@ -42,7 +42,12 @@ gpgagent = lib.mkDefault true; gammastep = lib.mkDefault true; spicetify = lib.mkDefault true; - + blueman-applet = lib.mkDefault true; + nm-applet = lib.mkDefault true; + obsidian-tray = lib.mkDefault true; + anki-tray = lib.mkDefault true; + element-tray = lib.mkDefault true; + vesktop-tray = lib.mkDefault true; }; };