blob: 7ec2b16d926fb224a46b1b82060328d39dfa612a (
plain)
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
|
{ config, lib, ... }:
let
cfg = config.default-applications;
mkCommand = name: lib.mkOption {
type = lib.types.str;
default = "";
description = "The default ${name}.";
};
mkDesktopFile = name: lib.mkOption {
type = lib.types.str;
default = "";
description = "The default ${name}'s .desktop file";
};
in {
options.default-applications = {
web-browser = {
command = mkCommand "web browser";
desktop-file = mkDesktopFile "web browser";
};
text-editor = {
command = mkCommand "text editor";
desktop-file = mkDesktopFile "text editor";
};
image-viewer = {
command = mkCommand "image viewer";
desktop-file = mkDesktopFile "image viewer";
};
video-viewer = {
command = mkCommand "video viewer";
desktop-file = mkDesktopFile "video viewer";
};
terminal-emulator = {
command = mkCommand "terminal emulator";
runTuiCommand = mkCommand "terminal emulator run tui command";
runCliCommand = mkCommand "terminal emulator run cli command";
desktop-file = mkDesktopFile "terminal emulator";
};
};
config = {
xdg.mimeApps = {
enable = true;
defaultApplications = {
"text/plain" = [ cfg.text-editor.desktop-file ];
"text/html" = [ cfg.text-editor.desktop-file ];
"text/nix" = [ cfg.text-editor.desktop-file ];
};
};
};
}
|