From aaaea4c35f6efd15fee8d49798a6a4124557e74a Mon Sep 17 00:00:00 2001 From: BZ Date: Sat, 15 May 2021 14:48:14 +0200 Subject: [PATCH] run awesome.signals in glib idle context --- init.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 21e6dc6..0af3e18 100644 --- a/init.lua +++ b/init.lua @@ -3,6 +3,7 @@ local gears = require("gears") local awful = require("awful") local theme = require("beautiful") local naughty = require("naughty") +local glib = require("lgi").GLib local dpi = theme.xresources.apply_dpi local module = {} @@ -33,6 +34,14 @@ local function update_on_signal(c, signal, widget) table.insert(widgets, widget) 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) if pos == "left" or pos == "right" then return "v" @@ -292,7 +301,7 @@ local add_hot_corner = function(args) awesome.emit_signal(signal) end)) if must_connect_signal then - awesome.connect_signal(signal, actions[btn.name]) + awesome.connect_signal(signal, glib_context(actions[btn.name])) end end end @@ -305,7 +314,7 @@ local add_hot_corner = function(args) awesome.emit_signal(signal) end) if must_connect_signal then - awesome.connect_signal(signal, actions[action]) + awesome.connect_signal(signal, glib_context(actions[action])) end end end