mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
Merge branch 'ewmh_urgent_v1'
- Fix / revert changing of file modes for: lib/awful/tag.lua.in, lib/awful/widget/taglist.lua.in, objects/client.c and property.h. - Fix typo / punctuation in doc. - Use `capi.client.connect_signal` instead of `add_signal` (Ref: https://github.com/Elv13/awesome-1/commit/b292b09#commitcomment-9750466). Pull request: https://github.com/awesomeWM/awesome/pull/33
This commit is contained in:
commit
f2aa8d39ed
6 changed files with 63 additions and 14 deletions
18
ewmh.c
18
ewmh.c
|
@ -346,12 +346,18 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set)
|
|||
}
|
||||
else if(state == _NET_WM_STATE_DEMANDS_ATTENTION)
|
||||
{
|
||||
if(set == _NET_WM_STATE_REMOVE)
|
||||
client_set_urgent(L, -1, false);
|
||||
else if(set == _NET_WM_STATE_ADD)
|
||||
client_set_urgent(L, -1, true);
|
||||
else if(set == _NET_WM_STATE_TOGGLE)
|
||||
client_set_urgent(L, -1, !c->urgent);
|
||||
if(set == _NET_WM_STATE_REMOVE) {
|
||||
lua_pushboolean(L, false);
|
||||
luaA_object_emit_signal(L, -2, "request::urgent", 1);
|
||||
}
|
||||
else if(set == _NET_WM_STATE_ADD) {
|
||||
lua_pushboolean(L, true);
|
||||
luaA_object_emit_signal(L, -2, "request::urgent", 1);
|
||||
}
|
||||
else if(set == _NET_WM_STATE_TOGGLE) {
|
||||
lua_pushboolean(L, !c->urgent);
|
||||
luaA_object_emit_signal(L, -2, "request::urgent", 1);
|
||||
}
|
||||
}
|
||||
|
||||
lua_pop(L, 1);
|
||||
|
|
|
@ -10,6 +10,7 @@ local screen = screen
|
|||
local ipairs = ipairs
|
||||
local math = math
|
||||
local atag = require("awful.tag")
|
||||
local aclient = require("awful.client")
|
||||
|
||||
--- Implements EWMH requests handling.
|
||||
-- awful.ewmh
|
||||
|
@ -158,8 +159,15 @@ function ewmh.tag(c, t)
|
|||
end
|
||||
end
|
||||
|
||||
function ewmh.urgent(c, urgent)
|
||||
if c ~= client.focus and not aclient.property.get(c,"ignore_urgent") then
|
||||
c.urgent = urgent
|
||||
end
|
||||
end
|
||||
|
||||
client.connect_signal("request::activate", ewmh.activate)
|
||||
client.connect_signal("request::tag", ewmh.tag)
|
||||
client.connect_signal("request::urgent", ewmh.urgent)
|
||||
client.connect_signal("request::maximized_horizontal", maximized_horizontal)
|
||||
client.connect_signal("request::maximized_vertical", maximized_vertical)
|
||||
client.connect_signal("request::fullscreen", fullscreen)
|
||||
|
|
|
@ -632,7 +632,40 @@ capi.client.connect_signal("manage", function(c)
|
|||
c:connect_signal("property::screen", tag.withcurrent)
|
||||
end)
|
||||
|
||||
-- Keep track of the number of urgent clients.
|
||||
local function update_urgent(c,t)
|
||||
local modif = c.urgent == true and 1 or -1
|
||||
local count = tag.getproperty(t,"urgent_count") or 0
|
||||
count = (count + modif) >= 0 and (count + modif) or 0
|
||||
tag.setproperty(t,"urgent" , count > 0)
|
||||
tag.setproperty(t,"urgent_count", count )
|
||||
end
|
||||
|
||||
-- Update the urgent counter when a client is tagged.
|
||||
local function client_tagged(c,t)
|
||||
if c.urgent then
|
||||
update_urgent(c,t)
|
||||
end
|
||||
end
|
||||
|
||||
-- Update the urgent counter when a client is untagged.
|
||||
local function client_untagged(c,t)
|
||||
if c.urgent then
|
||||
update_urgent(c,t)
|
||||
end
|
||||
end
|
||||
|
||||
-- Count the urgent clients.
|
||||
local function urgent_callback(c)
|
||||
for k,t in ipairs(c:tags()) do
|
||||
update_urgent(c,t)
|
||||
end
|
||||
end
|
||||
|
||||
capi.client.connect_signal("property::urgent", urgent_callback)
|
||||
capi.client.connect_signal("manage", tag.withcurrent)
|
||||
capi.client.connect_signal("untagged", client_untagged)
|
||||
capi.client.connect_signal("tagged", client_tagged)
|
||||
capi.tag.connect_signal("request::select", tag.viewonly)
|
||||
|
||||
capi.tag.add_signal("property::hide")
|
||||
|
@ -644,6 +677,8 @@ capi.tag.add_signal("property::nmaster")
|
|||
capi.tag.add_signal("property::windowfact")
|
||||
capi.tag.add_signal("property::screen")
|
||||
capi.tag.add_signal("property::index")
|
||||
capi.tag.add_signal("property::urgent")
|
||||
capi.tag.add_signal("property::urgent_count")
|
||||
|
||||
capi.screen.add_signal("tag::history::update")
|
||||
for s = 1, capi.screen.count() do
|
||||
|
|
|
@ -85,12 +85,9 @@ function taglist.taglist_label(t, args)
|
|||
if bg_empty then bg_color = bg_empty end
|
||||
if fg_empty then fg_color = fg_empty end
|
||||
end
|
||||
for k, c in pairs(cls) do
|
||||
if c.urgent then
|
||||
if bg_urgent then bg_color = bg_urgent end
|
||||
if fg_urgent then fg_color = fg_urgent end
|
||||
break
|
||||
end
|
||||
if tag.getproperty(t, "urgent") then
|
||||
if bg_urgent then bg_color = bg_urgent end
|
||||
if fg_urgent then fg_color = fg_urgent end
|
||||
end
|
||||
end
|
||||
if t.selected then
|
||||
|
@ -176,7 +173,7 @@ function taglist.new(screen, filter, buttons, style, update_function, base_widge
|
|||
tag.attached_connect_signal(screen, "property::activated", ut)
|
||||
tag.attached_connect_signal(screen, "property::screen", ut)
|
||||
tag.attached_connect_signal(screen, "property::index", ut)
|
||||
capi.client.connect_signal("property::urgent", uc)
|
||||
tag.attached_connect_signal(screen, "property::urgent", ut)
|
||||
capi.client.connect_signal("property::screen", function(c)
|
||||
-- If client change screen, refresh it anyway since we don't from
|
||||
-- which screen it was coming :-)
|
||||
|
|
|
@ -2537,6 +2537,7 @@ client_class_setup(lua_State *L)
|
|||
signal_add(&client_class.signals, "request::maximized_horizontal");
|
||||
signal_add(&client_class.signals, "request::maximized_vertical");
|
||||
signal_add(&client_class.signals, "request::tag");
|
||||
signal_add(&client_class.signals, "request::urgent");
|
||||
signal_add(&client_class.signals, "tagged");
|
||||
signal_add(&client_class.signals, "unfocus");
|
||||
signal_add(&client_class.signals, "unmanage");
|
||||
|
|
|
@ -198,7 +198,9 @@ property_update_wm_hints(client_t *c, xcb_get_property_cookie_t cookie)
|
|||
return;
|
||||
|
||||
luaA_object_push(L, c);
|
||||
client_set_urgent(L, -1, xcb_icccm_wm_hints_get_urgency(&wmh));
|
||||
|
||||
lua_pushboolean(L, xcb_icccm_wm_hints_get_urgency(&wmh));
|
||||
luaA_object_emit_signal(L, -2, "request::urgent", 1);
|
||||
|
||||
if(wmh.flags & XCB_ICCCM_WM_HINT_INPUT)
|
||||
c->nofocus = !wmh.input;
|
||||
|
|
Loading…
Reference in a new issue