From 5133b7ebfc13eda58bf54cf2c1ac5b73c2ccf237 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 5 Dec 2025 09:27:51 +0100 Subject: ... --- accounts/gkleen@sif/niri/mako.nix | 112 -------------------------------------- 1 file changed, 112 deletions(-) delete mode 100644 accounts/gkleen@sif/niri/mako.nix (limited to 'accounts/gkleen@sif/niri/mako.nix') diff --git a/accounts/gkleen@sif/niri/mako.nix b/accounts/gkleen@sif/niri/mako.nix deleted file mode 100644 index 3d246d96..00000000 --- a/accounts/gkleen@sif/niri/mako.nix +++ /dev/null @@ -1,112 +0,0 @@ -{ config, lib, pkgs, ... }: -{ - config = lib.mkIf false { - services.mako = { - enable = true; - settings = { - font = "Fira Sans 10"; - format = "%s\\n%b"; - margin = "2"; - max-visible = -1; - background-color = "#000000dd"; - progress-color = "source #223544ff"; - width = 384; - outer-margin = 1; - max-history = 100; - max-icon-size = 48; - - grouped.format = "(%g) %s\\n%b"; - "urgency=low".text-color = "#999999ff"; - "urgency=critical".background-color = "#900000dd"; - "app-name=Element".group-by = "summary"; - "app-name=poweralertd" = { - history = false; - ignore-timeout = true; - default-timeout = 2000; - }; - "app-name=worktime".history = false; - "mode=silent".invisible = true; - }; - package = pkgs.symlinkJoin { - name = "${pkgs.mako.name}-wrapped"; - paths = with pkgs; [ mako ]; - inherit (pkgs.mako) meta; - postBuild = '' - rm -r $out/share/dbus-1 - ''; - }; - }; - systemd.user.services.mako = { - Unit = { - Description = "Mako notification daemon"; - PartOf = [ "graphical-session.target" ]; - }; - Install = { - WantedBy = [ "graphical-session.target" ]; - }; - Service = { - Type = "dbus"; - BusName = "org.freedesktop.Notifications"; - ExecStart = lib.getExe config.services.mako.package; - RestartSec = 5; - Restart = "always"; - }; - }; - - systemd.user.services.mako-follows-focus = { - Unit = { - BindsTo = [ "niri.service" "mako.service" ]; - After = [ "niri.service" "mako.service" ]; - }; - Service = { - Type = "simple"; - Restart = "always"; - ExecStart = pkgs.writers.writePython3 "mako-follows-focus" { - libraries = with pkgs.python3Packages; []; - } '' - import os - import socket - import json - import subprocess - - - current_output = None - workspaces = [] - - - def output_changed(new_output): - global current_output - - if current_output == new_output: - return - - current_output = new_output - subprocess.run(["makoctl", "reload"]) - - - sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) - sock.connect(os.environ["NIRI_SOCKET"]) - sock.send(b"\"EventStream\"\n") - for line in sock.makefile(buffering=1, encoding='utf-8'): - if line_json := json.loads(line): - if "WorkspacesChanged" in line_json: - workspaces = line_json["WorkspacesChanged"]["workspaces"] - for workspace in workspaces: - if not workspace["is_focused"]: - continue - output_changed(workspace["output"]) - break - if "WorkspaceActivated" in line_json and line_json["WorkspaceActivated"]["focused"]: # noqa: E501 - for workspace in workspaces: - if not workspace["id"] == line_json["WorkspaceActivated"]["id"]: # noqa: E501 - continue - output_changed(workspace["output"]) - break - ''; - }; - Install = { - WantedBy = [ "mako.service" ]; - }; - }; - }; -} -- cgit v1.2.3