Codebase list awesome-extra / f3543c1
Update freedesktop Reiner Herrmann 3 years ago
2 changed file(s) with 22 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
1515 local utils = require("menubar.utils")
1616 local wibox = require("wibox")
1717
18 local capi = capi
1918 local io = io
2019 local ipairs = ipairs
2120 local mouse = mouse
2221 local os = os
2322 local string = string
23 local screen = screen
2424 local table = table
2525
2626 -- Desktop icons
7676
7777 -- define icon dimensions and position
7878 if not desktop_current_pos[s] then
79 desktop_current_pos[s] = { x = (capi.screen[s].geometry.x + args.iconsize.width + args.margin.x), y = 40 }
79 desktop_current_pos[s] = { x = (screen[s].geometry.x + args.iconsize.width + args.margin.x), y = 40 }
8080 end
8181
8282 local totheight = (icon and args.iconsize.height or 0) + (label and args.labelsize.height or 0)
8383 if totheight == 0 then return end
8484
85 if desktop_current_pos[s].y + totheight > capi.screen[s].geometry.height - 40 then
85 if desktop_current_pos[s].y + totheight > screen[s].geometry.height - 40 then
8686 desktop_current_pos[s].x = desktop_current_pos[s].x + args.labelsize.width + args.iconsize.width + args.margin.x
8787 desktop_current_pos[s].y = 40
8888 end
1414 local menu_gen = require("menubar.menu_gen")
1515 local menu_utils = require("menubar.utils")
1616 local icon_theme = require("menubar.icon_theme")
17 local gls = require("gears.filesystem")
1817
19 local pairs, string, table, os = pairs, string, table, os
20
21 -- Add support for NixOS systems too
22 table.insert(menu_gen.all_menu_dirs, string.format("%s/.nix-profile/share/applications", os.getenv("HOME")))
23
24 -- Remove non existent paths in order to avoid issues
25 local existent_paths = {}
26 for k,v in pairs(menu_gen.all_menu_dirs) do
27 if gls.is_dir(v) then
28 table.insert(existent_paths, v)
29 end
30 end
31 menu_gen.all_menu_dirs = existent_paths
18 local io, pairs, string, table, os = io, pairs, string, table, os
3219
3320 -- Expecting a wm_name of awesome omits too many applications and tools
3421 menu_utils.wm_name = ""
3623 -- Menu
3724 -- freedesktop.menu
3825 local menu = {}
26
27 -- Determines if a path points to a directory, by checking if it can be read
28 -- (which is `nil` also for empty files) and if its size is not 0.
29 -- @author blueyed
30 -- @param path the path to check
31 function menu.is_dir(path)
32 local f = io.open(path)
33 return f and not f:read(0) and f:seek("end") ~= 0 and f:close()
34 end
35
36 -- Remove non existent paths in order to avoid issues
37 local existent_paths = {}
38 for k,v in pairs(menu_gen.all_menu_dirs) do
39 if menu.is_dir(v) then
40 table.insert(existent_paths, v)
41 end
42 end
43 menu_gen.all_menu_dirs = existent_paths
3944
4045 -- Determines whether an table includes a certain element
4146 -- @param tab a given table