refactor: minor fixes

This commit is contained in:
actionless 2015-08-21 02:24:01 +02:00
parent fe9ee01268
commit 9a020ce776
1 changed files with 19 additions and 24 deletions

View File

@ -30,13 +30,12 @@ local capi = {
}
local delayed_call = require("gears.timer").delayed_call
local revelation ={}
local clientData = {} -- table that holds the positions and sizes of floating clients
charorder = "jkluiopyhnmfdsatgvcewqzx1234567890"
hintbox = {} -- Table of letter wiboxes with characters as the keys
local charorder = "jkluiopyhnmfdsatgvcewqzx1234567890"
local hintbox = {} -- Table of letter wiboxes with characters as the keys
revelation = {
local revelation = {
-- Name of expose tag.
tag_name = "Revelation",
@ -63,7 +62,8 @@ revelation = {
is_excluded = false,
curr_tag_only = false,
font = "monospace 20",
fg = beautiful.fg_normal
fg = beautiful.fg_normal,
hintsize = beautiful.xresources.apply_dpi(50)
}
@ -88,8 +88,8 @@ end
-- @param t The tag to give matching clients.
local function match_clients(rule, clients, t, is_excluded)
local mfc = rule.any and revelation.match.any or revelation.match.exact
local mf = is_excluded and function(c,rule) return not mfc(c,rule) end or mfc
local k,v, flt
local mf = is_excluded and function(c,_rule) return not mfc(c,_rule) end or mfc
local flt
for _, c in pairs(clients) do
if mf(c, rule) then
-- Store geometry before setting their tags
@ -122,7 +122,7 @@ end
function revelation.expose(args)
local args = args or {}
args = args or {}
local rule = args.rule or {}
local is_excluded = args.is_excluded or false
local curr_tag_only = args.curr_tag_only or false
@ -135,9 +135,6 @@ function revelation.expose(args)
for scr=1,capi.screen.count() do
all_tags = awful.tag.gettags(scr)
t[scr] = awful.tag.new({revelation.tag_name},
scr,
awful.layout.suit.fair)[1]
@ -154,10 +151,11 @@ function revelation.expose(args)
awful.tag.viewonly(t[scr], t.screen)
end
delayed_call(function() expose_callback(t, zt) end)
delayed_call(function() revelation.expose_callback(t, zt) end)
end
function expose_callback(t, zt)
function revelation.expose_callback(t, zt)
local hintindex = {} -- Table of visible clients with the hint letter as the keys
local clientlist = awful.client.visible()
for i,thisclient in pairs(clientlist) do
@ -167,14 +165,13 @@ function expose_callback(t, zt)
hintindex[char] = thisclient
local geom = thisclient:geometry()
hintbox[char].visible = true
hintbox[char].x = math.floor(geom.x + geom.width/2 - hintsize/2)
hintbox[char].y = math.floor(geom.y + geom.height/2 - hintsize/2)
hintbox[char].x = math.floor(geom.x + geom.width/2 - revelation.hintsize/2)
hintbox[char].y = math.floor(geom.y + geom.height/2 - revelation.hintsize/2)
hintbox[char].screen = thisclient.screen
end
end
local function restore()
local k,v
for scr=1, capi.screen.count() do
awful.tag.history.restore(scr)
t[scr].screen = nil
@ -219,11 +216,11 @@ function expose_callback(t, zt)
local zoomed = false
local zoomedClient = nil
local keyPressed = false
local keyPressed = false
capi.keygrabber.run(function (mod, key, event)
local c = nil
local keyPressed = false
local c
keyPressed = false
if event == "release" then return true end
@ -321,11 +318,9 @@ end
-- Create the wiboxes, but don't show them
function revelation.init(args)
hintsize = beautiful.xresources.apply_dpi(50)
local fontcolor = revelation.fg
local letterbox = {}
local args = args or {}
args = args or {}
revelation.tag_name = args.tag_name or revelation.tag_name
if args.match then
@ -338,8 +333,8 @@ function revelation.init(args)
local char = charorder:sub(i,i)
hintbox[char] = wibox({fg=beautiful.fg_normal, bg=beautiful.bg_focus, border_color=beautiful.border_focus, border_width=beautiful.border_width})
hintbox[char].ontop = true
hintbox[char].width = hintsize
hintbox[char].height = hintsize
hintbox[char].width = revelation.hintsize
hintbox[char].height = revelation.hintsize
letterbox[char] = wibox.widget.textbox()
letterbox[char]:set_markup(
"<span color=\"" .. revelation.fg .. "\"" .. ">" ..