1
0
Fork 0
mirror of https://github.com/lcpz/awesome-copycats.git synced 2024-12-23 03:32:30 +00:00

fixing #35; lain: new commit

This commit is contained in:
luke bonham 2014-03-30 12:35:03 +02:00
parent ce017a2deb
commit bc166ade29
2 changed files with 5 additions and 31 deletions

View file

@ -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'

2
lain

@ -1 +1 @@
Subproject commit 67865e6426dfe0d74d0d9fff7a7c29c729823684
Subproject commit a0bd2798accb561db079aebbdd3ee8d4d9c65465