awesomeWM / awesome

awesome window manager
https://awesomewm.org/
GNU General Public License v2.0
6.39k stars 597 forks source link

"DESKTOP" type windows cause error in matcher #3206

Open RossComputerGuy opened 4 years ago

RossComputerGuy commented 4 years ago

Output of awesome --version:

awesome v4.3-894-gcc67a5b4 (Too long)
 • Compiled against Lua 5.3.3 (running with Lua 5.3)
 • API level: 4
 • D-Bus support: yes
 • xcb-errors support: no
 • execinfo support: yes
 • xcb-randr version: 1.6
 • LGI version: 0.9.2
 • Transparency enabled: yes
 • Custom search paths: no

How to reproduce the issue: Use LGI to create a GTK window with the type hint of Gdk.WindowTypeHint.DESKTOP

Actual result: No errors like this should appear

Expected result: When the window is created:

2020-11-03 15:41:23 W: awesome: luaA_dofunction:78: error while running function!
stack traceback:
        [C]: in function 'ipairs'
        /usr/share/awesome/lib/gears/matcher.lua:312: in method '_match_any'
        /usr/share/awesome/lib/gears/matcher.lua:357: in method 'matches_rule'
        /usr/share/awesome/lib/gears/matcher.lua:411: in method 'matching_rules'
        /usr/share/awesome/lib/gears/matcher.lua:489: in upvalue 'default_rules_callback'
        /usr/share/awesome/lib/gears/matcher.lua:511: in field 'callback'
        /usr/share/awesome/lib/gears/matcher.lua:627: in function </usr/share/awesome/lib/gears/matcher.lua:624>
        (...tail calls...)
error: /usr/share/awesome/lib/gears/matcher.lua:312: bad argument #1 to 'ipairs' (table expected, got boolean)
psychon commented 3 years ago

@RossComputerGuy I am too lazy to look at Gtk docs. Do you have a self-contained, runnable example that can be used to reproduce this issue?

RossComputerGuy commented 3 years ago

No but I have the code that creates this window for my setup, https://github.com/ExpidusOS/shell/blob/master/share/expidus-shell/expidus/launcher.lua

psychon commented 3 years ago

Wait, you are creating Gtk windows from within Awesome's Lua code? That's a dangerous thing to do (but should not really relate to the error in question).

Also, that code uses soooo much more than just Gtk. I do not want to install libhandy just for this. :-(

Anyway, here is a pure-Gtk version that does not reproduce the issue, sorry (save that code in a file and run it):

local lgi = require("lgi")
local Gdk = lgi.Gdk
local GObject = lgi.GObject
local Gio = lgi.Gio
local Gtk = lgi.Gtk

local win = Gtk.Window.new(Gtk.WindowType.TOPLEVEL)
win:set_type_hint(Gdk.WindowTypeHint.DESKTOP)
win:set_title("Title here")
win:set_default_size(200, 100)
function win.on_destroy()
    Gtk.main_quit()
end
win:add(Gtk.Button.new_with_label("Button"))
win:show_all()

Gtk.main()

(Also, the window does not get a titlebar here...)

RossComputerGuy commented 3 years ago

Yes, I'm making a Gtk window for my own launcher. That's why I also have C code mixed in. I also am using libhandy so that I can work on mobile support.