Add support for 'exec_once' property, add basic support for tag 'add' and 'selected' smart hooks

This commit is contained in:
Emmanuel Lepage Vallee 2013-03-08 00:33:34 -05:00
parent 4779fcbf45
commit 916d8e600e
2 changed files with 23 additions and 14 deletions

View File

@ -110,6 +110,7 @@ tyranical.tags = {
-- icon = utils.tools.invertedIconPath("folder.png") ,
screen = 1,--config.data().scr.pri ,
layout = awful.layout.suit.tile ,
exec_once = {"dolphin"} ,
class = {
"Thunar" , "Konqueror" , "Dolphin" , "ark" , "Nautilus", }
} ,

View File

@ -12,18 +12,10 @@ local module = {}
-------------------------------INIT------------------------------
local signals = {
"property::exclusive",
"property::init",
"property::volatile",
"property::focus_on_new",
"property::instances",
"property::match",
"property::class",
"property::spawn",
"property::position",
"property::force_screen",
"property::max_clients",
"property::exclusive" , "property::init" , "property::volatile" ,
"property::focus_on_new" , "property::instances" , "property::match" ,
"property::class" , "property::spawn" , "property::position" ,
"property::force_screen" , "property::max_clients", "property::exec_once",
}
for _,sig in ipairs(signals) do
capi.tag.add_signal(sig)
@ -35,6 +27,16 @@ local class_client,matches_client = {},{}
--------------------------TYRANIC LOGIC--------------------------
--Called when a tag is selected/unselected
local function on_selected_change(tag,data)
if data.exec_once and tag.selected and not data._init_done then
for k,v in ipairs(type(data.exec_once) == "string" and {data.exec_once} or data.exec_once) do
awful.util.spawn(v, false)
end
data._init_done = true
end
end
--Turn tags -> matches into matches -> tags
local function fill_tyranic(tab_in,tab_out,value)
if tab_in and tab_out then
@ -160,7 +162,7 @@ capi.client.connect_signal("untagged", function (c, t)
end)
-- awful.tag.withcurrent = function() end --Disable automatic tag insertion
awful.tag.withcurrent = function(c, startup)
awful.tag.withcurrent,awful.tag._add = function(c, startup)
local tags,old_tags = {},c:tags()
--Safety to prevent
for k, t in ipairs(old_tags) do
@ -178,6 +180,12 @@ awful.tag.withcurrent = function(c, startup)
end
end
c:tags(tags)
end,awful.tag.add
awful.tag.add = function(tag,props)
local t = awful.tag._add(tag,props)
t:connect_signal("property::selected", function(t) on_selected_change(t,props) end)
return t
end
--------------------------OBJECT GEARS---------------------------