$OpenBSD: patch-lib_menubar_utils_lua_in,v 1.4 2014/09/29 11:12:54 dcoppa Exp $

From f2f6eb68214df6369486c55563b957c3572a1c9d
From: Daniel Hahler <git@thequod.de>
Date: Thu, 25 Sep 2014 02:47:40 +0200
Subject: [PATCH] menubar: skip comments in .desktop files

--- lib/menubar/utils.lua.in.orig	Fri Apr 11 11:07:10 2014
+++ lib/menubar/utils.lua.in	Mon Sep 29 12:41:40 2014
@@ -81,10 +81,10 @@ function utils.lookup_icon(icon_file)
         local icon_theme_paths = {}
         local icon_theme = theme.icon_theme
         if icon_theme then
-            table.insert(icon_theme_paths, '/usr/share/icons/' .. icon_theme .. '/')
+            table.insert(icon_theme_paths, '${LOCALBASE}/share/icons/' .. icon_theme .. '/')
             -- TODO also look in parent icon themes, as in freedesktop.org specification
         end
-        table.insert(icon_theme_paths, '/usr/share/icons/hicolor/') -- fallback theme
+        table.insert(icon_theme_paths, '${LOCALBASE}/share/icons/hicolor/') -- fallback theme
 
         for i, icon_theme_directory in ipairs(icon_theme_paths) do
             for j, size in ipairs(all_icon_sizes) do
@@ -97,8 +97,8 @@ function utils.lookup_icon(icon_file)
             end
         end
         -- lowest priority fallbacks
-        table.insert(icon_path, '/usr/share/pixmaps/')
-        table.insert(icon_path, '/usr/share/icons/')
+        table.insert(icon_path, '${LOCALBASE}/share/pixmaps/')
+        table.insert(icon_path, '${LOCALBASE}/share/icons/')
 
         for i, directory in ipairs(icon_path) do
             if is_format_supported(icon_file) and awful_util.file_readable(directory .. icon_file) then
@@ -129,7 +129,9 @@ function utils.parse(file)
     -- Parse the .desktop file.
     -- We are interested in [Desktop Entry] group only.
     for line in io.lines(file) do
-        if not desktop_entry and line == "[Desktop Entry]" then
+        if line:find("^%s*#") then
+            -- Skip comments.
+        elseif not desktop_entry and line == "[Desktop Entry]" then
             desktop_entry = true
         else
             if line:sub(1, 1) == "[" and line:sub(-1) == "]" then
