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 <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
This commit is contained in:
Vincent Ambo 2023-06-30 18:24:43 +03:00 committed by clbot
parent c9272e0651
commit 0a6b82070d

View file

@ -3,6 +3,14 @@
{ depot, pkgs, ... }: # readTree { depot, pkgs, ... }: # readTree
{ config, lib, ... }: # home-manager { 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 '' home.activation.screenshots = lib.hm.dag.entryAnywhere ''
$DRY_RUN_CMD mkdir -p $HOME/screenshots $DRY_RUN_CMD mkdir -p $HOME/screenshots
@ -32,6 +40,27 @@
lockCmd = "${depot.users.tazjin.screenLock}/bin/tazjin-screen-lock"; 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 = { services.picom = {
enable = true; enable = true;
vSync = true; vSync = true;