lcpz / awesome-freedesktop

Freedesktop.org menu and desktop icons support for Awesome WM
GNU General Public License v2.0
129 stars 25 forks source link

menu.lua : over the top dumps #11

Closed Sorky closed 5 years ago

Sorky commented 5 years ago

Environment:

.xinitrc starts awesome with error capture...
    exec awesome > ~/.awesome.log 2>&1

awesome v4.2 (Human after all)
 • Compiled against Lua 5.3.3 (running with Lua 5.3)
 • D-Bus support: ✔
 • execinfo support: ✔
 • xcb-randr version: 1.5
 • LGI version: 0.9.2

Issue:

Long list of messages logged...
    ls: cannot access '/home/david/.local/share/applications/': No such file or directory
    ls: cannot access '/usr/local/share/applications/': No such file or directory
    apport-gtk.desktop
    audacious.desktop
    <etc>

Cause (AFAICT):

if os.execute(string.format("ls %s &> /dev/null", v)) then

Solution (Best?):

-- add as the first 'require'
local Gio        = require("lgi").Gio

-- replace the 'Cause' with...
if Gio.File.new_for_path(v):query_file_type({}) == "DIRECTORY" then

-- remove this (+ CR + whitespace)...
execute = os.execute,

Solution (Alternate):

-- add as the first 'require'
local gfs        = require("gears.filesystem")

-- replace the 'Cause' with...
if gfs.is_dir(v) then

-- remove this (+ CR + whitespace)...
execute = os.execute,