Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
-- Notifications for property changes (number of masters, master width factor). {{{
-- local prev_tag_vals = {['property::nmaster']={}, ['property::mwfact']={}}
local prev_tag_vals, prop_notification_id = {}, nil
for s = 1, capi.screen.count() do
for sig, name in pairs({['property::nmaster'] = 'nmaster',
['property::ncol'] = 'ncol',
['property::windowfact'] = 'windowfact',
['property::mwfact'] = 'mwfact'}) do
awful.tag.attached_connect_signal(s, sig, function(t)
if not prev_tag_vals[sig] then
prev_tag_vals[sig] = { [t] = '?' }
elseif not prev_tag_vals[sig][t] then
prev_tag_vals[sig][t] = '?'
end
local old = prev_tag_vals[sig][t]
local val = awful.tag.getproperty(t, name)
prop_notification_id = naughty.notify({
text = name .. ' changed: ' .. tostring(old) .. ' => ' .. tostring(val),
timeout = 10,
replaces_id = prop_notification_id,
}).id
prev_tag_vals[sig][t] = val
end)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment