about summary refs log tree commit diff
path: root/users/tazjin/home
diff options
context:
space:
mode:
Diffstat (limited to 'users/tazjin/home')
-rw-r--r--users/tazjin/home/shared.nix29
1 files changed, 29 insertions, 0 deletions
diff --git a/users/tazjin/home/shared.nix b/users/tazjin/home/shared.nix
index 2baf4dade36e..df81932ccd63 100644
--- a/users/tazjin/home/shared.nix
+++ b/users/tazjin/home/shared.nix
@@ -3,6 +3,14 @@
 { depot, pkgs, ... }: # readTree
 { config, lib, ... }: # home-manager
 
+
+let
+  # URL handler to open `tg://` URLs in telega.el
+  telega-launcher = pkgs.writeShellScriptBin "telega-launcher" ''
+    echo "Opening ''${1} in telega.el ..."
+    ${pkgs.emacs-unstable}/bin/emacsclient -e "(telega-browse-url \"''${1}\")"
+  '';
+in
 {
   home.activation.screenshots = lib.hm.dag.entryAnywhere ''
     $DRY_RUN_CMD mkdir -p $HOME/screenshots
@@ -32,6 +40,27 @@
     lockCmd = "${depot.users.tazjin.screenLock}/bin/tazjin-screen-lock";
   };
 
+  home.packages = [ telega-launcher ];
+
+  xdg.desktopEntries.telega-launcher = {
+    name = "Telega Launcher";
+    exec = "${telega-launcher}/bin/telega-launcher";
+    terminal = false;
+    mimeType = [ "x-scheme-handler/tg" ];
+  };
+
+  xdg.mimeApps = {
+    enable = true;
+    defaultApplications = {
+      "x-scheme-handler/tg" = [ "telega-launcher.desktop" ];
+      "text/html" = [ "chromium-browser.desktop" ];
+      "x-scheme-handler/http" = [ "chromium-browser.desktop" ];
+      "x-scheme-handler/https" = [ "chromium-browser.desktop" ];
+      "x-scheme-handler/about" = [ "chromium-browser.desktop" ];
+      "x-scheme-handler/unknown" = [ "chromium-browser.desktop" ];
+    };
+  };
+
   services.picom = {
     enable = true;
     vSync = true;