about summary refs log tree commit diff
path: root/modules/kde.nix
blob: a23eaa4bb5aa70c88435cbf2aefe8499e42c6f27 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
{
  config,
  inputs,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.nixfiles.modules.kde;
in
{
  options.nixfiles.modules.kde.enable = lib.mkEnableOption "KDE Plasma";

  config = lib.mkIf cfg.enable {
    nixfiles.modules = {
      common.xdg.defaultApplications."org.kde.dolphin" = [ "inode/directory" ];

      gnupg.pinentry = pkgs.pinentry-qt;
      sound.enable = true;
    };

    stylix.targets.qt.enable = false;

    hm = {
      imports = [ inputs.plasma-manager.homeManagerModules.plasma-manager ];

      stylix.targets.qt.enable = false;

      home.sessionVariables.GTK_THEME = config.hm.gtk.theme.name;

      gtk.theme = lib.mkForce {
        package = pkgs.kdePackages.breeze-gtk;
        name = "Breeze";
      };

      programs = {
        plasma = {
          enable = true;

          immutableByDefault = false;

          fonts = {
            windowTitle = with config.stylix.fonts; {
              family = sansSerif.name;
              pointSize = sizes.desktop;
            };
          };

          desktop = {
            icons = {
              alignment = "left";
              arrangement = "topToBottom";
              sorting = {
                mode = "name";
                descending = true;
                foldersFirst = true;
              };
            };
          };

          session = {
            general.askForConfirmationOnLogout = true;
            sessionRestore = {
              excludeApplications = [ ];
              restoreOpenApplicationsOnLogin = "whenSessionWasManuallySaved";
            };
          };

          spectacle = {
            shortcuts = {
              launch = "Meta+S";
              launchWithoutCapturing = "Meta+Alt+S";

              captureActiveWindow = "Meta+Print";
              captureCurrentMonitor = "Print";
              captureEntireDesktop = "Shift+Print";
              captureRectangularRegion = "Meta+Shift+S";
              captureWindowUnderCursor = "Meta+Ctrl+Print";

              recordRegion = "Meta+Shift+R";
              recordScreen = "Meta+Alt+R";
              recordWindow = "Meta+Ctrl+R";
            };
          };

          input.keyboard = with config.services.xserver; {
            repeatDelay = autoRepeatDelay;
            repeatRate = autoRepeatInterval;
            numlockOnStartup = "off";
          };

          configFile = {
            baloofilerc."Basic Settings"."Indexing-Enabled" = false;
            kwalletrc."Wallet"."Enabled" = false;
            kwinrc."Xwayland"."XwaylandEavesdrop" = "None";
            spectaclerc = {
              "ImageSave"."imageSaveLocation" = "file://${config.userDirs.pictures}";
              "VideoSave"."videoSaveLocation" = "file://${config.userDirs.videos}";
            };
          };
        };

        firefox.profiles.default.settings = {
          "widget.use-xdg-desktop-portal.file-picker" = 1;
          "widget.use-xdg-desktop-portal.mime-handler" = 1;
        };
      };

      xdg.configFile = {
        "fontconfig/conf.d/10-hm-fonts.conf".force = lib.mkForce true;
        "mimeapps.list".force = lib.mkForce true;
      };
    };

    services = {
      desktopManager.plasma6.enable = true;

      displayManager.sddm = {
        enable = true;

        wayland = {
          enable = true;
          compositor = "kwin";
        };
      };
    };

    environment = {
      plasma6.excludePackages = with pkgs.kdePackages; [
        elisa
        gwenview
        kate
        khelpcenter
        print-manager
      ];
      systemPackages = with pkgs.kdePackages; [
        krdc
        plasma-disks
      ];
    };
  };
}

Consider giving Nix/NixOS a try! <3