From c6601957928201bbd6ed8c2720dd80f784f572d9 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Sun, 16 Aug 2026 11:49:32 -0300 Subject: [PATCH] feat(home/calendar): split import and viewer handlers Add khal-import.desktop for interactive text/calendar imports. Associate pkgs.khal's existing khal.desktop, which launches ikhal, with x-scheme-handler/calendar and use that handler from Waybar. Assisted-by: pi (gpt-5.6-sol) --- .../desktop/common/wayland-wm/waybar.nix | 2 +- home/gabriel/features/productivity/khal.nix | 22 ++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/home/gabriel/features/desktop/common/wayland-wm/waybar.nix b/home/gabriel/features/desktop/common/wayland-wm/waybar.nix index 045d054c..37332fb4 100644 --- a/home/gabriel/features/desktop/common/wayland-wm/waybar.nix +++ b/home/gabriel/features/desktop/common/wayland-wm/waybar.nix @@ -226,7 +226,7 @@ in { }; on-click = mkScript { deps = [pkgs.handlr-regex]; - script = "handlr launch text/calendar"; + script = "handlr launch x-scheme-handler/calendar"; }; }; "custom/gpg-status" = { diff --git a/home/gabriel/features/productivity/khal.nix b/home/gabriel/features/productivity/khal.nix index b2a69e54..e4dcf365 100644 --- a/home/gabriel/features/productivity/khal.nix +++ b/home/gabriel/features/productivity/khal.nix @@ -1,11 +1,23 @@ { - # Set as default calendar handler + config, + lib, + ... +}: { + # Import calendar files interactively in a terminal + xdg.desktopEntries.khal-import = { + name = "Import calendar event"; + exec = "${lib.getExe' config.programs.khal.package "khal"} import %f"; + terminal = true; + noDisplay = true; + mimeType = ["text/calendar"]; + }; + xdg.mimeApps = { - associations.added = { - "text/calendar" = "khal.desktop"; - }; + # pkgs.khal's desktop entry launches ikhal but declares no MIME types + associations.added."x-scheme-handler/calendar" = "khal.desktop"; defaultApplications = { - "text/calendar" = "khal.desktop"; + "text/calendar" = "khal-import.desktop"; + "x-scheme-handler/calendar" = "khal.desktop"; }; };