From bc166ade29ea82e49137e8fd1ed17b4733b145f0 Mon Sep 17 00:00:00 2001 From: luke bonham Date: Sun, 30 Mar 2014 12:35:03 +0200 Subject: [PATCH] fixing #35; lain: new commit --- freedesktop/utils.lua | 34 ++++------------------------------ lain | 2 +- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/freedesktop/utils.lua b/freedesktop/utils.lua index 87340b9..c5247c3 100644 --- a/freedesktop/utils.lua +++ b/freedesktop/utils.lua @@ -160,39 +160,13 @@ end -- @param requested_icon_sizes A list of icon sizes (optional). If this list is given, it will be used as a priority list for icon sizes when looking up for icons. If you want large icons, for example, you can put '128x128' as the first item in the list. -- @return A table with file entries. function parse_desktop_file(arg) - - local function check_nil(f, v) - -- Almost the same as - -- return f and f or v - -- but it will return false if f = false - if f == nil then return v else return f end - end - - --- Parses .desktop file considering groups. - -- @param file Path to file - -- @return A table with group enries. Each group entry is table with file entries. - local function parse_file(file) - local result = {} - local group = nil - - for line in io.lines(file) do - group = line:match("^%[([^%[%]%c]+)%]*(.-)%s*$") or group - if group then - result[group] = check_nil(result[group], {}) - - for key, value in line:gmatch("(%w+)=(.+)") do - result[group][key] = value - end - end + local program = { show = true, file = arg.file } + for line in io.lines(arg.file) do + for key, value in line:gmatch("(%w+)=(.+)") do + program[key] = value end - return result end - -- Using only 'Desktop Entry' group. - local program = parse_file(arg.file)['Desktop Entry'] - program.show = check_nil(program.show, true) - program.file = arg.file - -- Don't show the program if NoDisplay is true -- Only show the program if there is not OnlyShowIn attribute -- or if it's equal to 'awesome' diff --git a/lain b/lain index 67865e6..a0bd279 160000 --- a/lain +++ b/lain @@ -1 +1 @@ -Subproject commit 67865e6426dfe0d74d0d9fff7a7c29c729823684 +Subproject commit a0bd2798accb561db079aebbdd3ee8d4d9c65465