This commit is contained in:
crater2150 2013-04-13 17:17:09 +02:00
parent d4097316e1
commit b241b19f44
53 changed files with 1156 additions and 853 deletions

12
autobeautiful.lua Normal file
View 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

View file

@ -1,6 +1,15 @@
local aweswt = require("aweswt")
local mb = require("modalbind")
-- key bindings
local awful = awful
local conf = conf
local mpd = require("mpd")
local obvious = {}
local scratch = require("scratch")
obvious.popup_run_prompt = require("obvious.popup_run_prompt")
local modkey = conf.modkey or "Mod4"
local mb = require("modalbind")
local bindings = {mb = mb}
-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
@ -9,14 +18,16 @@ awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}
local function spawnf(cmd) return function() awful.util.spawn(cmd) end end
mpdmap = {
name = "MPD",
m = mpd.ctrl.toggle,
n = mpd.ctrl.next,
N = mpd.ctrl.prev,
s = function() awful.util.spawn("mpd") end,
g = function () awful.util.spawn(cmd.mpd_client) end
s = spawnf("mpd"),
S = spawnf("mpd --kill"),
g = spawnf(conf.cmd.mpd_client)
}
mpdpromts = {
name = "MPD PROMPTS",
@ -28,91 +39,49 @@ mpdpromts = {
progmap = {
name = "PROGRAMS",
f = function () awful.util.spawn(cmd.browser) end,
i = function () awful.util.spawn(cmd.im_client) end,
m = function () awful.util.spawn(cmd.mail_client) end
f = spawnf(conf.cmd.browser),
i = spawnf(conf.cmd.im_client),
I = spawnf(conf.cmd.irc_client),
m = spawnf(conf.cmd.mail_client)
}
-- {{{ 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),
adapters = { u = "wwan", w = "wlan", b = "bluetooth" }
function rfkill(cmd)
map={ name = string.upper(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
-- }
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),
awful.key({ }, "Menu", aweswt.switch),
--}}}
--{{{ 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),
--}}}
function bindings.extend_and_register_key_table(globalkeys)
local totalkeys = globalkeys or {}
totalkeys = awful.util.table.join(totalkeys,
awful.key({ }, "Menu", spawnf('wmselect')),
awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Shift" }, "q", awesome.quit),
awful.key({ modkey, }, "Return", function () awful.util.spawn(cmd.terminal) end),
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),
--}}}
--{{{ 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({ }, "XF86AudioMute", function () awful.util.spawn("amixer set Master toggle") 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),
awful.key({ }, "XF86AudioPrev", mpd.ctrl.prev),
@ -120,38 +89,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("urxvtc -e alsamixer","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("urxvtc -e ncmpcpp","bottom","center", 0.99, 0.4)
end ),
awful.key({ }, "Print", function ()
scratch.drop("galsamixer","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", spawnf("dmenu_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
@ -165,7 +134,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),
@ -181,60 +149,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 :

188
boxes.lua
View file

@ -1,188 +0,0 @@
local wibox = require("wibox")
function exists(filename)
local file = io.open(filename)
if file then
io.close(file)
return true
else
return false
end
end
-- {{{ Reusable separators
spacer = wibox.widget.textbox({ name = "spacer" })
spacer.set_text(" ")
nullwidget = wibox.widget.textbox({ name = "nullwidget" })
-- }}}
-- {{{ Wibox
--popup run
-- Create a textclock widget
--clock = awful.widget.textclock({ align = "right" })
mysystray = wibox.widget.systray()
clock = wibox.widget.textbox()
vicious.register(clock, vicious.widgets.date, "%b %d, %R", 60)
-- music widget {{{
mpdwidget = wibox.widget.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")})
-- }}}
-- mail widget {{{
mailwidget = wibox.widget.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 = wibox.widget.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 = wibox.widget.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 = wibox.widget.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 = wibox.widget.textbox()
vicious.register(cpulabel, vicious.widgets.cpu, "CPU: $1%")
if exists("/sys/class/net/wlan0") then
wlanwidget = wibox.widget.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
View 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
-- }}}

90
layouts.lua Normal file
View 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)

View file

@ -4,7 +4,153 @@ local modewidget = {}
local modewibox = { screen = -1 }
--local functions
local ensure_init, set_default, update_settings, show_box, hide_box
local defaults = {}
defaults.opacity = 1.0
defaults.height = 22
defaults.border_width = 1
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
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
--- Change the opacity of the modebox.
-- @param amount opacity between 0.0 and 1.0, or nil to use default
M.set_opacity = function (amount)
settings.opacity = amount or defaults.opacity
update_settings()
end
--- Change height of the modebox.
-- @param amount height in pixels, or nil to use default
M.set_height = function (amount)
settings.height = amount or defaults.height
update_settings()
end
--- Change border width of the modebox.
-- @param amount width in pixels, or nil to use default
M.set_border_width = function (amount)
settings.border_width = amount or defaults.border_width
update_settings()
end
--- 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
M.set_x_offset = function (amount)
settings.x_offset = amount or defaults.x_offset
update_settings()
end
--- 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
M.set_y_offset = function (amount)
settings.y_offset = amount or defaults.y_offset
update_settings()
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
M.set_corner = function (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
M.set_show_options = function (bool)
settings.show_options = bool
end
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
modewibox[s].y = screen[s].geometry.height - settings.height
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
local function show_box(s, map)
ensure_init()
modewibox.screen = s
local label = " -- " .. map.name .. " -- "
if settings.show_options then
for key in pairs(map) do
if key ~= "name" then label = label .. " " .. key end
end
end
modewidget[s]:set_text(label)
modewibox[s].visible = true
set_default(s)
end
local function hide_box()
local s = modewibox.screen
if s ~= -1 then modewibox[s].visible = false end
end
M.grab = function(keymap, stay_in_mode)
if keymap.name then show_box(mouse.screen, keymap) end
@ -31,118 +177,10 @@ M.grab = function(keymap, stay_in_mode)
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.show_options = true
-- Clone the defaults for the used settings
local settings = {}
for key, value in pairs(defaults) do
settings[key] = value
M.grabf = function(keymap, stay_in_mode)
return function() M.grab(keymap, stay_in_mode) end
end
M.set_opacity = function (amount)
settings.opacity = amount or defaults.opacity
update_settings()
end
M.set_height = function (amount)
settings.height = amount or defaults.height
update_settings()
end
M.set_border_width = function (amount)
settings.border_width = amount or defaults.border_width
update_settings()
end
M.set_x_offset = function (amount)
settings.x_offset = amount or defaults.x_offset
update_settings()
end
M.set_show_options = function (bool)
settings.show_options = bool
end
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
end
set_default = function (s)
modewibox[s]:geometry({
width = modewidget[s].extents(modewidget[s]).width,
height = settings.height,
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
})
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
end
show_box = function (s, map)
ensure_init()
modewibox.screen = s
local label = " -- " .. map.name .. " -- "
if settings.show_options then
for key in pairs(map) do
if key ~= "name" then label = label .. " " .. key end
end
end
modewidget[s].text = label
set_default(s)
modewibox[s].visible = true
end
hide_box = function ()
local s = modewibox.screen
if s ~= -1 then modewibox[s].visible = false end
end
M.wibox = function() return modewibox[1] end
return M

View file

@ -2,6 +2,7 @@
require "mpdc"
local M = {}
local type = ""
local conf = conf
-- local functions
local show, mpc_play_search, notify
@ -74,9 +75,9 @@ 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 = {}

@ -1 +1 @@
Subproject commit dccf3cb530ff250c0e5db363d04e1ef803cb3808
Subproject commit c5b884459194a15a38b88c99d5558a64efaf4e89

92
rc.lua
View file

@ -1,38 +1,68 @@
-- 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")
-- }}}
-- 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/"
-- {{{ Tags
dofile (MY_PATH .. "localconf.lua")
tags = require('tags')
tags.setup()
-- }}}
-- Themes define colours, icons, and wallpapers
beautiful.init("/home/crater2150/.config/awesome/zenburn/theme.lua")
-- {{{ 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")
-- {{{
widgets.add.mail(s, ltop, { os.getenv("HOME") .. "/.maildir/" })
widgets.add.spacer(ltop)
widgets.add.clock(s, ltop)
-- 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
}
widgets.add.layout(s, lbottom)
widgets.add.taglist(s, lbottom)
dofile (MY_PATH .. "tags.lua")
dofile (MY_PATH .. "wibox.lua")
dofile (MY_PATH .. "bindings.lua")
dofile (MY_PATH .. "rules.lua")
dofile (MY_PATH .. "signals.lua")
-- dofile (MY_PATH .. "uzbl.lua")
widgets.add.cpu(s, rtop)
widgets.add.spacer(rtop)
widgets.add.battery(s, rtop, "BAT0")
widgets.add.spacer(rtop)
widgets.add.battery(s, rtop, "BAT1")
widgets.add.spacer(rtop)
widgets.add.wifi(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

216
rules.lua
View file

@ -1,67 +1,151 @@
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 = "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 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_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
}
},
{
rule = { role = "buddy_list" },
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 = "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 = { class = "Gvim" },
properties = {
opacity = 0.9
}
},
{
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)

View file

@ -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
View 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
View 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

View file

@ -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)

128
tags.lua
View file

@ -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)

View file

@ -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"

@ -1 +1 @@
Subproject commit dcc2b60cd85dabd716e2bb8c49d9703f050eaff5
Subproject commit c316528698906fe5ce92a20b4de5863b1c1ab31b

201
wibox.lua
View file

@ -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

266
widgets.lua Normal file
View file

@ -0,0 +1,266 @@
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(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]["mail"] = widget
parent_layout:add(bg)
widgets.update("mail")
end
--}}}
widgets.add.mail = mailwidget
-- text clock
local function clockwidget(screen, parent_layout) -- {{{
wlist[screen]["clock"] = awful.widget.textclock()
parent_layout:add(wlist[screen]["clock"])
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(screen, parent_layout) --{{{
-- Create a taglist widget
wlist[screen]["taglist"] = awful.widget.taglist(screen,
awful.widget.taglist.filter.all,
mytaglist.buttons)
parent_layout:add(wlist[screen]["taglist"])
end --}}}
widgets.add.taglist = taglistwidget
-- system tray
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(screen, parent_layout) --{{{
wlist[screen]["cpu"] = wibox.widget.textbox()
vicious.register(wlist[screen]["cpu"], vicious.widgets.cpu, "CPU: $1%")
parent_layout:add(wlist[screen]["cpu"])
end --}}}
widgets.add.cpu = cpuwidget
-- battery
local function batterywidget(screen, parent_layout, batname) --{{{
if(wlist[screen]["bat"] == nil) then
wlist[screen]["bat"] = {}
end
-- more than one batwidget is possible
local batwidget = wibox.widget.textbox()
local bg = wibox.widget.background()
bg:set_widget(batwidget)
table.insert(wlist[screen]["bat"], batwidget)
vicious.register(batwidget, 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 batname .. ": " ..
args[1]..args[2].."% - "..args[3]
end
end, 61, batname)
parent_layout:add(bg)
end --}}}
widgets.add.battery = batterywidget
-- wireless status
local function wifiwidget(screen, parent_layout, interface) --{{{
wlist[screen]["wifi"] = wibox.widget.textbox()
vicious.register(wlist[screen]["wifi"], vicious.widgets.wifi,
"WLAN ${ssid} @ ${sign}, Q:${link}/70", 31, interface)
parent_layout:add(wlist[screen]["wifi"])
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB