From 2649edfb475ba8b0673c185a87edbce3ec05cbd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Fri, 2 Jun 2023 23:11:11 -0300 Subject: [PATCH] chat: autostart programs using sway settings --- user/chat.nix | 74 +++++------------------------------------------- user/firefox.nix | 18 +++--------- user/gnome.nix | 5 ---- 3 files changed, 11 insertions(+), 86 deletions(-) diff --git a/user/chat.nix b/user/chat.nix index 9fcb4c9..94bad02 100644 --- a/user/chat.nix +++ b/user/chat.nix @@ -1,71 +1,11 @@ { config, pkgs, lib, inputs, ... }: { - systemd.user.services = { - astroid = lib.mkIf (pkgs.uservars.email-client == "astroid") { - Unit = { - Description = "Astroid Email client"; - PartOf = [ "graphical-session.target" ]; - After = [ "graphical-session.target" ]; - }; - Service = { - ExecStartPre = "/usr/bin/env sleep 10s"; - ExecStart = "${pkgs.astroid}/bin/astroid"; - Restart = "on-failure"; - TimeoutStopSec = 10; - }; - Install = { WantedBy = [ "sway-session.target" ]; }; - }; - thunderbird = lib.mkIf (pkgs.uservars.email-client == "thunderbird") { - Unit = { - Description = "Thunderbird Email client"; - PartOf = [ "graphical-session.target" ]; - After = [ "graphical-session.target" ]; - }; - Service = { - ExecStartPre = "/usr/bin/env sleep 10s"; - ExecStart = "${pkgs.thunderbird}/bin/thunderbird"; - Restart = "on-failure"; - }; - Install = { WantedBy = [ "sway-session.target" ]; }; - }; - discord = { - Unit = { - Description = "Discord Internet voice chat"; - PartOf = [ "graphical-session.target" ]; - After = [ "graphical-session.target" "pipewire-pulse.service" "tray.service" "telegram.service" ]; - }; - Service = { - ExecStartPre = "/usr/bin/env sleep 12s"; - ExecStart = "${pkgs.webcord}/bin/webcord"; - Restart = "on-failure"; - }; - Install = { WantedBy = [ "sway-session.target" ]; }; - }; - telegram = { - Unit = { - Description = "Telegram Internet chat"; - PartOf = [ "graphical-session.target" ]; - After = [ "graphical-session.target" "pipewire-pulse.service" "tray.service" ]; - }; - Service = { - ExecStartPre = "/usr/bin/env sleep 11s"; - ExecStart = "${pkgs.tdesktop}/bin/telegram-desktop"; - Restart = "on-failure"; - }; - Install = { WantedBy = [ "sway-session.target" ]; }; - }; - element = { - Unit = { - Description = "Feature-rich client for Matrix.org"; - PartOf = [ "graphical-session.target" ]; - After = [ "graphical-session.target" "pipewire-pulse.service" "tray.service" ]; - }; - Service = { - ExecStartPre = "/usr/bin/env sleep 11s"; - ExecStart = "${pkgs.element-desktop-wayland}/bin/element-desktop"; - Restart = "on-failure"; - }; - Install = { WantedBy = [ "sway-session.target" ]; }; - }; + wayland.windowManager.sway = { + extraConfig = '' + exec thunderbird + exec webcord + exec telegram-desktop + exec element-desktop + ''; }; home.packages = with pkgs; [ diff --git a/user/firefox.nix b/user/firefox.nix index 28bc77f..210c339 100644 --- a/user/firefox.nix +++ b/user/firefox.nix @@ -49,20 +49,10 @@ in { }; }; }; - systemd.user.services = lib.mkIf (browser == "firefox") { - firefox = { - Unit = { - Description = "Firefox Web client"; - PartOf = [ "graphical-session.target" ]; - After = [ "graphical-session.target" ]; - }; - Service = { - ExecStartPre = "/usr/bin/env sleep 10s"; - ExecStart = "${pkgs.firefox}/bin/firefox"; - Restart = "on-failure"; - }; - Install = { WantedBy = [ "sway-session.target" ]; }; - }; + wayland.windowManager.sway = { + extraConfig = '' + exec firefox + ''; }; home.sessionVariables = { MOZ_ENABLE_WAYLAND = "1"; diff --git a/user/gnome.nix b/user/gnome.nix index 29e937f..083cc3f 100644 --- a/user/gnome.nix +++ b/user/gnome.nix @@ -12,11 +12,6 @@ }; }; - home.sessionVariables = { - LD_PRELOAD = ""; - GTK_CSD = "1"; - }; - home.packages = with pkgs; [ inputs.nixos-conf-editor.packages.${pkgs.system}.nixos-conf-editor inputs.nix-software-center.packages.${pkgs.system}.nix-software-center