abaddon: integrate with swaync services buttons

This commit is contained in:
Colin 2023-11-21 03:32:59 +00:00
parent 70292e4f8e
commit 6a950b4e97
2 changed files with 44 additions and 4 deletions

View File

@ -1,7 +1,20 @@
# discord gtk3 client
{ lib, pkgs, ... }:
{ config, lib, pkgs, ... }:
let
cfg = config.sane.programs.abaddon;
in
{
sane.programs.abaddon = {
configOption = with lib; mkOption {
default = {};
type = types.submodule {
options.autostart = mkOption {
type = types.bool;
default = true;
};
};
};
package = pkgs.abaddon.overrideAttrs (upstream: {
patches = (upstream.patches or []) ++ [
(pkgs.fetchpatch {
@ -9,6 +22,14 @@
name = ''"view members" default to false'';
hash = "sha256-9BX8iO86CU1lNrKS1G2BjDR+3IlV9bmhRNTsLrxChwQ=";
})
(pkgs.fetchpatch {
# this makes it so Abaddon reports its app_name in notifications.
# not 100% necessary; just a nice-to-have. maybe don't rely on it until it's merged upstream.
# upstream PR: <https://github.com/uowuo/abaddon/pull/247>
url = "https://git.uninsane.org/colin/abaddon/commit/18cd863fdbb5e6b1e9aaf9394dbd673d51839f30.patch";
name = "set glib application name";
hash = "sha256-IFYxf1D8hIsxgZehGd6hL3zJiBkPZfWGm+Faaa5ZFl4=";
})
];
});
@ -69,5 +90,16 @@
persist.byStore.private = [
".cache/abaddon"
];
services.abaddon = {
description = "unofficial Discord chat client";
wantedBy = lib.mkIf cfg.config.autostart [ "default.target" ];
serviceConfig = {
ExecStart = "${cfg.package}/bin/abaddon";
Type = "simple";
Restart = "always";
RestartSec = "20s";
};
};
};
}

View File

@ -367,13 +367,21 @@ in
command = "${systemctl-toggle}/bin/systemctl-toggle --user geary";
active = "${pkgs.systemd}/bin/systemctl is-active --user geary";
}
] ++ lib.optionals config.sane.programs.gtkcord4.enabled [
] ++ lib.optionals config.sane.programs.abaddon.enabled [
{
type = "toggle";
label = "󰊴"; # Discord chat client; icons: 󰊴, 🎮
command = "${systemctl-toggle}/bin/systemctl-toggle --user gtkcord4";
active = "${pkgs.systemd}/bin/systemctl is-active --user gtkcord4";
command = "${systemctl-toggle}/bin/systemctl-toggle --user abaddon";
active = "${pkgs.systemd}/bin/systemctl is-active --user abaddon";
}
# ] ++ lib.optionals config.sane.programs.gtkcord4.enabled [
# # XXX: disabled in favor of abaddon: gtkcord4 leaks memory
# {
# type = "toggle";
# label = "󰊴"; # Discord chat client; icons: 󰊴, 🎮
# command = "${systemctl-toggle}/bin/systemctl-toggle --user gtkcord4";
# active = "${pkgs.systemd}/bin/systemctl is-active --user gtkcord4";
# }
] ++ lib.optionals config.sane.programs.signal-desktop.enabled [
{
type = "toggle";