[awful] Add a tagging system to manipulate windows
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
e6b14c1d39
commit
a82a56d5f8
|
@ -42,7 +42,7 @@ end
|
|||
-- Create a taglist widget
|
||||
mytaglist = widget.new({ type = "taglist", name = "mytaglist" })
|
||||
mytaglist:mouse({}, 1, function (object, tag) awful.tag.viewonly(tag) end)
|
||||
mytaglist:mouse({ modkey }, 1, function (object, tag) awful.client.toggletag(tag) end)
|
||||
mytaglist:mouse({ modkey }, 1, function (object, tag) awful.client.movetotag(tag) end)
|
||||
mytaglist:mouse({}, 3, function (object, tag) tag:view(not tag:isselected()) end)
|
||||
mytaglist:mouse({ modkey }, 3, function (object, tag) awful.client.toggletag(tag) end)
|
||||
mytaglist:mouse({ }, 4, awful.tag.viewnext)
|
||||
|
@ -174,6 +174,21 @@ keybinding.new({ modkey, "Shift" }, "space", function () awful.layout.inc(layout
|
|||
|
||||
-- Menu
|
||||
keybinding.new({ modkey }, "F1", function () awful.menu("Run: ", mymenubox, awful.spawn) end):add()
|
||||
|
||||
-- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them
|
||||
awful.client.ontag(function (c) c:border_set({ color = "red" }) end)
|
||||
keybinding.new({ modkey }, "t", awful.client.tag):add()
|
||||
for i = 1, keynumber do
|
||||
keybinding.new({ modkey, "Shift" }, "F" .. i,
|
||||
function ()
|
||||
local screen = mouse.screen_get()
|
||||
if tags[screen][i] then
|
||||
for c, v in pairs(awful.client.gettagged()) do
|
||||
awful.client.movetotag(tags[screen][i], c)
|
||||
end
|
||||
end
|
||||
end):add()
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Hooks
|
||||
|
|
43
awful.lua
43
awful.lua
|
@ -268,6 +268,45 @@ local function layout_get(screen)
|
|||
end
|
||||
end
|
||||
|
||||
-- Just set a awful tag to a client to move it later.
|
||||
local awfultags = {}
|
||||
local ontag_callback = nil
|
||||
local onuntag_callback = nil
|
||||
|
||||
local function client_ontag (f)
|
||||
ontag_callback = f
|
||||
end
|
||||
|
||||
local function client_onuntag (f)
|
||||
onuntag_callback = f
|
||||
end
|
||||
|
||||
local function client_tag (c)
|
||||
local cl = c or client.focus_get()
|
||||
if cl then
|
||||
for k, v in pairs(awfultags) do
|
||||
if cl == v then
|
||||
return
|
||||
end
|
||||
end
|
||||
awfultags[cl] = true
|
||||
-- Call callback
|
||||
if ontag_callback then ontag_callback(cl) end
|
||||
end
|
||||
end
|
||||
|
||||
-- Return the tagged client and empty the table
|
||||
local function client_gettagged ()
|
||||
if onuntag_callback then
|
||||
for k, v in pairs(awfultags) do
|
||||
onuntag_callback(k)
|
||||
end
|
||||
end
|
||||
t = awfultags
|
||||
awfultags = {}
|
||||
return t
|
||||
end
|
||||
|
||||
-- Function to change the layout of the current tag.
|
||||
-- layouts = table of layouts (define in .awesomerc.lua)
|
||||
-- i = relative index
|
||||
|
@ -429,6 +468,10 @@ P.client =
|
|||
togglefloating = client_togglefloating;
|
||||
moveresize = client_moveresize;
|
||||
movetoscreen = client_movetoscreen;
|
||||
tag = client_tag;
|
||||
gettagged = client_gettagged;
|
||||
ontag = client_ontag;
|
||||
onuntag = client_onuntag;
|
||||
}
|
||||
P.screen =
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue