Merge branch 'awesome3.5'
1
.gitignore
vendored
|
@ -3,3 +3,4 @@ wallpaper
|
|||
walls
|
||||
*.swp
|
||||
localconf.lua
|
||||
debugging
|
||||
|
|
3
.gitmodules
vendored
|
@ -1,6 +1,3 @@
|
|||
[submodule "obvious"]
|
||||
path = obvious
|
||||
url = git://git.mercenariesguild.net/obvious.git
|
||||
[submodule "vicious"]
|
||||
path = vicious
|
||||
url = http://git.sysphere.org/vicious
|
||||
|
|
12
autobeautiful.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
local beautiful = require("beautiful")
|
||||
local gears = require("gears")
|
||||
|
||||
beautiful.init(awful.util.getdir("config") .. "/theme.lua")
|
||||
|
||||
if beautiful.wallpaper then
|
||||
for s = 1, screen.count() do
|
||||
gears.wallpaper.maximized(beautiful.wallpaper, s, true)
|
||||
end
|
||||
end
|
||||
|
||||
return beautiful
|
138
aweswt.lua
|
@ -1,138 +0,0 @@
|
|||
-- aweswt.lua
|
||||
-- Application switcher using dmenu
|
||||
--
|
||||
|
||||
local M = {}
|
||||
|
||||
-- local functions
|
||||
local get_out, get_input, _switch, assemble_command
|
||||
|
||||
local defaults = {}
|
||||
local settings = {}
|
||||
|
||||
defaults.bg_focus = theme.bg_focus
|
||||
defaults.fg_focus = theme.fg_focus
|
||||
defaults.bg_normal = theme.bg_normal
|
||||
defaults.fg_normal = theme.fg_normal
|
||||
defaults.font = string.gsub(theme.font, " ","-")
|
||||
defaults.menu_cmd = "dmenu -nf %q -nb %q -sf %q -sb %q -p 'Switch to' -fn %q -i"
|
||||
|
||||
local command
|
||||
|
||||
for key, value in pairs(defaults) do
|
||||
settings[key] = value
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- switch with window titles
|
||||
M.switch = function()
|
||||
_switch(true)
|
||||
end
|
||||
|
||||
-- switch with client instance and class
|
||||
M.switch_class = function()
|
||||
_switch(false)
|
||||
end
|
||||
|
||||
-- {{{ option setters
|
||||
|
||||
M.set_bg_focus = function (color)
|
||||
settings.bg_focus = color or defaults.bg_focus
|
||||
assemble_command()
|
||||
end
|
||||
|
||||
M.set_fg_focus = function (color)
|
||||
settings.fg_focus = color or defaults.fg_focus
|
||||
assemble_command()
|
||||
end
|
||||
|
||||
M.set_bg_normal = function (color)
|
||||
settings.bg_normal = color or defaults.bg_normal
|
||||
assemble_command()
|
||||
end
|
||||
|
||||
M.set_fg_normal = function (color)
|
||||
settings.fg_normal = color or defaults.fg_normal
|
||||
assemble_command()
|
||||
end
|
||||
|
||||
M.set_font = function (font)
|
||||
settings.font = font or defaults.font
|
||||
assemble_command()
|
||||
end
|
||||
|
||||
M.set_menu_command = function (command)
|
||||
settings.menu_cmd = command or defaults.menu_cmd
|
||||
assemble_command()
|
||||
end
|
||||
|
||||
-- }}}
|
||||
|
||||
-- {{{ io functions
|
||||
get_out = function (a)
|
||||
local f = io.popen(a)
|
||||
t = {}
|
||||
for line in f:lines() do
|
||||
table.insert(t, line)
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
get_input = function (a)
|
||||
s1 = 'echo "' .. a .. '" | ' .. command
|
||||
return get_out(s1)
|
||||
end
|
||||
|
||||
-- }}}
|
||||
|
||||
-- {{{ main worker function
|
||||
_switch = function(use_name)
|
||||
local clients = client.get()
|
||||
|
||||
if table.getn(clients) == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local client_list_table = {}
|
||||
local apps = {}
|
||||
|
||||
for key, client in pairs(clients) do
|
||||
local app
|
||||
|
||||
if use_name then
|
||||
app = client['name']
|
||||
else
|
||||
app = key .. ':' .. client['instance'] .. '.' .. client['class']
|
||||
end
|
||||
|
||||
table.insert(client_list_table, app)
|
||||
apps[app] = client
|
||||
end
|
||||
|
||||
table.sort(client_list_table, function(a, b)
|
||||
return string.lower(a) < string.lower(b)
|
||||
end)
|
||||
local client_list = table.concat(client_list_table, "\n")
|
||||
|
||||
local client_selected = apps[get_input(client_list)[1]]
|
||||
if client_selected then
|
||||
local ctags = client_selected:tags()
|
||||
awful.tag.viewonly(ctags[1])
|
||||
client.focus = client_selected
|
||||
client_selected:raise()
|
||||
end
|
||||
end
|
||||
-- }}}
|
||||
|
||||
assemble_command = function()
|
||||
command = string.format(settings.menu_cmd,
|
||||
settings.fg_normal,
|
||||
settings.bg_normal,
|
||||
settings.fg_focus,
|
||||
settings.bg_focus,
|
||||
settings.font)
|
||||
end
|
||||
|
||||
assemble_command()
|
||||
return M
|
222
bindings.lua
|
@ -1,6 +1,13 @@
|
|||
local aweswt = require("aweswt")
|
||||
local mb = require("modalbind")
|
||||
-- key bindings
|
||||
local awful = awful
|
||||
local conf = conf
|
||||
local mpd = require("mpd")
|
||||
local scratch = require("scratch")
|
||||
|
||||
local modkey = conf.modkey or "Mod4"
|
||||
local mb = require("modalbind")
|
||||
|
||||
local bindings = {mb = mb}
|
||||
|
||||
-- {{{ Mouse bindings
|
||||
root.buttons(awful.util.table.join(
|
||||
|
@ -11,28 +18,37 @@ awful.button({ }, 5, awful.tag.viewprev)
|
|||
|
||||
local function spawnf(cmd) return function() awful.util.spawn(cmd) end end
|
||||
|
||||
conf.cmd.run = conf.cmd.run or spawnf("dmenu_run")
|
||||
|
||||
mpdmap = {
|
||||
name = "MPD",
|
||||
m = mpd.ctrl.toggle,
|
||||
n = mpd.ctrl.next,
|
||||
N = mpd.ctrl.prev,
|
||||
s = spawnf("mpd"),
|
||||
g = spawnf(cmd.mpd_client)
|
||||
S = spawnf("mpd --kill"),
|
||||
g = spawnf(conf.cmd.mpd_client)
|
||||
}
|
||||
mpdpromts = {
|
||||
name = "MPD PROMPTS",
|
||||
a = mpd.prompt.artist,
|
||||
A = mpd.prompt.album,
|
||||
b = mpd.prompt.album,
|
||||
t = mpd.prompt.title,
|
||||
r = mpd.prompt.toggle_replace_on_search,
|
||||
r = mpd.prompt.toggle_replace_on_search
|
||||
}
|
||||
|
||||
progmap = {
|
||||
name = "PROGRAMS",
|
||||
f = spawnf(cmd.browser),
|
||||
i = spawnf(cmd.im_client),
|
||||
I = spawnf(cmd.irc_client),
|
||||
m = spawnf(cmd.mail_client)
|
||||
f = spawnf(conf.cmd.browser),
|
||||
i = spawnf(conf.cmd.im_client),
|
||||
I = spawnf(conf.cmd.irc_client),
|
||||
m = spawnf(conf.cmd.mail_client)
|
||||
}
|
||||
|
||||
docmap = {
|
||||
name = "DOCUMENTS",
|
||||
u = spawnf("docopen ~/uni pdf"),
|
||||
b = spawnf("docopen ~/books pdf epub mobi txt lit html htm"),
|
||||
}
|
||||
|
||||
adapters = { u = "wwan", w = "wlan", b = "bluetooth" }
|
||||
|
@ -41,95 +57,44 @@ function rfkill(cmd)
|
|||
for key, adapter in pairs(adapters) do
|
||||
map[key] = spawnf("sudo rfkill "..cmd.." "..adapter)
|
||||
end
|
||||
print(map["name"])
|
||||
return map
|
||||
end
|
||||
wirelessmap = {
|
||||
name = "RFKILL",
|
||||
b = function () mb.grab(rfkill("block")) end,
|
||||
u = function () mb.grab(rfkill("unblock")) end
|
||||
|
||||
connectmap = {
|
||||
name = "CONNECT",
|
||||
u = spawnf("umts"),
|
||||
w = spawnf("wlanacpi")
|
||||
}
|
||||
|
||||
-- {{{ Key bindings
|
||||
globalkeys = awful.util.table.join(
|
||||
--{{{ Focus and Tags
|
||||
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, }, "j",
|
||||
function ()
|
||||
awful.client.focus.byidx( 1)
|
||||
if client.focus then client.focus:raise() end
|
||||
end),
|
||||
awful.key({ modkey, }, "k",
|
||||
function ()
|
||||
awful.client.focus.byidx(-1)
|
||||
if client.focus then client.focus:raise() end
|
||||
end),
|
||||
|
||||
awful.key({ modkey, "Control" }, "j", function ()
|
||||
awful.screen.focus_relative( 1)
|
||||
end),
|
||||
|
||||
awful.key({ modkey, "Control" }, "k", function ()
|
||||
awful.screen.focus_relative(-1)
|
||||
end),
|
||||
wirelessmap = {
|
||||
name = "WIRELESS",
|
||||
b = mb.grabf(rfkill("block")),
|
||||
u = mb.grabf(rfkill("unblock")),
|
||||
c = mb.grabf(connectmap)
|
||||
}
|
||||
|
||||
function bindings.extend_and_register_key_table(globalkeys)
|
||||
local totalkeys = globalkeys or {}
|
||||
totalkeys = awful.util.table.join(totalkeys,
|
||||
awful.key({ }, "Menu", spawnf('wmselect')),
|
||||
--}}}
|
||||
|
||||
--{{{ Layout manipulation
|
||||
awful.key({ modkey, "Shift" }, "j", function ()
|
||||
awful.client.swap.byidx( 1)
|
||||
end),
|
||||
|
||||
awful.key({ modkey, "Shift" }, "k", function ()
|
||||
awful.client.swap.byidx( -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),
|
||||
awful.key({ "Mod1", }, "Tab", function ()
|
||||
awful.client.focus.history.previous()
|
||||
if client.focus then
|
||||
client.focus:raise()
|
||||
end
|
||||
end),
|
||||
|
||||
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
|
||||
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
|
||||
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
|
||||
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-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, 0) end),
|
||||
|
||||
--}}}
|
||||
|
||||
awful.key({ modkey, "Control" }, "r", awesome.restart),
|
||||
awful.key({ modkey, "Shift" }, "q", awesome.quit),
|
||||
awful.key({ modkey, }, "Return", spawnf(cmd.terminal)),
|
||||
awful.key({ modkey, }, "Return", spawnf(conf.cmd.terminal)),
|
||||
|
||||
--{{{ Modal mappings
|
||||
|
||||
awful.key({ modkey }, "m", function () mb.grab(mpdmap, true) end),
|
||||
awful.key({ modkey, "Shift" }, "m", function () mb.grab(mpdpromts) end),
|
||||
awful.key({ modkey }, "c", function () mb.grab(progmap) end),
|
||||
awful.key({ modkey }, "w", function () mb.grab(wirelessmap) end),
|
||||
|
||||
awful.key({ modkey }, "m", mb.grabf(mpdmap, true)),
|
||||
awful.key({ modkey, "Shift" }, "m", mb.grabf(mpdpromts)),
|
||||
awful.key({ modkey }, "c", mb.grabf(progmap)),
|
||||
awful.key({ modkey }, "w", mb.grabf(wirelessmap)),
|
||||
awful.key({ modkey }, "d", mb.grabf(docmap)),
|
||||
--}}}
|
||||
|
||||
--{{{ Audio control
|
||||
|
||||
awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("amixer set Master 2%-")end ),
|
||||
awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("amixer set Master 2%+")end ),
|
||||
awful.key({ }, "XF86AudioLowerVolume", spawnf("amixer set Master 2%-")),
|
||||
awful.key({ }, "XF86AudioRaiseVolume", spawnf("amixer set Master 2%+")),
|
||||
awful.key({ }, "XF86AudioMute", spawnf("amixer set Master toggle")),
|
||||
awful.key({ }, "XF86AudioPlay", mpd.ctrl.toggle),
|
||||
awful.key({ }, "XF86AudioNext", mpd.ctrl.next),
|
||||
|
@ -138,38 +103,38 @@ globalkeys = awful.util.table.join(
|
|||
--}}}
|
||||
|
||||
-- {{{ teardrops
|
||||
awful.key({ }, "F12", function () teardrop(cmd.terminal,"center","center", 0.99, 0.7)end ),
|
||||
awful.key({ modkey }, "`", function () teardrop("urxvtc -e ncmpcpp","bottom","center", 0.99, 0.4)end ),
|
||||
awful.key({ }, "Print", function () teardrop("galsamixer","top","center", 0.99, 0.4)end ),
|
||||
awful.key({ }, "F12", function ()
|
||||
scratch.drop(conf.cmd.terminal,"center","center", 0.99, 0.7)
|
||||
end ),
|
||||
awful.key({ modkey }, "`", function ()
|
||||
scratch.drop("gpms","bottom","center", 0.99, 0.4)
|
||||
end ),
|
||||
awful.key({ }, "Print", function ()
|
||||
scratch.drop("gpulse-mixer","top","center", 0.99, 0.4)
|
||||
end ),
|
||||
-- }}}
|
||||
|
||||
--{{{ Prompt
|
||||
|
||||
awful.key({ modkey }, "r", function ()
|
||||
obvious.popup_run_prompt.set_prompt_string(" Run~ ")
|
||||
obvious.popup_run_prompt.set_cache("history")
|
||||
obvious.popup_run_prompt.set_run_function(awful.util.spawn)
|
||||
obvious.popup_run_prompt.run_prompt()
|
||||
end),
|
||||
awful.key({ modkey }, "e", function ()
|
||||
obvious.popup_run_prompt.set_prompt_string(" exec Lua~ ")
|
||||
obvious.popup_run_prompt.set_cache("history_eval")
|
||||
obvious.popup_run_prompt.set_run_function(awful.util.eval)
|
||||
obvious.popup_run_prompt.run_prompt()
|
||||
end),
|
||||
awful.key({ modkey }, "r", conf.cmd.run),
|
||||
|
||||
awful.key({ modkey }, "s", spawnf("dmsearch")),
|
||||
|
||||
--}}}
|
||||
|
||||
--{{{ misc. XF86 Keys
|
||||
|
||||
awful.key({ }, "XF86Sleep", function () awful.util.spawn("/usr/local/bin/s2ram")end ),
|
||||
awful.key({ }, "XF86Away", function () awful.util.spawn("xlock")end ),
|
||||
awful.key({ }, "XF86TouchpadToggle", function () awful.util.spawn("touchpad")end ),
|
||||
awful.key({ }, "XF86Sleep", spawnf("s2ram")),
|
||||
awful.key({ }, "XF86Away", spawnf("xlock")),
|
||||
awful.key({ }, "XF86TouchpadToggle", spawnf("touchpad"))
|
||||
)
|
||||
|
||||
--}}}
|
||||
|
||||
awful.key({ modkey }, "BackSpace", rodentbane.start)
|
||||
)
|
||||
-- Set keys
|
||||
root.keys(totalkeys)
|
||||
end
|
||||
|
||||
|
||||
function client_opacity_set(c, default, max, step)
|
||||
if c.opacity < 0 or c.opacity > 1 then
|
||||
|
@ -183,7 +148,6 @@ function client_opacity_set(c, default, max, step)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
clientkeys = awful.util.table.join(
|
||||
awful.key({ modkey, "Shift" }, "f", function (c) c.fullscreen = not c.fullscreen end),
|
||||
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
|
||||
|
@ -199,60 +163,10 @@ clientkeys = awful.util.table.join(
|
|||
awful.key({ }, "XF86Calculater", awful.client.movetoscreen )
|
||||
)
|
||||
|
||||
-- Compute the maximum number of digit we need, limited to 22
|
||||
keynumber = 0
|
||||
for s = 1, screen.count() do
|
||||
keynumber = math.min(22, math.max(#tags[s], keynumber));
|
||||
end
|
||||
|
||||
-- Bind all key numbers to tags.
|
||||
-- Be careful: we use keycodes to make it works on any keyboard layout.
|
||||
-- This should map on the top row of your keyboard, usually 1 to 9.
|
||||
-- FKeys: 67-78
|
||||
for i = 1, keynumber do
|
||||
if i < 10 then
|
||||
k = "#" .. i + 9
|
||||
elseif i == 10 then
|
||||
k = "#19"
|
||||
elseif i > 10 then
|
||||
k = "F" .. i - 10
|
||||
end
|
||||
globalkeys = awful.util.table.join(globalkeys,
|
||||
awful.key({ modkey }, k,
|
||||
function ()
|
||||
local screen = mouse.screen
|
||||
if tags[screen][i] then
|
||||
awful.tag.viewonly(tags[screen][i])
|
||||
end
|
||||
end),
|
||||
awful.key({ modkey, "Control" }, k,
|
||||
function ()
|
||||
local screen = mouse.screen
|
||||
if tags[screen][i] then
|
||||
awful.tag.viewtoggle(tags[screen][i])
|
||||
end
|
||||
end),
|
||||
awful.key({ modkey, "Shift" }, k,
|
||||
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" }, k,
|
||||
function ()
|
||||
if client.focus and tags[client.focus.screen][i] then
|
||||
awful.client.toggletag(tags[client.focus.screen][i])
|
||||
end
|
||||
end))
|
||||
end
|
||||
|
||||
clientbuttons = awful.util.table.join(
|
||||
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
|
||||
awful.button({ modkey }, 1, awful.mouse.client.move),
|
||||
awful.button({ modkey }, 3, awful.mouse.client.resize))
|
||||
|
||||
-- Set keys
|
||||
root.keys(globalkeys)
|
||||
-- }}}
|
||||
return bindings
|
||||
-- vim: set fenc=utf-8 tw=80 foldmethod=marker :
|
||||
|
||||
|
|
201
boxes.lua
|
@ -1,201 +0,0 @@
|
|||
function exists(filename)
|
||||
local file = io.open(filename)
|
||||
if file then
|
||||
io.close(file)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- {{{ Reusable separators
|
||||
spacer = widget({ type = "textbox", name = "spacer" })
|
||||
spacer.text = " "
|
||||
|
||||
nullwidget = widget({ type = "textbox", name = "nullwidget" })
|
||||
-- }}}
|
||||
|
||||
-- {{{ Wibox
|
||||
|
||||
--popup run
|
||||
|
||||
-- Create a textclock widget
|
||||
--clock = awful.widget.textclock({ align = "right" })
|
||||
mysystray = widget({ type = "systray" })
|
||||
|
||||
clock = widget({ type = "textbox" })
|
||||
vicious.register(clock, vicious.widgets.date, "%b %d, %R", 60)
|
||||
|
||||
|
||||
-- music widget {{{
|
||||
mpdwidget = widget({ type = "textbox" })
|
||||
vicious.register(mpdwidget, vicious.widgets.mpd,
|
||||
function(widget, args)
|
||||
if args["{state}"] == "N/A" then
|
||||
return ""
|
||||
else
|
||||
return "[ ♫ "..args["{Artist}"].." - "..args["{Title}"].." ]"
|
||||
end
|
||||
end, 3, {nil, os.getenv("MPD_HOST"), os.getenv("MPD_PORT")})
|
||||
mpdwidget:buttons(awful.util.table.join(
|
||||
awful.button({ }, 1, function () teardrop("urxvtc -e ncmpcpp","top","center", 0.99, 0.4)end )
|
||||
))
|
||||
|
||||
mpdnext = widget({ type = "textbox" })
|
||||
mpdnext.text = "▲"
|
||||
mpdnext:buttons(awful.util.table.join(
|
||||
awful.button({ }, 1, function () awful.util.spawn("mpc next") end)
|
||||
))
|
||||
mpdprev = widget({ type = "textbox" })
|
||||
mpdprev.text = "▼"
|
||||
mpdprev:buttons(awful.util.table.join(
|
||||
awful.button({ }, 1, function () awful.util.spawn("mpc prev") end)
|
||||
))
|
||||
-- }}}
|
||||
|
||||
-- mail widget {{{
|
||||
mailwidget = widget({ type = "textbox" })
|
||||
vicious.register(mailwidget, vicious.widgets.mdir,
|
||||
function(widget, args)
|
||||
if args[1] > 0 then
|
||||
naughty.notify({
|
||||
title = "New mail arrived",
|
||||
text = "Unread "..args[2].." / New "..args[1],
|
||||
position = "top_left"
|
||||
|
||||
})
|
||||
widget.bg = theme.bg_urgent
|
||||
widget.fg = theme.fg_urgent
|
||||
elseif args[2] > 0 then
|
||||
widget.bg = theme.bg_focus
|
||||
widget.fg = theme.fg_focus
|
||||
else
|
||||
widget.bg = theme.bg_normal
|
||||
widget.fg = theme.fg_normal
|
||||
end
|
||||
return "⬓⬓ Unread "..args[2].." / New "..args[1].. " "
|
||||
end, 181, {os.getenv("HOME") .. "/.maildir/"})
|
||||
--}}}
|
||||
|
||||
-- battery {{{
|
||||
if exists("/sys/class/power_supply/BAT0") then
|
||||
batwidget0 = widget({ type = "textbox" })
|
||||
vicious.register(batwidget0, vicious.widgets.bat,
|
||||
function (widget, args)
|
||||
if args[2] == 0 then return ""
|
||||
else
|
||||
if args[2] < 15 then
|
||||
widget.bg = theme.bg_urgent
|
||||
widget.fg = theme.fg_urgent
|
||||
else
|
||||
widget.bg = theme.bg_normal
|
||||
widget.fg = theme.fg_normal
|
||||
end
|
||||
return "( BAT0: "..args[1]..args[2].."% - "..args[3].." )"
|
||||
end
|
||||
end, 61, "BAT0")
|
||||
else batwidget0 = nullwidget end
|
||||
|
||||
if exists("/sys/class/power_supply/BAT1") then
|
||||
batwidget1 = widget({ type = "textbox" })
|
||||
vicious.register(batwidget1, vicious.widgets.bat,
|
||||
function (widget, args)
|
||||
if args[2] == 0 then return ""
|
||||
else
|
||||
if args[2] < 15 then
|
||||
widget.bg = theme.bg_urgent
|
||||
widget.fg = theme.fg_urgent
|
||||
else
|
||||
widget.bg = theme.bg_normal
|
||||
widget.fg = theme.fg_normal
|
||||
end
|
||||
return "( BAT1: "..args[1]..args[2].."% - "..args[3].." )"
|
||||
end
|
||||
end, 61, "BAT1")
|
||||
else batwidget1 = nullwidget end
|
||||
|
||||
if exists("/sys/class/power_supply/BAT2") then
|
||||
batwidget2 = widget({ type = "textbox" })
|
||||
vicious.register(batwidget2, vicious.widgets.bat,
|
||||
function (widget, args)
|
||||
if args[2] == 0 then return ""
|
||||
else
|
||||
if args[2] < 15 then
|
||||
widget.bg = theme.bg_urgent
|
||||
widget.fg = theme.fg_urgent
|
||||
else
|
||||
widget.bg = theme.bg_normal
|
||||
widget.fg = theme.fg_normal
|
||||
end
|
||||
return "( BAT2: "..args[1]..args[2].."% - "..args[3].." )"
|
||||
end
|
||||
end, 61, "BAT2")
|
||||
else batwidget2 = nullwidget end
|
||||
|
||||
--}}}
|
||||
|
||||
cpulabel = widget({ type = "textbox" })
|
||||
vicious.register(cpulabel, vicious.widgets.cpu, "CPU: $1%")
|
||||
|
||||
if exists("/sys/class/net/wlan0") then
|
||||
wlanwidget = widget({ type = "textbox" })
|
||||
vicious.register(wlanwidget, vicious.widgets.wifi, " )( WLAN ${ssid} @ ${sign}, Q:${link}/70", 31, "wlan0")
|
||||
else wlanwidget = nullwidget end
|
||||
|
||||
-- Create a wibox for each screen and add it
|
||||
leftwibox = {}
|
||||
rightwibox = {}
|
||||
|
||||
mylayoutbox = {}
|
||||
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, awful.tag.viewnext),
|
||||
awful.button({ }, 5, awful.tag.viewprev)
|
||||
)
|
||||
|
||||
for s = 1, screen.count() do
|
||||
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
|
||||
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
|
||||
|
||||
|
||||
-- Create the wibox
|
||||
leftwibox[s] = awful.wibox({ position = "left", screen = s, width = 18 })
|
||||
rightwibox[s] = awful.wibox({ position = "right", screen = s , width = 18})
|
||||
-- Add widgets to the wibox - order matters
|
||||
leftwibox[s].widgets = {
|
||||
mytaglist[s],
|
||||
mylayoutbox[s],
|
||||
mailwidget,
|
||||
spacer,
|
||||
layout = awful.widget.layout.horizontal.rightleft
|
||||
}
|
||||
rightwibox[s].widgets = {
|
||||
{
|
||||
clock, spacer,
|
||||
batwidget0,
|
||||
batwidget1,
|
||||
batwidget2,
|
||||
wlanwidget,
|
||||
spacer, cpulabel, cpuwidget,
|
||||
spacer, mpdwidget, mpdnext, spacer, mpdprev,
|
||||
spacer,
|
||||
layout = awful.widget.layout.horizontal.leftright
|
||||
},
|
||||
separator, spacer, mysystray,
|
||||
layout = awful.widget.layout.horizontal.leftright
|
||||
}
|
||||
end
|
||||
-- }}}
|
||||
--
|
||||
-- vim:foldmethod=marker
|
27
errors.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
-- Notification library
|
||||
local naughty = naughty
|
||||
|
||||
-- {{{ Error handling
|
||||
-- Check if awesome encountered an error during startup and fell back to
|
||||
-- another config (This code will only ever execute for the fallback config)
|
||||
if awesome.startup_errors then
|
||||
naughty.notify({ preset = naughty.config.presets.critical,
|
||||
title = "Oops, there were errors during startup!",
|
||||
text = awesome.startup_errors })
|
||||
end
|
||||
|
||||
-- Handle runtime errors after startup
|
||||
do
|
||||
local in_error = false
|
||||
awesome.connect_signal("debug::error", function (err)
|
||||
-- Make sure we don't go into an endless error loop
|
||||
if in_error then return end
|
||||
in_error = true
|
||||
|
||||
naughty.notify({ preset = naughty.config.presets.critical,
|
||||
title = "Oops, an error happened!",
|
||||
text = err })
|
||||
in_error = false
|
||||
end)
|
||||
end
|
||||
-- }}}
|
248
inspect.lua
Normal file
|
@ -0,0 +1,248 @@
|
|||
-----------------------------------------------------------------------------------------------------------------------
|
||||
-- inspect.lua - v1.2.0 (2012-10)
|
||||
-- Enrique García Cota - enrique.garcia.cota [AT] gmail [DOT] com
|
||||
-- human-readable representations of tables.
|
||||
-- inspired by http://lua-users.org/wiki/TableSerialization
|
||||
-----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
local inspect ={}
|
||||
inspect.__VERSION = '1.2.0'
|
||||
|
||||
-- Apostrophizes the string if it has quotes, but not aphostrophes
|
||||
-- Otherwise, it returns a regular quoted string
|
||||
local function smartQuote(str)
|
||||
if string.match( string.gsub(str,"[^'\"]",""), '^"+$' ) then
|
||||
return "'" .. str .. "'"
|
||||
end
|
||||
return string.format("%q", str )
|
||||
end
|
||||
|
||||
local controlCharsTranslation = {
|
||||
["\a"] = "\\a", ["\b"] = "\\b", ["\f"] = "\\f", ["\n"] = "\\n",
|
||||
["\r"] = "\\r", ["\t"] = "\\t", ["\v"] = "\\v", ["\\"] = "\\\\"
|
||||
}
|
||||
|
||||
local function unescapeChar(c) return controlCharsTranslation[c] end
|
||||
|
||||
local function unescape(str)
|
||||
local result, _ = string.gsub( str, "(%c)", unescapeChar )
|
||||
return result
|
||||
end
|
||||
|
||||
local function isIdentifier(str)
|
||||
return type(str) == 'string' and str:match( "^[_%a][_%a%d]*$" )
|
||||
end
|
||||
|
||||
local function isArrayKey(k, length)
|
||||
return type(k)=='number' and 1 <= k and k <= length
|
||||
end
|
||||
|
||||
local function isDictionaryKey(k, length)
|
||||
return not isArrayKey(k, length)
|
||||
end
|
||||
|
||||
local sortOrdersByType = {
|
||||
['number'] = 1, ['boolean'] = 2, ['string'] = 3, ['table'] = 4,
|
||||
['function'] = 5, ['userdata'] = 6, ['thread'] = 7
|
||||
}
|
||||
|
||||
local function sortKeys(a,b)
|
||||
local ta, tb = type(a), type(b)
|
||||
if ta ~= tb then return sortOrdersByType[ta] < sortOrdersByType[tb] end
|
||||
if ta == 'string' or ta == 'number' then return a < b end
|
||||
return false
|
||||
end
|
||||
|
||||
local function getDictionaryKeys(t)
|
||||
local length = #t
|
||||
local keys = {}
|
||||
for k,_ in pairs(t) do
|
||||
if isDictionaryKey(k, length) then table.insert(keys,k) end
|
||||
end
|
||||
table.sort(keys, sortKeys)
|
||||
return keys
|
||||
end
|
||||
|
||||
local function getToStringResultSafely(t, mt)
|
||||
local __tostring = type(mt) == 'table' and mt.__tostring
|
||||
local string, status
|
||||
if type(__tostring) == 'function' then
|
||||
status, string = pcall(__tostring, t)
|
||||
string = status and string or 'error: ' .. tostring(string)
|
||||
end
|
||||
return string
|
||||
end
|
||||
|
||||
local Inspector = {}
|
||||
|
||||
function Inspector:new(t, depth)
|
||||
local inspector = {
|
||||
buffer = {},
|
||||
depth = depth,
|
||||
level = 0,
|
||||
maxIds = {
|
||||
['function'] = 0,
|
||||
['userdata'] = 0,
|
||||
['thread'] = 0,
|
||||
['table'] = 0,
|
||||
['key'] = 0,
|
||||
['tag'] = 0
|
||||
},
|
||||
ids = {
|
||||
['function'] = setmetatable({}, {__mode = "kv"}),
|
||||
['userdata'] = setmetatable({}, {__mode = "kv"}),
|
||||
['thread'] = setmetatable({}, {__mode = "kv"}),
|
||||
['table'] = setmetatable({}, {__mode = "kv"}),
|
||||
['key'] = setmetatable({}, {__mode = "kv"}),
|
||||
['tag'] = setmetatable({}, {__mode = "kv"})
|
||||
},
|
||||
tableAppearances = setmetatable({}, {__mode = "k"})
|
||||
}
|
||||
|
||||
setmetatable(inspector, {__index = Inspector})
|
||||
|
||||
inspector:countTableAppearances(t)
|
||||
|
||||
return inspector:putValue(t)
|
||||
end
|
||||
|
||||
function Inspector:countTableAppearances(t)
|
||||
if type(t) == 'table' then
|
||||
if not self.tableAppearances[t] then
|
||||
self.tableAppearances[t] = 1
|
||||
for k,v in pairs(t) do
|
||||
self:countTableAppearances(k)
|
||||
self:countTableAppearances(v)
|
||||
end
|
||||
else
|
||||
self.tableAppearances[t] = self.tableAppearances[t] + 1
|
||||
end
|
||||
self:countTableAppearances(getmetatable(t))
|
||||
end
|
||||
end
|
||||
|
||||
function Inspector:tabify()
|
||||
self:puts("\n", string.rep(" ", self.level))
|
||||
return self
|
||||
end
|
||||
|
||||
function Inspector:up()
|
||||
self.level = self.level - 1
|
||||
end
|
||||
|
||||
function Inspector:down()
|
||||
self.level = self.level + 1
|
||||
end
|
||||
|
||||
function Inspector:puts(...)
|
||||
local args = {...}
|
||||
local len = #self.buffer
|
||||
for i=1, #args do
|
||||
len = len + 1
|
||||
self.buffer[len] = tostring(args[i])
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
function Inspector:commaControl(comma)
|
||||
if comma then self:puts(',') end
|
||||
return true
|
||||
end
|
||||
|
||||
function Inspector:putTable(t)
|
||||
if self:alreadyVisited(t) then
|
||||
self:puts('<table ', self:getId(t), '>')
|
||||
elseif self.depth and self.level >= self.depth then
|
||||
self:puts('{...}')
|
||||
else
|
||||
if self.tableAppearances[t] > 1 then
|
||||
self:puts('<',self:getId(t),'>')
|
||||
end
|
||||
self:puts('{')
|
||||
self:down()
|
||||
|
||||
local length = #t
|
||||
local mt = getmetatable(t)
|
||||
|
||||
local string = getToStringResultSafely(t, mt)
|
||||
if type(string) == 'string' and #string > 0 then
|
||||
self:puts(' -- ', unescape(string))
|
||||
if length >= 1 then self:tabify() end -- tabify the array values
|
||||
end
|
||||
|
||||
local comma = false
|
||||
for i=1, length do
|
||||
comma = self:commaControl(comma)
|
||||
self:puts(' '):putValue(t[i])
|
||||
end
|
||||
|
||||
local dictKeys = getDictionaryKeys(t)
|
||||
|
||||
for _,k in ipairs(dictKeys) do
|
||||
comma = self:commaControl(comma)
|
||||
self:tabify():putKey(k):puts(' = '):putValue(t[k])
|
||||
end
|
||||
|
||||
if mt then
|
||||
comma = self:commaControl(comma)
|
||||
self:tabify():puts('<metatable> = '):putValue(mt)
|
||||
end
|
||||
|
||||
self:up()
|
||||
|
||||
if #dictKeys > 0 or mt then -- dictionary table. Justify closing }
|
||||
self:tabify()
|
||||
elseif length > 0 then -- array tables have one extra space before closing }
|
||||
self:puts(' ')
|
||||
end
|
||||
self:puts('}')
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
function Inspector:alreadyVisited(v)
|
||||
return self.ids[type(v)][v] ~= nil
|
||||
end
|
||||
|
||||
function Inspector:getId(v)
|
||||
local tv = type(v)
|
||||
local idtable = self.ids[tv]
|
||||
local id = idtable and idtable[v] or nil
|
||||
if not id then
|
||||
id = self.maxIds[tv] + 1
|
||||
self.maxIds[tv] = id
|
||||
self.ids[tv][v] = id
|
||||
end
|
||||
return id
|
||||
end
|
||||
|
||||
function Inspector:putValue(v)
|
||||
local tv = type(v)
|
||||
|
||||
if tv == 'string' then
|
||||
self:puts(smartQuote(unescape(v)))
|
||||
elseif tv == 'number' or tv == 'boolean' or tv == 'nil' then
|
||||
self:puts(tostring(v))
|
||||
elseif tv == 'table' then
|
||||
self:putTable(v)
|
||||
else
|
||||
self:puts('<',tv,' ',self:getId(v),'>')
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
function Inspector:putKey(k)
|
||||
if isIdentifier(k) then return self:puts(k) end
|
||||
return self:puts( "[" ):putValue(k):puts("]")
|
||||
end
|
||||
|
||||
function Inspector:tostring()
|
||||
return table.concat(self.buffer)
|
||||
end
|
||||
|
||||
setmetatable(inspect, { __call = function(_,t,depth)
|
||||
return Inspector:new(t, depth):tostring()
|
||||
end })
|
||||
|
||||
return inspect
|
||||
|
90
layouts.lua
Normal file
|
@ -0,0 +1,90 @@
|
|||
local awful = awful
|
||||
local conf = conf
|
||||
local modkey = conf.modkey or "Mod4"
|
||||
|
||||
local layouts={ mt={} }
|
||||
local list = {
|
||||
awful.layout.suit.fair,
|
||||
awful.layout.suit.fair.horizontal,
|
||||
awful.layout.suit.tile,
|
||||
awful.layout.suit.tile.bottom,
|
||||
awful.layout.suit.max,
|
||||
awful.layout.suit.max.fullscreen,
|
||||
awful.layout.suit.floating
|
||||
}
|
||||
|
||||
function layouts.set_list(layout_list)
|
||||
list = layout_list
|
||||
end
|
||||
|
||||
function layouts.extend_key_table(globalkeys)
|
||||
local layoutkeys = globalkeys or {}
|
||||
return awful.util.table.join(layoutkeys,
|
||||
awful.key({ modkey }, "j", function ()
|
||||
awful.client.focus.byidx( 1)
|
||||
if client.focus then client.focus:raise() end
|
||||
end),
|
||||
awful.key({ modkey }, "k", function ()
|
||||
awful.client.focus.byidx(-1)
|
||||
if client.focus then client.focus:raise() end
|
||||
end),
|
||||
|
||||
-- Layout manipulation
|
||||
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),
|
||||
awful.key({ "Mod1", }, "Tab", function ()
|
||||
awful.client.focus.history.previous()
|
||||
if client.focus then
|
||||
client.focus:raise()
|
||||
end
|
||||
end),
|
||||
awful.key({ modkey, }, "l", function ()
|
||||
awful.tag.incmwfact( 0.05)
|
||||
end),
|
||||
awful.key({ modkey, }, "h", function ()
|
||||
awful.tag.incmwfact(-0.05)
|
||||
end),
|
||||
awful.key({ modkey, "Shift" }, "h", function ()
|
||||
awful.tag.incnmaster( 1)
|
||||
end),
|
||||
awful.key({ modkey, "Shift" }, "l", function ()
|
||||
awful.tag.incnmaster(-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(list, 1)
|
||||
end),
|
||||
awful.key({ modkey, "Shift" }, "space", function ()
|
||||
awful.layout.inc(list, -1)
|
||||
end),
|
||||
awful.key({ modkey, "Shift" }, "j", function ()
|
||||
awful.client.swap.byidx( 1)
|
||||
end),
|
||||
awful.key({ modkey, "Shift" }, "k", function ()
|
||||
awful.client.swap.byidx( -1)
|
||||
end),
|
||||
awful.key({ modkey, "Control" }, "j", function ()
|
||||
awful.screen.focus_relative( 1)
|
||||
end),
|
||||
awful.key({ modkey, "Control" }, "k", function ()
|
||||
awful.screen.focus_relative(-1)
|
||||
end),
|
||||
awful.key({ modkey }, "Left", awful.tag.viewprev ),
|
||||
awful.key({ modkey }, "Right", awful.tag.viewnext ),
|
||||
awful.key({ modkey }, "Escape", awful.tag.history.restore)
|
||||
);
|
||||
end
|
||||
|
||||
layouts.mt.__index = list
|
||||
layouts.mt.__newindex = list
|
||||
return setmetatable(layouts, layouts.mt)
|
257
modalbind.lua
|
@ -1,133 +1,147 @@
|
|||
local M = {}
|
||||
local modalbind = {}
|
||||
local wibox = require("wibox")
|
||||
local inited = false
|
||||
local modewidget = {}
|
||||
local modewibox = { screen = -1 }
|
||||
local nesting = 0
|
||||
|
||||
--local functions
|
||||
local ensure_init, set_default, update_settings, show_box, hide_box
|
||||
M.grab = function(keymap, stay_in_mode)
|
||||
if keymap.name then show_box(mouse.screen, keymap) end
|
||||
|
||||
keygrabber.run(function(mod, key, event)
|
||||
if key == "Escape" then
|
||||
keygrabber.stop()
|
||||
hide_box();
|
||||
return true
|
||||
end
|
||||
|
||||
if event == "release" then return true end
|
||||
|
||||
if keymap[key] then
|
||||
keygrabber.stop()
|
||||
if stay_in_mode then
|
||||
keymap[key](key)
|
||||
M.grab(keymap, true)
|
||||
else
|
||||
hide_box()
|
||||
keymap[key](key)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end)
|
||||
end
|
||||
|
||||
-- Partially adapted from Obvious Widget Library module "popup_run_prompt" --
|
||||
-- Original Author: Andrei "Garoth" Thorp --
|
||||
-- Copyright 2009 Andrei "Garoth" Thorp --
|
||||
|
||||
local defaults = {}
|
||||
-- Default is 1 for people without compositing
|
||||
|
||||
defaults.opacity = 1.0
|
||||
defaults.height = 22
|
||||
defaults.border_width = 1
|
||||
defaults.x_offset = 18
|
||||
defaults.x_offset = 0
|
||||
defaults.y_offset = 0
|
||||
defaults.show_options = true
|
||||
|
||||
-- Clone the defaults for the used settings
|
||||
local settings = {}
|
||||
for key, value in pairs(defaults) do
|
||||
settings[key] = value
|
||||
settings[key] = value
|
||||
end
|
||||
|
||||
local function update_settings()
|
||||
for s, value in ipairs(modewibox) do
|
||||
value.border_width = settings.border_width
|
||||
set_default(s)
|
||||
value.opacity = settings.opacity
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
M.set_opacity = function (amount)
|
||||
settings.opacity = amount or defaults.opacity
|
||||
update_settings()
|
||||
--- Change the opacity of the modebox.
|
||||
-- @param amount opacity between 0.0 and 1.0, or nil to use default
|
||||
function set_opacity(amount)
|
||||
settings.opacity = amount or defaults.opacity
|
||||
update_settings()
|
||||
end
|
||||
modalbind.set_opacity = set_opacity
|
||||
|
||||
M.set_height = function (amount)
|
||||
settings.height = amount or defaults.height
|
||||
update_settings()
|
||||
--- Change height of the modebox.
|
||||
-- @param amount height in pixels, or nil to use default
|
||||
function set_height(amount)
|
||||
settings.height = amount or defaults.height
|
||||
update_settings()
|
||||
end
|
||||
modalbind.set_height = set_height
|
||||
|
||||
M.set_border_width = function (amount)
|
||||
settings.border_width = amount or defaults.border_width
|
||||
update_settings()
|
||||
--- Change border width of the modebox.
|
||||
-- @param amount width in pixels, or nil to use default
|
||||
function set_border_width(amount)
|
||||
settings.border_width = amount or defaults.border_width
|
||||
update_settings()
|
||||
end
|
||||
modalbind.set_border_width = set_border_width
|
||||
|
||||
M.set_x_offset = function (amount)
|
||||
settings.x_offset = amount or defaults.x_offset
|
||||
update_settings()
|
||||
--- Change horizontal offset of the modebox.
|
||||
-- set location for the box with set_corner(). The box is shifted to the right
|
||||
-- if it is in one of the left corners or to the left otherwise
|
||||
-- @param amount horizontal shift in pixels, or nil to use default
|
||||
function set_x_offset (amount)
|
||||
settings.x_offset = amount or defaults.x_offset
|
||||
update_settings()
|
||||
end
|
||||
modalbind.set_x_offset = set_x_offset
|
||||
|
||||
M.set_show_options = function (bool)
|
||||
settings.show_options = bool
|
||||
--- Change vertical offset of the modebox.
|
||||
-- set location for the box with set_corner(). The box is shifted downwards if it
|
||||
-- is in one of the upper corners or upwards otherwise.
|
||||
-- @param amount vertical shift in pixels, or nil to use default
|
||||
function set_y_offset(amount)
|
||||
settings.y_offset = amount or defaults.y_offset
|
||||
update_settings()
|
||||
end
|
||||
modalbind.set_y_offset = set_y_offset
|
||||
|
||||
ensure_init = function ()
|
||||
if inited then
|
||||
return
|
||||
end
|
||||
|
||||
inited = true
|
||||
for s = 1, screen.count() do
|
||||
modewidget[s] = widget({
|
||||
type = "textbox",
|
||||
name = "modewidget" .. s,
|
||||
align = "center"
|
||||
})
|
||||
|
||||
modewibox[s] = wibox({
|
||||
fg = beautiful.fg_normal,
|
||||
bg = beautiful.bg_normal,
|
||||
border_width = settings.border_width,
|
||||
border_color = beautiful.bg_focus,
|
||||
})
|
||||
set_default(s)
|
||||
modewibox[s].visible = false
|
||||
modewibox[s].screen = s
|
||||
modewibox[s].ontop = true
|
||||
|
||||
-- Widgets for prompt wibox
|
||||
modewibox[s].widgets = {
|
||||
modewidget[s],
|
||||
layout = awful.widget.layout.vertical.center
|
||||
}
|
||||
end
|
||||
--- Set the corner, where the modebox will be displayed
|
||||
-- If a parameter is not a valid orientation (see below), the function returns
|
||||
-- without doing anything
|
||||
-- @param vertical either top or bottom
|
||||
-- @param horizontal either left or right
|
||||
function set_corner(vertical, horizontal)
|
||||
if (vertical ~= "top" and vertical ~= "bottom") then
|
||||
return
|
||||
end
|
||||
if (horizontal ~= "left" and horizontal ~= "right") then
|
||||
return
|
||||
end
|
||||
settings.corner_v = vertical or defaults.corner_v
|
||||
settings.corner_h = horizontal or defaults.corner_h
|
||||
end
|
||||
modalbind.set_corner = set_corner
|
||||
|
||||
set_default = function (s)
|
||||
modewibox[s]:geometry({
|
||||
width = modewidget[s].extents(modewidget[s]).width,
|
||||
height = settings.height,
|
||||
x = settings.x_offset < 0 and
|
||||
function set_show_options(bool)
|
||||
settings.show_options = bool
|
||||
end
|
||||
modalbind.set_show_options = set_show_options
|
||||
|
||||
local function set_default(s)
|
||||
minwidth, minheight = modewidget[s]:fit(screen[s].geometry.width,
|
||||
screen[s].geometry.height)
|
||||
modewibox[s].width = minwidth + 1;
|
||||
modewibox[s].height = math.max(settings.height, minheight)
|
||||
modewibox[s].x = settings.x_offset < 0 and
|
||||
screen[s].geometry.x - width + settings.x_offset or
|
||||
settings.x_offset,
|
||||
y = screen[s].geometry.y + screen[s].geometry.height - settings.height
|
||||
})
|
||||
settings.x_offset
|
||||
modewibox[s].y = screen[s].geometry.height - settings.height
|
||||
end
|
||||
|
||||
update_settings = function ()
|
||||
for s, value in ipairs(modewibox) do
|
||||
value.border_width = settings.border_width
|
||||
set_default(s)
|
||||
value.opacity = settings.opacity
|
||||
end
|
||||
local function ensure_init()
|
||||
if inited then
|
||||
return
|
||||
end
|
||||
inited = true
|
||||
for s = 1, screen.count() do
|
||||
modewidget[s] = wibox.widget.textbox()
|
||||
modewidget[s]:set_align("center")
|
||||
|
||||
modewibox[s] = wibox({
|
||||
fg = beautiful.fg_normal,
|
||||
bg = beautiful.bg_normal,
|
||||
border_width = settings.border_width,
|
||||
border_color = beautiful.bg_focus,
|
||||
})
|
||||
|
||||
local modelayout = {}
|
||||
modelayout[s] = wibox.layout.fixed.horizontal()
|
||||
modelayout[s]:add(modewidget[s])
|
||||
modewibox[s]:set_widget(modelayout[s]);
|
||||
set_default(s)
|
||||
modewibox[s].visible = false
|
||||
modewibox[s].screen = s
|
||||
modewibox[s].ontop = true
|
||||
|
||||
-- Widgets for prompt wibox
|
||||
modewibox[s].widgets = {
|
||||
modewidget[s],
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
show_box = function (s, map)
|
||||
local function show_box(s, map)
|
||||
ensure_init()
|
||||
modewibox.screen = s
|
||||
local label = " -- " .. map.name .. " -- "
|
||||
|
@ -136,14 +150,55 @@ show_box = function (s, map)
|
|||
if key ~= "name" then label = label .. " " .. key end
|
||||
end
|
||||
end
|
||||
modewidget[s].text = label
|
||||
set_default(s)
|
||||
modewibox[s].visible = true
|
||||
modewidget[s]:set_text(label)
|
||||
modewibox[s].visible = true
|
||||
set_default(s)
|
||||
end
|
||||
|
||||
hide_box = function ()
|
||||
local function hide_box()
|
||||
local s = modewibox.screen
|
||||
if s ~= -1 then modewibox[s].visible = false end
|
||||
if s ~= -1 then modewibox[s].visible = false end
|
||||
end
|
||||
|
||||
return M
|
||||
function grab(keymap, stay_in_mode)
|
||||
if keymap.name then
|
||||
show_box(mouse.screen, keymap)
|
||||
nesting = nesting + 1
|
||||
end
|
||||
|
||||
keygrabber.run(function(mod, key, event)
|
||||
if key == "Escape" then
|
||||
keygrabber.stop()
|
||||
nesting = 0
|
||||
hide_box();
|
||||
return true
|
||||
end
|
||||
|
||||
if event == "release" then return true end
|
||||
|
||||
if keymap[key] then
|
||||
keygrabber.stop()
|
||||
keymap[key]()
|
||||
if stay_in_mode then
|
||||
grab(keymap, true)
|
||||
else
|
||||
nesting = nesting - 1
|
||||
if nesting < 1 then hide_box() end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end)
|
||||
end
|
||||
modalbind.grab = grab
|
||||
|
||||
function grabf(keymap, stay_in_mode)
|
||||
return function() grab(keymap, stay_in_mode) end
|
||||
end
|
||||
modalbind.grabf = grabf
|
||||
|
||||
function modebox() return modewibox[1] end
|
||||
modalbind.modebox = modebox
|
||||
|
||||
return modalbind
|
||||
|
|
56
mpd.lua
|
@ -1,80 +1,76 @@
|
|||
local awful = awful
|
||||
local M = {}
|
||||
local type = ""
|
||||
local conf = conf
|
||||
local awful = awful
|
||||
local log = log
|
||||
|
||||
-- local functions
|
||||
local show, mpc_play_search, notify
|
||||
local dmenu, mpc_play_search, notify, mpc
|
||||
|
||||
local defaults = {}
|
||||
local settings = {}
|
||||
|
||||
defaults.host = "127.0.0.1"
|
||||
defaults.port = 6600
|
||||
defaults.replace_on_search = true
|
||||
|
||||
for key, value in pairs(defaults) do
|
||||
settings[key] = value
|
||||
end
|
||||
|
||||
-- {{{ basic functions
|
||||
|
||||
-- }}}
|
||||
mpc = function(command)
|
||||
awful.util.spawn("mpc " .. command)
|
||||
end
|
||||
|
||||
-- {{{ mpd.ctrl submodule
|
||||
|
||||
M.ctrl = {}
|
||||
|
||||
M.ctrl.toggle = function ()
|
||||
awful.util.spawn("mpc toggle")
|
||||
mpc("toggle")
|
||||
end
|
||||
|
||||
M.ctrl.play = function ()
|
||||
awful.util.spawn("mpc play")
|
||||
mpc("play")
|
||||
end
|
||||
|
||||
M.ctrl.pause = function ()
|
||||
awful.util.spawn("mpc pause")
|
||||
mpc("pause")
|
||||
end
|
||||
|
||||
M.ctrl.next = function ()
|
||||
awful.util.spawn("mpc next")
|
||||
mpc("next")
|
||||
end
|
||||
|
||||
M.ctrl.prev = function ()
|
||||
awful.util.spawn("mpc prev")
|
||||
end
|
||||
|
||||
M.ctrl.clear = function ()
|
||||
awful.util.spawn("mpc clear")
|
||||
mpc("prev")
|
||||
end
|
||||
|
||||
-- }}}
|
||||
|
||||
-- {{{ mpd.prompt submodule
|
||||
|
||||
local clear_before = cfg.mpd_prompt_clear_before == nil and
|
||||
local clear_before = conf.mpd_prompt_clear_before == nil and
|
||||
true or
|
||||
cfg.mpd_prompt_clear_before
|
||||
conf.mpd_prompt_clear_before
|
||||
|
||||
M.prompt = {}
|
||||
|
||||
M.prompt.artist = function()
|
||||
type = "artist"
|
||||
show()
|
||||
dmenu("-a")
|
||||
end
|
||||
|
||||
M.prompt.album = function()
|
||||
type = "album"
|
||||
show()
|
||||
dmenu("-a -b")
|
||||
end
|
||||
|
||||
|
||||
M.prompt.title = function()
|
||||
type = "title"
|
||||
show()
|
||||
dmenu("-a -b -t")
|
||||
end
|
||||
M.prompt.title = title
|
||||
|
||||
function dmenu(opts)
|
||||
awful.util.spawn("dmpc " .. (clear_before and "-r" or "-R") .. " " .. opts)
|
||||
end
|
||||
|
||||
M.prompt.replace_on_search = function(bool)
|
||||
clear_before = bool
|
||||
end
|
||||
|
@ -86,16 +82,8 @@ M.prompt.toggle_replace_on_search = function()
|
|||
).. " the playlist")
|
||||
end
|
||||
|
||||
function show()
|
||||
obvious.popup_run_prompt.set_prompt_string("Play ".. type .. ":")
|
||||
obvious.popup_run_prompt.set_cache("/mpd_ ".. type);
|
||||
obvious.popup_run_prompt.set_run_function(mpc_play_search)
|
||||
obvious.popup_run_prompt.run_prompt()
|
||||
end
|
||||
|
||||
function mpc_play_search(s)
|
||||
if clear_before then M.ctrl.clear() end
|
||||
awful.util.spawn("mpc search " .. type .. " | mpc add; mpc play")
|
||||
notify("Found " .. (s) .. " matches");
|
||||
end
|
||||
|
||||
-- }}}
|
||||
|
|
1
obvious
|
@ -1 +0,0 @@
|
|||
Subproject commit c5b884459194a15a38b88c99d5558a64efaf4e89
|
103
rc.lua
|
@ -1,40 +1,79 @@
|
|||
-- libraries {{{
|
||||
awful = require("awful")
|
||||
awful.rules = require("awful.rules")
|
||||
require("awful.autofocus")
|
||||
wibox = require("wibox")
|
||||
beautiful = require("autobeautiful")
|
||||
naughty = require("naughty")
|
||||
conf = require("localconf")
|
||||
require("errors")
|
||||
inspect = require("inspect")
|
||||
-- }}}
|
||||
|
||||
-- Standard awesome library
|
||||
require("awful")
|
||||
require("awful.autofocus")
|
||||
require("awful.rules")
|
||||
require("beautiful")
|
||||
require("naughty")
|
||||
require("teardrop")
|
||||
require("obvious.popup_run_prompt")
|
||||
require("vicious")
|
||||
require("rodentbane.rodentbane")
|
||||
layouts = require('layouts')
|
||||
|
||||
MY_PATH = os.getenv("HOME") .. "/.config/awesome/"
|
||||
-- {{{ Logging
|
||||
log = require("simplelog")
|
||||
log.add_logger(log.loggers.stdio, 0)
|
||||
log.add_logger(log.loggers.naughty, 2)
|
||||
|
||||
dofile (MY_PATH .. "localconf.lua")
|
||||
-- }}}
|
||||
|
||||
-- Themes define colours, icons, and wallpapers
|
||||
beautiful.init("/home/crater2150/.config/awesome/zenburn/theme.lua")
|
||||
-- {{{ Tags
|
||||
|
||||
tags = require('tags')
|
||||
tags.setup()
|
||||
|
||||
-- Table of layouts to cover with awful.layout.inc, order matters.
|
||||
layouts =
|
||||
{
|
||||
awful.layout.suit.fair,
|
||||
awful.layout.suit.fair.horizontal,
|
||||
awful.layout.suit.tile,
|
||||
awful.layout.suit.tile.bottom,
|
||||
awful.layout.suit.max,
|
||||
awful.layout.suit.max.fullscreen,
|
||||
awful.layout.suit.floating
|
||||
}
|
||||
-- }}}
|
||||
|
||||
awful.util.spawn("wmname LG3D")
|
||||
-- {{{ widgets
|
||||
widgets = require("widgets")
|
||||
widgets.setup()
|
||||
for s = 1, screen.count() do
|
||||
local ltop = widgets.layout(s,"left","top")
|
||||
local rtop = widgets.layout(s,"right","top")
|
||||
local lbottom = widgets.layout(s,"left","bottom")
|
||||
|
||||
dofile (MY_PATH .. "/tags.lua")
|
||||
dofile (MY_PATH .. "/boxes.lua")
|
||||
dofile (MY_PATH .. "/bindings.lua")
|
||||
dofile (MY_PATH .. "/rules.lua")
|
||||
dofile (MY_PATH .. "/signals.lua")
|
||||
-- dofile (MY_PATH .. "uzbl.lua")
|
||||
-- {{{
|
||||
widgets.add.mail("mail_me", s, ltop, { os.getenv("HOME") .. "/.maildir/me" })
|
||||
widgets.add.spacer(ltop)
|
||||
widgets.add.mail("mail_uber", s, ltop, { os.getenv("HOME") .. "/.maildir/uber" })
|
||||
widgets.add.spacer(ltop)
|
||||
widgets.add.clock("clock", s, ltop)
|
||||
|
||||
widgets.add.layout(s, lbottom)
|
||||
widgets.add.taglist("tags", s, lbottom)
|
||||
|
||||
widgets.add.cpu("cpu", s, rtop)
|
||||
widgets.add.spacer(rtop)
|
||||
widgets.add.battery("bat", s, rtop, "BAT0")
|
||||
widgets.add.spacer(rtop)
|
||||
widgets.add.battery("slice", s, rtop, "BAT1")
|
||||
widgets.add.spacer(rtop)
|
||||
widgets.add.wifi("wlan", s, rtop, "wlan0")
|
||||
widgets.add.spacer(rtop)
|
||||
widgets.add.systray(s, rtop)
|
||||
|
||||
widgets.set_spacer_text(" ◈ ")
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Key bindings
|
||||
globalkeys = {}
|
||||
globalkeys = layouts.extend_key_table(globalkeys);
|
||||
globalkeys = tags.extend_key_table(globalkeys);
|
||||
|
||||
bindings = require("bindings")
|
||||
bindings.extend_and_register_key_table(globalkeys)
|
||||
bindings.mb.set_x_offset(18)
|
||||
-- }}}
|
||||
|
||||
-- {{{ rules
|
||||
rules = require("rules")
|
||||
rules.setup()
|
||||
-- }}}
|
||||
|
||||
require("signals")
|
||||
|
||||
--
|
||||
-- vim: fdm=marker
|
||||
|
|
269
rules.lua
|
@ -1,70 +1,201 @@
|
|||
local rules = { mt={} }
|
||||
local awful = awful
|
||||
local conf = conf
|
||||
local tags = tags
|
||||
local beautiful = beautiful
|
||||
local inspect=require("inspect")
|
||||
|
||||
awful.rules.rules = {
|
||||
-- All clients will match this rule.
|
||||
{ rule = { },
|
||||
properties = { border_width = beautiful.border_width,
|
||||
border_color = beautiful.border_normal,
|
||||
focus = true,
|
||||
size_hints_honor = false,
|
||||
keys = clientkeys,
|
||||
minimized = false,
|
||||
--skip_taskbar = true,
|
||||
buttons = clientbuttons } },
|
||||
{ rule = { class = "MPlayer" },
|
||||
properties = { floating = true,
|
||||
size_hints_honor = true } },
|
||||
{ rule = { class = "Passprompt" },
|
||||
properties = { floating = true,
|
||||
ontop = true,
|
||||
focus = true } },
|
||||
{ rule = { class = "pinentry" },
|
||||
properties = { floating = true } },
|
||||
-- Set Firefox to always map on tags number 2 of screen 1.
|
||||
{ rule = { class = "Uzbl-core" },
|
||||
properties = { tag = tags[rule_screen][2],
|
||||
skip_taskbar = false } },
|
||||
{ rule = { class = "Firefox", instance = "Navigator" },
|
||||
properties = { tag = tags[rule_screen][2],
|
||||
floating = false, minimized = false } },
|
||||
{ rule = { class = "Webbrowser", instance = "Navigator" },
|
||||
properties = { tag = tags[rule_screen][2],
|
||||
floating = false, minimized = false } },
|
||||
{ rule = { class = "Pidgin" },
|
||||
properties = { tag = tags[rule_screen][3], opacity = 0.9 } },
|
||||
{ rule = { role = "buddy_list" },
|
||||
properties = { master = true } },
|
||||
{ rule = { role = "conversation" },
|
||||
callback = awful.client.setslave },
|
||||
{ rule = { instance = "Weechat"},
|
||||
properties = { tag = tags[rule_screen][3]} ,
|
||||
callback = awful.client.setslave},
|
||||
{ rule = { class = "Irssi"},
|
||||
properties = { tag = tags[rule_screen][3]} ,
|
||||
callback = awful.client.setslave},
|
||||
{ rule = { class = "Claws-mail" },
|
||||
properties = { tag = tags[rule_screen][4] } },
|
||||
{ rule = { instance = "Gmutt" },
|
||||
properties = { tag = tags[rule_screen][4] } },
|
||||
{ rule = { instance = "Gcanto" },
|
||||
properties = { tag = tags[rule_screen][5] } },
|
||||
{ rule = { instance = "Gncmpcpp" },
|
||||
properties = { tag = tags[rule_screen][6] } },
|
||||
{ rule = { class = "Gmpc" },
|
||||
properties = { tag = tags[rule_screen][6] } },
|
||||
{ rule = { class = "Deluge" },
|
||||
properties = { tag = tags[rule_screen][7] } },
|
||||
{ rule = { class = "Cellwriter" },
|
||||
properties = { tag = tags[rule_screen][1],
|
||||
ontop = true,
|
||||
size_hints_honor = true,
|
||||
float = true,
|
||||
sticky = true,
|
||||
fullscreen = true
|
||||
} },
|
||||
{ rule = { class = "Xhtop" },
|
||||
properties = { tag = tags[rule_screen][22] } },
|
||||
{ rule = { class = "URxvt" },
|
||||
properties = { opacity = 0.9 } },
|
||||
{ rule = { instance = "URxvt" },
|
||||
properties = { opacity = 0.9 } },
|
||||
}
|
||||
local rule_screen = conf.rule_screen or 1
|
||||
|
||||
local function popup_urgent(message)
|
||||
return function(client)
|
||||
client:connect_signal("property::urgent", function (c)
|
||||
if c.urgent and not c.focus then
|
||||
naughty.notify({ text=message })
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
local function setup(self)
|
||||
awful.rules.rules = {
|
||||
-- All clients will match this rule.
|
||||
{
|
||||
rule = { },
|
||||
properties = {
|
||||
border_width = beautiful.border_width,
|
||||
border_color = beautiful.border_normal,
|
||||
focus = true,
|
||||
size_hints_honor = false,
|
||||
keys = clientkeys,
|
||||
minimized = false,
|
||||
--skip_taskbar = true,
|
||||
buttons = clientbuttons
|
||||
}
|
||||
},
|
||||
{
|
||||
rule = { class = "Passprompt" },
|
||||
properties = { ontop = true, focus = true}
|
||||
},
|
||||
{
|
||||
rule = { class = "Sm" },
|
||||
properties = {
|
||||
ontop = true,
|
||||
border_width = 0
|
||||
}
|
||||
},
|
||||
{
|
||||
rule_any = { class = {
|
||||
"pinentry", "Passprompt", "MPlayer"
|
||||
}},
|
||||
properties = { floating = true, size_hints_honor = true }
|
||||
},
|
||||
|
||||
{
|
||||
rule = { class = "Firefox", instance = "Navigator" },
|
||||
properties = {
|
||||
tag = tags[rule_screen][2],
|
||||
floating = false, minimized = false
|
||||
}
|
||||
},
|
||||
{
|
||||
rule_any = { class = {"Pidgin"}, instance = {"Weechat"} },
|
||||
properties = {
|
||||
tag = tags[rule_screen][3], opacity = 0.9
|
||||
},
|
||||
callback = popup_urgent("new chat message")
|
||||
},
|
||||
{
|
||||
rule = { role = "buddy_list" },
|
||||
properties = {
|
||||
master = true
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
rule = { class = "Steam", name = "Friends" },
|
||||
properties = {
|
||||
master = true
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
rule_any = { role ={ "conversation" }, instance = { "Weechat" } },
|
||||
callback = awful.client.setslave
|
||||
},
|
||||
{
|
||||
rule = { class = "Irssi"},
|
||||
properties = {
|
||||
tag = tags[rule_screen][3]
|
||||
} ,
|
||||
callback = awful.client.setslave
|
||||
},
|
||||
{
|
||||
rule = { class = "Claws-mail" },
|
||||
properties = {
|
||||
tag = tags[rule_screen][4]
|
||||
}
|
||||
},
|
||||
{
|
||||
rule = { instance = "Gmutt" },
|
||||
properties = {
|
||||
tag = tags[rule_screen][4]
|
||||
}
|
||||
},
|
||||
{
|
||||
rule = { instance = "Gcanto" },
|
||||
properties = {
|
||||
tag = tags[rule_screen][5]
|
||||
}
|
||||
},
|
||||
{
|
||||
rule = { instance = "Gncmpcpp" },
|
||||
properties = {
|
||||
tag = tags[rule_screen][6]
|
||||
}
|
||||
},
|
||||
{
|
||||
rule = { class = "Gmpc" },
|
||||
properties = {
|
||||
tag = tags[rule_screen][6]
|
||||
}
|
||||
},
|
||||
{
|
||||
rule = { class = "Deluge" },
|
||||
properties = {
|
||||
tag = tags[rule_screen][7]
|
||||
}
|
||||
},
|
||||
{
|
||||
rule = { class = "Pdfpc" },
|
||||
properties = {
|
||||
size_hints_honor = true,
|
||||
float = true,
|
||||
fullscreen = true
|
||||
}
|
||||
},
|
||||
{
|
||||
rule = { class = "Cellwriter" },
|
||||
properties = {
|
||||
tag = tags[rule_screen][1],
|
||||
ontop = true,
|
||||
size_hints_honor = true,
|
||||
float = true,
|
||||
sticky = true,
|
||||
fullscreen = true
|
||||
}
|
||||
},
|
||||
{
|
||||
rule = { class = "Xhtop" },
|
||||
properties = {
|
||||
tag = tags[rule_screen][22]
|
||||
}
|
||||
},
|
||||
{
|
||||
rule = { class = "Dmenu" },
|
||||
properties = {
|
||||
opacity = 0.8
|
||||
}
|
||||
},
|
||||
{
|
||||
rule = { class = "URxvt" },
|
||||
properties = {
|
||||
opacity = 0.9
|
||||
}
|
||||
},
|
||||
{
|
||||
rule = { class = "Gvim" },
|
||||
properties = {
|
||||
opacity = 0.9
|
||||
}
|
||||
},
|
||||
{
|
||||
rule = { class = "feh", name = "timetable" },
|
||||
properties = {
|
||||
tag = tags[rule_screen][13],
|
||||
skip_taskbar = true,
|
||||
type = desktop,
|
||||
focusable = false,
|
||||
border_width = 0
|
||||
}
|
||||
},
|
||||
{
|
||||
rule = { instance = "Awesomelog" },
|
||||
properties = {
|
||||
tag = tags[rule_screen][14]
|
||||
}
|
||||
},
|
||||
{
|
||||
rule = { class = "GLSlideshow" },
|
||||
properties = {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
rules.setup = setup
|
||||
|
||||
rules.mt.__call = setup
|
||||
|
||||
return setmetatable(rules, rules.mt)
|
||||
|
|
|
@ -1,26 +1,27 @@
|
|||
----------------------------------------------------------------
|
||||
-------------------------------------------------------------------
|
||||
-- Drop-down applications manager for the awesome window manager
|
||||
----------------------------------------------------------------
|
||||
-- Adrian C. <anrxc.sysphere.org>
|
||||
-------------------------------------------------------------------
|
||||
-- Coded by: * Lucas de Vries <lucas@glacicle.com>
|
||||
-- Hacked by: * Adrian C. (anrxc) <anrxc@sysphere.org>
|
||||
-- Licensed under the WTFPL version 2
|
||||
-- * http://sam.zoy.org/wtfpl/COPYING
|
||||
----------------------------------------------------------------
|
||||
-------------------------------------------------------------------
|
||||
-- To use this module add:
|
||||
-- require("teardrop")
|
||||
-- local scratch = require("scratch")
|
||||
-- to the top of your rc.lua, and call it from a keybinding:
|
||||
-- teardrop(prog, vert, horiz, width, height, sticky, screen)
|
||||
-- scratch.drop(prog, vert, horiz, width, height, sticky, screen)
|
||||
--
|
||||
-- Parameters:
|
||||
-- prog - Program to run; "urxvt", "gmrun", "thunderbird"
|
||||
-- vert - Vertical; "bottom", "center" or "top" (default)
|
||||
-- horiz - Horizontal; "left", "right" or "center" (default)
|
||||
-- width - Width in absolute pixels, or width percentage
|
||||
-- when < 1 (0.9999 (99.9% of the screen) by default)
|
||||
-- when <= 1 (1 (100% of the screen) by default)
|
||||
-- height - Height in absolute pixels, or height percentage
|
||||
-- when < 1 (0.25 (25% of the screen) by default)
|
||||
-- when <= 1 (0.25 (25% of the screen) by default)
|
||||
-- sticky - Visible on all tags, false by default
|
||||
-- screen - Screen (optional), mouse.screen by default
|
||||
----------------------------------------------------------------
|
||||
-------------------------------------------------------------------
|
||||
|
||||
-- Grab environment
|
||||
local pairs = pairs
|
||||
|
@ -32,26 +33,31 @@ local capi = {
|
|||
screen = screen
|
||||
}
|
||||
|
||||
-- Teardrop: Drop-down applications manager for the awesome window manager
|
||||
module("teardrop")
|
||||
-- Scratchdrop: drop-down applications manager for the awesome window manager
|
||||
local drop = {} -- module scratch.drop
|
||||
|
||||
|
||||
local dropdown = {}
|
||||
|
||||
-- Create a new window for the drop-down application when it doesn't
|
||||
-- exist, or toggle between hidden and visible states when it does
|
||||
function toggle(prog, vert, horiz, width, height, sticky, screen)
|
||||
local vert = vert or "top"
|
||||
local horiz = horiz or "center"
|
||||
local width = width or 0.9999
|
||||
local height = height or 0.25
|
||||
local sticky = sticky or false
|
||||
local screen = screen or capi.mouse.screen
|
||||
vert = vert or "top"
|
||||
horiz = horiz or "center"
|
||||
width = width or 1
|
||||
height = height or 0.25
|
||||
sticky = sticky or false
|
||||
screen = screen or capi.mouse.screen
|
||||
|
||||
-- Determine signal usage in this version of awesome
|
||||
local attach_signal = client.connect_signal or client.add_signal
|
||||
local detach_signal = client.disconnect_signal or client.remove_signal
|
||||
|
||||
if not dropdown[prog] then
|
||||
dropdown[prog] = {}
|
||||
|
||||
-- Add unmanage signal for teardrop programs
|
||||
capi.client.add_signal("unmanage", function (c)
|
||||
-- Add unmanage signal for scratchdrop programs
|
||||
attach_signal("unmanage", function (c)
|
||||
for scr, cl in pairs(dropdown[prog]) do
|
||||
if cl == c then
|
||||
dropdown[prog][scr] = nil
|
||||
|
@ -64,14 +70,14 @@ function toggle(prog, vert, horiz, width, height, sticky, screen)
|
|||
spawnw = function (c)
|
||||
dropdown[prog][screen] = c
|
||||
|
||||
-- Teardrop clients are floaters
|
||||
-- Scratchdrop clients are floaters
|
||||
awful.client.floating.set(c, true)
|
||||
|
||||
-- Client geometry and placement
|
||||
local screengeom = capi.screen[screen].workarea
|
||||
|
||||
if width < 1 then width = screengeom.width * width end
|
||||
if height < 1 then height = screengeom.height * height end
|
||||
if width <= 1 then width = screengeom.width * width end
|
||||
if height <= 1 then height = screengeom.height * height end
|
||||
|
||||
if horiz == "left" then x = screengeom.x
|
||||
elseif horiz == "right" then x = screengeom.width - width
|
||||
|
@ -91,18 +97,18 @@ function toggle(prog, vert, horiz, width, height, sticky, screen)
|
|||
|
||||
c:raise()
|
||||
capi.client.focus = c
|
||||
capi.client.remove_signal("manage", spawnw)
|
||||
detach_signal("manage", spawnw)
|
||||
end
|
||||
|
||||
-- Add manage signal and spawn the program
|
||||
capi.client.add_signal("manage", spawnw)
|
||||
attach_signal("manage", spawnw)
|
||||
awful.util.spawn(prog, false)
|
||||
else
|
||||
-- Get a running client
|
||||
c = dropdown[prog][screen]
|
||||
|
||||
-- Switch the client to the current workspace
|
||||
if c:isvisible() == false then c.hidden = true;
|
||||
if c:isvisible() == false then c.hidden = true
|
||||
awful.client.movetotag(awful.tag.selected(screen), c)
|
||||
end
|
||||
|
||||
|
@ -117,7 +123,7 @@ function toggle(prog, vert, horiz, width, height, sticky, screen)
|
|||
else -- Hide and detach tags if not
|
||||
c.hidden = true
|
||||
local ctags = c:tags()
|
||||
for i, v in pairs(ctags) do
|
||||
for i, t in pairs(ctags) do
|
||||
ctags[i] = nil
|
||||
end
|
||||
c:tags(ctags)
|
||||
|
@ -125,4 +131,4 @@ function toggle(prog, vert, horiz, width, height, sticky, screen)
|
|||
end
|
||||
end
|
||||
|
||||
setmetatable(_M, { __call = function(_, ...) return toggle(...) end })
|
||||
return setmetatable(drop, { __call = function(_, ...) return toggle(...) end })
|
14
scratch/init.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
---------------------------------------------------------------
|
||||
-- Drop-down applications and scratchpad manager for awesome wm
|
||||
---------------------------------------------------------------
|
||||
-- Coded by: * Adrian C. (anrxc) <anrxc@sysphere.org>
|
||||
-- Licensed under the WTFPL version 2
|
||||
-- * http://sam.zoy.org/wtfpl/COPYING
|
||||
---------------------------------------------------------------
|
||||
|
||||
local scratch = {} -- module scratch
|
||||
|
||||
scratch.pad = require("scratch.pad")
|
||||
scratch.drop = require("scratch.drop")
|
||||
|
||||
return scratch
|
137
scratch/pad.lua
Normal file
|
@ -0,0 +1,137 @@
|
|||
---------------------------------------------------------------
|
||||
-- Basic scratchpad manager for the awesome window manager
|
||||
---------------------------------------------------------------
|
||||
-- Coded by: * Adrian C. (anrxc) <anrxc@sysphere.org>
|
||||
-- Licensed under the WTFPL version 2
|
||||
-- * http://sam.zoy.org/wtfpl/COPYING
|
||||
---------------------------------------------------------------
|
||||
-- To use this module add:
|
||||
-- local scratch = require("scratch")
|
||||
-- to the top of your rc.lua, and call:
|
||||
-- scratch.pad.set(c, width, height, sticky, screen)
|
||||
-- from a clientkeys binding, and:
|
||||
-- scratch.pad.toggle(screen)
|
||||
-- from a globalkeys binding.
|
||||
--
|
||||
-- Parameters:
|
||||
-- c - Client to scratch or un-scratch
|
||||
-- width - Width in absolute pixels, or width percentage
|
||||
-- when <= 1 (0.50 (50% of the screen) by default)
|
||||
-- height - Height in absolute pixels, or height percentage
|
||||
-- when <= 1 (0.50 (50% of the screen) by default)
|
||||
-- sticky - Visible on all tags, false by default
|
||||
-- screen - Screen (optional), mouse.screen by default
|
||||
---------------------------------------------------------------
|
||||
|
||||
-- Grab environment
|
||||
local pairs = pairs
|
||||
local awful = require("awful")
|
||||
local capi = {
|
||||
mouse = mouse,
|
||||
client = client,
|
||||
screen = screen
|
||||
}
|
||||
|
||||
-- Scratchpad: basic scratchpad manager for the awesome window manager
|
||||
local pad = {} -- module scratch.pad
|
||||
|
||||
|
||||
local scratchpad = {}
|
||||
|
||||
-- Toggle a set of properties on a client.
|
||||
local function toggleprop(c, prop)
|
||||
c.ontop = prop.ontop or false
|
||||
c.above = prop.above or false
|
||||
c.hidden = prop.hidden or false
|
||||
c.sticky = prop.stick or false
|
||||
c.skip_taskbar = prop.task or false
|
||||
end
|
||||
|
||||
-- Scratch the focused client, or un-scratch and tile it. If another
|
||||
-- client is already scratched, replace it with the focused client.
|
||||
function pad.set(c, width, height, sticky, screen)
|
||||
width = width or 0.50
|
||||
height = height or 0.50
|
||||
sticky = sticky or false
|
||||
screen = screen or capi.mouse.screen
|
||||
|
||||
-- Determine signal usage in this version of awesome
|
||||
local attach_signal = capi.client.add_signal or capi.client.connect_signal
|
||||
local detach_signal = capi.client.remove_signal or capi.client.disconnect_signal
|
||||
|
||||
local function setscratch(c)
|
||||
-- Scratchpad is floating and has no titlebar
|
||||
awful.client.floating.set(c, true); awful.titlebar.remove(c)
|
||||
|
||||
-- Scratchpad client properties
|
||||
toggleprop(c, {ontop=true, above=true, task=true, stick=sticky})
|
||||
|
||||
-- Scratchpad geometry and placement
|
||||
local screengeom = capi.screen[screen].workarea
|
||||
if width <= 1 then width = screengeom.width * width end
|
||||
if height <= 1 then height = screengeom.height * height end
|
||||
|
||||
c:geometry({ -- Scratchpad is always centered on screen
|
||||
x = screengeom.x + (screengeom.width - width) / 2,
|
||||
y = screengeom.y + (screengeom.height - height) / 2,
|
||||
width = width, height = height
|
||||
})
|
||||
|
||||
-- Scratchpad should not loose focus
|
||||
c:raise(); capi.client.focus = c
|
||||
end
|
||||
|
||||
-- Prepare a table for storing clients,
|
||||
if not scratchpad.pad then scratchpad.pad = {}
|
||||
-- add unmanage signal for scratchpad clients
|
||||
attach_signal("unmanage", function (c)
|
||||
for scr, cl in pairs(scratchpad.pad) do
|
||||
if cl == c then scratchpad.pad[scr] = nil end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- If the scratcphad is emtpy, store the client,
|
||||
if not scratchpad.pad[screen] then
|
||||
scratchpad.pad[screen] = c
|
||||
-- then apply geometry and properties
|
||||
setscratch(c)
|
||||
else -- If a client is already scratched,
|
||||
local oc = scratchpad.pad[screen]
|
||||
-- unscratch, and compare it with the focused client
|
||||
awful.client.floating.toggle(oc); toggleprop(oc, {})
|
||||
-- If it matches clear the table, if not replace it
|
||||
if oc == c then scratchpad.pad[screen] = nil
|
||||
else scratchpad.pad[screen] = c; setscratch(c) end
|
||||
end
|
||||
end
|
||||
|
||||
-- Move the scratchpad to the current workspace, focus and raise it
|
||||
-- when it's hidden, or hide it when it's visible.
|
||||
function pad.toggle(screen)
|
||||
screen = screen or capi.mouse.screen
|
||||
|
||||
-- Check if we have a client on storage,
|
||||
if scratchpad.pad and
|
||||
scratchpad.pad[screen] ~= nil
|
||||
then -- and get it out, to play
|
||||
local c = scratchpad.pad[screen]
|
||||
|
||||
-- If it's visible on another tag hide it,
|
||||
if c:isvisible() == false then c.hidden = true
|
||||
-- and move it to the current worskpace
|
||||
awful.client.movetotag(awful.tag.selected(screen), c)
|
||||
end
|
||||
|
||||
-- Focus and raise if it's hidden,
|
||||
if c.hidden then
|
||||
awful.placement.centered(c)
|
||||
c.hidden = false
|
||||
c:raise(); capi.client.focus = c
|
||||
else -- hide it if it's not
|
||||
c.hidden = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return pad
|
54
signals.lua
|
@ -1,12 +1,9 @@
|
|||
local awful = awful
|
||||
local beautiful = beautiful
|
||||
|
||||
-- {{{ Signals
|
||||
-- Signal function to execute when a new client appears.
|
||||
client.add_signal("manage", function (c, startup)
|
||||
-- Add a titlebar
|
||||
-- awful.titlebar.add(c, { modkey = modkey })
|
||||
|
||||
client.connect_signal("manage", function (c, startup)
|
||||
-- Enable sloppy focus
|
||||
c:add_signal("mouse::enter", function(c)
|
||||
c:connect_signal("mouse::enter", function(c)
|
||||
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
|
||||
and awful.client.focus.filter(c) then
|
||||
client.focus = c
|
||||
|
@ -24,8 +21,45 @@ client.add_signal("manage", function (c, startup)
|
|||
awful.placement.no_offscreen(c)
|
||||
end
|
||||
end
|
||||
|
||||
local titlebars_enabled = false
|
||||
if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
|
||||
-- Widgets that are aligned to the left
|
||||
local left_layout = wibox.layout.fixed.horizontal()
|
||||
left_layout:add(awful.titlebar.widget.iconwidget(c))
|
||||
|
||||
-- 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 title = awful.titlebar.widget.titlewidget(c)
|
||||
title: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)
|
||||
))
|
||||
|
||||
-- Now bring it all together
|
||||
local layout = wibox.layout.align.horizontal()
|
||||
layout:set_left(left_layout)
|
||||
layout:set_right(right_layout)
|
||||
layout:set_middle(title)
|
||||
|
||||
awful.titlebar(c):set_widget(layout)
|
||||
end
|
||||
end)
|
||||
|
||||
client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
|
||||
client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal 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)
|
||||
|
|
79
simplelog.lua
Normal file
|
@ -0,0 +1,79 @@
|
|||
local naughty = require("naughty")
|
||||
|
||||
local simplelog = { loggers = {}, mt = {}}
|
||||
|
||||
local defaults = {}
|
||||
local settings = {}
|
||||
|
||||
defaults.loggers = { }
|
||||
defaults.defaultlevel = 0
|
||||
|
||||
for key, value in pairs(defaults) do
|
||||
settings[key] = value
|
||||
end
|
||||
|
||||
level = {
|
||||
ERROR = 3,
|
||||
WARNING = 2,
|
||||
NORMAL = 1,
|
||||
DEBUG = 0
|
||||
}
|
||||
simplelog.level = level
|
||||
|
||||
function loglv(msg, level)
|
||||
for _,logger in ipairs(settings.loggers) do
|
||||
logger(msg, level)
|
||||
end
|
||||
end
|
||||
|
||||
function dbg(msg)
|
||||
loglv(msg, 0)
|
||||
end
|
||||
simplelog.debug = dbg
|
||||
|
||||
function log(msg)
|
||||
loglv(msg, 1)
|
||||
end
|
||||
simplelog.log = log
|
||||
|
||||
function warn(msg)
|
||||
loglv(msg, 2)
|
||||
end
|
||||
simplelog.warn = warn
|
||||
|
||||
function error(msg)
|
||||
loglv(msg, 3)
|
||||
end
|
||||
simplelog.error = error
|
||||
|
||||
function add_logger(logger, level)
|
||||
if level == nil then
|
||||
level = settings.defaultlevel
|
||||
end
|
||||
table.insert(settings.loggers, function(msg, severity)
|
||||
if severity >= level then
|
||||
logger(msg, severity)
|
||||
end
|
||||
end)
|
||||
end
|
||||
simplelog.add_logger = add_logger
|
||||
|
||||
function logger_naughty(msg, severity)
|
||||
if severity == level.WARNING then
|
||||
msg = "<span color=\"#ff6\">".. msg .. "</span>"
|
||||
elseif severity == level.ERROR then
|
||||
msg = "<span color=\"#f66\">".. msg .. "</span>"
|
||||
end
|
||||
naughty.notify({ text = msg })
|
||||
end
|
||||
simplelog.loggers.naughty = logger_naughty
|
||||
|
||||
|
||||
function logger_print(msg, severity)
|
||||
print(msg)
|
||||
end
|
||||
simplelog.loggers.stdio = logger_print
|
||||
|
||||
simplelog.mt.__call = log
|
||||
|
||||
return setmetatable(simplelog, simplelog.mt)
|
128
tags.lua
|
@ -1,21 +1,60 @@
|
|||
-- tags and layouts
|
||||
local awful = awful
|
||||
local conf = conf
|
||||
local modkey = conf.modkey or "Mod4"
|
||||
|
||||
-- {{{ Tags
|
||||
tags={}
|
||||
tags.setup = {
|
||||
{ name = "1:⚙", layout = layouts[1] },
|
||||
local tags={ mt={} }
|
||||
local layouts = layouts
|
||||
|
||||
local function funcViewOnly(i)
|
||||
return function ()
|
||||
local screen = mouse.screen
|
||||
if tags[screen][i] then
|
||||
awful.tag.viewonly(tags[screen][i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function funcViewToggle(i)
|
||||
return function ()
|
||||
local screen = mouse.screen
|
||||
if tags[screen][i] then
|
||||
awful.tag.viewtoggle(tags[screen][i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function funcMoveTo(i)
|
||||
return function ()
|
||||
if client.focus and tags[client.focus.screen][i] then
|
||||
awful.client.movetotag(tags[client.focus.screen][i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function funcToggle(i)
|
||||
return function ()
|
||||
if client.focus and tags[client.focus.screen][i] then
|
||||
awful.client.toggletag(tags[client.focus.screen][i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local defaultsetup = {
|
||||
{"1:⚙"},
|
||||
{ name = "2:⌘", layout = layouts[5] },
|
||||
{ name = "3:☻", layout = layouts[3], mwfact = 0.20 },
|
||||
{ name = "4:✉", layout = layouts[5] },
|
||||
{ name = "5:☑", layout = layouts[1] },
|
||||
{ name = "6:♫", layout = layouts[1] },
|
||||
{ name = "7:☣", layout = layouts[1] },
|
||||
{ name = "8:☕", layout = layouts[1] },
|
||||
{ name = "9:⚂", layout = layouts[1] },
|
||||
{ name = "0:☠", layout = layouts[1] },
|
||||
{ name = "F1:☭", layout = layouts[1] },
|
||||
{ name = "F2:♚", layout = layouts[1] },
|
||||
{ name = "F3:♛", layout = layouts[1] },
|
||||
{ name = "F4:♜", layout = layouts[1] }--,
|
||||
{"5:☑"},
|
||||
{"6:♫"},
|
||||
{"7:☣"},
|
||||
{"8:☕"},
|
||||
{"9:⚂"},
|
||||
{"0:☠"},
|
||||
{"F1:☭"},
|
||||
{"F2:♚"},
|
||||
{"F3:♛"},
|
||||
{"F4:♜"}--,
|
||||
-- { name = "F5:♝", layout = layouts[1] },
|
||||
-- { name = "F6:♞", layout = layouts[1] },
|
||||
-- { name = "F7:♟", layout = layouts[1] },
|
||||
|
@ -26,15 +65,54 @@ tags.setup = {
|
|||
-- { name = "F12:⚙", layout = layouts[1] }
|
||||
}
|
||||
|
||||
for s = 1, screen.count() do
|
||||
tags[s] = {}
|
||||
for i, t in ipairs(tags.setup) do
|
||||
tags[s][i] = tag({ name = t.name })
|
||||
tags[s][i].screen = s
|
||||
awful.tag.setproperty(tags[s][i], "layout", t.layout)
|
||||
awful.tag.setproperty(tags[s][i], "mwfact", t.mwfact)
|
||||
awful.tag.setproperty(tags[s][i], "hide", t.hide)
|
||||
end
|
||||
tags[s][1].selected = true
|
||||
local list = {}
|
||||
|
||||
function tags.setup(setuptable)
|
||||
local setup = setuptable or defaultsetup
|
||||
for s = 1, screen.count() do
|
||||
list[s] = {}
|
||||
for i, t in ipairs(setup) do
|
||||
local layout = t.layout or layouts[1]
|
||||
local name = t.name or t[1]
|
||||
list[s][i] = awful.tag.new({name}, s, layout)[1];
|
||||
list[s][i].selected = false
|
||||
if(t.mwfact) then
|
||||
awful.tag.setmwfact(t.mwfact,list[s][i])
|
||||
end
|
||||
end
|
||||
list[s][1].selected = true
|
||||
end
|
||||
end
|
||||
-- }}}
|
||||
|
||||
function tags.extend_key_table(globalkeys)
|
||||
-- Compute the maximum number of digit we need, limited to 22
|
||||
keynumber = 0
|
||||
for s = 1, screen.count() do
|
||||
keynumber = math.min(22, math.max(#(list[s]), keynumber));
|
||||
end
|
||||
|
||||
local inspect = require("inspect")
|
||||
local tagkeys = globalkeys or {}
|
||||
|
||||
-- Bind all key numbers to tags, using keycodes
|
||||
for i = 1, keynumber do
|
||||
if i < 10 then
|
||||
k = "#" .. i + 9 -- number keys 1-9
|
||||
elseif i == 10 then
|
||||
k = "#19" -- zero
|
||||
elseif i > 10 then
|
||||
k = "F" .. i - 10 -- F keys
|
||||
end
|
||||
tagkeys = awful.util.table.join(tagkeys,
|
||||
awful.key( { modkey }, k, funcViewOnly(i)),
|
||||
awful.key( { modkey, "Control" }, k, funcViewToggle(i)),
|
||||
awful.key( { modkey, "Shift" }, k, funcMoveTo(i)),
|
||||
awful.key( { modkey, "Control", "Shift" }, k, funcToggle(i))
|
||||
)
|
||||
end
|
||||
return tagkeys;
|
||||
end
|
||||
|
||||
tags.mt.__index = list
|
||||
tags.mt.__newindex = list
|
||||
return setmetatable(tags, tags.mt)
|
||||
|
|
|
@ -1,16 +1,7 @@
|
|||
-------------------------------
|
||||
-- "Zenburn" awesome theme --
|
||||
-- By Adrian C. (anrxc) --
|
||||
-------------------------------
|
||||
|
||||
-- Alternative icon sets and widget icons:
|
||||
-- * http://awesome.naquadah.org/wiki/Nice_Icons
|
||||
|
||||
-- {{{ Main
|
||||
theme = {}
|
||||
theme.wallpaper_cmd = { "awsetbg -l" }
|
||||
theme.wallpaper = "~/.wallpaper"
|
||||
-- }}}
|
||||
|
||||
-- {{{ Styles
|
||||
theme.font = "dejavu 7"
|
||||
|
||||
|
@ -35,40 +26,6 @@ theme.titlebar_bg_focus = "#3F3F3F"
|
|||
theme.titlebar_bg_normal = "#3F3F3F"
|
||||
-- }}}
|
||||
|
||||
-- There are other variable sets
|
||||
-- overriding the default one when
|
||||
-- defined, the sets are:
|
||||
-- [taglist|tasklist]_[bg|fg]_[focus|urgent]
|
||||
-- titlebar_[normal|focus]
|
||||
-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
|
||||
-- Example:
|
||||
--theme.taglist_bg_focus = "#CC9393"
|
||||
-- }}}
|
||||
|
||||
-- {{{ Widgets
|
||||
-- You can add as many variables as
|
||||
-- you wish and access them by using
|
||||
-- beautiful.variable in your rc.lua
|
||||
--theme.fg_widget = "#AECF96"
|
||||
--theme.fg_center_widget = "#88A175"
|
||||
--theme.fg_end_widget = "#FF5656"
|
||||
--theme.bg_widget = "#494B4F"
|
||||
--theme.border_widget = "#3F3F3F"
|
||||
-- }}}
|
||||
|
||||
-- {{{ Mouse finder
|
||||
theme.mouse_finder_color = "#CC9393"
|
||||
-- mouse_finder_[timeout|animate_timeout|radius|factor]
|
||||
-- }}}
|
||||
|
||||
-- {{{ Menu
|
||||
-- Variables set for theming the menu:
|
||||
-- menu_[bg|fg]_[normal|focus]
|
||||
-- menu_[border_color|border_width]
|
||||
theme.menu_height = "15"
|
||||
theme.menu_width = "100"
|
||||
-- }}}
|
||||
|
||||
-- {{{ Icons
|
||||
-- {{{ Taglist
|
||||
theme.taglist_squares_sel = "/usr/share/awesome/themes/zenburn/taglist/squarefz.png"
|
47
uzbl.lua
|
@ -1,47 +0,0 @@
|
|||
|
||||
|
||||
uzbltag = tags[rule_screen][2]
|
||||
mytasklist = {}
|
||||
mytasklist.buttons = awful.util.table.join(
|
||||
awful.button({ }, 1, function (c)
|
||||
if c == client.focus then
|
||||
c.minimized = true
|
||||
else
|
||||
if not c:isvisible() then
|
||||
awful.tag.viewonly(c:tags()[1])
|
||||
end
|
||||
-- This will also un-minimize
|
||||
-- the client, if needed
|
||||
client.focus = c
|
||||
c:raise()
|
||||
end
|
||||
end),
|
||||
awful.button({ }, 3, function ()
|
||||
if instance then
|
||||
instance:hide()
|
||||
instance = nil
|
||||
else
|
||||
instance = awful.menu.clients({ 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))
|
||||
|
||||
mytasklist[rule_screen] = awful.widget.tasklist(function(c)
|
||||
return awful.widget.tasklist.label.currenttags(c, rule_screen)
|
||||
end, mytasklist.buttons)
|
||||
uzblbox = {}
|
||||
uzblbox = awful.wibox({ position = "top", screen = rule_screen })
|
||||
uzblbox.visible = false
|
||||
uzblbox.widgets = { mytasklist[rule_screen],
|
||||
layout = awful.widget.layout.horizontal.rightleft }
|
||||
|
||||
uzbltag:add_signal("property::selected", function (tag)
|
||||
uzblbox.visible = tag.selected
|
||||
end)
|
2
vicious
|
@ -1 +1 @@
|
|||
Subproject commit 2d8d7d752bc54310634c44f2d90e4c54357ba989
|
||||
Subproject commit c316528698906fe5ce92a20b4de5863b1c1ab31b
|
265
widgets.lua
Normal file
|
@ -0,0 +1,265 @@
|
|||
local wibox = require("wibox")
|
||||
local vicious = require("vicious")
|
||||
local modkey = conf.modkey or "Mod4"
|
||||
|
||||
local widgets = { add = {} }
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- table declarations {{{
|
||||
--------------------------------------------------------------------------------
|
||||
local wlist = {}
|
||||
local bars = {}
|
||||
local leftwibox = {}
|
||||
local rightwibox = {}
|
||||
|
||||
local 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)
|
||||
)
|
||||
-- }}}
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- setup {{{
|
||||
--------------------------------------------------------------------------------
|
||||
local function setup() -- {{{
|
||||
for s = 1, screen.count() do
|
||||
wlist[s]={}
|
||||
bars[s]={}
|
||||
|
||||
|
||||
|
||||
-- Create the wibox
|
||||
leftwibox[s] = awful.wibox({
|
||||
position = "left",
|
||||
screen = s,
|
||||
width = 18
|
||||
})
|
||||
rightwibox[s] = awful.wibox({
|
||||
position = "right",
|
||||
screen = s,
|
||||
width = 18
|
||||
})
|
||||
|
||||
-- {{{ create layouts
|
||||
local left_bottom_layout = wibox.layout.fixed.horizontal()
|
||||
local left_top_layout = wibox.layout.fixed.horizontal()
|
||||
|
||||
local left_layout = wibox.layout.align.horizontal()
|
||||
left_layout:set_left(left_bottom_layout)
|
||||
left_layout:set_right(left_top_layout)
|
||||
|
||||
local right_bottom_layout = wibox.layout.fixed.horizontal()
|
||||
local right_top_layout = wibox.layout.fixed.horizontal()
|
||||
|
||||
local right_layout = wibox.layout.align.horizontal()
|
||||
right_layout:set_left(right_top_layout)
|
||||
right_layout:set_right(right_bottom_layout)
|
||||
--}}}
|
||||
|
||||
|
||||
-- {{{ rotate layouts and add to wibox
|
||||
local leftrotate = wibox.layout.rotate()
|
||||
leftrotate:set_direction('east')
|
||||
leftrotate:set_widget(left_layout)
|
||||
leftwibox[s]:set_widget(leftrotate)
|
||||
|
||||
local rightrotate = wibox.layout.rotate()
|
||||
rightrotate:set_direction('west')
|
||||
rightrotate:set_widget(right_layout)
|
||||
rightwibox[s]:set_widget(rightrotate)
|
||||
--}}}
|
||||
|
||||
|
||||
bars[s] = {}
|
||||
bars[s].left = {}
|
||||
bars[s].left.bottom = left_bottom_layout
|
||||
bars[s].left.top = left_top_layout
|
||||
bars[s].right = {}
|
||||
bars[s].right.bottom = right_bottom_layout
|
||||
bars[s].right.top = right_top_layout
|
||||
end
|
||||
end -- }}}
|
||||
widgets.setup = setup
|
||||
|
||||
-- }}}
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Utility {{{
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- force update of a widget
|
||||
local function update(widgetname, index) -- {{{
|
||||
for s = 1, screen.count() do
|
||||
if wlist[s] ~= nil and wlist[s][widgetname] ~= nil then
|
||||
if index ~= nil then
|
||||
vicious.force({ wlist[s][widgetname][index] })
|
||||
else
|
||||
vicious.force({ wlist[s][widgetname] })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--}}}
|
||||
widgets.update = update
|
||||
|
||||
-- get layout for adding widgets
|
||||
local function get_layout(screen, bar, align) --{{{
|
||||
if bars[screen][bar] == nil then return nil end
|
||||
|
||||
return bars[screen][bar][align]
|
||||
end --}}}
|
||||
widgets.layout = get_layout
|
||||
|
||||
-- }}}
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- widget creators {{{
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- mail widget
|
||||
local function mailwidget(name, screen, parent_layout, mailboxes) --{{{
|
||||
local widget = wibox.widget.textbox()
|
||||
local bg = wibox.widget.background()
|
||||
bg:set_widget(widget)
|
||||
vicious.register(widget, vicious.widgets.mdir, function(widget, args)
|
||||
if args[1] > 0 then
|
||||
naughty.notify({
|
||||
title = "New mail arrived",
|
||||
text = "Unread "..args[2].." / New "..args[1],
|
||||
position = "top_left"
|
||||
|
||||
})
|
||||
bg:set_bg(theme.bg_urgent)
|
||||
bg:set_fg(theme.fg_urgent)
|
||||
elseif args[2] > 0 then
|
||||
bg:set_bg(theme.bg_focus)
|
||||
bg:set_fg(theme.fg_focus)
|
||||
else
|
||||
bg:set_bg(theme.bg_normal)
|
||||
bg:set_fg(theme.fg_normal)
|
||||
end
|
||||
return "⬓⬓ Unread "..args[2].." / New "..args[1].. " "
|
||||
end, 0, mailboxes)
|
||||
wlist[screen][name] = widget
|
||||
parent_layout:add(bg)
|
||||
widgets.update(name)
|
||||
end
|
||||
--}}}
|
||||
widgets.add.mail = mailwidget
|
||||
|
||||
-- text clock
|
||||
local function clockwidget(name, screen, parent_layout) -- {{{
|
||||
wlist[screen][name] = awful.widget.textclock()
|
||||
parent_layout:add(wlist[screen][name])
|
||||
end
|
||||
--}}}
|
||||
widgets.add.clock = clockwidget
|
||||
|
||||
-- layoutbox
|
||||
local function layoutwidget(screen, parent_layout) -- {{{
|
||||
wlist[screen]["layout"] = awful.widget.layoutbox(s)
|
||||
parent_layout:add(wlist[screen]["layout"])
|
||||
end
|
||||
--}}}
|
||||
widgets.add.layout = layoutwidget
|
||||
|
||||
-- taglist
|
||||
local function taglistwidget(name, screen, parent_layout) --{{{
|
||||
-- Create a taglist widget
|
||||
wlist[screen][name] = awful.widget.taglist(screen,
|
||||
awful.widget.taglist.filter.all,
|
||||
mytaglist.buttons)
|
||||
parent_layout:add(wlist[screen][name])
|
||||
end --}}}
|
||||
widgets.add.taglist = taglistwidget
|
||||
|
||||
-- system tray
|
||||
-- not using a name argument, because only one systray is allowed
|
||||
local function systraywidget(screen, parent_layout) --{{{
|
||||
if (wlist["systray"] ~= nil) then
|
||||
return
|
||||
end
|
||||
wlist["systray"] = wibox.widget.systray()
|
||||
parent_layout:add(wlist["systray"])
|
||||
end --}}}
|
||||
widgets.add.systray = systraywidget
|
||||
|
||||
-- cpu usage
|
||||
local function cpuwidget(name, screen, parent_layout) --{{{
|
||||
wlist[screen][name] = wibox.widget.textbox()
|
||||
vicious.register(wlist[screen][name], vicious.widgets.cpu, "CPU: $1%")
|
||||
parent_layout:add(wlist[screen][name])
|
||||
end --}}}
|
||||
widgets.add.cpu = cpuwidget
|
||||
|
||||
-- battery
|
||||
local function batterywidget(name, screen, parent_layout, batname) --{{{
|
||||
print("creating batwidget '" .. name .. "' for battery '"..batname.."'")
|
||||
local widget = wibox.widget.textbox()
|
||||
local bg = wibox.widget.background()
|
||||
bg:set_widget(widget)
|
||||
vicious.register(widget, vicious.widgets.bat, function (widget, args)
|
||||
if args[2] == 0 then return ""
|
||||
else
|
||||
if args[2] < 15 then
|
||||
bg:set_bg(theme.bg_urgent)
|
||||
bg:set_fg(theme.fg_urgent)
|
||||
else
|
||||
bg:set_bg(theme.bg_normal)
|
||||
bg:set_fg(theme.fg_normal)
|
||||
end
|
||||
return name .. ": " ..
|
||||
args[1]..args[2].."% - "..args[3]
|
||||
end
|
||||
end, 61, batname)
|
||||
wlist[screen][name] = widget
|
||||
parent_layout:add(bg)
|
||||
widgets.update(name)
|
||||
end --}}}
|
||||
widgets.add.battery = batterywidget
|
||||
|
||||
-- wireless status
|
||||
local function wifiwidget(name, screen, parent_layout, interface) --{{{
|
||||
wlist[screen][name] = wibox.widget.textbox()
|
||||
vicious.register(wlist[screen][name], vicious.widgets.wifi,
|
||||
"WLAN ${ssid} @ ${sign}, Q:${link}/70", 31, interface)
|
||||
parent_layout:add(wlist[screen][name])
|
||||
end --}}}
|
||||
widgets.add.wifi = wifiwidget
|
||||
|
||||
-- }}}
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- spacers {{{
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
local spacer = wibox.widget.textbox()
|
||||
spacer:set_text(" ")
|
||||
|
||||
-- manual spacing between widgets
|
||||
local function spacerwidget(parent_layout) --{{{
|
||||
parent_layout:add(spacer)
|
||||
end --}}}
|
||||
widgets.add.spacer = spacerwidget
|
||||
|
||||
-- change appearance of spacers
|
||||
local function spacertext(text) --{{{
|
||||
spacer:set_text(text)
|
||||
end --}}}
|
||||
widgets.set_spacer_text = spacertext
|
||||
|
||||
-- }}}
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
return widgets
|
||||
|
||||
-- vim:foldmethod=marker
|
Before Width: | Height: | Size: 177 B |
Before Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 191 B |
Before Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 189 B |
Before Width: | Height: | Size: 199 B |
Before Width: | Height: | Size: 191 B |
Before Width: | Height: | Size: 276 B |
Before Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 189 B |
Before Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 188 B |
Before Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 211 B |
Before Width: | Height: | Size: 370 B |
Before Width: | Height: | Size: 210 B |
Before Width: | Height: | Size: 339 B |
Before Width: | Height: | Size: 361 B |
Before Width: | Height: | Size: 328 B |
Before Width: | Height: | Size: 202 B |
Before Width: | Height: | Size: 337 B |
Before Width: | Height: | Size: 369 B |
Before Width: | Height: | Size: 349 B |
Before Width: | Height: | Size: 188 B |
Before Width: | Height: | Size: 333 B |
Before Width: | Height: | Size: 349 B |
Before Width: | Height: | Size: 334 B |
Before Width: | Height: | Size: 199 B |
Before Width: | Height: | Size: 330 B |
Before Width: | Height: | Size: 361 B |
Before Width: | Height: | Size: 329 B |
Before Width: | Height: | Size: 9.3 KiB |