Reset awesome config
|
@ -1,205 +0,0 @@
|
||||||
-- -*- coding: utf-8 -*-
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- @author Nicolas Berthier <nberthier@gmail.com>
|
|
||||||
-- @copyright 2010 Nicolas Berthier
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
--
|
|
||||||
-- Bowls are kind of helpers that can be drawn (at the bottom --- for now) of an
|
|
||||||
-- area, and displaying the current key prefix. It is inspired by emacs'
|
|
||||||
-- behavior, that prints prefix keys in the minibuffer after a certain time.
|
|
||||||
--
|
|
||||||
-- I call it `bowl' as a reference to the bowl that one might have at home,
|
|
||||||
-- where one puts its actual keys... A more serious name would be `hint' or
|
|
||||||
-- `tooltip' (but they do not fit well for this usage).
|
|
||||||
--
|
|
||||||
-- Example usage: see `rc.lua' file.
|
|
||||||
--
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
--{{{ Grab environment (mostly aliases)
|
|
||||||
local setmetatable = setmetatable
|
|
||||||
local ipairs = ipairs
|
|
||||||
local type = type
|
|
||||||
local pairs = pairs
|
|
||||||
local string = string
|
|
||||||
local print = print
|
|
||||||
local error = error
|
|
||||||
|
|
||||||
local capi = capi
|
|
||||||
local client = client
|
|
||||||
local awesome = awesome
|
|
||||||
local root = root
|
|
||||||
local timer = timer
|
|
||||||
|
|
||||||
local infoline = require ("infoline")
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
module ("bowl")
|
|
||||||
|
|
||||||
-- Privata data: we use weak keys in order to allow collection of private data
|
|
||||||
-- if keys (clients) are collected (i.e., no longer used, after having been
|
|
||||||
-- killed for instance)
|
|
||||||
local data = setmetatable ({}, { __mode = 'k' })
|
|
||||||
|
|
||||||
--{{{ Default values
|
|
||||||
|
|
||||||
--- Default modifier filter
|
|
||||||
local modfilter = {
|
|
||||||
["Mod1"] = "M",
|
|
||||||
["Mod4"] = "S",
|
|
||||||
["Control"] = "C",
|
|
||||||
["Shift"] = string.upper,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Timers configuration
|
|
||||||
local use_timers = true
|
|
||||||
local timeout = 2.0
|
|
||||||
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
--{{{ Keychain pretty-printing
|
|
||||||
|
|
||||||
function mod_to_string (mods, k)
|
|
||||||
local ret, k = "", k
|
|
||||||
for _, mod in ipairs (mods) do
|
|
||||||
if modfilter[mod] then
|
|
||||||
local t = type (modfilter[mod])
|
|
||||||
if t == "function" then
|
|
||||||
k = modfilter[mod](k)
|
|
||||||
elseif t == "string" then
|
|
||||||
ret = ret .. modfilter[mod] .. "-"
|
|
||||||
else
|
|
||||||
error ("Invalid modifier key filter: got a " .. t)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
ret = ret .. mod .. "-"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return ret, k
|
|
||||||
end
|
|
||||||
|
|
||||||
function ks_to_string (m, k)
|
|
||||||
local m, k = mod_to_string (m, k)
|
|
||||||
return m .. k
|
|
||||||
end
|
|
||||||
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
--{{{ Timer management
|
|
||||||
|
|
||||||
local function delete_timer_maybe (d)
|
|
||||||
if d.timer then -- stop and remove the timer
|
|
||||||
d.timer:remove_signal ("timeout", d.timer_function)
|
|
||||||
d.timer:stop ()
|
|
||||||
d.timer = nil
|
|
||||||
d.timer_expired = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function delayed_call_maybe (d, f)
|
|
||||||
if use_timers then
|
|
||||||
if not d.timer_expired and not d.timer then
|
|
||||||
-- create and start the timer
|
|
||||||
d.timer = timer ({ timeout = timeout })
|
|
||||||
d.timer_function = function () f (); delete_timer_maybe (d) end
|
|
||||||
d.timer:add_signal ("timeout", d.timer_function)
|
|
||||||
d.timer:start ()
|
|
||||||
d.timer_expired = false
|
|
||||||
elseif not d.timer_expired then
|
|
||||||
-- restart the timer...
|
|
||||||
|
|
||||||
-- XXX: What is the actual semantics of the call to `start' (ie,
|
|
||||||
-- does it restart the timer with the initial timeout)?
|
|
||||||
d.timer:stop ()
|
|
||||||
d.timer.timeout = timeout -- reset timeout
|
|
||||||
d.timer:start ()
|
|
||||||
end
|
|
||||||
else -- timers disabled
|
|
||||||
f () -- call the given function directly
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
--{{{ Infoline management
|
|
||||||
|
|
||||||
function dispose (w)
|
|
||||||
local d = data[w]
|
|
||||||
if d.bowl then -- if bowl was enabled... (should always be true...)
|
|
||||||
infoline.dispose (d.bowl)
|
|
||||||
d.bowl = nil
|
|
||||||
end
|
|
||||||
delete_timer_maybe (d)
|
|
||||||
data[w] = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
function append (w, m, k)
|
|
||||||
local d = data[w]
|
|
||||||
local pretty_ks = ks_to_string (m, k) .. " "
|
|
||||||
infoline.set_text (d.bowl, infoline.get_text (d.bowl) .. pretty_ks)
|
|
||||||
|
|
||||||
local function enable_bowl ()
|
|
||||||
-- XXX: is there a possible bad interleaving that could make
|
|
||||||
-- this function execute while the bowl has already been
|
|
||||||
-- disposed of? in which case the condition should be checked
|
|
||||||
-- first...
|
|
||||||
|
|
||||||
-- if d.bowl then
|
|
||||||
infoline.attach (d.bowl, w)
|
|
||||||
-- end
|
|
||||||
end
|
|
||||||
|
|
||||||
delayed_call_maybe (d, enable_bowl)
|
|
||||||
end
|
|
||||||
|
|
||||||
function create (w)
|
|
||||||
-- XXX: Note the prefix text could be customizable...
|
|
||||||
data[w] = { bowl = infoline.new (" ") }
|
|
||||||
end
|
|
||||||
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
|
|
||||||
--- Initializes the bowl module, with given properties; should be called before
|
|
||||||
--- ANY other function of this module.
|
|
||||||
-- Configurations fields include:
|
|
||||||
--
|
|
||||||
-- `use_timers', `timeout': A boolean defining whether bowls drawing should be
|
|
||||||
-- delayed, along with a number being this time shift, in seconds (Default
|
|
||||||
-- values are `true' and `2').
|
|
||||||
--
|
|
||||||
-- `modfilter': A table associating modifiers (Mod1, Mod4, Control, Shift, etc.)
|
|
||||||
-- with either a string (in this case it will replace the modifier when printed
|
|
||||||
-- in heplers) or functions (in this case the key string will be repaced by a
|
|
||||||
-- call to this function with the key string as parameter). Default value is:
|
|
||||||
-- { ["Mod1"] = "M", ["Mod4"] = "S", ["Control"] = "C", ["Shift"] =
|
|
||||||
-- string.upper }
|
|
||||||
--
|
|
||||||
-- @param c The table of properties.
|
|
||||||
function init (c)
|
|
||||||
local c = c or { }
|
|
||||||
modfilter = c.modfilter and c.modfilter or modfilter
|
|
||||||
if c.use_timers ~= nil then use_timers = c.use_timers end
|
|
||||||
if use_timers then
|
|
||||||
timeout = c.timeout ~= nil and c.timeout or timeout
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Setup signal listeners, that trigger appropriate functions for a default
|
|
||||||
--- behavior.
|
|
||||||
function default_setup ()
|
|
||||||
local function to_root (f) return function (...) f (root, ...) end end
|
|
||||||
client.add_signal ("keychain::enter", create)
|
|
||||||
client.add_signal ("keychain::append", append)
|
|
||||||
client.add_signal ("keychain::leave", dispose)
|
|
||||||
awesome.add_signal ("keychain::enter", to_root (create))
|
|
||||||
awesome.add_signal ("keychain::append", to_root (append))
|
|
||||||
awesome.add_signal ("keychain::leave", to_root (dispose))
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Local variables:
|
|
||||||
-- indent-tabs-mode: nil
|
|
||||||
-- fill-column: 80
|
|
||||||
-- lua-indent-level: 4
|
|
||||||
-- End:
|
|
||||||
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
|
@ -1,81 +0,0 @@
|
||||||
local client=client
|
|
||||||
local awful=awful
|
|
||||||
local pairs=pairs
|
|
||||||
local table=table
|
|
||||||
|
|
||||||
module("ext")
|
|
||||||
|
|
||||||
-- Returns true if all pairs in table1 are present in table2
|
|
||||||
function match(table1, table2)
|
|
||||||
for k, v in pairs(table1) do
|
|
||||||
if table[k] ~= v and not table2[k]:find(v) then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Spawns cmd if no client can be found matching properties
|
|
||||||
-- If such a client can be found, pop to first tag where it is
|
|
||||||
-- visible, and give it focus
|
|
||||||
function run_or_raise(cmd, properties)
|
|
||||||
local clients = client.get()
|
|
||||||
local focused = awful.client.next(0)
|
|
||||||
local findex = 0
|
|
||||||
local matched_clients = { }
|
|
||||||
local n = 0
|
|
||||||
|
|
||||||
for i, c in pairs(clients) do
|
|
||||||
-- make an array of matched clients
|
|
||||||
if match(properties, c) then
|
|
||||||
n = n + 1
|
|
||||||
matched_clients[n] = c
|
|
||||||
|
|
||||||
if n == focused then
|
|
||||||
findex = n
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if n > 0 then
|
|
||||||
local c = matched_clients[1]
|
|
||||||
|
|
||||||
-- if the focused window matched switch focus to next in list
|
|
||||||
if 0 < findex and findex < n then
|
|
||||||
c = matched_clients[findex + 1]
|
|
||||||
end
|
|
||||||
|
|
||||||
local ctags = c:tags()
|
|
||||||
|
|
||||||
if table.getn(ctags) == 0 then
|
|
||||||
-- ctags is empty, show client on current tag
|
|
||||||
local curtag = awful.tag.selected()
|
|
||||||
awful.client.movetotag(curtag, c)
|
|
||||||
else
|
|
||||||
-- Otherwise, pop to first tag client is visible on
|
|
||||||
awful.tag.viewonly(ctags[1])
|
|
||||||
end
|
|
||||||
|
|
||||||
-- And then focus the client
|
|
||||||
client.focus = c
|
|
||||||
c:raise()
|
|
||||||
awful.screen.focus(c.screen)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
awful.util.spawn(cmd)
|
|
||||||
end
|
|
||||||
|
|
||||||
function prev_client()
|
|
||||||
awful.client.focus.history.previous()
|
|
||||||
if client.focus then
|
|
||||||
client.focus:raise()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function next_client()
|
|
||||||
awful.client.focus.byidx(1)
|
|
||||||
if client.focus then
|
|
||||||
client.focus:raise()
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,183 +0,0 @@
|
||||||
-- -*- coding: utf-8 -*-
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- @author Nicolas Berthier <nberthier@gmail.com>
|
|
||||||
-- @copyright 2010 Nicolas Berthier
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
--
|
|
||||||
-- This is a module for defining infolines in awesome. An infoline is a wibox
|
|
||||||
-- attached to a region (typically, a client or the root window).
|
|
||||||
--
|
|
||||||
-- Remarks:
|
|
||||||
--
|
|
||||||
-- - It has not been tested with multiple screens yet.
|
|
||||||
--
|
|
||||||
-- Example usage: (TODO --- read the comments for now, there are not many
|
|
||||||
-- functions)
|
|
||||||
--
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
--{{{ Grab environment (mostly aliases)
|
|
||||||
local setmetatable = setmetatable
|
|
||||||
local ipairs = ipairs
|
|
||||||
local type = type
|
|
||||||
local pairs = pairs
|
|
||||||
local string = string
|
|
||||||
local print = print
|
|
||||||
local error = error
|
|
||||||
local io = io
|
|
||||||
|
|
||||||
local client = client
|
|
||||||
local awesome = awesome
|
|
||||||
local wibox = wibox
|
|
||||||
local widget = widget
|
|
||||||
local root = root
|
|
||||||
local screen = screen
|
|
||||||
local mouse = mouse
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
module ("infoline")
|
|
||||||
|
|
||||||
-- Privata data: we use weak keys in order to allow collection of private data
|
|
||||||
-- if keys (clients) are collected (i.e., no longer used, after having been
|
|
||||||
-- killed for instance).
|
|
||||||
--
|
|
||||||
-- XXX: For now, we have at most one infoline per client, but it could be
|
|
||||||
-- interesting to create several types of infolines (identified by indexes to be
|
|
||||||
-- allocated by this module), and associated to, e.g., different configuration
|
|
||||||
-- flags and positioning routine...
|
|
||||||
local data = setmetatable ({}, { __mode = 'k' })
|
|
||||||
|
|
||||||
--{{{ Infoline positioning
|
|
||||||
|
|
||||||
-- XXX: this is a hack that positions an infoline at the bottom of a given area.
|
|
||||||
local function setup_position (wb, geom)
|
|
||||||
local b = wb:geometry ()
|
|
||||||
b.x = geom.x
|
|
||||||
b.width = geom.width
|
|
||||||
b.y = geom.y + geom.height - awesome.font_height
|
|
||||||
b.height = awesome.font_height
|
|
||||||
wb:geometry (b)
|
|
||||||
end
|
|
||||||
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
--{{{ Configurations:
|
|
||||||
|
|
||||||
-- When true, this flag indicates that an infoline is hidden if its attached
|
|
||||||
-- client loses its focus. Otherwise, it remains always visible.
|
|
||||||
follow_focus = true
|
|
||||||
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
--{{{ Infoline updates
|
|
||||||
|
|
||||||
function get_text (il) return il.wb.widgets[1].text end
|
|
||||||
function set_text (il, text) il.wb.widgets[1].text = text end
|
|
||||||
|
|
||||||
-- Forces a refresh of the given infoline.
|
|
||||||
function update (il)
|
|
||||||
local wb = il.wb
|
|
||||||
local c = il.cli
|
|
||||||
|
|
||||||
if il.enabled then
|
|
||||||
-- XXX: Note this could be much better if we had some sort of root and
|
|
||||||
-- client interface unification: the following involves a priori useless
|
|
||||||
-- code duplication...
|
|
||||||
if c == root then
|
|
||||||
wb.screen = mouse.screen -- XXX: is this the behavior we need?
|
|
||||||
wb.visible = true
|
|
||||||
setup_position (wb, screen[mouse.screen].workarea)
|
|
||||||
else
|
|
||||||
if c:isvisible () and (not follow_focus or client.focus == c) then
|
|
||||||
wb.screen = c.screen
|
|
||||||
wb.visible = true
|
|
||||||
setup_position (wb, c:geometry ())
|
|
||||||
else -- do we have to hide it?
|
|
||||||
wb.visible = false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
elseif wb.visible then --otherwise we need to hide it.
|
|
||||||
wb.visible = false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function update_from_client (c)
|
|
||||||
-- Note that we may not have an infoline for this client, hence the
|
|
||||||
-- conditional...
|
|
||||||
if data[c] then update (data[c]) end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Force execution of the above function on client state modification.
|
|
||||||
client.add_signal ("focus", update_from_client)
|
|
||||||
client.add_signal ("unfocus", update_from_client)
|
|
||||||
client.add_signal ("unmanage", update_from_client)
|
|
||||||
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
--{{{ Infoline management
|
|
||||||
|
|
||||||
--- Creates a new infoline, with the given initial text. Note it is not visible
|
|
||||||
--- by default, and not attached to any client.
|
|
||||||
function new (text)
|
|
||||||
local il = {
|
|
||||||
wb = wibox ({
|
|
||||||
ontop = true, -- XXX: setting a depth when attaching to
|
|
||||||
--a client would be much better
|
|
||||||
widgets = {
|
|
||||||
widget ({ type = "textbox", align="left" })
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
-- these will remain false until the infoline is attached to a client.
|
|
||||||
il.wb.visible = false
|
|
||||||
il.enabled = false
|
|
||||||
set_text (il, text or "")
|
|
||||||
return il
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Attached infolines will react to the following client-related signals, and
|
|
||||||
-- automatically setup their position according to the client's geometry.
|
|
||||||
local csignals = { "property::geometry", "property::minimized",
|
|
||||||
"property::visible", "property::focus", "property::screen", }
|
|
||||||
|
|
||||||
-- Attaches an infoline to a client. Note the infoline becomes visible at that
|
|
||||||
-- time, if the client is currently visible (and if it has focus, when
|
|
||||||
-- `follow_focus' holds).
|
|
||||||
function attach (il, c)
|
|
||||||
data[c] = il
|
|
||||||
il.cli = c
|
|
||||||
il.enabled = true
|
|
||||||
update (il)
|
|
||||||
if c ~= root then
|
|
||||||
-- subscribe to client-related signals
|
|
||||||
for _, s in ipairs (csignals) do
|
|
||||||
c:add_signal (s, update_from_client)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Detach the given infoline from its client, if any.
|
|
||||||
function dispose (il)
|
|
||||||
local c = il.cli
|
|
||||||
if c then -- note c can be nil here, if the given infoline has not been
|
|
||||||
--attached to any client...
|
|
||||||
il.enabled = false
|
|
||||||
update (il) -- a shortcut here would be: `il.wb.visible = false'
|
|
||||||
data[c] = nil
|
|
||||||
if c ~= root then
|
|
||||||
-- unsubscribe from client-related signals
|
|
||||||
for _, s in ipairs (csignals) do
|
|
||||||
c:remove_signal (s, update_from_client)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
-- Local variables:
|
|
||||||
-- indent-tabs-mode: nil
|
|
||||||
-- fill-column: 80
|
|
||||||
-- lua-indent-level: 4
|
|
||||||
-- End:
|
|
||||||
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
|
@ -1,334 +0,0 @@
|
||||||
-- -*- coding: utf-8 -*-
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- @author Nicolas Berthier <nberthier@gmail.com>
|
|
||||||
-- @copyright 2010 Nicolas Berthier
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
--
|
|
||||||
-- This is a module for defining keychains à la emacs in awesome. I was also
|
|
||||||
-- inspired by ion3 behavior when designing it.
|
|
||||||
--
|
|
||||||
-- Remarks:
|
|
||||||
--
|
|
||||||
-- - This module does not handle `release' key bindings, but is it useful for
|
|
||||||
-- keychains?
|
|
||||||
--
|
|
||||||
-- - It has not been tested with multiple screens yet.
|
|
||||||
--
|
|
||||||
-- - There might (... must) be incompatibilities with the shifty module. Also,
|
|
||||||
-- defining global and per-client keychains with the same prefix is not
|
|
||||||
-- allowed (or leads to unspecified behaviors... --- in practice: the
|
|
||||||
-- per-client ones are ignored). However, I do think separation of per-client
|
|
||||||
-- and global keys is a bad idea if client keys do not have a higher priority
|
|
||||||
-- than the global ones...
|
|
||||||
--
|
|
||||||
-- Example usage: see `rc.lua' file.
|
|
||||||
--
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
--{{{ Grab environment (mostly aliases)
|
|
||||||
local setmetatable = setmetatable
|
|
||||||
local ipairs = ipairs
|
|
||||||
local type = type
|
|
||||||
local pairs = pairs
|
|
||||||
local string = string
|
|
||||||
local print = print
|
|
||||||
local error = error
|
|
||||||
local io = io
|
|
||||||
|
|
||||||
local capi = capi
|
|
||||||
local client = client
|
|
||||||
local awesome = awesome
|
|
||||||
local root = root
|
|
||||||
|
|
||||||
local akey = require ("awful.key")
|
|
||||||
local join = awful.util.table.join
|
|
||||||
local clone = awful.util.table.clone
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
module ("keychain")
|
|
||||||
|
|
||||||
-- Privata data: we use weak keys in order to allow collection of private data
|
|
||||||
-- if keys (clients) are collected (i.e., no longer used, after having been
|
|
||||||
-- killed for instance)
|
|
||||||
local data = setmetatable ({}, { __mode = 'k' })
|
|
||||||
|
|
||||||
--{{{ Functional Tuples
|
|
||||||
-- see http://lua-users.org/wiki/FunctionalTuples for details
|
|
||||||
|
|
||||||
--- Creates a keystroke representation to fill the `escape' table configuration
|
|
||||||
--- property.
|
|
||||||
-- @param m Modifiers table.
|
|
||||||
-- @param k The key itself.
|
|
||||||
-- @return A keystroke representation (only for the escape sequence, for now?).
|
|
||||||
function keystroke (m, k)
|
|
||||||
if type (m) ~= "table" then
|
|
||||||
error ("Keystroke modifiers must be given a table (got a "..
|
|
||||||
type (m)..")")
|
|
||||||
end
|
|
||||||
if type (k) ~= "string" then
|
|
||||||
error ("Keystroke key must be given a string (got a "..
|
|
||||||
type (m)..")")
|
|
||||||
end
|
|
||||||
return function (fn) return fn (m, k) end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- keystroke accessors
|
|
||||||
local function ks_mod (_m, _k) return _m end
|
|
||||||
local function ks_key (_m, _k) return _k end
|
|
||||||
|
|
||||||
-- ---
|
|
||||||
|
|
||||||
--- Creates a final keychain binding to fill the keychain binding tables,
|
|
||||||
--- meaning that the given function will be executed at the end of the keychain.
|
|
||||||
-- @param m Modifiers table.
|
|
||||||
-- @param k The key.
|
|
||||||
-- @param cont The function to be bound to the given keys.
|
|
||||||
-- @return A "final" key binding.
|
|
||||||
function key (m, k, cont)
|
|
||||||
if type (cont) ~= "function" then
|
|
||||||
error ("Final binding must be given a function (got a "..
|
|
||||||
type (cont)..")")
|
|
||||||
end
|
|
||||||
return function (fn) return fn (keystroke (m, k), cont, true) end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Creates an intermediate (prefix) keychain binding.
|
|
||||||
-- @param m Modifiers table.
|
|
||||||
-- @param k The key.
|
|
||||||
-- @param sub The subchain description table to be bound to the given keys.
|
|
||||||
-- @return An "intermediate" key binding.
|
|
||||||
function subchain (m, k, sub)
|
|
||||||
if type (sub) ~= "table" then
|
|
||||||
error ("Subchain binding must be given a table (got a "..
|
|
||||||
type (sub)..")")
|
|
||||||
end
|
|
||||||
return function (fn) return fn (keystroke (m, k), sub, false) end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- key/subchain binding accessors
|
|
||||||
local function binding_ks (ks, cont, leaf) return ks end
|
|
||||||
local function binding_cont (ks, cont, leaf) return cont end
|
|
||||||
local function binding_leaf (ks, cont, leaf) return leaf end
|
|
||||||
|
|
||||||
--- Creates an intermediate keychain if sub is a table, or a final key binding
|
|
||||||
--- otherwise (and then sub must be a function).
|
|
||||||
-- @param m Modifiers table.
|
|
||||||
-- @param k The key.
|
|
||||||
-- @param sub Either the subchain description table, or the function, to be
|
|
||||||
-- bound to the given keys.
|
|
||||||
function sub (m, k, sub)
|
|
||||||
if type (sub) == "table" then
|
|
||||||
return subchain (m, k, sub)
|
|
||||||
else
|
|
||||||
return key (m, k, sub)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
--{{{ Default values
|
|
||||||
|
|
||||||
--- Default escape sequences (S-g is inspired by emacs...)
|
|
||||||
local escape_keystrokes = {
|
|
||||||
keystroke ( { }, "Escape" ),
|
|
||||||
keystroke ( { "Mod4" }, "g" ),
|
|
||||||
}
|
|
||||||
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
--{{{ Key table management facilities
|
|
||||||
|
|
||||||
local function set_keys (c, k)
|
|
||||||
if c == root then root.keys (k) else c:keys (k) end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function keys_of (c)
|
|
||||||
if c == root then return root.keys () else return c:keys () end
|
|
||||||
end
|
|
||||||
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
--{{{ Signal emission helper
|
|
||||||
|
|
||||||
local function notif (sig, w, ...)
|
|
||||||
if w ~= root then
|
|
||||||
client.emit_signal (sig, w, ...)
|
|
||||||
else -- we use global signals otherwise
|
|
||||||
awesome.emit_signal (sig, ...)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
--{{{ Client/Root-related state management
|
|
||||||
|
|
||||||
local function init_client_state_maybe (w)
|
|
||||||
if data[w] == nil then
|
|
||||||
local d = { }
|
|
||||||
d.keys = keys_of (w) -- save client keys
|
|
||||||
data[w] = d -- register client
|
|
||||||
notif ("keychain::enter", w)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function restore_client_state (c)
|
|
||||||
local w = c or root
|
|
||||||
local d = data[w]
|
|
||||||
-- XXX: Turns out that `d' can be nil already here, in case the keyboard has
|
|
||||||
-- been grabbed since the previous call to this funtion... (that also seems
|
|
||||||
-- to be called again upon release…)
|
|
||||||
if d then
|
|
||||||
set_keys (w, d.keys) -- restore client keys
|
|
||||||
data[w] = nil -- unregister client
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function leave (c)
|
|
||||||
local w = c or root
|
|
||||||
|
|
||||||
-- Destroy notifier structures if needed
|
|
||||||
if data[w] then -- XXX: necessary test?
|
|
||||||
notif ("keychain::leave", w)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- force disposal of resources when clients are killed
|
|
||||||
client.add_signal ("unmanage", leave)
|
|
||||||
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
--{{{ Key binding tree access helpers
|
|
||||||
|
|
||||||
local function make_on_entering (m, k, subchain) return
|
|
||||||
function (c)
|
|
||||||
local w = c or root
|
|
||||||
|
|
||||||
-- Register and initialize client state, if not already in a keychain
|
|
||||||
init_client_state_maybe (w)
|
|
||||||
|
|
||||||
-- Update notifier text, and trigger its drawing if necessary
|
|
||||||
notif ("keychain::append", w, m, k)
|
|
||||||
|
|
||||||
-- Setup subchain
|
|
||||||
set_keys (w, subchain)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function on_leaving (c)
|
|
||||||
-- Trigger disposal routine
|
|
||||||
leave (c)
|
|
||||||
|
|
||||||
-- Restore initial key mapping of client
|
|
||||||
restore_client_state (c)
|
|
||||||
end
|
|
||||||
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
--{{{ Configuration
|
|
||||||
|
|
||||||
-- Flag to detect late initialization error
|
|
||||||
local already_used = false
|
|
||||||
|
|
||||||
-- Escape binding table built once upon initialization
|
|
||||||
local escape_bindings = { }
|
|
||||||
|
|
||||||
--- Fills the escape bindings table with actual `awful.key' elements triggering
|
|
||||||
--- execution of `on_leaving'.
|
|
||||||
local function init_escape_bindings ()
|
|
||||||
escape_bindings = { }
|
|
||||||
for _, e in ipairs (escape_keystrokes) do
|
|
||||||
escape_bindings = join (escape_bindings,
|
|
||||||
akey (e (ks_mod), e (ks_key), on_leaving))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Call it once upon module loading to initialize escape_bindings (in case
|
|
||||||
-- `init' is not called).
|
|
||||||
init_escape_bindings ()
|
|
||||||
|
|
||||||
|
|
||||||
--- Initializes the keychain module, with given properties; to be called before
|
|
||||||
--- ANY other function of this module.
|
|
||||||
-- Configurations fields include:
|
|
||||||
--
|
|
||||||
-- `escapes': A table of keystrokes (@see keychain.keystroke) escaping keychains
|
|
||||||
-- (defaults are `Mod4-g' and `Escape').
|
|
||||||
--
|
|
||||||
-- @param c The table of properties.
|
|
||||||
function init (c)
|
|
||||||
local c = c or { }
|
|
||||||
|
|
||||||
if already_used then
|
|
||||||
-- heum... just signal the error: "print" or "error"?
|
|
||||||
return print ("E: keychain: Call to `init' AFTER having bound keys!")
|
|
||||||
end
|
|
||||||
|
|
||||||
escape_keystrokes = c.escapes and c.escapes or escape_keystrokes
|
|
||||||
|
|
||||||
-- Now, fill the escape bindings table again with actual `awful.key'
|
|
||||||
-- elements triggering `on_leaving' executions, in case escape keys has
|
|
||||||
-- changed.
|
|
||||||
init_escape_bindings ()
|
|
||||||
end
|
|
||||||
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
--{{{ Keychain creation
|
|
||||||
|
|
||||||
--- Creates a new keychain binding.
|
|
||||||
-- @param m Modifiers table.
|
|
||||||
-- @param k The key.
|
|
||||||
-- @param chains A table of keychains, describing either final bindings (see
|
|
||||||
-- key constructor) or subchains (see subchain constructor). If arg is not a
|
|
||||||
-- table, then `awful.key' is called directly with the arguments.
|
|
||||||
-- @return A key binding for the `awful.key' module.
|
|
||||||
-- @see awful.key
|
|
||||||
function new (m, k, chains)
|
|
||||||
|
|
||||||
-- If the argument is a function, then we need to return an actual awful.key
|
|
||||||
-- directly.
|
|
||||||
if type (chains) ~= "table" then
|
|
||||||
return akey (m, k, chains)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- This table will contain the keys to be mapped upon <m, k> keystroke. It
|
|
||||||
-- initially contains the escape bindings, so that one can still rebind them
|
|
||||||
-- differently in `chains'.
|
|
||||||
local subchain = clone (escape_bindings)
|
|
||||||
|
|
||||||
already_used = true -- subsequent init avoidance flag...
|
|
||||||
|
|
||||||
-- For each entry of the given chains, add a corresponding `awful.key'
|
|
||||||
-- element in the subchain
|
|
||||||
for _, e in ipairs (chains) do
|
|
||||||
local ks = e (binding_ks)
|
|
||||||
if e (binding_leaf) then
|
|
||||||
-- We encountered a leaf in the chains.
|
|
||||||
local function on_leaf (c) on_leaving (c); e (binding_cont) (c) end
|
|
||||||
subchain = join (subchain, akey (ks (ks_mod), ks (ks_key), on_leaf))
|
|
||||||
else
|
|
||||||
-- Recursively call subchain creation. "Funny" detail: I think there
|
|
||||||
-- is no way of creating ill-structured keychain descriptors that
|
|
||||||
-- would produce infinite recursive calls here, since we control
|
|
||||||
-- their creation with functional tuples, that cannot lead to cyclic
|
|
||||||
-- structures...
|
|
||||||
local subch = new (ks (ks_mod), ks (ks_key), e (binding_cont))
|
|
||||||
subchain = join (subchain, subch)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Then return an actual `awful.key', triggering the `on_entering' routine
|
|
||||||
return akey (m, k, make_on_entering (m, k, subchain))
|
|
||||||
end
|
|
||||||
--}}}
|
|
||||||
|
|
||||||
-- Setup `__call' entry in module's metatable so that we can create new prefix
|
|
||||||
-- binding using `keychain (m, k, ...)' directly.
|
|
||||||
setmetatable (_M, { __call = function (_, ...) return new (...) end })
|
|
||||||
|
|
||||||
-- Local variables:
|
|
||||||
-- indent-tabs-mode: nil
|
|
||||||
-- fill-column: 80
|
|
||||||
-- lua-indent-level: 4
|
|
||||||
-- End:
|
|
||||||
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
|
@ -1,73 +0,0 @@
|
||||||
local awful = awful
|
|
||||||
local beautiful = beautiful
|
|
||||||
local client = client
|
|
||||||
local ext = require("ext")
|
|
||||||
local lfs = require("lfs")
|
|
||||||
local pairs = pairs
|
|
||||||
local string = string
|
|
||||||
local table = table
|
|
||||||
local widget = widget
|
|
||||||
|
|
||||||
module("oni")
|
|
||||||
|
|
||||||
local maildirfmt = "/home/slash/documents/mail/%s/inbox/new/"
|
|
||||||
|
|
||||||
function mailcount(account)
|
|
||||||
local i = 0
|
|
||||||
local dir = string.format(maildirfmt, account)
|
|
||||||
|
|
||||||
for file in lfs.dir(dir) do
|
|
||||||
if file ~= "." and file ~= ".." then
|
|
||||||
i = i + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return i
|
|
||||||
end
|
|
||||||
|
|
||||||
local function showmail(name)
|
|
||||||
awful.util.spawn("emacsclient -e '(oni:view-mail \"" .. name .. "\")'")
|
|
||||||
end
|
|
||||||
|
|
||||||
function mailcount_widgets(label, account, name)
|
|
||||||
widgets = {}
|
|
||||||
widgets.label = widget({ type = "textbox" })
|
|
||||||
widgets.label.text = string.format(" %s: ", label)
|
|
||||||
widgets.count = widget({ type = "textbox" })
|
|
||||||
widgets.count.text = string.format(" %d ", mailcount(account))
|
|
||||||
widgets.count.bg = beautiful.bg_focus
|
|
||||||
widgets.count:buttons(
|
|
||||||
awful.util.table.join(
|
|
||||||
awful.button({ }, 1, function (c) showmail(name) end)))
|
|
||||||
|
|
||||||
return widgets
|
|
||||||
end
|
|
||||||
|
|
||||||
function focus_raise(direction)
|
|
||||||
awful.client.focus.bydirection(direction)
|
|
||||||
if client.focus then client.focus:raise() end
|
|
||||||
end
|
|
||||||
|
|
||||||
function ror_browser()
|
|
||||||
ext.run_or_raise("conkeror", { class = "Conkeror" })
|
|
||||||
end
|
|
||||||
|
|
||||||
function ror_editor()
|
|
||||||
ext.run_or_raise("emacsclient -c -a emacs", { class = "Emacs" })
|
|
||||||
end
|
|
||||||
|
|
||||||
function ror_term()
|
|
||||||
ext.run_or_raise("urxvt", { class = "URxvt" })
|
|
||||||
end
|
|
||||||
|
|
||||||
function run_browser()
|
|
||||||
awful.util.spawn("conkeror")
|
|
||||||
end
|
|
||||||
|
|
||||||
function run_editor()
|
|
||||||
awful.util.spawn("emacsclient -c -a emacs")
|
|
||||||
end
|
|
||||||
|
|
||||||
function run_term()
|
|
||||||
awful.util.spawn("urxvt")
|
|
||||||
end
|
|
|
@ -1,6 +1,8 @@
|
||||||
-- Standard awesome library
|
-- Standard awesome library
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
|
awful.rules = require("awful.rules")
|
||||||
|
require("awful.autofocus")
|
||||||
-- Widget and layout library
|
-- Widget and layout library
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
-- Theme handling library
|
-- Theme handling library
|
||||||
|
@ -10,30 +12,13 @@ local naughty = require("naughty")
|
||||||
local menubar = require("menubar")
|
local menubar = require("menubar")
|
||||||
local lfs = require("lfs")
|
local lfs = require("lfs")
|
||||||
|
|
||||||
awful.rules = require("awful.rules")
|
package.path =
|
||||||
require("awful.autofocus")
|
'/home/slash/projects/avandu-lua/lua/?.lua;' .. package.path
|
||||||
|
|
||||||
|
local avandu = require 'avandu'
|
||||||
|
|
||||||
local maildir_base = os.getenv("HOME") .. "/documents/mail/"
|
local maildir_base = os.getenv("HOME") .. "/documents/mail/"
|
||||||
|
|
||||||
function ror(program, cls)
|
|
||||||
local rorfunc = function ()
|
|
||||||
local matcher = function (c)
|
|
||||||
return awful.rules.match(c, { class = cls })
|
|
||||||
end
|
|
||||||
|
|
||||||
awful.client.run_or_raise(program, matcher)
|
|
||||||
end
|
|
||||||
|
|
||||||
return rorfunc
|
|
||||||
end
|
|
||||||
|
|
||||||
function ror_combo(mod, key, program, class)
|
|
||||||
return awful.util.table.join(
|
|
||||||
awful.key(mod, key, ror(program, class)),
|
|
||||||
awful.key(awful.util.table.join(mod, { "Shift" }), key,
|
|
||||||
function () awful.util.spawn(program) end))
|
|
||||||
end
|
|
||||||
|
|
||||||
function new_mail(maildir)
|
function new_mail(maildir)
|
||||||
local count = 0
|
local count = 0
|
||||||
|
|
||||||
|
@ -53,10 +38,9 @@ function new_mail(maildir)
|
||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
----- Error handling
|
-- {{{ Error handling
|
||||||
-- Check if awesome encountered an error during startup and fell back
|
-- Check if awesome encountered an error during startup and fell back to
|
||||||
-- to another config (This code will only ever execute for the
|
-- another config (This code will only ever execute for the fallback config)
|
||||||
-- fallback config)
|
|
||||||
if awesome.startup_errors then
|
if awesome.startup_errors then
|
||||||
naughty.notify({ preset = naughty.config.presets.critical,
|
naughty.notify({ preset = naughty.config.presets.critical,
|
||||||
title = "Oops, there were errors during startup!",
|
title = "Oops, there were errors during startup!",
|
||||||
|
@ -77,57 +61,58 @@ do
|
||||||
in_error = false
|
in_error = false
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
-- }}}
|
||||||
----- Variable definitions
|
|
||||||
-- Themes define colours, icons, and wallpapers
|
-- {{{ Variable definitions
|
||||||
|
-- Themes define colours, icons, font and wallpapers.
|
||||||
beautiful.init("/usr/share/awesome/themes/default/theme.lua")
|
beautiful.init("/usr/share/awesome/themes/default/theme.lua")
|
||||||
|
avandu.ttrss_url = "https://ryuslash.org/tt-rss/api/"
|
||||||
|
|
||||||
-- This is used later as the default terminal and editor to run.
|
-- This is used later as the default terminal and editor to run.
|
||||||
terminal = "urxvt"
|
terminal = "urxvt"
|
||||||
editor = os.getenv("EDITOR") or "nano"
|
editor = "emacsclient -c"
|
||||||
editor_cmd = terminal .. " -e " .. editor
|
editor_cmd = editor
|
||||||
|
|
||||||
----- Default modkey.
|
-- Default modkey.
|
||||||
-- Usually, Mod4 is the key with a logo between Control and Alt. If
|
-- Usually, Mod4 is the key with a logo between Control and Alt.
|
||||||
-- you do not like this or do not have such a key, I suggest you to
|
-- If you do not like this or do not have such a key,
|
||||||
-- remap Mod4 to another key using xmodmap or other tools. However,
|
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
|
||||||
-- you can use another modifier like Mod1, but it may interact with
|
-- However, you can use another modifier like Mod1, but it may interact with others.
|
||||||
-- others.
|
|
||||||
modkey = "Mod4"
|
modkey = "Mod4"
|
||||||
|
|
||||||
-- Table of layouts to cover with awful.layout.inc, order matters.
|
-- Table of layouts to cover with awful.layout.inc, order matters.
|
||||||
local layouts =
|
local layouts =
|
||||||
{
|
{
|
||||||
awful.layout.suit.tile,
|
awful.layout.suit.tile,
|
||||||
awful.layout.suit.tile.left,
|
-- awful.layout.suit.tile.left,
|
||||||
awful.layout.suit.tile.bottom,
|
-- awful.layout.suit.tile.bottom,
|
||||||
awful.layout.suit.tile.top,
|
-- awful.layout.suit.tile.top,
|
||||||
awful.layout.suit.fair,
|
-- awful.layout.suit.fair,
|
||||||
awful.layout.suit.fair.horizontal,
|
-- awful.layout.suit.fair.horizontal,
|
||||||
awful.layout.suit.spiral,
|
-- awful.layout.suit.spiral,
|
||||||
awful.layout.suit.spiral.dwindle,
|
-- awful.layout.suit.spiral.dwindle,
|
||||||
awful.layout.suit.max,
|
awful.layout.suit.max,
|
||||||
awful.layout.suit.max.fullscreen,
|
-- awful.layout.suit.max.fullscreen,
|
||||||
awful.layout.suit.magnifier,
|
-- awful.layout.suit.magnifier,
|
||||||
awful.layout.suit.floating
|
-- awful.layout.suit.floating,
|
||||||
}
|
}
|
||||||
|
-- }}}
|
||||||
----- Wallpaper
|
|
||||||
if beautiful.wallpaper then
|
-- {{{ Wallpaper
|
||||||
for s = 1, screen.count() do
|
-- gears.wallpaper.tiled("/home/slash/pictures/wallpaper-962650.jpg")
|
||||||
gears.wallpaper.maximized(beautiful.wallpaper, s, true)
|
gears.wallpaper.tiled("/home/slash/pictures/wallpaper-2311191.jpg")
|
||||||
end
|
-- }}}
|
||||||
end
|
|
||||||
|
-- {{{ Tags
|
||||||
----- Tags
|
|
||||||
-- Define a tag table which hold all screen tags.
|
-- Define a tag table which hold all screen tags.
|
||||||
tags = {}
|
tags = {}
|
||||||
for s = 1, screen.count() do
|
for s = 1, screen.count() do
|
||||||
-- Each screen has its own tag table.
|
-- Each screen has its own tag table.
|
||||||
tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[1])
|
tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[1])
|
||||||
end
|
end
|
||||||
|
-- }}}
|
||||||
----- Menu
|
|
||||||
|
-- {{{ Menu
|
||||||
-- Create a laucher widget and a main menu
|
-- Create a laucher widget and a main menu
|
||||||
myawesomemenu = {
|
myawesomemenu = {
|
||||||
{ "manual", terminal .. " -e man awesome" },
|
{ "manual", terminal .. " -e man awesome" },
|
||||||
|
@ -136,18 +121,19 @@ myawesomemenu = {
|
||||||
{ "quit", awesome.quit }
|
{ "quit", awesome.quit }
|
||||||
}
|
}
|
||||||
|
|
||||||
mymainmenu = awful.menu(
|
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
|
||||||
{ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
|
{ "open terminal", terminal }
|
||||||
{ "open terminal", terminal } } })
|
}
|
||||||
|
})
|
||||||
|
|
||||||
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
|
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
|
||||||
menu = mymainmenu })
|
menu = mymainmenu })
|
||||||
|
|
||||||
-- Menubar configuration
|
-- Menubar configuration
|
||||||
menubar.utils.terminal = terminal -- Set the terminal for applications
|
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
||||||
-- that require it
|
-- }}}
|
||||||
|
|
||||||
----- Wibox
|
-- {{{ Wibox
|
||||||
-- Create a textclock widget
|
-- Create a textclock widget
|
||||||
mytextclock = awful.widget.textclock()
|
mytextclock = awful.widget.textclock()
|
||||||
|
|
||||||
|
@ -156,61 +142,89 @@ mywibox = {}
|
||||||
mypromptbox = {}
|
mypromptbox = {}
|
||||||
mylayoutbox = {}
|
mylayoutbox = {}
|
||||||
mytaglist = {}
|
mytaglist = {}
|
||||||
|
mytaglist.buttons = awful.util.table.join(
|
||||||
|
awful.button({ }, 1, awful.tag.viewonly),
|
||||||
|
awful.button({ modkey }, 1, awful.client.movetotag),
|
||||||
|
awful.button({ }, 3, awful.tag.viewtoggle),
|
||||||
|
awful.button({ modkey }, 3, awful.client.toggletag),
|
||||||
|
awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
|
||||||
|
awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
|
||||||
|
)
|
||||||
mytasklist = {}
|
mytasklist = {}
|
||||||
|
mytasklist.buttons = awful.util.table.join(
|
||||||
|
awful.button({ }, 1, function (c)
|
||||||
|
if c ~= client.focus then
|
||||||
|
client.focus = c
|
||||||
|
c:raise()
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
awful.button({ }, 3, function ()
|
||||||
|
if instance then
|
||||||
|
instance:hide()
|
||||||
|
instance = nil
|
||||||
|
else
|
||||||
|
instance = awful.menu.clients({
|
||||||
|
theme = { width = 250 }
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
awful.button({ }, 4, function ()
|
||||||
|
awful.client.focus.byidx(1)
|
||||||
|
if client.focus then client.focus:raise() end
|
||||||
|
end),
|
||||||
|
awful.button({ }, 5, function ()
|
||||||
|
awful.client.focus.byidx(-1)
|
||||||
|
if client.focus then client.focus:raise() end
|
||||||
|
end))
|
||||||
|
|
||||||
mymaillist = wibox.widget.textbox()
|
mymaillist = wibox.widget.textbox()
|
||||||
mymaillist:set_text(
|
mymaillist:set_text(
|
||||||
string.format(" ryu: %d gmail: %d aethon: %d 9f: %d",
|
string.format(" ryu: %d gmail: %d 9f: %d ",
|
||||||
new_mail('ryuslash.org/inbox'),
|
new_mail('ryuslash.org/inbox'),
|
||||||
new_mail('gmail/inbox'),
|
new_mail('gmail/inbox'),
|
||||||
new_mail('aethon/inbox'),
|
|
||||||
new_mail('ninthfloor/inbox')))
|
new_mail('ninthfloor/inbox')))
|
||||||
mymaillisttimer = timer({ timeout = 60 })
|
mymaillisttimer = timer({ timeout = 60 })
|
||||||
mymaillisttimer:connect_signal(
|
mymaillisttimer:connect_signal(
|
||||||
"timeout",
|
"timeout",
|
||||||
function ()
|
function ()
|
||||||
mymaillist:set_text(
|
mymaillist:set_text(
|
||||||
string.format(" ryu: %d gmail: %d aethon: %d 9f: %d",
|
string.format(" ryu: %d gmail: %d 9f: %d ",
|
||||||
new_mail('ryuslash.org/inbox'),
|
new_mail('ryuslash.org/inbox'),
|
||||||
new_mail('gmail/inbox'),
|
new_mail('gmail/inbox'),
|
||||||
new_mail('aethon/inbox'),
|
|
||||||
new_mail('ninthfloor/inbox')))
|
new_mail('ninthfloor/inbox')))
|
||||||
end)
|
end)
|
||||||
mymaillisttimer:start()
|
mymaillisttimer:start()
|
||||||
|
|
||||||
mytodolist = wibox.widget.textbox()
|
-- myrsslist = wibox.widget.textbox()
|
||||||
mytodolist:set_text(
|
-- myrsslist:set_text(" rss: " .. (avandu.unread() or '?'))
|
||||||
string.format(" ptodo: %d wtodo: %d",
|
-- myrsslisttimer = timer({ timeout = 60 })
|
||||||
awful.util.pread("todo-count t"),
|
-- myrsslisttimer:connect_signal(
|
||||||
awful.util.pread("todo-count w")))
|
-- "timeout",
|
||||||
mytodolisttimer = timer({ timeout = 60 * 60 })
|
-- function ()
|
||||||
mytodolisttimer:connect_signal(
|
-- myrsslist:set_text(" rss: " .. (avandu.unread() or '?'))
|
||||||
"timeout",
|
-- end
|
||||||
function ()
|
-- )
|
||||||
mytodolist:set_text(
|
-- myrsslisttimer:start()
|
||||||
string.format(" pers: %d work: %d",
|
|
||||||
awful.util.pread("todo-count t"),
|
|
||||||
awful.util.pread("todo-count w")))
|
|
||||||
end)
|
|
||||||
mytodolisttimer:start()
|
|
||||||
|
|
||||||
for s = 1, screen.count() do
|
for s = 1, screen.count() do
|
||||||
-- Create a promptbox for each screen
|
-- Create a promptbox for each screen
|
||||||
mypromptbox[s] = awful.widget.prompt()
|
mypromptbox[s] = awful.widget.prompt()
|
||||||
-- Create an imagebox widget which will contains an icon
|
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
|
||||||
-- indicating which layout we're using. We need one layoutbox per
|
-- We need one layoutbox per screen.
|
||||||
-- screen.
|
|
||||||
mylayoutbox[s] = awful.widget.layoutbox(s)
|
mylayoutbox[s] = awful.widget.layoutbox(s)
|
||||||
|
mylayoutbox[s]:buttons(awful.util.table.join(
|
||||||
|
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
|
||||||
|
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
|
||||||
|
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
|
||||||
|
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
|
||||||
-- Create a taglist widget
|
-- Create a taglist widget
|
||||||
mytaglist[s] = awful.widget.taglist(
|
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
|
||||||
s, awful.widget.taglist.filter.all, mytaglist.buttons)
|
|
||||||
|
|
||||||
-- Create a tasklist widget
|
-- Create a tasklist widget
|
||||||
mytasklist[s] = awful.widget.tasklist(
|
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
|
||||||
s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
|
|
||||||
|
|
||||||
-- Create the wibox
|
-- Create the wibox
|
||||||
mywibox[s] = awful.wibox({ position = "top", screen = s })
|
mywibox[s] = awful.wibox({ position = "bottom", screen = s })
|
||||||
|
|
||||||
-- Widgets that are aligned to the left
|
-- Widgets that are aligned to the left
|
||||||
local left_layout = wibox.layout.fixed.horizontal()
|
local left_layout = wibox.layout.fixed.horizontal()
|
||||||
|
@ -221,7 +235,7 @@ for s = 1, screen.count() do
|
||||||
-- Widgets that are aligned to the right
|
-- Widgets that are aligned to the right
|
||||||
local right_layout = wibox.layout.fixed.horizontal()
|
local right_layout = wibox.layout.fixed.horizontal()
|
||||||
if s == 1 then
|
if s == 1 then
|
||||||
right_layout:add(mytodolist)
|
-- right_layout:add(myrsslist)
|
||||||
right_layout:add(mymaillist)
|
right_layout:add(mymaillist)
|
||||||
right_layout:add(wibox.widget.systray())
|
right_layout:add(wibox.widget.systray())
|
||||||
end
|
end
|
||||||
|
@ -236,189 +250,254 @@ for s = 1, screen.count() do
|
||||||
|
|
||||||
mywibox[s]:set_widget(layout)
|
mywibox[s]:set_widget(layout)
|
||||||
end
|
end
|
||||||
|
-- }}}
|
||||||
----- Key bindings
|
|
||||||
globalkeys = awful.util.table.join(
|
|
||||||
awful.key({ modkey, }, "Left", awful.tag.viewprev),
|
|
||||||
awful.key({ modkey, }, "Right", awful.tag.viewnext),
|
|
||||||
awful.key({ modkey, }, "Escape", awful.tag.history.restore),
|
|
||||||
|
|
||||||
awful.key({ modkey, }, "n",
|
-- {{{ Mouse bindings
|
||||||
function ()
|
root.buttons(awful.util.table.join(
|
||||||
awful.client.focus.byidx(1)
|
awful.button({ }, 3, function () mymainmenu:toggle() end),
|
||||||
if client.focus then client.focus:raise() end
|
awful.button({ }, 4, awful.tag.viewnext),
|
||||||
end),
|
awful.button({ }, 5, awful.tag.viewprev)
|
||||||
awful.key({ modkey, }, "p",
|
))
|
||||||
function ()
|
-- }}}
|
||||||
awful.client.focus.byidx(-1)
|
|
||||||
if client.focus then client.focus:raise() end
|
function fraise (idx)
|
||||||
end),
|
awful.client.focus.byidx(idx)
|
||||||
|
if client.focus then client.focus:raise() end
|
||||||
|
end
|
||||||
|
|
||||||
|
function hpraise ()
|
||||||
|
awful.client.focus.history.previous()
|
||||||
|
if client.focus then client.focus:raise() end
|
||||||
|
end
|
||||||
|
|
||||||
|
function ror (prog, class)
|
||||||
|
function inner ()
|
||||||
|
local matcher = function (c)
|
||||||
|
return awful.rules.match(c, { class = class })
|
||||||
|
end
|
||||||
|
awful.client.run_or_raise(prog, matcher)
|
||||||
|
end
|
||||||
|
|
||||||
|
return inner
|
||||||
|
end
|
||||||
|
|
||||||
|
-- {{{ Key bindings
|
||||||
|
globalkeys = awful.util.table.join(
|
||||||
|
awful.key({ modkey, }, "l", awful.tag.viewprev),
|
||||||
|
awful.key({ modkey, }, "y", awful.tag.viewnext),
|
||||||
|
awful.key({ modkey, }, "Escape", awful.tag.history.restore),
|
||||||
|
awful.key({ modkey, }, "n", function () fraise(1) end),
|
||||||
|
awful.key({ modkey, }, "p", function () fraise(-1) end),
|
||||||
|
-- awful.key({ modkey, }, "w", function () mymainmenu:show() end),
|
||||||
|
awful.key({ }, "Print", function () awful.util.spawn("scrot") end),
|
||||||
|
-- awful.key({ "Control", }, "Print", function () awful.util.spawn("scrot -s") end),
|
||||||
|
|
||||||
|
awful.key({ modkey, }, "c", ror("urxvt", "URxvt")),
|
||||||
|
awful.key({ modkey, }, "e", ror("emacsclient -c", "Emacs")),
|
||||||
|
awful.key({ modkey, }, "w", ror("conkeror", "Conkeror")),
|
||||||
|
|
||||||
-- Layout manipulation
|
-- Layout manipulation
|
||||||
awful.key({ modkey, "Shift" }, "n",
|
awful.key({ modkey, "Shift" }, "n", function () awful.client.swap.byidx( 1) end),
|
||||||
function () awful.client.swap.byidx(1) end),
|
awful.key({ modkey, "Shift" }, "p", function () awful.client.swap.byidx( -1) end),
|
||||||
awful.key({ modkey, "Shift" }, "p",
|
awful.key({ modkey, }, ".", function () awful.screen.focus_relative( 1) end),
|
||||||
function () awful.client.swap.byidx(-1) end),
|
awful.key({ modkey, }, ",", function () awful.screen.focus_relative(-1) end),
|
||||||
awful.key({ modkey, "Control" }, "n",
|
awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
|
||||||
function () awful.screen.focus_relative(1) end),
|
awful.key({ modkey, }, "Tab", hpraise),
|
||||||
awful.key({ modkey, "Control" }, "p",
|
|
||||||
function () awful.screen.focus_relative(-1) end),
|
|
||||||
awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
|
|
||||||
awful.key({ modkey, }, "Tab",
|
|
||||||
function ()
|
|
||||||
awful.client.focus.history.previous()
|
|
||||||
if client.focus then
|
|
||||||
client.focus:raise()
|
|
||||||
end
|
|
||||||
end),
|
|
||||||
|
|
||||||
-- Standard program
|
-- Standard program
|
||||||
awful.key({ modkey, }, "Return",
|
awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
|
||||||
function () awful.util.spawn(terminal) end),
|
|
||||||
awful.key({ modkey, "Control" }, "r", awesome.restart),
|
awful.key({ modkey, "Control" }, "r", awesome.restart),
|
||||||
awful.key({ modkey, "Shift" }, "q", awesome.quit),
|
awful.key({ modkey, "Shift" }, "q", awesome.quit),
|
||||||
|
|
||||||
awful.key({ modkey, }, "l",
|
awful.key({ modkey, }, "j", function () awful.tag.incmwfact( 0.05) end),
|
||||||
function () awful.tag.incmwfact( 0.05) end),
|
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
|
||||||
awful.key({ modkey, }, "h",
|
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
|
||||||
function () awful.tag.incmwfact(-0.05) end),
|
awful.key({ modkey, "Shift" }, "j", function () awful.tag.incnmaster(-1) end),
|
||||||
awful.key({ modkey, "Shift" }, "h",
|
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
|
||||||
function () awful.tag.incnmaster(1) end),
|
awful.key({ modkey, "Control" }, "j", function () awful.tag.incncol(-1) end),
|
||||||
awful.key({ modkey, "Shift" }, "l",
|
awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
|
||||||
function () awful.tag.incnmaster(-1) end),
|
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
|
||||||
awful.key({ modkey, "Control" }, "h",
|
|
||||||
function () awful.tag.incncol(1) end),
|
|
||||||
awful.key({ modkey, "Control" }, "l",
|
|
||||||
function () awful.tag.incncol(-1) end),
|
|
||||||
awful.key({ modkey, }, "space",
|
|
||||||
function () awful.layout.inc(layouts, 1) end),
|
|
||||||
awful.key({ modkey, "Shift" }, "space",
|
|
||||||
function () awful.layout.inc(layouts, -1) end),
|
|
||||||
|
|
||||||
awful.key({ modkey, "Control" }, "j", awful.client.restore),
|
|
||||||
|
|
||||||
-- Prompt
|
-- Prompt
|
||||||
awful.key({ modkey }, "r",
|
awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
|
||||||
function () mypromptbox[mouse.screen]:run() end),
|
|
||||||
|
|
||||||
awful.key({ modkey }, "x",
|
awful.key({ modkey }, "x",
|
||||||
function ()
|
function ()
|
||||||
awful.prompt.run(
|
awful.prompt.run({ prompt = "Run Lua code: " },
|
||||||
{ prompt = "Run Lua code: " },
|
mypromptbox[mouse.screen].widget,
|
||||||
mypromptbox[mouse.screen].widget,
|
awful.util.eval, nil,
|
||||||
awful.util.eval, nil,
|
awful.util.getdir("cache") .. "/history_eval")
|
||||||
awful.util.getdir("cache") .. "/history_eval")
|
|
||||||
end),
|
end),
|
||||||
|
-- Menubar
|
||||||
|
awful.key({ modkey }, "k", function() menubar.show() end),
|
||||||
|
|
||||||
ror_combo({ modkey }, "e", 'emacsclient -ca emacs', 'Emacs'),
|
awful.key({ "Control", "Mod1" }, "l", function () awful.util.spawn('i3lock -c000000') end)
|
||||||
ror_combo({ modkey }, "c", 'urxvt', 'URxvt'),
|
)
|
||||||
ror_combo({ modkey }, "w", 'conkeror', 'Conkeror'),
|
|
||||||
awful.key({ "Control", "Mod1" }, "l",
|
|
||||||
function () awful.util.spawn('i3lock -c 000000') end))
|
|
||||||
|
|
||||||
clientkeys = awful.util.table.join(
|
clientkeys = awful.util.table.join(
|
||||||
awful.key({ modkey, }, "f",
|
awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
|
||||||
function (c) c.fullscreen = not c.fullscreen end),
|
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
|
||||||
awful.key({ modkey, "Shift" }, "c",
|
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
|
||||||
function (c) c:kill() end),
|
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
|
||||||
awful.key({ modkey, "Control" }, "space",
|
awful.key({ modkey, }, "o", awful.client.movetoscreen ),
|
||||||
awful.client.floating.toggle),
|
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
|
||||||
awful.key({ modkey, "Control" }, "Return",
|
awful.key({ modkey, }, "m",
|
||||||
function (c) c:swap(awful.client.getmaster()) end),
|
function (c)
|
||||||
awful.key({ modkey, }, "o",
|
c.maximized_horizontal = not c.maximized_horizontal
|
||||||
function () awful.screen.focus_relative(1) end),
|
c.maximized_vertical = not c.maximized_vertical
|
||||||
awful.key({ modkey, "Shift" }, "o", awful.client.movetoscreen),
|
end)
|
||||||
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
|
)
|
||||||
awful.key({ modkey, }, "m",
|
|
||||||
function (c)
|
|
||||||
c.maximized_horizontal = not c.maximized_horizontal
|
|
||||||
c.maximized_vertical = not c.maximized_vertical
|
|
||||||
end))
|
|
||||||
|
|
||||||
-- Compute the maximum number of digit we need, limited to 9
|
-- Bind all key numbers to tags.
|
||||||
keynumber = 0
|
-- Be careful: we use keycodes to make it works on any keyboard layout.
|
||||||
for s = 1, screen.count() do
|
-- This should map on the top row of your keyboard, usually 1 to 9.
|
||||||
keynumber = math.min(9, math.max(#tags[s], keynumber))
|
for i = 1, 9 do
|
||||||
|
globalkeys = awful.util.table.join(globalkeys,
|
||||||
|
-- View tag only.
|
||||||
|
awful.key({ modkey }, "#" .. i + 9,
|
||||||
|
function ()
|
||||||
|
local screen = mouse.screen
|
||||||
|
local tag = awful.tag.gettags(screen)[i]
|
||||||
|
if tag then
|
||||||
|
awful.tag.viewonly(tag)
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
-- Toggle tag.
|
||||||
|
awful.key({ modkey, "Control" }, "#" .. i + 9,
|
||||||
|
function ()
|
||||||
|
local screen = mouse.screen
|
||||||
|
local tag = awful.tag.gettags(screen)[i]
|
||||||
|
if tag then
|
||||||
|
awful.tag.viewtoggle(tag)
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
-- Move client to tag.
|
||||||
|
awful.key({ modkey, "Shift" }, "#" .. i + 9,
|
||||||
|
function ()
|
||||||
|
if client.focus then
|
||||||
|
local tag = awful.tag.gettags(client.focus.screen)[i]
|
||||||
|
if tag then
|
||||||
|
awful.client.movetotag(tag)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
-- Toggle tag.
|
||||||
|
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
|
||||||
|
function ()
|
||||||
|
if client.focus then
|
||||||
|
local tag = awful.tag.gettags(client.focus.screen)[i]
|
||||||
|
if tag then
|
||||||
|
awful.client.toggletag(tag)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Bind all key numbers to tags. Be careful: we use keycodes to make
|
clientbuttons = awful.util.table.join(
|
||||||
-- it works on any keyboard layout. This should map on the top row of
|
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
|
||||||
-- your keyboard, usually 1 to 9.
|
awful.button({ modkey }, 1, awful.mouse.client.move),
|
||||||
for i = 1, keynumber do
|
awful.button({ modkey }, 3, awful.mouse.client.resize))
|
||||||
globalkeys = awful.util.table.join(
|
|
||||||
globalkeys,
|
|
||||||
awful.key({ modkey }, "#" .. i + 9,
|
|
||||||
function ()
|
|
||||||
local screen = mouse.screen
|
|
||||||
if tags[screen][i] then
|
|
||||||
awful.tag.viewonly(tags[screen][i])
|
|
||||||
end
|
|
||||||
end),
|
|
||||||
awful.key({ modkey, "Control" }, "#" .. i + 9,
|
|
||||||
function ()
|
|
||||||
local screen = mouse.screen
|
|
||||||
if tags[screen][i] then
|
|
||||||
awful.tag.viewtoggle(tags[screen][i])
|
|
||||||
end
|
|
||||||
end),
|
|
||||||
awful.key({ modkey, "Shift" }, "#" .. i + 9,
|
|
||||||
function ()
|
|
||||||
if client.focus and tags[client.focus.screen][i] then
|
|
||||||
awful.client.movetotag(tags[client.focus.screen][i])
|
|
||||||
end
|
|
||||||
end),
|
|
||||||
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
|
|
||||||
function ()
|
|
||||||
if client.focus and tags[client.focus.screen][i] then
|
|
||||||
awful.client.toggletag(tags[client.focus.screen][i])
|
|
||||||
end
|
|
||||||
end))
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Set keys
|
-- Set keys
|
||||||
root.keys(globalkeys)
|
root.keys(globalkeys)
|
||||||
|
-- }}}
|
||||||
----- Rules
|
|
||||||
|
-- {{{ Rules
|
||||||
|
-- Rules to apply to new clients (through the "manage" signal).
|
||||||
awful.rules.rules = {
|
awful.rules.rules = {
|
||||||
-- All clients will match this rule.
|
-- All clients will match this rule.
|
||||||
{ rule = { },
|
{ rule = { },
|
||||||
properties = { border_width = beautiful.border_width,
|
properties = { border_width = beautiful.border_width,
|
||||||
border_color = beautiful.border_normal,
|
border_color = beautiful.border_normal,
|
||||||
focus = awful.client.focus.filter,
|
focus = awful.client.focus.filter,
|
||||||
keys = clientkeys } },
|
raise = true,
|
||||||
{ rule = { class = "pinentry" },
|
keys = clientkeys,
|
||||||
properties = { floating = true } },
|
buttons = clientbuttons } },
|
||||||
{ rule = { class = "gimp" },
|
{ rule = { class = "MPlayer" },
|
||||||
properties = { floating = true } },
|
properties = { floating = true } },
|
||||||
{ rule = { class = "Conkeror" },
|
{ rule = { class = "pinentry" },
|
||||||
properties = { floating = false,
|
properties = { floating = true } },
|
||||||
tag = tags[2][1] } },
|
{ rule = { class = "gimp" },
|
||||||
-- Set Firefox to always map on tags number 2 of screen 1.
|
properties = { floating = true } },
|
||||||
-- { rule = { class = "Firefox" },
|
{ rule = { instance = "SteamWorldDig.exe" },
|
||||||
-- properties = { tag = tags[1][2] } },
|
properties = { fullscreen = true } },
|
||||||
|
{ rule = { instance = "RogueLegacy.exe" },
|
||||||
|
properties = { fullscreen = true } },
|
||||||
|
{ rule = { class = "Conkeror" },
|
||||||
|
properties = { tag = tags[2][1] } },
|
||||||
|
{ rule = { class = "Emacs" },
|
||||||
|
properties = { tag = tags[1][1] } },
|
||||||
|
-- Set Firefox to always map on tags number 2 of screen 1.
|
||||||
|
-- { rule = { class = "Firefox" },
|
||||||
|
-- properties = { tag = tags[1][2] } },
|
||||||
}
|
}
|
||||||
|
-- }}}
|
||||||
----- Signals
|
|
||||||
|
-- {{{ Signals
|
||||||
-- Signal function to execute when a new client appears.
|
-- Signal function to execute when a new client appears.
|
||||||
client.connect_signal(
|
client.connect_signal("manage", function (c, startup)
|
||||||
"manage",
|
if not startup then
|
||||||
function (c, startup)
|
-- Set the windows at the slave,
|
||||||
if not startup then
|
-- i.e. put it at the end of others instead of setting it master.
|
||||||
-- Set the windows at the slave, i.e. put it at the end of
|
if not awful.rules.match(c, { class = "Emacs" }) then
|
||||||
-- others instead of setting it master.
|
awful.client.setslave(c)
|
||||||
-- awful.client.setslave(c)
|
end
|
||||||
|
|
||||||
-- Put windows in a smart way, only if they does not set an
|
-- Put windows in a smart way, only if they does not set an initial position.
|
||||||
-- initial position.
|
if not c.size_hints.user_position and not c.size_hints.program_position then
|
||||||
if not c.size_hints.user_position
|
awful.placement.no_overlap(c)
|
||||||
and not c.size_hints.program_position then
|
awful.placement.no_offscreen(c)
|
||||||
awful.placement.no_overlap(c)
|
end
|
||||||
awful.placement.no_offscreen(c)
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
client.connect_signal(
|
local titlebars_enabled = false
|
||||||
"focus", function(c) c.border_color = beautiful.border_focus end)
|
if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
|
||||||
client.connect_signal(
|
-- buttons for the titlebar
|
||||||
"unfocus", function(c) c.border_color = beautiful.border_normal end)
|
local buttons = awful.util.table.join(
|
||||||
|
awful.button({ }, 1, function()
|
||||||
|
client.focus = c
|
||||||
|
c:raise()
|
||||||
|
awful.mouse.client.move(c)
|
||||||
|
end),
|
||||||
|
awful.button({ }, 3, function()
|
||||||
|
client.focus = c
|
||||||
|
c:raise()
|
||||||
|
awful.mouse.client.resize(c)
|
||||||
|
end)
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Widgets that are aligned to the left
|
||||||
|
local left_layout = wibox.layout.fixed.horizontal()
|
||||||
|
left_layout:add(awful.titlebar.widget.iconwidget(c))
|
||||||
|
left_layout:buttons(buttons)
|
||||||
|
|
||||||
|
-- Widgets that are aligned to the right
|
||||||
|
local right_layout = wibox.layout.fixed.horizontal()
|
||||||
|
right_layout:add(awful.titlebar.widget.floatingbutton(c))
|
||||||
|
right_layout:add(awful.titlebar.widget.maximizedbutton(c))
|
||||||
|
right_layout:add(awful.titlebar.widget.stickybutton(c))
|
||||||
|
right_layout:add(awful.titlebar.widget.ontopbutton(c))
|
||||||
|
right_layout:add(awful.titlebar.widget.closebutton(c))
|
||||||
|
|
||||||
|
-- The title goes in the middle
|
||||||
|
local middle_layout = wibox.layout.flex.horizontal()
|
||||||
|
local title = awful.titlebar.widget.titlewidget(c)
|
||||||
|
title:set_align("center")
|
||||||
|
middle_layout:add(title)
|
||||||
|
middle_layout:buttons(buttons)
|
||||||
|
|
||||||
|
-- Now bring it all together
|
||||||
|
local layout = wibox.layout.align.horizontal()
|
||||||
|
layout:set_left(left_layout)
|
||||||
|
layout:set_right(right_layout)
|
||||||
|
layout:set_middle(middle_layout)
|
||||||
|
|
||||||
|
awful.titlebar(c):set_widget(layout)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
|
||||||
|
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
awful.tag.setmwfact(0.586, nil);
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
Background images:
|
|
||||||
Mikael Eriksson <mikael_eriksson@miffe.org>
|
|
||||||
Licensed under CC-BY-SA-3.0
|
|
Before Width: | Height: | Size: 220 KiB |
Before Width: | Height: | Size: 265 KiB |
Before Width: | Height: | Size: 967 B |
Before Width: | Height: | Size: 997 B |
Before Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 395 B |
Before Width: | Height: | Size: 388 B |
Before Width: | Height: | Size: 202 B |
Before Width: | Height: | Size: 202 B |
Before Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 321 B |
Before Width: | Height: | Size: 321 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 174 B |
Before Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 172 B |
Before Width: | Height: | Size: 170 B |
Before Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 215 B |
Before Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 440 B |
Before Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 345 B |
Before Width: | Height: | Size: 334 B |
|
@ -1,96 +0,0 @@
|
||||||
---------------------------
|
|
||||||
-- Default awesome theme --
|
|
||||||
---------------------------
|
|
||||||
|
|
||||||
theme = {}
|
|
||||||
|
|
||||||
theme.font = "osaka_unicode 10"
|
|
||||||
|
|
||||||
theme.bg_normal = "#222222"
|
|
||||||
theme.bg_focus = "#535d6c"
|
|
||||||
theme.bg_urgent = "#ff0000"
|
|
||||||
theme.bg_minimize = "#444444"
|
|
||||||
|
|
||||||
theme.fg_normal = "#aaaaaa"
|
|
||||||
theme.fg_focus = "#ffffff"
|
|
||||||
theme.fg_urgent = "#ffffff"
|
|
||||||
theme.fg_minimize = "#ffffff"
|
|
||||||
|
|
||||||
theme.border_width = "1"
|
|
||||||
theme.border_normal = "#000000"
|
|
||||||
theme.border_focus = "#535d6c"
|
|
||||||
theme.border_marked = "#91231c"
|
|
||||||
|
|
||||||
-- There are other variable sets
|
|
||||||
-- overriding the default one when
|
|
||||||
-- defined, the sets are:
|
|
||||||
-- [taglist|tasklist]_[bg|fg]_[focus|urgent]
|
|
||||||
-- titlebar_[bg|fg]_[normal|focus]
|
|
||||||
-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
|
|
||||||
-- mouse_finder_[color|timeout|animate_timeout|radius|factor]
|
|
||||||
-- Example:
|
|
||||||
--theme.taglist_bg_focus = "#ff0000"
|
|
||||||
|
|
||||||
-- Display the taglist squares
|
|
||||||
theme.taglist_squares_sel = "/home/slash/.config/awesome/themes/custom/taglist/squarefw.png"
|
|
||||||
theme.taglist_squares_unsel = "/home/slash/.config/awesome/themes/custom/taglist/squarew.png"
|
|
||||||
|
|
||||||
theme.tasklist_floating_icon = "/home/slash/.config/awesome/themes/custom/tasklist/floatingw.png"
|
|
||||||
|
|
||||||
-- Variables set for theming the menu:
|
|
||||||
-- menu_[bg|fg]_[normal|focus]
|
|
||||||
-- menu_[border_color|border_width]
|
|
||||||
theme.menu_submenu_icon = "/home/slash/.config/awesome/themes/custom/submenu.png"
|
|
||||||
theme.menu_height = "15"
|
|
||||||
theme.menu_width = "100"
|
|
||||||
|
|
||||||
-- You can add as many variables as
|
|
||||||
-- you wish and access them by using
|
|
||||||
-- beautiful.variable in your rc.lua
|
|
||||||
--theme.bg_widget = "#cc0000"
|
|
||||||
|
|
||||||
-- Define the image to load
|
|
||||||
theme.titlebar_close_button_normal = "/home/slash/.config/awesome/themes/custom/titlebar/close_normal.png"
|
|
||||||
theme.titlebar_close_button_focus = "/home/slash/.config/awesome/themes/custom/titlebar/close_focus.png"
|
|
||||||
|
|
||||||
theme.titlebar_ontop_button_normal_inactive = "/home/slash/.config/awesome/themes/custom/titlebar/ontop_normal_inactive.png"
|
|
||||||
theme.titlebar_ontop_button_focus_inactive = "/home/slash/.config/awesome/themes/custom/titlebar/ontop_focus_inactive.png"
|
|
||||||
theme.titlebar_ontop_button_normal_active = "/home/slash/.config/awesome/themes/custom/titlebar/ontop_normal_active.png"
|
|
||||||
theme.titlebar_ontop_button_focus_active = "/home/slash/.config/awesome/themes/custom/titlebar/ontop_focus_active.png"
|
|
||||||
|
|
||||||
theme.titlebar_sticky_button_normal_inactive = "/home/slash/.config/awesome/themes/custom/titlebar/sticky_normal_inactive.png"
|
|
||||||
theme.titlebar_sticky_button_focus_inactive = "/home/slash/.config/awesome/themes/custom/titlebar/sticky_focus_inactive.png"
|
|
||||||
theme.titlebar_sticky_button_normal_active = "/home/slash/.config/awesome/themes/custom/titlebar/sticky_normal_active.png"
|
|
||||||
theme.titlebar_sticky_button_focus_active = "/home/slash/.config/awesome/themes/custom/titlebar/sticky_focus_active.png"
|
|
||||||
|
|
||||||
theme.titlebar_floating_button_normal_inactive = "/home/slash/.config/awesome/themes/custom/titlebar/floating_normal_inactive.png"
|
|
||||||
theme.titlebar_floating_button_focus_inactive = "/home/slash/.config/awesome/themes/custom/titlebar/floating_focus_inactive.png"
|
|
||||||
theme.titlebar_floating_button_normal_active = "/home/slash/.config/awesome/themes/custom/titlebar/floating_normal_active.png"
|
|
||||||
theme.titlebar_floating_button_focus_active = "/home/slash/.config/awesome/themes/custom/titlebar/floating_focus_active.png"
|
|
||||||
|
|
||||||
theme.titlebar_maximized_button_normal_inactive = "/home/slash/.config/awesome/themes/custom/titlebar/maximized_normal_inactive.png"
|
|
||||||
theme.titlebar_maximized_button_focus_inactive = "/home/slash/.config/awesome/themes/custom/titlebar/maximized_focus_inactive.png"
|
|
||||||
theme.titlebar_maximized_button_normal_active = "/home/slash/.config/awesome/themes/custom/titlebar/maximized_normal_active.png"
|
|
||||||
theme.titlebar_maximized_button_focus_active = "/home/slash/.config/awesome/themes/custom/titlebar/maximized_focus_active.png"
|
|
||||||
|
|
||||||
-- You can use your own command to set your wallpaper
|
|
||||||
theme.wallpaper_cmd = { "awsetbg -u feh -c /usr/share/archlinux/wallpaper/archlinux-simplyblack.png" }
|
|
||||||
|
|
||||||
-- You can use your own layout icons like this:
|
|
||||||
theme.layout_fairh = "/home/slash/.config/awesome/themes/custom/layouts/fairhw.png"
|
|
||||||
theme.layout_fairv = "/home/slash/.config/awesome/themes/custom/layouts/fairvw.png"
|
|
||||||
theme.layout_floating = "/home/slash/.config/awesome/themes/custom/layouts/floatingw.png"
|
|
||||||
theme.layout_magnifier = "/home/slash/.config/awesome/themes/custom/layouts/magnifierw.png"
|
|
||||||
theme.layout_max = "/home/slash/.config/awesome/themes/custom/layouts/maxw.png"
|
|
||||||
theme.layout_fullscreen = "/home/slash/.config/awesome/themes/custom/layouts/fullscreenw.png"
|
|
||||||
theme.layout_tilebottom = "/home/slash/.config/awesome/themes/custom/layouts/tilebottomw.png"
|
|
||||||
theme.layout_tileleft = "/home/slash/.config/awesome/themes/custom/layouts/tileleftw.png"
|
|
||||||
theme.layout_tile = "/home/slash/.config/awesome/themes/custom/layouts/tilew.png"
|
|
||||||
theme.layout_tiletop = "/home/slash/.config/awesome/themes/custom/layouts/tiletopw.png"
|
|
||||||
theme.layout_spiral = "/home/slash/.config/awesome/themes/custom/layouts/spiralw.png"
|
|
||||||
theme.layout_dwindle = "/home/slash/.config/awesome/themes/custom/layouts/dwindlew.png"
|
|
||||||
|
|
||||||
theme.awesome_icon = "/usr/share/awesome/icons/awesome16.png"
|
|
||||||
|
|
||||||
return theme
|
|
||||||
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
|
Before Width: | Height: | Size: 666 B |
Before Width: | Height: | Size: 908 B |
Before Width: | Height: | Size: 598 B |
Before Width: | Height: | Size: 549 B |
Before Width: | Height: | Size: 879 B |
Before Width: | Height: | Size: 548 B |
Before Width: | Height: | Size: 1,013 B |
Before Width: | Height: | Size: 767 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 745 B |
Before Width: | Height: | Size: 774 B |
Before Width: | Height: | Size: 690 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 684 B |
Before Width: | Height: | Size: 833 B |
Before Width: | Height: | Size: 645 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 619 B |