Skip to content

Commit

Permalink
menu: remove icon_size since it is blocking and demanding; fix #19
Browse files Browse the repository at this point in the history
  • Loading branch information
lcpz committed Apr 13, 2021
1 parent b77dee0 commit e4ac597
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions menu.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

--[[
Awesome-Freedesktop
Expand All @@ -11,10 +12,10 @@
--]]

local Gio = require("lgi").Gio
local awful_menu = require("awful.menu")
local menu_gen = require("menubar.menu_gen")
local menu_utils = require("menubar.utils")
local icon_theme = require("menubar.icon_theme")

local io, pairs, string, table, os = io, pairs, string, table, os

Expand All @@ -25,13 +26,11 @@ menu_utils.wm_name = ""
-- freedesktop.menu
local menu = {}

-- Determines if a path points to a directory, by checking if it can be read
-- (which is `nil` also for empty files) and if its size is not 0.
-- @author blueyed
-- @param path the path to check
-- Check if a path is a directory.
-- @tparam string path The directory path
-- @treturn boolean True if path exists and is a directory
function menu.is_dir(path)
local f = io.open(path)
return f and not f:read(0) and f:seek("end") ~= 0 and f:close()
return Gio.File.new_for_path(path):query_file_type({}) == "DIRECTORY"
end

-- Remove non existent paths in order to avoid issues
Expand Down Expand Up @@ -60,7 +59,6 @@ end
-- @return awful.menu
function menu.build(args)
local args = args or {}
local icon_size = args.icon_size
local before = args.before or {}
local after = args.after or {}
local skip_items = args.skip_items or {}
Expand Down Expand Up @@ -114,13 +112,6 @@ function menu.build(args)
for _, v in pairs(after) do _menu:add(v) end
end)

-- Set icon size
if icon_size then
for _,v in pairs(menu_gen.all_categories) do
v.icon = icon_theme():find_icon_path(v.icon_name, icon_size)
end
end

-- Hold the menu in the module
menu.menu = _menu

Expand Down

0 comments on commit e4ac597

Please sign in to comment.