diff --git a/README.md b/README.md index 0b84cde..0298461 100644 --- a/README.md +++ b/README.md @@ -159,24 +159,26 @@ Then edit this section to fit your needs. ##### That available tags properties are: -| Property | Description | Type | -| --------------------- | ---------------------------------------------- |:----------------:| -| **class** | Match these classes to this tag | array of string | -| **clone_on** | Create a clone on screen(s) | number or array | -| **exclusive** | Allow only client from the "class" attributes | boolean | -| **exec_once** | Execute when the tag is first selected | string (command) | -| **force_screen** | Force a screen | number | -| **hide** | Hide this tag from view | boolean | -| **icon** | Tag icon | path | -| **init** | Create when awesome launch | boolean | -| **layout** | The tag layout | layout | -| **mwfact** | Tiled layout master/slave ratio | float(0-1) | -| **ncol** | Number of columns | number | -| **nmaster** | Number of master clients | number | -| **no_focus_stealing** | Prevent tag from stealing focus on new clients | boolean | -| **screen** | Tag screen(s) | number or array | -| **selected** | Select when created | boolean | -| **volatile** | Destroy when the last client is closed | boolean | +| Property | Description | Type | +| ------------------------- | ---------------------------------------------------- |:----------------:| +| **class** | Match these classes to this tag | array of string | +| **clone_on** | Create a clone on screen(s) | number or array | +| **exclusive** | Allow only client from the "class" attributes | boolean | +| **exec_once** | Execute when the tag is first selected | string (command) | +| **force_screen** | Force a screen | number | +| **hide** | Hide this tag from view | boolean | +| **icon** | Tag icon | path | +| **init** | Create when awesome launch | boolean | +| **layout** | The tag layout | layout | +| **mwfact** | Tiled layout master/slave ratio | float(0-1) | +| **ncol** | Number of columns | number | +| **nmaster** | Number of master clients | number | +| **no_focus_stealing** | Do not change focus then a new client is added | boolean | +| **no_focus_stealing_in** | Do not select this tag when a new client is added | boolean | +| **no_focus_stealing_out** | Do not unselect when a new client is added elsewhere | boolean | +| **screen** | Tag screen(s) | number or array | +| **selected** | Select when created | boolean | +| **volatile** | Destroy when the last client is closed | boolean | ##### The available client properties are: @@ -210,6 +212,7 @@ Then edit this section to fit your needs. | **group_children** | Add dialogs to the same tags as their parent client | boolean | | **mwfact** | The default master/slave ratio | float (0-1) | | **force_odd_as_intrusive** | Make all non-normal (dock, splash) intrusive | boolean | +| **no_focus_stealing_out** | Do not unselect tags when a new client is added | boolean | It's worth noting that some settings like `mwfact` and `default_layout` should diff --git a/extra/request.lua b/extra/request.lua new file mode 100644 index 0000000..acd2e1d --- /dev/null +++ b/extra/request.lua @@ -0,0 +1,35 @@ +local capi = {client=client,awesome=awesome} +local ewmh = require("awful.ewmh") +local tyrannical = nil + +-- Use Tyrannical policies instead of the default ones +capi.client.disconnect_signal("request::activate",ewmh.activate) +capi.client.connect_signal("request::activate",function(c) + if not tyrannical then + tyrannical = require("tyrannical") + end + local sel_tags = nil --TODO check if the current tag prevent _out stealing + local tags = c:tags() +-- for k,t in ipairs(tags) do + --TODO check if one of them is selected +-- end + capi.client.focus = c + c:raise() +end) + + +capi.client.disconnect_signal("request::tag", ewmh.tag) +capi.client.connect_signal("request::tag", function(c) + if capi.awesome.startup then + --TODO create a tag on that screen + else + --TODO block invalid requests, let Tyrannical do its job + local tags = c:tags() + if #tags == 0 then + --TODO cannot happen + end + end +end) + + +--lib/awful/tag.lua.in:capi.tag.connect_signal("request::select", tag.viewonly) \ No newline at end of file diff --git a/init.lua b/init.lua index db1cc02..3fbe399 100755 --- a/init.lua +++ b/init.lua @@ -4,8 +4,8 @@ local ipairs , type = ipairs , type local string , unpack= string,unpack local awful = require("awful") -local capi = {client = client , tag = tag , - screen = screen , mouse = mouse } +local capi = {client = client , tag = tag , awesome = awesome, + screen = screen , mouse = mouse } -------------------------------INIT------------------------------ @@ -13,7 +13,7 @@ local signals,module,class_client,tags_hash,settings,sn_callback = { "exclusive" , "init" , "volatile" , "focus_new" , "instances" , "match" , "class" , "spawn" , "position" , "force_screen" , "max_clients" , "exec_once" , "clone_on" , "clone_of" , "no_focus_stealing", - "shape_bounding", + "shape_bounding", "no_focus_stealing_out","no_focus_stealing_in" },{},{},{},{},{} for _,sig in ipairs(signals) do @@ -110,6 +110,7 @@ end --Match client local function match_client(c, startup) if not c then return end + local startup = startup == nil and capi.awesome.startup or startup if c.startup_id and sn_callback[c.startup_id] and sn_callback[c.startup_id](c,startup) then return end local low = string.lower(c.class or "N/A") local rules = class_client[low] @@ -145,7 +146,7 @@ local function match_client(c, startup) if #tags > 0 and tags[1] then c:tags(tags) if awful.tag.getproperty(tags[1],"focus_new") ~= false and not (c.transient_for and settings.block_transient_for_focus_stealing) - and not awful.tag.getproperty(tags[1],"no_focus_stealing") then + and not awful.tag.getproperty(tags[1],"no_focus_stealing_in") then awful.tag.viewonly(tags[1]) -- elseif awful.tag.getproperty(tags[1],"no_focus_stealing") then -- c.urgent = true --It is not Tyrannical job to decide if it is urgent or not @@ -218,15 +219,24 @@ awful.tag.add,awful.tag._setscreen = function(tag,props) return t end,awful.tag.setscreen -awful.tag.setscreen,awful.tag._viewonly = function(tag,screen) --Why this isn't by default... - if not tag or type(tag) ~= "tag" then return end - awful.tag._setscreen(tag,screen) - for k,c in ipairs(tag:clients()) do - c.screen = screen or 1 --Move all clients - c:tags({tag}) --Prevent some very strange side effects, does create some issue with multitag clients +awful.tag._viewonly = awful.tag.viewonly + +-- Check is Awesome is 3.5.3+ +if capi.awesome.startup == nil then + -- Monkey patch a bug fixed in 3.5.3 + awful.tag.setscreen = function(tag,screen) + if not tag or type(tag) ~= "tag" then return end + awful.tag._setscreen(tag,screen) + for k,c in ipairs(tag:clients()) do + c.screen = screen or 1 --Move all clients + c:tags({tag}) --Prevent some very strange side effects, does create some issue with multitag clients + end + awful.tag.history.restore(tag.screen,1) end - awful.tag.history.restore(tag.screen,1) -end,awful.tag.viewonly +else + -- Restore the old behavior in newer Awesome + require("tyrannical.extra.request") +end awful.tag.viewonly = function(t) if not t then return end