diff --git a/README.md b/README.md index dd0aaf9..8efe61c 100644 --- a/README.md +++ b/README.md @@ -36,13 +36,17 @@ This will start vlc with the first parameter set to $HOME/Music: dub run desktopfile:desktoputil -- exec /usr/share/applications/vlc.desktop $HOME/Music -Should start command line application in terminal emulator (will be detected automatically): +This should start command line application in terminal emulator (will be detected automatically): dub run desktopfile:desktoputil -- exec /usr/share/applications/python2.7.desktop Run in specific terminal emulator: dub run desktopfile:desktoputil -- exec /usr/share/applications/python2.7.desktop --term=xterm + +Additional application actions are supported too: + + dub run desktopfile:desktoputil -- exec /usr/share/applications/steam.desktop --action=Settings Open link with preferred application: diff --git a/source/desktopfile.d b/source/desktopfile.d index 14448aa..e8d0df9 100644 --- a/source/desktopfile.d +++ b/source/desktopfile.d @@ -387,6 +387,17 @@ public: return null; } + /// + unittest + { + string contents = +`[Desktop Entry] +Name=Program +Type=Application`; + auto df = new DesktopFile(iniLikeStringReader(contents), DesktopFile.ReadOptions.noOptions, "/usr/share/applications/de/example.desktop"); + assert(df.id() == "de-example.desktop"); + } + /** * Generic name of the application, for example "Web Browser". * Returns: The value associated with "GenericName" key. @@ -697,10 +708,7 @@ public: } else if (token == "%c") { toReturn ~= localizedName(locale); } else if (token == "%k") { - auto fileStr = fileName(); - if (fileStr.length) { - toReturn ~= fileStr; - } + toReturn ~= fileName(); } else if (token == "%d" || token == "%D" || token == "%n" || token == "%N" || token == "%m" || token == "%v") { continue; } else { @@ -718,11 +726,11 @@ public: `[Desktop Entry] Name=Program Name[ru]=Программа -Exec=program %i -w %c -f %k %U %D +Exec=program %i -w %c -f %k %U %D %u %f %F Icon=folder`; auto df = new DesktopFile(iniLikeStringReader(contents), DesktopFile.ReadOptions.noOptions, "/example.desktop"); assert(df.expandExecString(["one", "two"], "ru") == - ["program", "--icon", "folder", "-w", "Программа", "-f", "/example.desktop", "one", "two"]); + ["program", "--icon", "folder", "-w", "Программа", "-f", "/example.desktop", "one", "two", "one", "one", "one", "two"]); } /**