From fc297a92ca20d8697d503ff8f409a57803dbea43 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 26 Oct 2021 21:16:00 +0200 Subject: rc: use singleton notification helper --- rc.lua | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/rc.lua b/rc.lua index 96f3b22..0a8a4f1 100644 --- a/rc.lua +++ b/rc.lua @@ -12,6 +12,7 @@ local naughty = require("naughty") local bindings = require("bindings") local commondefs = require("commondefs") local pager = require("pager") +local utils = require("utils") local workspace = require("workspace") -- {{{ Error handling @@ -193,20 +194,16 @@ client.connect_signal("mouse::enter", -- show a notification on changing tag properties do local tag_prop_notify = { - master_count = {}, - column_count = {}, - master_width_factor = {}, + master_count = 'Master count', + column_count = 'Column count', + master_width_factor = 'Master width factor', } - for name, tbl in pairs(tag_prop_notify) do + for name, desc in pairs(tag_prop_notify) do tag.connect_signal('property::' .. name, function(tag) - local args = { title = name, text = tostring(tag[name]), timeout = 2 } - if tbl.notification and tbl.notification.box.visible then - args.replaces_id = tbl.notification.id - end - - tbl.notification = naughty.notify(args) + utils.notify_singleton(wsp, name, + { title = desc, text = tostring(tag[name]), timeout = 2 }) end) end end -- cgit v1.2.3