diff --git a/hosts/common/programs/fractal.nix b/hosts/common/programs/fractal.nix index 72778c01..97dcc721 100644 --- a/hosts/common/programs/fractal.nix +++ b/hosts/common/programs/fractal.nix @@ -1,10 +1,23 @@ -{ pkgs, ... }: +{ config, lib, pkgs, ... }: +let + cfg = config.sane.programs.fractal; +in { sane.programs.fractal = { package = pkgs.fractal-nixified; # package = pkgs.fractal-latest; # package = pkgs.fractal-next; + configOption = with lib; mkOption { + default = {}; + type = types.submodule { + options.autostart = mkOption { + type = types.bool; + default = true; + }; + }; + }; + persist.private = [ # XXX by default fractal stores its state in ~/.local/share//. ".local/share/hack" # for debug-like builds @@ -12,5 +25,17 @@ ]; suggestedPrograms = [ "gnome-keyring" ]; + + services.fractal = { + description = "auto-start and maintain fractal Matrix connection"; + wantedBy = lib.mkIf cfg.config.autostart [ "default.target" ]; + serviceConfig = { + ExecStart = "${cfg.package}/bin/fractal"; + Type = "simple"; + Restart = "always"; + RestartSec = "20s"; + }; + # environment.G_MESSAGES_DEBUG = "all"; + }; }; } diff --git a/hosts/common/programs/swaynotificationcenter.nix b/hosts/common/programs/swaynotificationcenter.nix index a76faa66..3aa9754c 100644 --- a/hosts/common/programs/swaynotificationcenter.nix +++ b/hosts/common/programs/swaynotificationcenter.nix @@ -322,10 +322,17 @@ in ] ++ lib.optionals config.sane.programs.dino.config.autostart [ { type = "toggle"; - label = "jingle"; # XMPP calls + label = "XMPP"; # XMPP calls (jingle) command = "${systemctl-toggle}/bin/systemctl-toggle --user dino"; active = "${pkgs.systemd}/bin/systemctl is-active --user dino"; } + ] ++ lib.optionals config.sane.programs.fractal.config.autostart [ + { + type = "toggle"; + label = "Matrix"; # Matrix messages + command = "${systemctl-toggle}/bin/systemctl-toggle --user fractal"; + active = "${pkgs.systemd}/bin/systemctl is-active --user fractal"; + } ]; }; dnd = { diff --git a/hosts/modules/gui/sway/sway-config b/hosts/modules/gui/sway/sway-config index f2c08fc0..eae00bef 100644 --- a/hosts/modules/gui/sway/sway-config +++ b/hosts/modules/gui/sway/sway-config @@ -145,6 +145,7 @@ for_window [title="megapixels"] inhibit_idle open # Dino (XMPP) is ordinarily started for the purpose of daemonizing (but still visible). keep it on a predictable, out-of-the-way workspace # TODO: could be neat to somehow do this in a way that it never steals focus from anything... for_window [app_id="im.dino.Dino"] move container to workspace number 1 +for_window [app_id="org.gnome.Fractal"] move container to workspace number 1 ### displays ## DESKTOP