current
 1{lib, ...}: {
 2  flake.modules.homeManager.desktop = {
 3    pkgs,
 4    osConfig,
 5    ...
 6  }: let
 7    chromiumCLA = lib.optionals isLinux ([
 8        "--ozone-platform-hint=auto"
 9        "--enable-wayland-ime"
10        "--wayland-text-input-version=3"
11      ]
12      ++ lib.optionals (!isPlasma) [
13        # Fix https://github.com/microsoft/vscode/issues/187338
14        "--password-store=gnome-libsecret"
15      ]);
16
17    isLinux = pkgs.stdenv.hostPlatform.isLinux;
18    isPlasma = isLinux && (osConfig.services.desktopManager.plasma6.enable or false);
19
20    # Fix Chromium IME bug
21    cherry-studio = pkgs.cherry-studio.override {commandLineArgs = chromiumCLA;};
22
23    wpsoffice-cn = pkgs.wpsoffice-cn.overrideAttrs (oldAttrs: {
24      buildInputs = (oldAttrs.buildInputs or []) ++ [pkgs.makeWrapper];
25      postFixup =
26        (oldAttrs.postFixup or "")
27        + ''
28          for app in wps et wpp wpspdf; do
29              wrapProgram $out/bin/$app \
30              --set GTK_IM_MODULE fcitx \
31              --set QT_IM_MODULE fcitx \
32              --set XMODIFIERS @im=fcitx \
33              --set QT_QPA_PLATFORM xcb \
34              --set QT_FONT_DPI ${builtins.toString osConfig.services.xserver.dpi}
35          done
36        '';
37    });
38  in {
39    home.packages =
40      (with pkgs; [
41        blender
42        ffmpeg-full
43        fluffychat
44        geogebra6
45        imagemagick
46        inkscape
47        wireshark
48      ])
49      ++ (lib.optionals pkgs.stdenv.hostPlatform.isLinux (with pkgs; [
50        cherry-studio # No darwin package in Nixpkgs
51        atril
52        gimp3
53        kdePackages.kdenlive
54        nautilus
55        obs-studio
56        veracrypt
57      ]));
58
59    xdg.mimeApps.defaultApplications = {
60      "application/pdf" = ["org.mate.atril.desktop"];
61      "application/epub+zip" = ["readest.desktop"];
62    };
63  };
64}