run awesome.signals in glib idle context
This commit is contained in:
parent
c9a8b3fa03
commit
aaaea4c35f
13
init.lua
13
init.lua
|
@ -3,6 +3,7 @@ local gears = require("gears")
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local theme = require("beautiful")
|
local theme = require("beautiful")
|
||||||
local naughty = require("naughty")
|
local naughty = require("naughty")
|
||||||
|
local glib = require("lgi").GLib
|
||||||
local dpi = theme.xresources.apply_dpi
|
local dpi = theme.xresources.apply_dpi
|
||||||
|
|
||||||
local module = {}
|
local module = {}
|
||||||
|
@ -33,6 +34,14 @@ local function update_on_signal(c, signal, widget)
|
||||||
table.insert(widgets, widget)
|
table.insert(widgets, widget)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local glib_context = function(fn)
|
||||||
|
return function(args)
|
||||||
|
glib.idle_add(glib.PRIORITY_DEFAULT_IDLE, function()
|
||||||
|
fn(args)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function ori(pos)
|
local function ori(pos)
|
||||||
if pos == "left" or pos == "right" then
|
if pos == "left" or pos == "right" then
|
||||||
return "v"
|
return "v"
|
||||||
|
@ -292,7 +301,7 @@ local add_hot_corner = function(args)
|
||||||
awesome.emit_signal(signal)
|
awesome.emit_signal(signal)
|
||||||
end))
|
end))
|
||||||
if must_connect_signal then
|
if must_connect_signal then
|
||||||
awesome.connect_signal(signal, actions[btn.name])
|
awesome.connect_signal(signal, glib_context(actions[btn.name]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -305,7 +314,7 @@ local add_hot_corner = function(args)
|
||||||
awesome.emit_signal(signal)
|
awesome.emit_signal(signal)
|
||||||
end)
|
end)
|
||||||
if must_connect_signal then
|
if must_connect_signal then
|
||||||
awesome.connect_signal(signal, actions[action])
|
awesome.connect_signal(signal, glib_context(actions[action]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue