Skip to content

Commit

Permalink
feat(home-manager): add zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgon committed Nov 5, 2024
1 parent 6284dde commit ab587dc
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/apps/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ _: {
./syncthing
./thunderbird
./zathura
./zoom
];
}
62 changes: 62 additions & 0 deletions modules/apps/zoom/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.myHomeApps.zoom;
in
{
options.myHomeApps.zoom = {
enable = lib.mkEnableOption "zoom";
};

config =
let
zoomwrapper = pkgs.writeShellScriptBin "zoom-wrapper" ''
TARGET="https://app.zoom.us/wc/$(echo "$@" | awk -F/ '{ print $NF }' | grep -Eo '(^|=)[0-9]{10,}' | tr -d '=')/join"
ZOOM_PASSWORD="$(echo "$@" | grep -Eo '[?&]pwd=[^&]+' | tr '&' '?')"
${lib.getExe pkgs.ungoogled-chromium} --app="$TARGET$ZOOM_PASSWORD" --class="Zoom" --user-data-dir="${config.xdg.stateHome}/zoom"
'';
in
lib.mkIf cfg.enable {
home.packages = [ zoomwrapper ];

myHomeApps.firefox.extraConfig = {
"network.protocol-handler.expose.zoommtg" = false;
};

xdg = {
dataFile = {
"applications/Zoom.desktop".text = ''
[Desktop Entry]
Name=Zoom
Comment=Zoom Video Conference
Exec=${lib.getExe zoomwrapper} %U
Icon=Zoom
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Network;Application;
StartupWMClass=zoom
MimeType=x-scheme-handler/zoommtg;x-scheme-handler/zoomus;x-scheme-handler/tel;x-scheme-handler/callto;x-scheme-handler/zoomphonecall;application/x-zoom
X-KDE-Protocols=zoommtg;zoomus;tel;callto;zoomphonecall;
Name[en_US]=Zoom
'';
};

mimeApps = {
defaultApplications = {
"x-scheme-handler/zoommtg" = "Zoom.desktop";
"x-scheme-handler/zoomus" = "Zoom.desktop";
"x-scheme-handler/tel" = "Zoom.desktop";
"x-scheme-handler/callto" = "Zoom.desktop";
"x-scheme-handler/zoomphonecall" = "Zoom.desktop";
"application/x-zoom" = "Zoom.desktop";
};
};
};
};
}

0 comments on commit ab587dc

Please sign in to comment.