From 0a6b82070d6fd19739184c55ba057bf378ef6b6f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 30 Jun 2023 18:24:43 +0300 Subject: feat(tazjin/home): add URL handler for sending `tg://` to telega Change-Id: I72b19ee758165f92c1a202781beec4350c728a47 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8911 Tested-by: BuildkiteCI Reviewed-by: tazjin Autosubmit: tazjin --- users/tazjin/home/shared.nix | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'users') 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; -- cgit 1.4.1