xdg-desktop-entries: add 'actions' option, deprecate fileValidation (#2778)
Validation is always enabled so it does not make sense to keep this option
This commit is contained in:
parent
bb860e3e11
commit
f47001cec9
|
@ -7,6 +7,8 @@ let
|
||||||
imports = [
|
imports = [
|
||||||
(mkRemovedOptionModule [ "extraConfig" ]
|
(mkRemovedOptionModule [ "extraConfig" ]
|
||||||
"The `extraConfig` option of `xdg.desktopEntries` has been removed following a change in Nixpkgs.")
|
"The `extraConfig` option of `xdg.desktopEntries` has been removed following a change in Nixpkgs.")
|
||||||
|
(mkRemovedOptionModule [ "fileValidation" ]
|
||||||
|
"Validation of the desktop file is always enabled.")
|
||||||
];
|
];
|
||||||
options = {
|
options = {
|
||||||
# Since this module uses the nixpkgs/pkgs/build-support/make-desktopitem function,
|
# Since this module uses the nixpkgs/pkgs/build-support/make-desktopitem function,
|
||||||
|
@ -118,10 +120,35 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
fileValidation = mkOption {
|
actions = mkOption {
|
||||||
type = types.bool;
|
type = types.attrsOf (types.submodule ({ name, ... }: {
|
||||||
description = "Whether to validate the generated desktop file.";
|
options.name = mkOption {
|
||||||
default = true;
|
type = types.str;
|
||||||
|
default = name;
|
||||||
|
defaultText = literalExpression "<name>";
|
||||||
|
description = "Name of the action.";
|
||||||
|
};
|
||||||
|
options.exec = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = "Program to execute, possibly with arguments.";
|
||||||
|
};
|
||||||
|
options.icon = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = "Icon to display in file manager, menus, etc.";
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
default = { };
|
||||||
|
defaultText = literalExpression "{ }";
|
||||||
|
example = literalExpression ''
|
||||||
|
{
|
||||||
|
"New Window" = {
|
||||||
|
exec = "''${pkgs.firefox}/bin/firefox --new-window %u";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
description =
|
||||||
|
"The set of actions made available to application launchers.";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Required for the assertions
|
# Required for the assertions
|
||||||
|
@ -145,7 +172,7 @@ let
|
||||||
inherit name;
|
inherit name;
|
||||||
inherit (config)
|
inherit (config)
|
||||||
type exec icon comment terminal genericName startupNotify noDisplay
|
type exec icon comment terminal genericName startupNotify noDisplay
|
||||||
prefersNonDefaultGPU;
|
prefersNonDefaultGPU actions;
|
||||||
desktopName = config.name;
|
desktopName = config.name;
|
||||||
mimeTypes = optionals (config.mimeType != null) config.mimeType;
|
mimeTypes = optionals (config.mimeType != null) config.mimeType;
|
||||||
categories = optionals (config.categories != null) config.categories;
|
categories = optionals (config.categories != null) config.categories;
|
||||||
|
|
|
@ -18,20 +18,33 @@ with lib;
|
||||||
startupNotify = false;
|
startupNotify = false;
|
||||||
noDisplay = false;
|
noDisplay = false;
|
||||||
prefersNonDefaultGPU = false;
|
prefersNonDefaultGPU = false;
|
||||||
extraConfig = ''
|
|
||||||
[X-ExtraSection]
|
|
||||||
Exec=foo -o
|
|
||||||
'';
|
|
||||||
settings = {
|
settings = {
|
||||||
Keywords = "calc;math";
|
Keywords = "calc;math";
|
||||||
DBusActivatable = "false";
|
DBusActivatable = "false";
|
||||||
};
|
};
|
||||||
fileValidation = true;
|
actions = {
|
||||||
|
"New-Window" = {
|
||||||
|
name = "New Window";
|
||||||
|
exec = "test --new-window";
|
||||||
|
icon = "test";
|
||||||
|
};
|
||||||
|
"Default" = { exec = "test --default"; };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
min = { # minimal definition
|
min = { # minimal definition
|
||||||
exec = "test --option";
|
exec = "test --option";
|
||||||
name = "Test";
|
name = "Test";
|
||||||
};
|
};
|
||||||
|
deprecated = {
|
||||||
|
exec = "test --option";
|
||||||
|
name = "Test";
|
||||||
|
# Deprecated options
|
||||||
|
fileValidation = true;
|
||||||
|
extraConfig = ''
|
||||||
|
[X-ExtraSection]
|
||||||
|
Exec=foo -o
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#testing that preexisting entries in the store are overridden
|
#testing that preexisting entries in the store are overridden
|
||||||
|
@ -50,10 +63,16 @@ with lib;
|
||||||
|
|
||||||
test.asserts.assertions.expected =
|
test.asserts.assertions.expected =
|
||||||
let currentFile = toString ./desktop-entries.nix;
|
let currentFile = toString ./desktop-entries.nix;
|
||||||
in [''
|
in [
|
||||||
The option definition `extraConfig' in `${currentFile}' no longer has any effect; please remove it.
|
''
|
||||||
The `extraConfig` option of `xdg.desktopEntries` has been removed following a change in Nixpkgs.
|
The option definition `fileValidation' in `${currentFile}' no longer has any effect; please remove it.
|
||||||
''];
|
Validation of the desktop file is always enabled.
|
||||||
|
''
|
||||||
|
''
|
||||||
|
The option definition `extraConfig' in `${currentFile}' no longer has any effect; please remove it.
|
||||||
|
The `extraConfig` option of `xdg.desktopEntries` has been removed following a change in Nixpkgs.
|
||||||
|
''
|
||||||
|
];
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertFileExists home-path/share/applications/full.desktop
|
assertFileExists home-path/share/applications/full.desktop
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
|
Actions=Default;New-Window
|
||||||
Categories=Network;WebBrowser
|
Categories=Network;WebBrowser
|
||||||
Comment=My Application
|
Comment=My Application
|
||||||
DBusActivatable=false
|
DBusActivatable=false
|
||||||
|
@ -14,3 +15,12 @@ StartupNotify=false
|
||||||
Terminal=true
|
Terminal=true
|
||||||
Type=Application
|
Type=Application
|
||||||
Version=1.4
|
Version=1.4
|
||||||
|
|
||||||
|
[Desktop Action Default]
|
||||||
|
Exec=test --default
|
||||||
|
Name=Default
|
||||||
|
|
||||||
|
[Desktop Action New-Window]
|
||||||
|
Exec=test --new-window
|
||||||
|
Icon=test
|
||||||
|
Name=New Window
|
||||||
|
|
Loading…
Reference in a new issue