libs: rewrite as module
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
64b09bdb02
commit
4abea3acca
|
@ -392,12 +392,12 @@ function hook_timer ()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set up some hooks
|
-- Set up some hooks
|
||||||
awful.hooks.focus(hook_focus)
|
awful.hooks.focus.register(hook_focus)
|
||||||
awful.hooks.unfocus(hook_unfocus)
|
awful.hooks.unfocus.register(hook_unfocus)
|
||||||
awful.hooks.marked(hook_marked)
|
awful.hooks.marked.register(hook_marked)
|
||||||
awful.hooks.unmarked(hook_unmarked)
|
awful.hooks.unmarked.register(hook_unmarked)
|
||||||
awful.hooks.manage(hook_manage)
|
awful.hooks.manage.register(hook_manage)
|
||||||
awful.hooks.mouseover(hook_mouseover)
|
awful.hooks.mouseover.register(hook_mouseover)
|
||||||
awful.hooks.arrange(hook_arrange)
|
awful.hooks.arrange.register(hook_arrange)
|
||||||
awful.hooks.timer(1, hook_timer)
|
awful.hooks.timer.register(1, hook_timer)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
497
lib/awful.lua.in
497
lib/awful.lua.in
|
@ -1,18 +1,9 @@
|
||||||
-----------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
-- awful: AWesome Function very UsefuL --
|
-- awful: AWesome Functions very UsefuL
|
||||||
-- Common useful awesome functions --
|
--
|
||||||
-- --
|
-- @author Julien Danjou <julien@danjou.info>
|
||||||
-- © 2008 Julien Danjou <julien@danjou.info> --
|
-- @copyright 2008 Julien Danjou
|
||||||
-----------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
-- We usually are required as 'awful'
|
|
||||||
-- But that can be changed.
|
|
||||||
local P = {} -- package
|
|
||||||
if _REQUIREDNAME == nil then
|
|
||||||
awful = P
|
|
||||||
else
|
|
||||||
_G[_REQUIREDNAME] = P
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Grab environment we need
|
-- Grab environment we need
|
||||||
local string = string
|
local string = string
|
||||||
|
@ -21,22 +12,23 @@ local loadstring = loadstring
|
||||||
local ipairs = ipairs
|
local ipairs = ipairs
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local unpack = unpack
|
local unpack = unpack
|
||||||
local awesome = awesome
|
|
||||||
local screen = screen
|
|
||||||
local client = client
|
|
||||||
local tag = tag
|
|
||||||
local mouse = mouse
|
|
||||||
local titlebar = titlebar
|
|
||||||
local widget = widget
|
|
||||||
local os = os
|
local os = os
|
||||||
local table = table
|
|
||||||
local hooks = hooks
|
|
||||||
local keygrabber = keygrabber
|
|
||||||
local io = io
|
local io = io
|
||||||
local setmetatable = setmetatable
|
local setmetatable = setmetatable
|
||||||
|
local table = table
|
||||||
|
local capi =
|
||||||
|
{
|
||||||
|
screen = screen,
|
||||||
|
client = client,
|
||||||
|
tag = tag,
|
||||||
|
mouse = mouse,
|
||||||
|
titlebar = titlebar,
|
||||||
|
widget = widget,
|
||||||
|
hooks = hooks,
|
||||||
|
keygrabber = keygrabber
|
||||||
|
}
|
||||||
|
|
||||||
-- Reset env
|
module("awful")
|
||||||
setfenv(1, P)
|
|
||||||
|
|
||||||
-- The ObjectTable class
|
-- The ObjectTable class
|
||||||
ObjectTable = {}
|
ObjectTable = {}
|
||||||
|
@ -57,46 +49,28 @@ function ObjectTable.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Various structure
|
-- Various structure
|
||||||
P.hooks = {}
|
hooks = {}
|
||||||
P.myhooks = {}
|
hooks.user = {}
|
||||||
P.prompt = {}
|
prompt = {}
|
||||||
P.completion = {}
|
completion = {}
|
||||||
P.screen = {}
|
screen = {}
|
||||||
P.layout = {}
|
layout = {}
|
||||||
P.client = {}
|
client = {}
|
||||||
P.client.focus = {}
|
client.focus = {}
|
||||||
P.client.focus.history = {}
|
client.focus.history = {}
|
||||||
P.client.focus.history.data = {}
|
client.focus.history.data = {}
|
||||||
P.tag = {}
|
tag = {}
|
||||||
P.tag.history = {}
|
tag.history = {}
|
||||||
P.tag.history.data = {}
|
tag.history.data = {}
|
||||||
P.tag.history.data.past = {}
|
tag.history.data.past = {}
|
||||||
P.tag.history.data.current = {}
|
tag.history.data.current = {}
|
||||||
P.titlebar = {}
|
titlebar = {}
|
||||||
P.titlebar.data = ObjectTable.new()
|
titlebar.data = ObjectTable.new()
|
||||||
P.widget = {}
|
widget = {}
|
||||||
P.widget.taglist = {}
|
widget.taglist = {}
|
||||||
P.widget.taglist.label = {}
|
widget.taglist.label = {}
|
||||||
P.widget.tasklist = {}
|
widget.tasklist = {}
|
||||||
P.widget.tasklist.label = {}
|
widget.tasklist.label = {}
|
||||||
|
|
||||||
|
|
||||||
--- Create a new userhook (for external libs).
|
|
||||||
-- @param name Hook name.
|
|
||||||
local function userhook_create(name)
|
|
||||||
P.myhooks[name] = {}
|
|
||||||
P.hooks[name] = function (f)
|
|
||||||
table.insert(P.myhooks[name], { callback = f })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Call a created userhook (for external libs).
|
|
||||||
-- @param name Hook name.
|
|
||||||
local function userhook_call(name, args)
|
|
||||||
for i, o in pairs(P.myhooks[name]) do
|
|
||||||
P.myhooks[name][i]['callback'](unpack(args))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Make i cycle.
|
--- Make i cycle.
|
||||||
-- @param t A length.
|
-- @param t A length.
|
||||||
|
@ -110,10 +84,10 @@ end
|
||||||
|
|
||||||
--- Remove a client from the focus history
|
--- Remove a client from the focus history
|
||||||
-- @param c The client that must be removed.
|
-- @param c The client that must be removed.
|
||||||
function P.client.focus.history.delete(c)
|
function client.focus.history.delete(c)
|
||||||
for k, v in ipairs(P.client.focus.history.data) do
|
for k, v in ipairs(client.focus.history.data) do
|
||||||
if v == c then
|
if v == c then
|
||||||
table.remove(P.client.focus.history.data, k)
|
table.remove(client.focus.history.data, k)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -121,11 +95,11 @@ end
|
||||||
|
|
||||||
--- Update client focus history.
|
--- Update client focus history.
|
||||||
-- @param c The client that has been focused.
|
-- @param c The client that has been focused.
|
||||||
function P.client.focus.history.add(c)
|
function client.focus.history.add(c)
|
||||||
-- Remove the client if its in stack
|
-- Remove the client if its in stack
|
||||||
P.client.focus.history.delete(c)
|
client.focus.history.delete(c)
|
||||||
-- Record the client has latest focused
|
-- Record the client has latest focused
|
||||||
table.insert(P.client.focus.history.data, 1, c)
|
table.insert(client.focus.history.data, 1, c)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the latest focused client for a screen in history.
|
--- Get the latest focused client for a screen in history.
|
||||||
|
@ -133,11 +107,11 @@ end
|
||||||
-- @param idx The index: 0 will return first candidate,
|
-- @param idx The index: 0 will return first candidate,
|
||||||
-- 1 will return second, etc.
|
-- 1 will return second, etc.
|
||||||
-- @return A client.
|
-- @return A client.
|
||||||
function P.client.focus.history.get(screen, idx)
|
function client.focus.history.get(screen, idx)
|
||||||
-- When this counter is equal to idx, we return the client
|
-- When this counter is equal to idx, we return the client
|
||||||
local counter = 0
|
local counter = 0
|
||||||
local vc = client.visible_get(screen)
|
local vc = capi.client.visible_get(screen)
|
||||||
for k, c in ipairs(P.client.focus.history.data) do
|
for k, c in ipairs(client.focus.history.data) do
|
||||||
if c.screen == screen then
|
if c.screen == screen then
|
||||||
for j, vcc in ipairs(vc) do
|
for j, vcc in ipairs(vc) do
|
||||||
if vcc == c then
|
if vcc == c then
|
||||||
|
@ -158,15 +132,15 @@ function P.client.focus.history.get(screen, idx)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Focus the previous client in history.
|
--- Focus the previous client in history.
|
||||||
function P.client.focus.history.previous()
|
function client.focus.history.previous()
|
||||||
local sel = client.focus_get()
|
local sel = capi.client.focus_get()
|
||||||
local s
|
local s
|
||||||
if sel then
|
if sel then
|
||||||
s = sel.screen
|
s = sel.screen
|
||||||
else
|
else
|
||||||
s = mouse.screen
|
s = capi.mouse.screen
|
||||||
end
|
end
|
||||||
local c = P.client.focus.history.get(s, 1)
|
local c = client.focus.history.get(s, 1)
|
||||||
if c then c:focus_set() end
|
if c then c:focus_set() end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -175,12 +149,12 @@ end
|
||||||
-- @param i The index.
|
-- @param i The index.
|
||||||
-- @param c Optional client.
|
-- @param c Optional client.
|
||||||
-- @return A client, or nil if no client is available.
|
-- @return A client, or nil if no client is available.
|
||||||
function P.client.next(i, c)
|
function client.next(i, c)
|
||||||
-- Get currently focused client
|
-- Get currently focused client
|
||||||
local sel = c or client.focus_get()
|
local sel = c or capi.client.focus_get()
|
||||||
if sel then
|
if sel then
|
||||||
-- Get all visible clients
|
-- Get all visible clients
|
||||||
local cls = client.visible_get(sel.screen)
|
local cls = capi.client.visible_get(sel.screen)
|
||||||
-- Loop upon each client
|
-- Loop upon each client
|
||||||
for idx, c in ipairs(cls) do
|
for idx, c in ipairs(cls) do
|
||||||
if c == sel then
|
if c == sel then
|
||||||
|
@ -194,8 +168,8 @@ end
|
||||||
--- Focus a client by its relative index.
|
--- Focus a client by its relative index.
|
||||||
-- @param i The index.
|
-- @param i The index.
|
||||||
-- @param c Optional client.
|
-- @param c Optional client.
|
||||||
function P.client.focusbyidx(i, c)
|
function client.focusbyidx(i, c)
|
||||||
local target = P.client.next(i, c)
|
local target = client.next(i, c)
|
||||||
if target then
|
if target then
|
||||||
target:focus_set()
|
target:focus_set()
|
||||||
end
|
end
|
||||||
|
@ -204,20 +178,20 @@ end
|
||||||
--- Swap a client by its relative index.
|
--- Swap a client by its relative index.
|
||||||
-- @param i The index.
|
-- @param i The index.
|
||||||
-- @param c Optional client, otherwise focused one is used.
|
-- @param c Optional client, otherwise focused one is used.
|
||||||
function P.client.swap(i, c)
|
function client.swap(i, c)
|
||||||
local sel = c or client.focus_get()
|
local sel = c or capi.client.focus_get()
|
||||||
local target = P.client.next(i, sel)
|
local target = client.next(i, sel)
|
||||||
if target then
|
if target then
|
||||||
target:swap(sel)
|
target:swap(sel)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the master window
|
--- Get the master window.
|
||||||
-- @param screen Optional screen number, otherwise screen mouse is used.
|
-- @param screen Optional screen number, otherwise screen mouse is used.
|
||||||
-- @return The master window.
|
-- @return The master window.
|
||||||
function P.client.master(screen)
|
function client.master(screen)
|
||||||
local s = screen or mouse.screen
|
local s = screen or capi.mouse.screen
|
||||||
return client.visible_get(s)[1]
|
return capi.client.visible_get(s)[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Move/resize a client relative to current coordinates.
|
--- Move/resize a client relative to current coordinates.
|
||||||
|
@ -226,8 +200,8 @@ end
|
||||||
-- @param w The relative width.
|
-- @param w The relative width.
|
||||||
-- @param h The relative height.
|
-- @param h The relative height.
|
||||||
-- @param c The optional client, otherwise focused one is used.
|
-- @param c The optional client, otherwise focused one is used.
|
||||||
function P.client.moveresize(x, y, w, h, c)
|
function client.moveresize(x, y, w, h, c)
|
||||||
local sel = c or client.focus_get()
|
local sel = c or capi.client.focus_get()
|
||||||
local coords = sel.coords
|
local coords = sel.coords
|
||||||
coords['x'] = coords['x'] + x
|
coords['x'] = coords['x'] + x
|
||||||
coords['y'] = coords['y'] + y
|
coords['y'] = coords['y'] + y
|
||||||
|
@ -238,11 +212,11 @@ end
|
||||||
|
|
||||||
--- Maximize a client to use the full workspace area.
|
--- Maximize a client to use the full workspace area.
|
||||||
-- @param c A client, or the focused one if nil.
|
-- @param c A client, or the focused one if nil.
|
||||||
function P.client.maximize(c)
|
function client.maximize(c)
|
||||||
local sel = c or client.focus_get()
|
local sel = c or capi.client.focus_get()
|
||||||
if sel then
|
if sel then
|
||||||
sel.floating = true
|
sel.floating = true
|
||||||
local ws = screen.workspace_get(sel.screen)
|
local ws = capi.screen.workspace_get(sel.screen)
|
||||||
ws.width = ws.width - 2 * sel.border_width
|
ws.width = ws.width - 2 * sel.border_width
|
||||||
ws.height = ws.height - 2 * sel.border_width
|
ws.height = ws.height - 2 * sel.border_width
|
||||||
sel.coords = ws
|
sel.coords = ws
|
||||||
|
@ -251,19 +225,19 @@ end
|
||||||
|
|
||||||
--- Give the focus to a screen, and move pointer.
|
--- Give the focus to a screen, and move pointer.
|
||||||
-- @param Screen number.
|
-- @param Screen number.
|
||||||
function P.screen.focus(i)
|
function screen.focus(i)
|
||||||
local sel = client.focus_get()
|
local sel = capi.client.focus_get()
|
||||||
local s
|
local s
|
||||||
if sel then
|
if sel then
|
||||||
s = sel.screen
|
s = sel.screen
|
||||||
else
|
else
|
||||||
s = mouse.screen
|
s = capi.mouse.screen
|
||||||
end
|
end
|
||||||
s = cycle(screen.count(), s + i)
|
s = cycle(capi.screen.count(), s + i)
|
||||||
local c = P.client.focus.history.get(s, 0)
|
local c = client.focus.history.get(s, 0)
|
||||||
if c then c:focus_set() end
|
if c then c:focus_set() end
|
||||||
-- Move the mouse on the screen
|
-- Move the mouse on the screen
|
||||||
mouse.coords = screen.coords_get(s)
|
capi.mouse.coords = capi.screen.coords_get(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Compare 2 tables of tags.
|
--- Compare 2 tables of tags.
|
||||||
|
@ -293,33 +267,33 @@ end
|
||||||
|
|
||||||
--- Update the tag history.
|
--- Update the tag history.
|
||||||
-- @param screen The screen number.
|
-- @param screen The screen number.
|
||||||
function P.tag.history.update(screen)
|
function tag.history.update(screen)
|
||||||
local curtags = tag.geti(screen)
|
local curtags = capi.tag.geti(screen)
|
||||||
if not tag_compare_select(curtags, P.tag.history.data.current[screen]) then
|
if not tag_compare_select(curtags, tag.history.data.current[screen]) then
|
||||||
P.tag.history.data.past[screen] = P.tag.history.data.current[screen]
|
tag.history.data.past[screen] = tag.history.data.current[screen]
|
||||||
P.tag.history.data.current[screen] = {}
|
tag.history.data.current[screen] = {}
|
||||||
for k, v in ipairs(curtags) do
|
for k, v in ipairs(curtags) do
|
||||||
P.tag.history.data.current[screen][k] = v.selected
|
tag.history.data.current[screen][k] = v.selected
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Revert tag history.
|
-- Revert tag history.
|
||||||
-- @param screen The screen number.
|
-- @param screen The screen number.
|
||||||
function P.tag.history.restore(screen)
|
function tag.history.restore(screen)
|
||||||
local s = screen or mouse.screen
|
local s = screen or capi.mouse.screen
|
||||||
local tags = tag.geti(s)
|
local tags = capi.tag.geti(s)
|
||||||
for k, t in pairs(tags) do
|
for k, t in pairs(tags) do
|
||||||
t.selected = P.tag.history.data.past[s][k]
|
t.selected = tag.history.data.past[s][k]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return a table with all visible tags
|
--- Return a table with all visible tags
|
||||||
-- @param s Screen number.
|
-- @param s Screen number.
|
||||||
-- @return A table with all selected tags.
|
-- @return A table with all selected tags.
|
||||||
function P.tag.selectedlist(s)
|
function tag.selectedlist(s)
|
||||||
local screen = s or mouse.screen
|
local screen = s or capi.mouse.screen
|
||||||
local tags = tag.geti(screen)
|
local tags = capi.tag.geti(screen)
|
||||||
local vtags = {}
|
local vtags = {}
|
||||||
for i, t in pairs(tags) do
|
for i, t in pairs(tags) do
|
||||||
if t.selected then
|
if t.selected then
|
||||||
|
@ -331,14 +305,14 @@ end
|
||||||
|
|
||||||
--- Return only the first visible tag.
|
--- Return only the first visible tag.
|
||||||
-- @param s Screen number.
|
-- @param s Screen number.
|
||||||
function P.tag.selected(s)
|
function tag.selected(s)
|
||||||
return P.tag.selectedlist(s)[1]
|
return tag.selectedlist(s)[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set master width factor.
|
--- Set master width factor.
|
||||||
-- @param mwfact Master width factor.
|
-- @param mwfact Master width factor.
|
||||||
function P.tag.setmwfact(mwfact)
|
function tag.setmwfact(mwfact)
|
||||||
local t = P.tag.selected()
|
local t = tag.selected()
|
||||||
if t then
|
if t then
|
||||||
t.mwfact = mwfact
|
t.mwfact = mwfact
|
||||||
end
|
end
|
||||||
|
@ -346,8 +320,8 @@ end
|
||||||
|
|
||||||
--- Increase master width factor.
|
--- Increase master width factor.
|
||||||
-- @param add Value to add to master width factor.
|
-- @param add Value to add to master width factor.
|
||||||
function P.tag.incmwfact(add)
|
function tag.incmwfact(add)
|
||||||
local t = P.tag.selected()
|
local t = tag.selected()
|
||||||
if t then
|
if t then
|
||||||
t.mwfact = t.mwfact + add
|
t.mwfact = t.mwfact + add
|
||||||
end
|
end
|
||||||
|
@ -355,8 +329,8 @@ end
|
||||||
|
|
||||||
--- Set the number of master windows.
|
--- Set the number of master windows.
|
||||||
-- @param nmaster The number of master windows.
|
-- @param nmaster The number of master windows.
|
||||||
function P.tag.setnmaster(nmaster)
|
function tag.setnmaster(nmaster)
|
||||||
local t = P.tag.selected()
|
local t = tag.selected()
|
||||||
if t then
|
if t then
|
||||||
t.nmaster = nmaster
|
t.nmaster = nmaster
|
||||||
end
|
end
|
||||||
|
@ -364,8 +338,8 @@ end
|
||||||
|
|
||||||
--- Increase the number of master windows.
|
--- Increase the number of master windows.
|
||||||
-- @param add Value to add to number of master windows.
|
-- @param add Value to add to number of master windows.
|
||||||
function P.tag.incnmaster(add)
|
function tag.incnmaster(add)
|
||||||
local t = P.tag.selected()
|
local t = tag.selected()
|
||||||
if t then
|
if t then
|
||||||
t.nmaster = t.nmaster + add
|
t.nmaster = t.nmaster + add
|
||||||
end
|
end
|
||||||
|
@ -373,8 +347,8 @@ end
|
||||||
|
|
||||||
--- Set number of column windows.
|
--- Set number of column windows.
|
||||||
-- @param ncol The number of column.
|
-- @param ncol The number of column.
|
||||||
function P.tag.setncol(ncol)
|
function tag.setncol(ncol)
|
||||||
local t = P.tag.selected()
|
local t = tag.selected()
|
||||||
if t then
|
if t then
|
||||||
t.ncol = ncol
|
t.ncol = ncol
|
||||||
end
|
end
|
||||||
|
@ -382,8 +356,8 @@ end
|
||||||
|
|
||||||
--- Increase number of column windows.
|
--- Increase number of column windows.
|
||||||
-- @param add Value to add to number of column windows.
|
-- @param add Value to add to number of column windows.
|
||||||
function P.tag.incncol(add)
|
function tag.incncol(add)
|
||||||
local t = P.tag.selected()
|
local t = tag.selected()
|
||||||
if t then
|
if t then
|
||||||
t.ncol = t.ncol + add
|
t.ncol = t.ncol + add
|
||||||
end
|
end
|
||||||
|
@ -391,8 +365,8 @@ end
|
||||||
|
|
||||||
--- View no tag.
|
--- View no tag.
|
||||||
-- @param Optional screen number.
|
-- @param Optional screen number.
|
||||||
function P.tag.viewnone(screen)
|
function tag.viewnone(screen)
|
||||||
local tags = tag.get(screen or mouse.screen)
|
local tags = capi.tag.get(screen or capi.mouse.screen)
|
||||||
for i, t in pairs(tags) do
|
for i, t in pairs(tags) do
|
||||||
t.selected = false
|
t.selected = false
|
||||||
end
|
end
|
||||||
|
@ -401,10 +375,10 @@ end
|
||||||
--- View a tag by its index.
|
--- View a tag by its index.
|
||||||
-- @param i The relative index to see.
|
-- @param i The relative index to see.
|
||||||
-- @param screen Optional screen number.
|
-- @param screen Optional screen number.
|
||||||
function P.tag.viewidx(i, screen)
|
function tag.viewidx(i, screen)
|
||||||
local tags = tag.geti(screen or mouse.screen)
|
local tags = capi.tag.geti(screen or capi.mouse.screen)
|
||||||
local sel = P.tag.selected()
|
local sel = tag.selected()
|
||||||
P.tag.viewnone()
|
tag.viewnone()
|
||||||
for k, t in ipairs(tags) do
|
for k, t in ipairs(tags) do
|
||||||
if t == sel then
|
if t == sel then
|
||||||
tags[cycle(#tags, k + i)].selected = true
|
tags[cycle(#tags, k + i)].selected = true
|
||||||
|
@ -413,27 +387,27 @@ function P.tag.viewidx(i, screen)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- View next tag. This is the same as tag.viewidx(1).
|
--- View next tag. This is the same as tag.viewidx(1).
|
||||||
function P.tag.viewnext()
|
function tag.viewnext()
|
||||||
return P.tag.viewidx(1)
|
return tag.viewidx(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- View previous tag. This is the same a tag.viewidx(-1).
|
--- View previous tag. This is the same a tag.viewidx(-1).
|
||||||
function P.tag.viewprev()
|
function tag.viewprev()
|
||||||
return P.tag.viewidx(-1)
|
return tag.viewidx(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- View only a tag.
|
--- View only a tag.
|
||||||
-- @param t The tag object.
|
-- @param t The tag object.
|
||||||
function P.tag.viewonly(t)
|
function tag.viewonly(t)
|
||||||
P.tag.viewnone()
|
tag.viewnone()
|
||||||
t.selected = true
|
t.selected = true
|
||||||
end
|
end
|
||||||
|
|
||||||
--- View only a set of tags.
|
--- View only a set of tags.
|
||||||
-- @param tags A table with tags to view only.
|
-- @param tags A table with tags to view only.
|
||||||
-- @param screen Optional screen number of the tags.
|
-- @param screen Optional screen number of the tags.
|
||||||
function P.tag.viewmore(tags, screen)
|
function tag.viewmore(tags, screen)
|
||||||
P.tag.viewnone(screen)
|
tag.viewnone(screen)
|
||||||
for i, t in pairs(tags) do
|
for i, t in pairs(tags) do
|
||||||
t.selected = true
|
t.selected = true
|
||||||
end
|
end
|
||||||
|
@ -442,11 +416,11 @@ end
|
||||||
--- Move a client to a tag.
|
--- Move a client to a tag.
|
||||||
-- @param target The tag to move the client to.
|
-- @param target The tag to move the client to.
|
||||||
-- @para c Optional client to move, otherwise the focused one is used.
|
-- @para c Optional client to move, otherwise the focused one is used.
|
||||||
function P.client.movetotag(target, c)
|
function client.movetotag(target, c)
|
||||||
local sel = c or client.focus_get();
|
local sel = c or capi.client.focus_get();
|
||||||
-- Check that tag and client screen are identical
|
-- Check that tag and client screen are identical
|
||||||
if sel.screen ~= target.screen then return end
|
if sel.screen ~= target.screen then return end
|
||||||
local tags = tag.get(sel.screen)
|
local tags = capi.tag.get(sel.screen)
|
||||||
for k, t in pairs(tags) do
|
for k, t in pairs(tags) do
|
||||||
sel:tag(t, false)
|
sel:tag(t, false)
|
||||||
end
|
end
|
||||||
|
@ -456,15 +430,15 @@ end
|
||||||
--- Toggle a tag on a client.
|
--- Toggle a tag on a client.
|
||||||
-- @param target The tag to toggle.
|
-- @param target The tag to toggle.
|
||||||
-- @param c Optional client to toggle, otherwise the focused one is used.
|
-- @param c Optional client to toggle, otherwise the focused one is used.
|
||||||
function P.client.toggletag(target, c)
|
function client.toggletag(target, c)
|
||||||
local sel = c or client.focus_get();
|
local sel = c or capi.client.focus_get();
|
||||||
-- Check that tag and client screen are identical
|
-- Check that tag and client screen are identical
|
||||||
if sel.screen ~= target.screen then return end
|
if sel.screen ~= target.screen then return end
|
||||||
local toggle = false
|
local toggle = false
|
||||||
if sel then
|
if sel then
|
||||||
-- Count how many tags has the client
|
-- Count how many tags has the client
|
||||||
-- an only toggle tag if the client has at least one tag other than target
|
-- an only toggle tag if the client has at least one tag other than target
|
||||||
for k, v in pairs(tag.get(sel.screen)) do
|
for k, v in pairs(capi.tag.get(sel.screen)) do
|
||||||
if target ~= v and sel:istagged(v) then
|
if target ~= v and sel:istagged(v) then
|
||||||
toggle = true
|
toggle = true
|
||||||
break
|
break
|
||||||
|
@ -478,8 +452,8 @@ end
|
||||||
|
|
||||||
--- Toggle the floating status of a client.
|
--- Toggle the floating status of a client.
|
||||||
-- @param c Optional client, the focused on if not set.
|
-- @param c Optional client, the focused on if not set.
|
||||||
function P.client.togglefloating(c)
|
function client.togglefloating(c)
|
||||||
local sel = c or client.focus_get();
|
local sel = c or capi.client.focus_get();
|
||||||
if sel then
|
if sel then
|
||||||
sel.floating = not sel.floating
|
sel.floating = not sel.floating
|
||||||
end
|
end
|
||||||
|
@ -488,39 +462,57 @@ end
|
||||||
--- Move a client to a screen. Default is next screen, cycling.
|
--- Move a client to a screen. Default is next screen, cycling.
|
||||||
-- @param c The client to move.
|
-- @param c The client to move.
|
||||||
-- @param s The screen number, default to current + 1.
|
-- @param s The screen number, default to current + 1.
|
||||||
function P.client.movetoscreen(c, s)
|
function client.movetoscreen(c, s)
|
||||||
local sel = c or client.focus_get();
|
local sel = c or capi.client.focus_get();
|
||||||
if sel then
|
if sel then
|
||||||
local sc = screen.count()
|
local sc = capi.screen.count()
|
||||||
if not s then
|
if not s then
|
||||||
s = sel.screen + 1
|
s = sel.screen + 1
|
||||||
end
|
end
|
||||||
if s > sc then s = 1 elseif s < 1 then s = sc end
|
if s > sc then s = 1 elseif s < 1 then s = sc end
|
||||||
sel.screen = s
|
sel.screen = s
|
||||||
mouse.coords = screen.coords_get(s)
|
capi.mouse.coords = capi.screen.coords_get(s)
|
||||||
sel:focus_set()
|
sel:focus_set()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the current layout name.
|
--- Get the current layout name.
|
||||||
-- @param screen The screen number.
|
-- @param screen The screen number.
|
||||||
function P.layout.get(screen)
|
function layout.get(screen)
|
||||||
local t = P.tag.selected(screen)
|
local t = tag.selected(screen)
|
||||||
if t then
|
if t then
|
||||||
return t.layout
|
return t.layout
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Create a new userhook (for external libs).
|
||||||
|
-- @param name Hook name.
|
||||||
|
function hooks.user.create(name)
|
||||||
|
hooks[name] = {}
|
||||||
|
hooks[name].callbacks = {}
|
||||||
|
hooks[name].register = function (f)
|
||||||
|
table.insert(hooks[name].callbacks, f)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Call a created userhook (for external libs).
|
||||||
|
-- @param name Hook name.
|
||||||
|
function hooks.user.call(name, ...)
|
||||||
|
for name, callback in pairs(hooks[name].callbacks) do
|
||||||
|
callback(unpack(args))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Just set an awful mark to a client to move it later.
|
-- Just set an awful mark to a client to move it later.
|
||||||
local awfulmarked = {}
|
local awfulmarked = {}
|
||||||
userhook_create('marked')
|
hooks.user.create('marked')
|
||||||
userhook_create('unmarked')
|
hooks.user.create('unmarked')
|
||||||
|
|
||||||
--- Mark a client, and then call 'marked' hook.
|
--- Mark a client, and then call 'marked' hook.
|
||||||
-- @param c The client to mark, the focused one if not specified.
|
-- @param c The client to mark, the focused one if not specified.
|
||||||
-- @return True if the client has been marked. False if the client was already marked.
|
-- @return True if the client has been marked. False if the client was already marked.
|
||||||
function P.client.mark (c)
|
function client.mark (c)
|
||||||
local cl = c or client.focus_get()
|
local cl = c or capi.client.focus_get()
|
||||||
if cl then
|
if cl then
|
||||||
for k, v in pairs(awfulmarked) do
|
for k, v in pairs(awfulmarked) do
|
||||||
if cl == v then
|
if cl == v then
|
||||||
|
@ -531,7 +523,7 @@ function P.client.mark (c)
|
||||||
table.insert(awfulmarked, cl)
|
table.insert(awfulmarked, cl)
|
||||||
|
|
||||||
-- Call callback
|
-- Call callback
|
||||||
userhook_call('marked', {cl})
|
hooks.user.call('marked', cl)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -539,13 +531,13 @@ end
|
||||||
--- Unmark a client and then call 'unmarked' hook.
|
--- Unmark a client and then call 'unmarked' hook.
|
||||||
-- @param c The client to unmark, or the focused one if not specified.
|
-- @param c The client to unmark, or the focused one if not specified.
|
||||||
-- @return True if the client has been unmarked. False if the client was not marked.
|
-- @return True if the client has been unmarked. False if the client was not marked.
|
||||||
function P.client.unmark(c)
|
function client.unmark(c)
|
||||||
local cl = c or client.focus_get()
|
local cl = c or capi.client.focus_get()
|
||||||
|
|
||||||
for k, v in pairs(awfulmarked) do
|
for k, v in pairs(awfulmarked) do
|
||||||
if cl == v then
|
if cl == v then
|
||||||
table.remove(awfulmarked, k)
|
table.remove(awfulmarked, k)
|
||||||
userhook_call('unmarked', {cl})
|
hooks.user.call('unmarked', cl)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -555,8 +547,8 @@ end
|
||||||
|
|
||||||
--- Check if a client is marked.
|
--- Check if a client is marked.
|
||||||
-- @param c The client to check, or the focused one otherwise.
|
-- @param c The client to check, or the focused one otherwise.
|
||||||
function P.client.ismarked(c)
|
function client.ismarked(c)
|
||||||
local cl = c or client.focus_get()
|
local cl = c or capi.client.focus_get()
|
||||||
if cl then
|
if cl then
|
||||||
for k, v in pairs(awfulmarked) do
|
for k, v in pairs(awfulmarked) do
|
||||||
if cl == v then
|
if cl == v then
|
||||||
|
@ -569,19 +561,19 @@ end
|
||||||
|
|
||||||
--- Toggle a client as marked.
|
--- Toggle a client as marked.
|
||||||
-- @param c The client to toggle mark.
|
-- @param c The client to toggle mark.
|
||||||
function P.client.togglemarked(c)
|
function client.togglemarked(c)
|
||||||
local cl = c or client.focus_get()
|
local cl = c or capi.client.focus_get()
|
||||||
|
|
||||||
if not P.client.mark(c) then
|
if not client.mark(c) then
|
||||||
P.client.unmark(c)
|
client.unmark(c)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return the marked clients and empty the marked table.
|
--- Return the marked clients and empty the marked table.
|
||||||
-- @return A table with all marked clients.
|
-- @return A table with all marked clients.
|
||||||
function P.client.getmarked()
|
function client.getmarked()
|
||||||
for k, v in pairs(awfulmarked) do
|
for k, v in pairs(awfulmarked) do
|
||||||
userhook_call('unmarked', {v})
|
hooks.user.call('unmarked', v)
|
||||||
end
|
end
|
||||||
|
|
||||||
t = awfulmarked
|
t = awfulmarked
|
||||||
|
@ -592,8 +584,8 @@ end
|
||||||
--- Change the layout of the current tag.
|
--- Change the layout of the current tag.
|
||||||
-- @param layouts A table of layouts.
|
-- @param layouts A table of layouts.
|
||||||
-- @param i Relative index.
|
-- @param i Relative index.
|
||||||
function P.layout.inc(layouts, i)
|
function layout.inc(layouts, i)
|
||||||
local t = P.tag.selected()
|
local t = tag.selected()
|
||||||
local number_of_layouts = 0
|
local number_of_layouts = 0
|
||||||
local rev_layouts = {}
|
local rev_layouts = {}
|
||||||
for i, v in ipairs(layouts) do
|
for i, v in ipairs(layouts) do
|
||||||
|
@ -612,56 +604,51 @@ end
|
||||||
|
|
||||||
--- Set the layout of the current tag by name.
|
--- Set the layout of the current tag by name.
|
||||||
-- @param layout Layout name.
|
-- @param layout Layout name.
|
||||||
function P.layout.set(layout)
|
function layout.set(layout)
|
||||||
local t = P.tag.selected()
|
local t = tag.selected()
|
||||||
if t then
|
if t then
|
||||||
t.layout = layout
|
t.layout = layout
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
P.hooks['userhook_create'] = userhook_create
|
-- Autodeclare awful.hooks.* functions
|
||||||
P.hooks['userhook_call'] = userhook_call
|
-- mapped to awesome hooks.* functions
|
||||||
|
for name, hook in pairs(capi.hooks) do
|
||||||
for name, hook in pairs(hooks) do
|
|
||||||
if name ~= 'timer' then
|
if name ~= 'timer' then
|
||||||
P.hooks[name] = function (f)
|
hooks[name] = {}
|
||||||
|
hooks[name].register = function (f)
|
||||||
if P.myhooks[name] == nil then
|
if not hooks[name].callbacks then
|
||||||
P.myhooks[name] = {}
|
hooks[name].callbacks = {}
|
||||||
hooks[name](function (...)
|
hook(function (...)
|
||||||
|
for i, callback in ipairs(hooks[name].callbacks) do
|
||||||
for i, o in pairs(P.myhooks[name]) do
|
callback(...)
|
||||||
P.myhooks[name][i]['callback'](...)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(P.myhooks[name], {callback = f})
|
table.insert(hooks[name].callbacks, f)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
P.hooks[name] = function (time, f, runnow)
|
hooks[name] = {}
|
||||||
|
hooks[name].register = function (time, f, runnow)
|
||||||
if P.myhooks[name] == nil then
|
if not hooks[name].callbacks then
|
||||||
P.myhooks[name] = {}
|
hooks[name].callbacks = {}
|
||||||
hooks[name](1, function (...)
|
hook(1, function (...)
|
||||||
|
for i, callback in pairs(hooks[name].callbacks) do
|
||||||
for i,o in pairs(P.myhooks[name]) do
|
if callback['counter'] >= callback['timer'] then
|
||||||
if P.myhooks[name][i]['counter'] >= P.myhooks[name][i]['timer'] then
|
callback['counter'] = 1
|
||||||
P.myhooks[name][i]['counter'] = 1
|
callback['callback'](...)
|
||||||
P.myhooks[name][i]['callback'](...)
|
|
||||||
else
|
else
|
||||||
P.myhooks[name][i]['counter'] = P.myhooks[name][i]['counter']+1
|
callback['counter'] = callback['counter'] + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
if runnow then
|
if runnow then
|
||||||
table.insert(P.myhooks[name], {callback = f, timer = time, counter = time})
|
table.insert(hooks[name].callbacks, { callback = f, timer = time, counter = time })
|
||||||
else
|
else
|
||||||
table.insert(P.myhooks[name], {callback = f, timer = time, counter = 0})
|
table.insert(hooks[name].callbacks, { callback = f, timer = time, counter = 0 })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -670,13 +657,13 @@ end
|
||||||
--- Spawn a program.
|
--- Spawn a program.
|
||||||
-- @param cmd The command.
|
-- @param cmd The command.
|
||||||
-- @return The os.execute() return value.
|
-- @return The os.execute() return value.
|
||||||
function P.spawn(cmd)
|
function spawn(cmd)
|
||||||
return os.execute(cmd .. "&")
|
return os.execute(cmd .. "&")
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Eval Lua code.
|
--- Eval Lua code.
|
||||||
-- @return The return value of Lua code.
|
-- @return The return value of Lua code.
|
||||||
function P.eval(s)
|
function eval(s)
|
||||||
return assert(loadstring("return " .. s))()
|
return assert(loadstring("return " .. s))()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -685,7 +672,7 @@ end
|
||||||
-- @param cur_pos The cursor position.
|
-- @param cur_pos The cursor position.
|
||||||
-- @paran ncomp The element number to complete.
|
-- @paran ncomp The element number to complete.
|
||||||
-- @return The new commande and the new cursor position.
|
-- @return The new commande and the new cursor position.
|
||||||
function P.completion.bash(command, cur_pos, ncomp)
|
function completion.bash(command, cur_pos, ncomp)
|
||||||
local wstart = 1
|
local wstart = 1
|
||||||
local wend = 1
|
local wend = 1
|
||||||
local words = {}
|
local words = {}
|
||||||
|
@ -769,7 +756,7 @@ end
|
||||||
-- @param textbox The textbox to use for the prompt.
|
-- @param textbox The textbox to use for the prompt.
|
||||||
-- @param exe_callback The callback function to call with command as argument when finished.
|
-- @param exe_callback The callback function to call with command as argument when finished.
|
||||||
-- @param completion_callback The callback function to call to get completion.
|
-- @param completion_callback The callback function to call to get completion.
|
||||||
function P.prompt(args, textbox, exe_callback, completion_callback)
|
function prompt(args, textbox, exe_callback, completion_callback)
|
||||||
if not args then return end
|
if not args then return end
|
||||||
local command = ""
|
local command = ""
|
||||||
local command_before_comp
|
local command_before_comp
|
||||||
|
@ -785,7 +772,7 @@ function P.prompt(args, textbox, exe_callback, completion_callback)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
textbox.text = prompt .. prompt_text_with_cursor(text, inv_col, cur_col, cur_pos)
|
textbox.text = prompt .. prompt_text_with_cursor(text, inv_col, cur_col, cur_pos)
|
||||||
keygrabber.run(
|
capi.keygrabber.run(
|
||||||
function (mod, key)
|
function (mod, key)
|
||||||
local has_ctrl = false
|
local has_ctrl = false
|
||||||
|
|
||||||
|
@ -920,7 +907,7 @@ end
|
||||||
-- Useful to set raw text in textbox.
|
-- Useful to set raw text in textbox.
|
||||||
-- @param text Text to escape.
|
-- @param text Text to escape.
|
||||||
-- @return Escape text.
|
-- @return Escape text.
|
||||||
function P.escape(text)
|
function escape(text)
|
||||||
text = text:gsub("&", "&")
|
text = text:gsub("&", "&")
|
||||||
text = text:gsub("<", "<")
|
text = text:gsub("<", "<")
|
||||||
text = text:gsub(">", ">")
|
text = text:gsub(">", ">")
|
||||||
|
@ -932,7 +919,7 @@ end
|
||||||
--- Unescape a string from entities.
|
--- Unescape a string from entities.
|
||||||
-- @param text Text to unescape.
|
-- @param text Text to unescape.
|
||||||
-- @return Unescaped text.
|
-- @return Unescaped text.
|
||||||
function P.unescape(text)
|
function unescape(text)
|
||||||
text = text:gsub("&", "&")
|
text = text:gsub("&", "&")
|
||||||
text = text:gsub("<", "<")
|
text = text:gsub("<", "<")
|
||||||
text = text:gsub(">", ">")
|
text = text:gsub(">", ">")
|
||||||
|
@ -950,10 +937,10 @@ end
|
||||||
-- @param bg_urgent The background color for urgent tags.
|
-- @param bg_urgent The background color for urgent tags.
|
||||||
-- @param fg_urgent The foreground color for urgent tags.
|
-- @param fg_urgent The foreground color for urgent tags.
|
||||||
-- @return A string to print.
|
-- @return A string to print.
|
||||||
function P.widget.taglist.label.all(t, bg_focus, fg_focus, bg_urgent, fg_urgent)
|
function widget.taglist.label.all(t, bg_focus, fg_focus, bg_urgent, fg_urgent)
|
||||||
local text
|
local text
|
||||||
local background = ""
|
local background = ""
|
||||||
local sel = client.focus_get()
|
local sel = capi.client.focus_get()
|
||||||
local bg_color = nil
|
local bg_color = nil
|
||||||
local fg_color = nil
|
local fg_color = nil
|
||||||
if t.selected then
|
if t.selected then
|
||||||
|
@ -963,7 +950,7 @@ function P.widget.taglist.label.all(t, bg_focus, fg_focus, bg_urgent, fg_urgent)
|
||||||
if sel and sel:istagged(t) then
|
if sel and sel:istagged(t) then
|
||||||
background = "resize=\"true\" image=\"@AWESOME_ICON_PATH@/taglist/squarefw.png\""
|
background = "resize=\"true\" image=\"@AWESOME_ICON_PATH@/taglist/squarefw.png\""
|
||||||
elseif bg_urgent and fg_urgent then
|
elseif bg_urgent and fg_urgent then
|
||||||
for k, c in pairs(client.get()) do
|
for k, c in pairs(capi.client.get()) do
|
||||||
if c:istagged(t) then
|
if c:istagged(t) then
|
||||||
background = "resize=\"true\" image=\"@AWESOME_ICON_PATH@/taglist/squarew.png\""
|
background = "resize=\"true\" image=\"@AWESOME_ICON_PATH@/taglist/squarew.png\""
|
||||||
if c.urgent then
|
if c.urgent then
|
||||||
|
@ -974,9 +961,9 @@ function P.widget.taglist.label.all(t, bg_focus, fg_focus, bg_urgent, fg_urgent)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if bg_color and fg_color then
|
if bg_color and fg_color then
|
||||||
text = "<bg "..background.." color='"..bg_color.."'/> <span color='"..fg_color.."'>"..P.escape(t.name).."</span> "
|
text = "<bg "..background.." color='"..bg_color.."'/> <span color='"..fg_color.."'>"..escape(t.name).."</span> "
|
||||||
else
|
else
|
||||||
text = " <bg "..background.." />"..P.escape(t.name).." "
|
text = " <bg "..background.." />"..escape(t.name).." "
|
||||||
end
|
end
|
||||||
return text
|
return text
|
||||||
end
|
end
|
||||||
|
@ -986,12 +973,12 @@ local function widget_tasklist_label_common(c, bg_focus, fg_focus, bg_urgent, fg
|
||||||
if c.floating then
|
if c.floating then
|
||||||
text = "<bg image=\"@AWESOME_ICON_PATH@/tasklist/floatingw.png\" align=\"right\"/>"
|
text = "<bg image=\"@AWESOME_ICON_PATH@/tasklist/floatingw.png\" align=\"right\"/>"
|
||||||
end
|
end
|
||||||
if client.focus_get() == c then
|
if capi.client.focus_get() == c then
|
||||||
text = text .. " <bg color='"..bg_focus.."'/><span color='"..fg_focus.."'>"..P.escape(c.name).."</span> "
|
text = text .. " <bg color='"..bg_focus.."'/><span color='"..fg_focus.."'>"..escape(c.name).."</span> "
|
||||||
elseif c.urgent and bg_urgent and fg_urgent then
|
elseif c.urgent and bg_urgent and fg_urgent then
|
||||||
text = text .. " <bg color='"..bg_urgent.."'/><span color='"..fg_urgent.."'>"..P.escape(c.name).."</span> "
|
text = text .. " <bg color='"..bg_urgent.."'/><span color='"..fg_urgent.."'>"..escape(c.name).."</span> "
|
||||||
else
|
else
|
||||||
text = text .. " "..P.escape(c.name).." "
|
text = text .. " "..escape(c.name).." "
|
||||||
end
|
end
|
||||||
return text
|
return text
|
||||||
end
|
end
|
||||||
|
@ -1007,7 +994,7 @@ end
|
||||||
-- @param bg_urgent The background color for urgent clients.
|
-- @param bg_urgent The background color for urgent clients.
|
||||||
-- @param fg_urgent The foreground color for urgent clients.
|
-- @param fg_urgent The foreground color for urgent clients.
|
||||||
-- @return A string to pring.
|
-- @return A string to pring.
|
||||||
function P.widget.tasklist.label.allscreen(c, screen, bg_focus, fg_focus, bg_urgent, fg_urgent)
|
function widget.tasklist.label.allscreen(c, screen, bg_focus, fg_focus, bg_urgent, fg_urgent)
|
||||||
return widget_tasklist_label_common(c, bg_focus, fg_focus, bg_urgent, fg_urgent)
|
return widget_tasklist_label_common(c, bg_focus, fg_focus, bg_urgent, fg_urgent)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1022,7 +1009,7 @@ end
|
||||||
-- @param bg_urgent The background color for urgent clients.
|
-- @param bg_urgent The background color for urgent clients.
|
||||||
-- @param fg_urgent The foreground color for urgent clients.
|
-- @param fg_urgent The foreground color for urgent clients.
|
||||||
-- @return A string to pring.
|
-- @return A string to pring.
|
||||||
function P.widget.tasklist.label.alltags(c, screen, bg_focus, fg_focus, bg_urgent, fg_urgent)
|
function widget.tasklist.label.alltags(c, screen, bg_focus, fg_focus, bg_urgent, fg_urgent)
|
||||||
-- Only print client on the same screen as this widget
|
-- Only print client on the same screen as this widget
|
||||||
if c.screen ~= screen then return end
|
if c.screen ~= screen then return end
|
||||||
return widget_tasklist_label_common(c, bg_focus, fg_focus, bg_urgent, fg_urgent)
|
return widget_tasklist_label_common(c, bg_focus, fg_focus, bg_urgent, fg_urgent)
|
||||||
|
@ -1039,10 +1026,10 @@ end
|
||||||
-- @param bg_urgent The background color for urgent clients.
|
-- @param bg_urgent The background color for urgent clients.
|
||||||
-- @param fg_urgent The foreground color for urgent clients.
|
-- @param fg_urgent The foreground color for urgent clients.
|
||||||
-- @return A string to pring.
|
-- @return A string to pring.
|
||||||
function P.widget.tasklist.label.currenttags(c, screen, bg_focus, fg_focus, bg_urgent, fg_urgent)
|
function widget.tasklist.label.currenttags(c, screen, bg_focus, fg_focus, bg_urgent, fg_urgent)
|
||||||
-- Only print client on the same screen as this widget
|
-- Only print client on the same screen as this widget
|
||||||
if c.screen ~= screen then return end
|
if c.screen ~= screen then return end
|
||||||
for k, t in pairs(tag.get(screen)) do
|
for k, t in pairs(capi.tag.get(screen)) do
|
||||||
if t.selected and c:istagged(t) then
|
if t.selected and c:istagged(t) then
|
||||||
return widget_tasklist_label_common(c, bg_focus, fg_focus, bg_urgent, fg_urgent)
|
return widget_tasklist_label_common(c, bg_focus, fg_focus, bg_urgent, fg_urgent)
|
||||||
end
|
end
|
||||||
|
@ -1056,53 +1043,53 @@ end
|
||||||
-- bg: the background color.
|
-- bg: the background color.
|
||||||
-- fg_focus: the foreground color for focused window.
|
-- fg_focus: the foreground color for focused window.
|
||||||
-- fg_focus: the background color for focused window.
|
-- fg_focus: the background color for focused window.
|
||||||
function P.titlebar.add(c, args)
|
function titlebar.add(c, args)
|
||||||
-- Store colors
|
-- Store colors
|
||||||
P.titlebar.data[c] = {}
|
titlebar.data[c] = {}
|
||||||
P.titlebar.data[c].fg = args.fg
|
titlebar.data[c].fg = args.fg
|
||||||
P.titlebar.data[c].bg = args.bg
|
titlebar.data[c].bg = args.bg
|
||||||
P.titlebar.data[c].fg_focus = args.fg_focus
|
titlebar.data[c].fg_focus = args.fg_focus
|
||||||
P.titlebar.data[c].bg_focus = args.bg_focus
|
titlebar.data[c].bg_focus = args.bg_focus
|
||||||
|
|
||||||
-- Built args
|
-- Built args
|
||||||
local targs = {}
|
local targs = {}
|
||||||
if args.fg then targs.fg = args.fg end
|
if args.fg then targs.fg = args.fg end
|
||||||
if args.bg then targs.bg = args.bg end
|
if args.bg then targs.bg = args.bg end
|
||||||
local tb = titlebar(targs)
|
local tb = capi.titlebar(targs)
|
||||||
|
|
||||||
tb:widget_add(widget({ type = "appicon", name = "appicon", align = "left" }))
|
tb:widget_add(capi.widget({ type = "appicon", name = "appicon", align = "left" }))
|
||||||
|
|
||||||
local title = widget({ type = "textbox", name = "title", align = "flex" })
|
local title = capi.widget({ type = "textbox", name = "title", align = "flex" })
|
||||||
title:mouse_add(mouse({ args.modkey }, 1, function (t) t:client_get():mouse_move() end))
|
title:mouse_add(mouse({ args.modkey }, 1, function (t) t:client_get():mouse_move() end))
|
||||||
title:mouse_add(mouse({ args.modkey }, 3, function (t) t:client_get():mouse_resize() end))
|
title:mouse_add(mouse({ args.modkey }, 3, function (t) t:client_get():mouse_resize() end))
|
||||||
tb:widget_add(title)
|
tb:widget_add(title)
|
||||||
|
|
||||||
local close_button= widget({ type = "textbox", name = "close", align = "right" })
|
local close_button= capi.widget({ type = "textbox", name = "close", align = "right" })
|
||||||
close_button:mouse_add(mouse({ }, 1, function (t) t:client_get():kill() end))
|
close_button:mouse_add(mouse({ }, 1, function (t) t:client_get():kill() end))
|
||||||
tb:widget_add(close_button)
|
tb:widget_add(close_button)
|
||||||
|
|
||||||
P.titlebar.update(c)
|
titlebar.update(c)
|
||||||
|
|
||||||
c.titlebar = tb
|
c.titlebar = tb
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Update a titlebar. This should be called in some hooks.
|
--- Update a titlebar. This should be called in some hooks.
|
||||||
-- @param c The client to update.
|
-- @param c The client to update.
|
||||||
function P.titlebar.update(c)
|
function titlebar.update(c)
|
||||||
if c.titlebar and P.titlebar.data[c] then
|
if c.titlebar and titlebar.data[c] then
|
||||||
local widgets = c.titlebar:widget_get()
|
local widgets = c.titlebar:widget_get()
|
||||||
if widgets.title then
|
if widgets.title then
|
||||||
widgets.title.text = " " .. P.escape(c.name)
|
widgets.title.text = " " .. escape(c.name)
|
||||||
end
|
end
|
||||||
if client.focus_get() == c then
|
if capi.client.focus_get() == c then
|
||||||
c.titlebar.fg = P.titlebar.data[c].fg_focus
|
c.titlebar.fg = titlebar.data[c].fg_focus
|
||||||
c.titlebar.bg = P.titlebar.data[c].bg_focus
|
c.titlebar.bg = titlebar.data[c].bg_focus
|
||||||
if widgets.close then
|
if widgets.close then
|
||||||
widgets.close.text = "<bg image=\"@AWESOME_ICON_PATH@/titlebar/closer.png\" resize=\"true\"/>"
|
widgets.close.text = "<bg image=\"@AWESOME_ICON_PATH@/titlebar/closer.png\" resize=\"true\"/>"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
c.titlebar.fg = P.titlebar.data[c].fg
|
c.titlebar.fg = titlebar.data[c].fg
|
||||||
c.titlebar.bg = P.titlebar.data[c].bg
|
c.titlebar.bg = titlebar.data[c].bg
|
||||||
if widgets.close then
|
if widgets.close then
|
||||||
widgets.close.text = "<bg image=\"@AWESOME_ICON_PATH@/titlebar/close.png\" resize=\"true\"/>"
|
widgets.close.text = "<bg image=\"@AWESOME_ICON_PATH@/titlebar/close.png\" resize=\"true\"/>"
|
||||||
end
|
end
|
||||||
|
@ -1112,20 +1099,18 @@ end
|
||||||
|
|
||||||
--- Remove a titlebar from a client.
|
--- Remove a titlebar from a client.
|
||||||
-- @param c The client.
|
-- @param c The client.
|
||||||
function P.titlebar.remove(c)
|
function titlebar.remove(c)
|
||||||
c.titlebar = nil
|
c.titlebar = nil
|
||||||
P.titlebar.data[c] = nil
|
titlebar.data[c] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Register standards hooks
|
-- Register standards hooks
|
||||||
P.hooks.arrange(P.tag.history.update)
|
hooks.arrange.register(tag.history.update)
|
||||||
|
|
||||||
P.hooks.focus(P.client.focus.history.add)
|
hooks.focus.register(client.focus.history.add)
|
||||||
P.hooks.unmanage(P.client.focus.history.delete)
|
hooks.unmanage.register(client.focus.history.delete)
|
||||||
|
|
||||||
P.hooks.focus(P.titlebar.update)
|
hooks.focus.register(titlebar.update)
|
||||||
P.hooks.unfocus(P.titlebar.update)
|
hooks.unfocus.register(titlebar.update)
|
||||||
P.hooks.titleupdate(P.titlebar.update)
|
hooks.titleupdate.register(titlebar.update)
|
||||||
P.hooks.unmanage(P.titlebar.remove)
|
hooks.unmanage.register(titlebar.remove)
|
||||||
|
|
||||||
return P
|
|
||||||
|
|
135
lib/tabulous.lua
135
lib/tabulous.lua
|
@ -1,38 +1,26 @@
|
||||||
----------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
-- tabulous: Fabulous tabs for awesome --
|
-- tabulous: fabulous tabs for awesome
|
||||||
-- --
|
--
|
||||||
-- © 2008 Julien Danjou <julien@danjou.info> --
|
-- @author Lucas de Vries <lucasdevries@gmail.com>
|
||||||
-- © 2008 Lucas de Vries <lucasdevries@gmail.com> --
|
-- @author Julien Danjou <julien@danjou.info>
|
||||||
----------------------------------------------------
|
-- @copyright 2008 Julien Danjou, Lucas de Vries
|
||||||
|
---------------------------------------------------------------------------
|
||||||
require('awful')
|
|
||||||
|
|
||||||
--------------------
|
|
||||||
-- Module loading --
|
|
||||||
--------------------
|
|
||||||
local P = {}
|
|
||||||
if _REQUIREDNAME == nil then
|
|
||||||
tabulous = P
|
|
||||||
else
|
|
||||||
_G[_REQUIREDNAME] = P
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Grab environment we need
|
-- Grab environment we need
|
||||||
local client = client
|
local capi = { client = client }
|
||||||
local table = table
|
local table = table
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local awful = awful
|
local awful = require('awful')
|
||||||
|
|
||||||
-- Reset env
|
module("tabulous")
|
||||||
setfenv(1, P)
|
|
||||||
|
|
||||||
tabbed = {}
|
local tabbed = {}
|
||||||
|
|
||||||
-- Hook creation
|
-- Hook creation
|
||||||
awful.hooks.userhook_create('tabbed')
|
awful.hooks.user.create('tabbed')
|
||||||
awful.hooks.userhook_create('untabbed')
|
awful.hooks.user.create('untabbed')
|
||||||
awful.hooks.userhook_create('tabdisplay')
|
awful.hooks.user.create('tabdisplay')
|
||||||
awful.hooks.userhook_create('tabhide')
|
awful.hooks.user.create('tabhide')
|
||||||
|
|
||||||
---------------
|
---------------
|
||||||
-- Functions --
|
-- Functions --
|
||||||
|
@ -42,7 +30,7 @@ awful.hooks.userhook_create('tabhide')
|
||||||
-- @param table The table to look into
|
-- @param table The table to look into
|
||||||
-- @param value The value to find.
|
-- @param value The value to find.
|
||||||
-- @return The key or nil if not found.
|
-- @return The key or nil if not found.
|
||||||
function P.findkey(table, value)
|
function findkey(table, value)
|
||||||
for k, v in pairs(table) do
|
for k, v in pairs(table) do
|
||||||
if v == value then
|
if v == value then
|
||||||
return k
|
return k
|
||||||
|
@ -50,12 +38,11 @@ function P.findkey(table, value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Swap and select which client in tab is displayed.
|
--- Swaand select which client in tab is displayed.
|
||||||
-- @param tabindex The tab index.
|
-- @param tabindex The tab index.
|
||||||
-- @param cl The client to show.
|
-- @param cl The client to show.
|
||||||
function P.display(tabindex, cl)
|
function display(tabindex, cl)
|
||||||
local p = tabbed[tabindex][1]
|
local p = tabbed[tabindex][1]
|
||||||
|
|
||||||
if cl and p ~= cl then
|
if cl and p ~= cl then
|
||||||
cl.hide = false
|
cl.hide = false
|
||||||
cl:swap(p)
|
cl:swap(p)
|
||||||
|
@ -64,8 +51,8 @@ function P.display(tabindex, cl)
|
||||||
|
|
||||||
tabbed[tabindex][1] = cl
|
tabbed[tabindex][1] = cl
|
||||||
|
|
||||||
awful.hooks.userhook_call('tabhide', {p})
|
awful.hooks.user.call('tabhide', p)
|
||||||
awful.hooks.userhook_call('tabdisplay', {cl})
|
awful.hooks.user.call('tabdisplay', cl)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -73,20 +60,20 @@ end
|
||||||
-- @param tabindex The tab index.
|
-- @param tabindex The tab index.
|
||||||
-- @param cl The client
|
-- @param cl The client
|
||||||
-- @return The key.
|
-- @return The key.
|
||||||
function P.tabindex_check(tabindex, cl)
|
function tabindex_check(tabindex, cl)
|
||||||
local c = cl or client.focus_get()
|
local c = cl or capi.client.focus_get()
|
||||||
return P.findkey(tabbed[tabindex], c)
|
return findkey(tabbed[tabindex], c)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Find the tab index or return nil if not tabbed.
|
--- Find the tab index or return nil if not tabbed.
|
||||||
-- @param cl The client to search.
|
-- @param cl The client to search.
|
||||||
-- @return The tab index.
|
-- @return The tab index.
|
||||||
function P.tabindex_get(cl)
|
function tabindex_get(cl)
|
||||||
local c = cl or client.focus_get()
|
local c = cl or capi.client.focus_get()
|
||||||
|
|
||||||
for tabindex, tabdisplay in pairs(tabbed) do
|
for tabindex, tabdisplay in pairs(tabbed) do
|
||||||
-- Loop through all tab displays
|
-- Loop through all tab displays
|
||||||
local me = P.tabindex_check(tabindex, c)
|
local me = tabindex_check(tabindex, c)
|
||||||
|
|
||||||
if me ~= nil then
|
if me ~= nil then
|
||||||
return tabindex
|
return tabindex
|
||||||
|
@ -99,7 +86,7 @@ end
|
||||||
--- Get all clients on a tabbed display.
|
--- Get all clients on a tabbed display.
|
||||||
-- @param tabindex The tab index.
|
-- @param tabindex The tab index.
|
||||||
-- @return All tabbed clients.
|
-- @return All tabbed clients.
|
||||||
function P.clients_get(tabindex)
|
function clients_get(tabindex)
|
||||||
if tabbed[tabindex] == nil then return nil end
|
if tabbed[tabindex] == nil then return nil end
|
||||||
return tabbed[tabindex][2]
|
return tabbed[tabindex][2]
|
||||||
end
|
end
|
||||||
|
@ -107,7 +94,7 @@ end
|
||||||
--- Get the displayed client on a tabbed display.
|
--- Get the displayed client on a tabbed display.
|
||||||
-- @param tabindex The tab index.
|
-- @param tabindex The tab index.
|
||||||
-- @return The displayed client.
|
-- @return The displayed client.
|
||||||
function P.displayed_get(tabindex)
|
function displayed_get(tabindex)
|
||||||
if tabbed[tabindex] == nil then return nil end
|
if tabbed[tabindex] == nil then return nil end
|
||||||
return tabbed[tabindex][1]
|
return tabbed[tabindex][1]
|
||||||
end
|
end
|
||||||
|
@ -116,7 +103,7 @@ end
|
||||||
-- @param tabindex The tab index.
|
-- @param tabindex The tab index.
|
||||||
-- @param pos The position in the tab.
|
-- @param pos The position in the tab.
|
||||||
-- @return The client at the given position.
|
-- @return The client at the given position.
|
||||||
function P.position_get(tabindex, pos)
|
function position_get(tabindex, pos)
|
||||||
if tabbed[tabindex] == nil then return nil end
|
if tabbed[tabindex] == nil then return nil end
|
||||||
return tabbed[tabindex][2][pos]
|
return tabbed[tabindex][2][pos]
|
||||||
end
|
end
|
||||||
|
@ -125,10 +112,10 @@ end
|
||||||
-- @param tabindex The tab index.
|
-- @param tabindex The tab index.
|
||||||
-- @param cl The current client.
|
-- @param cl The current client.
|
||||||
-- @return The next client.
|
-- @return The next client.
|
||||||
function P.next(tabindex, cl)
|
function next(tabindex, cl)
|
||||||
local c = cl or tabbed[tabindex][1]
|
local c = cl or tabbed[tabindex][1]
|
||||||
|
|
||||||
local i = P.findkey(tabbed[tabindex][2], c)
|
local i = findkey(tabbed[tabindex][2], c)
|
||||||
|
|
||||||
if i == nil then
|
if i == nil then
|
||||||
return nil
|
return nil
|
||||||
|
@ -145,10 +132,10 @@ end
|
||||||
-- @param tabindex The tab index.
|
-- @param tabindex The tab index.
|
||||||
-- @param cl The current client.
|
-- @param cl The current client.
|
||||||
-- @return The previous client.
|
-- @return The previous client.
|
||||||
function P.prev(tabindex, cl)
|
function prev(tabindex, cl)
|
||||||
local c = cl or tabbed[tabindex][1]
|
local c = cl or tabbed[tabindex][1]
|
||||||
|
|
||||||
local i = P.findkey(tabbed[tabindex][2], c)
|
local i = findkey(tabbed[tabindex][2], c)
|
||||||
|
|
||||||
if i == nil then
|
if i == nil then
|
||||||
return nil
|
return nil
|
||||||
|
@ -164,16 +151,16 @@ end
|
||||||
--- Remove a client from a tabbed display.
|
--- Remove a client from a tabbed display.
|
||||||
-- @param cl The client to remove.
|
-- @param cl The client to remove.
|
||||||
-- @return True if the client has been untabbed.
|
-- @return True if the client has been untabbed.
|
||||||
function P.untab(cl)
|
function untab(cl)
|
||||||
local c = cl or client.focus_get()
|
local c = cl or capi.client.focus_get()
|
||||||
local tabindex = P.tabindex_get(c)
|
local tabindex = tabindex_get(c)
|
||||||
|
|
||||||
if tabindex == nil then return false end
|
if tabindex == nil then return false end
|
||||||
|
|
||||||
local cindex = P.findkey(tabbed[tabindex][2], c)
|
local cindex = findkey(tabbed[tabindex][2], c)
|
||||||
|
|
||||||
if tabbed[tabindex][1] == c then
|
if tabbed[tabindex][1] == c then
|
||||||
P.display(tabindex, P.next(tabindex, c))
|
display(tabindex, P.next(tabindex, c))
|
||||||
end
|
end
|
||||||
|
|
||||||
table.remove(tabbed[tabindex][2], cindex)
|
table.remove(tabbed[tabindex][2], cindex)
|
||||||
|
@ -184,15 +171,15 @@ function P.untab(cl)
|
||||||
end
|
end
|
||||||
|
|
||||||
c.hide = false
|
c.hide = false
|
||||||
awful.hooks.userhook_call('untabbed', {c})
|
awful.hooks.user.call('untabbed', c)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Untab all clients in a tabbed display.
|
--- Untab all clients in a tabbed display.
|
||||||
-- @param tabindex The tab index.
|
-- @param tabindex The tab index.
|
||||||
function P.untab_all(tabindex)
|
function untab_all(tabindex)
|
||||||
for i,c in pairs(tabbed[tabindex][2]) do
|
for i,c in pairs(tabbed[tabindex][2]) do
|
||||||
c.hide = false
|
c.hide = false
|
||||||
awful.hooks.userhook_call('untabbed', {c})
|
awful.hooks.user.call('untabbed', c)
|
||||||
end
|
end
|
||||||
|
|
||||||
if tabbed[tabindex] ~= nil then
|
if tabbed[tabindex] ~= nil then
|
||||||
|
@ -203,8 +190,8 @@ end
|
||||||
--- Create a new tabbed display with client as the master.
|
--- Create a new tabbed display with client as the master.
|
||||||
-- @param cl The client to set into the tab, focused one otherwise.
|
-- @param cl The client to set into the tab, focused one otherwise.
|
||||||
-- @return The created tab index.
|
-- @return The created tab index.
|
||||||
function P.tab_create(cl)
|
function tab_create(cl)
|
||||||
local c = cl or client.focus_get()
|
local c = cl or capi.client.focus_get()
|
||||||
|
|
||||||
if not c then return end
|
if not c then return end
|
||||||
|
|
||||||
|
@ -213,35 +200,35 @@ function P.tab_create(cl)
|
||||||
{ c } -- List of windows in tabbed display
|
{ c } -- List of windows in tabbed display
|
||||||
})
|
})
|
||||||
|
|
||||||
awful.hooks.userhook_call('tabbed', {c})
|
awful.hooks.user.call('tabbed', c)
|
||||||
return P.tabindex_get(c)
|
return tabindex_get(c)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Add a client to a tabbed display.
|
--- Add a client to a tabbed display.
|
||||||
-- @param tabindex The tab index.
|
-- @param tabindex The tab index.
|
||||||
-- @param cl The client to add, or the focused one otherwise.
|
-- @param cl The client to add, or the focused one otherwise.
|
||||||
function P.tab(tabindex, cl)
|
function tab(tabindex, cl)
|
||||||
local c = cl or client.focus_get()
|
local c = cl or capi.client.focus_get()
|
||||||
|
|
||||||
if tabbed[tabindex] ~= nil then
|
if tabbed[tabindex] ~= nil then
|
||||||
local x = P.tabindex_get(c)
|
local x = tabindex_get(c)
|
||||||
|
|
||||||
if x == nil then
|
if x == nil then
|
||||||
-- Add untabbed client to tabindex
|
-- Add untabbed client to tabindex
|
||||||
table.insert(tabbed[tabindex][2], c)
|
table.insert(tabbed[tabindex][2], c)
|
||||||
P.display(tabindex, c)
|
display(tabindex, c)
|
||||||
|
|
||||||
awful.hooks.userhook_call('tabbed', {c})
|
awful.hooks.user.call('tabbed', c)
|
||||||
elseif x ~= tabindex then
|
elseif x ~= tabindex then
|
||||||
-- Merge two tabbed views
|
-- Merge two tabbed views
|
||||||
local cc = tabbed[tabindex][1]
|
local cc = tabbed[tabindex][1]
|
||||||
local clients = P.clients_get(x)
|
local clients = clients_get(x)
|
||||||
P.untab_all(x)
|
untab_all(x)
|
||||||
|
|
||||||
tabindex = P.tabindex_get(cc)
|
tabindex = tabindex_get(cc)
|
||||||
|
|
||||||
for i,b in pairs(clients) do
|
for i,b in pairs(clients) do
|
||||||
P.tab(tabindex, b)
|
tab(tabindex, b)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -249,20 +236,18 @@ end
|
||||||
|
|
||||||
--- Start autotabbing, this automatically tabs new clients when the current
|
--- Start autotabbing, this automatically tabs new clients when the current
|
||||||
-- client is tabbed.
|
-- client is tabbed.
|
||||||
function P.autotab_start()
|
function autotab_start()
|
||||||
awful.hooks.manage(function (c)
|
awful.hooks.manage.register(function (c)
|
||||||
local sel = client.focus_get()
|
local sel = capi.client.focus_get()
|
||||||
local index = P.tabindex_get(sel)
|
local index = tabindex_get(sel)
|
||||||
|
|
||||||
if index ~= nil then
|
if index ~= nil then
|
||||||
-- Currently focussed client is tabbed,
|
-- Currently focussed client is tabbed,
|
||||||
-- add the new window to the tabbed display
|
-- add the new window to the tabbed display
|
||||||
P.tab(index, c)
|
tab(index, c)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set up hook so we don't leave lost hidden clients
|
-- Set up hook so we don't leave lost hidden clients
|
||||||
awful.hooks.unmanage(P.untab)
|
awful.hooks.unmanage.register(untab)
|
||||||
|
|
||||||
return P
|
|
||||||
|
|
Loading…
Reference in New Issue