2013-09-13 19:20:22 +00:00
|
|
|
--[[
|
2013-07-26 19:11:19 +00:00
|
|
|
|
2014-05-10 22:24:30 +00:00
|
|
|
Rainbow Awesome WM config 2.0
|
|
|
|
github.com/copycat-killer
|
|
|
|
|
2013-09-13 19:20:22 +00:00
|
|
|
--]]
|
2013-07-26 19:11:19 +00:00
|
|
|
|
2013-09-13 19:20:22 +00:00
|
|
|
-- {{{ Required libraries
|
2013-08-16 17:44:55 +00:00
|
|
|
local gears = require("gears")
|
|
|
|
local awful = require("awful")
|
|
|
|
awful.rules = require("awful.rules")
|
2013-09-13 19:20:22 +00:00
|
|
|
require("awful.autofocus")
|
2013-08-16 17:44:55 +00:00
|
|
|
local wibox = require("wibox")
|
|
|
|
local beautiful = require("beautiful")
|
|
|
|
local naughty = require("naughty")
|
2013-09-13 19:20:22 +00:00
|
|
|
local lain = require("lain")
|
2013-07-26 19:11:19 +00:00
|
|
|
-- }}}
|
|
|
|
|
2014-05-11 00:15:20 +00:00
|
|
|
-- Error handling
|
|
|
|
require("myrc.errors")
|
2013-09-13 19:20:22 +00:00
|
|
|
|
2014-05-10 22:24:30 +00:00
|
|
|
-- STARTUP apps
|
|
|
|
require("settings.startup")
|
2013-07-26 19:11:19 +00:00
|
|
|
|
2013-09-13 19:20:22 +00:00
|
|
|
-- {{{ Variable definitions
|
|
|
|
-- localization
|
|
|
|
os.setlocale(os.getenv("LANG"))
|
2013-07-26 19:11:19 +00:00
|
|
|
|
2013-09-13 19:20:22 +00:00
|
|
|
-- beautiful init
|
2013-11-24 15:31:33 +00:00
|
|
|
beautiful.init(os.getenv("HOME") .. "/.config/awesome/themes/rainbow/theme.lua")
|
2013-07-26 19:11:19 +00:00
|
|
|
|
2013-09-13 19:20:22 +00:00
|
|
|
-- common
|
|
|
|
modkey = "Mod4"
|
|
|
|
altkey = "Mod1"
|
|
|
|
terminal = "urxvtc" or "xterm"
|
|
|
|
editor = os.getenv("EDITOR") or "nano" or "vi"
|
2013-07-26 19:11:19 +00:00
|
|
|
editor_cmd = terminal .. " -e " .. editor
|
|
|
|
|
2013-09-13 19:20:22 +00:00
|
|
|
-- user defined
|
|
|
|
browser = "dwb"
|
|
|
|
browser2 = "iron"
|
|
|
|
gui_editor = "gvim"
|
|
|
|
graphics = "gimp"
|
|
|
|
|
|
|
|
-- lain
|
|
|
|
lain.layout.termfair.nmaster = 3
|
|
|
|
lain.layout.termfair.ncol = 1
|
|
|
|
|
2014-05-11 22:02:36 +00:00
|
|
|
layouts = {
|
2013-09-13 19:20:22 +00:00
|
|
|
awful.layout.suit.floating,
|
|
|
|
awful.layout.suit.fair,
|
|
|
|
awful.layout.suit.tile,
|
|
|
|
lain.layout.uselessfair.horizontal,
|
|
|
|
lain.layout.uselesstile,
|
|
|
|
lain.layout.uselessfair,
|
|
|
|
lain.layout.termfair,
|
|
|
|
lain.layout.uselesspiral.dwindle
|
2013-07-26 19:11:19 +00:00
|
|
|
}
|
2013-09-13 19:20:22 +00:00
|
|
|
-- }}}
|
2013-07-26 19:11:19 +00:00
|
|
|
|
2013-09-13 19:20:22 +00:00
|
|
|
-- {{{ Tags
|
|
|
|
tags = {
|
|
|
|
names = { "www", "dev", "docs", "media" },
|
|
|
|
layout = { layouts[1], layouts[2], layouts[3], layouts[4] }
|
|
|
|
}
|
|
|
|
for s = 1, screen.count() do
|
|
|
|
tags[s] = awful.tag(tags.names, s, tags.layout)
|
|
|
|
end
|
2013-07-26 19:11:19 +00:00
|
|
|
-- }}}
|
|
|
|
|
|
|
|
-- {{{ Wallpaper
|
|
|
|
if beautiful.wallpaper then
|
|
|
|
for s = 1, screen.count() do
|
|
|
|
gears.wallpaper.maximized(beautiful.wallpaper, s, true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
-- }}}
|
|
|
|
|
|
|
|
-- {{{ Menu
|
2013-09-13 19:20:22 +00:00
|
|
|
require("freedesktop/freedesktop")
|
2013-07-26 19:11:19 +00:00
|
|
|
-- }}}
|
|
|
|
|
|
|
|
-- {{{ Wibox
|
2013-09-13 19:20:22 +00:00
|
|
|
markup = lain.util.markup
|
|
|
|
white = beautiful.fg_focus
|
|
|
|
gray = beautiful.fg_normal
|
|
|
|
|
|
|
|
-- Textclock
|
|
|
|
mytextclock = awful.widget.textclock(markup.font("Tamsyn 3", " ") ..
|
|
|
|
markup(white, " %H:%M "))
|
|
|
|
|
|
|
|
-- Calendar
|
|
|
|
lain.widgets.calendar:attach(mytextclock, { fg = beautiful.fg_focus })
|
|
|
|
|
|
|
|
--[[ Mail IMAP check
|
|
|
|
-- commented because it needs to be set before use
|
|
|
|
mailwidget = lain.widgets.imap({
|
|
|
|
timeout = 180,
|
|
|
|
server = "server",
|
|
|
|
mail = "mail",
|
|
|
|
password = "keyring get mail",
|
|
|
|
settings = function()
|
|
|
|
mail_notification_preset.fg = white
|
|
|
|
|
|
|
|
mail = ""
|
|
|
|
count = ""
|
|
|
|
|
|
|
|
if mailcount > 0 then
|
2014-04-12 16:02:00 +00:00
|
|
|
mail = "Mail "
|
2013-09-13 19:20:22 +00:00
|
|
|
count = mailcount .. " "
|
|
|
|
end
|
2013-07-26 19:11:19 +00:00
|
|
|
|
2013-09-13 19:20:22 +00:00
|
|
|
widget:set_markup(markup(gray, mail) .. markup(white, count))
|
2013-07-26 19:11:19 +00:00
|
|
|
end
|
2013-09-13 19:20:22 +00:00
|
|
|
})
|
|
|
|
]]
|
|
|
|
|
|
|
|
-- MPD
|
|
|
|
mpdwidget = lain.widgets.mpd({
|
|
|
|
settings = function()
|
|
|
|
mpd_notification_preset.fg = white
|
|
|
|
|
|
|
|
artist = mpd_now.artist .. " "
|
|
|
|
title = mpd_now.title .. " "
|
|
|
|
|
|
|
|
if mpd_now.state == "pause" then
|
|
|
|
artist = "mpd "
|
|
|
|
title = "paused "
|
|
|
|
elseif mpd_now.state == "stop" then
|
|
|
|
artist = ""
|
|
|
|
title = ""
|
|
|
|
end
|
2013-07-26 19:11:19 +00:00
|
|
|
|
2013-09-13 19:20:22 +00:00
|
|
|
widget:set_markup(markup(gray, artist) .. markup(white, title))
|
2013-07-26 19:11:19 +00:00
|
|
|
end
|
2013-09-13 19:20:22 +00:00
|
|
|
})
|
2013-07-26 19:11:19 +00:00
|
|
|
|
2013-09-13 19:20:22 +00:00
|
|
|
-- /home fs
|
|
|
|
fshome = lain.widgets.fs({
|
|
|
|
partition = "/home",
|
|
|
|
settings = function()
|
|
|
|
fs_notification_preset.fg = white
|
2013-07-26 19:11:19 +00:00
|
|
|
|
2013-09-13 19:20:22 +00:00
|
|
|
hdd = ""
|
|
|
|
p = ""
|
2013-07-26 19:11:19 +00:00
|
|
|
|
2013-10-02 14:25:08 +00:00
|
|
|
if fs_now.used >= 90 then
|
2013-09-13 19:20:22 +00:00
|
|
|
hdd = " Hdd "
|
2013-10-02 14:25:08 +00:00
|
|
|
p = fs_now.used .. " "
|
2013-09-13 19:20:22 +00:00
|
|
|
end
|
2013-07-26 19:11:19 +00:00
|
|
|
|
2013-09-13 19:20:22 +00:00
|
|
|
widget:set_markup(markup(gray, hdd) .. markup(white, p))
|
|
|
|
end
|
|
|
|
})
|
2013-07-26 19:11:19 +00:00
|
|
|
|
2013-09-13 19:20:22 +00:00
|
|
|
-- ALSA volume bar
|
2014-01-14 09:12:29 +00:00
|
|
|
volume = lain.widgets.alsabar({ ticks = true })
|
2013-09-13 21:08:18 +00:00
|
|
|
volmargin = wibox.layout.margin(volume.bar, 5, 8, 80)
|
2013-09-13 19:20:22 +00:00
|
|
|
volmargin:set_top(7)
|
|
|
|
volmargin:set_bottom(7)
|
2013-09-13 21:08:18 +00:00
|
|
|
volumewidget = wibox.widget.background(volmargin)
|
|
|
|
volumewidget:set_bgimage(beautiful.vol_bg)
|
2013-07-26 19:11:19 +00:00
|
|
|
|
2013-09-13 19:20:22 +00:00
|
|
|
-- Weather
|
|
|
|
yawn = lain.widgets.yawn(123456,
|
2013-07-26 19:11:19 +00:00
|
|
|
{
|
2013-09-13 19:20:22 +00:00
|
|
|
settings = function()
|
|
|
|
yawn_notification_preset.fg = white
|
2013-07-26 19:11:19 +00:00
|
|
|
end
|
2013-09-13 19:20:22 +00:00
|
|
|
})
|
2013-07-26 19:11:19 +00:00
|
|
|
|
|
|
|
-- Separators
|
|
|
|
spr = wibox.widget.textbox(' ')
|
|
|
|
small_spr = wibox.widget.textbox('<span font="Tamsyn 4"> </span>')
|
2013-09-13 19:20:22 +00:00
|
|
|
med_spr = wibox.widget.textbox('<span font="Tamsyn 7"> </span>')
|
2013-07-26 19:11:19 +00:00
|
|
|
|
|
|
|
-- Create a wibox for each screen and add it
|
|
|
|
mywibox = {}
|
|
|
|
mypromptbox = {}
|
|
|
|
txtlayoutbox = {}
|
2014-05-11 23:58:00 +00:00
|
|
|
require("stock.taglist")
|
|
|
|
require("stock.tasklist")
|
2013-07-26 19:11:19 +00:00
|
|
|
|
|
|
|
-- Writes a string representation of the current layout in a textbox widget
|
|
|
|
function updatelayoutbox(layout, s)
|
|
|
|
local screen = s or 1
|
2013-09-13 19:20:22 +00:00
|
|
|
local txt_l = beautiful["layout_txt_" .. awful.layout.getname(awful.layout.get(screen))] or ""
|
2013-08-16 12:19:48 +00:00
|
|
|
layout:set_text(txt_l)
|
2013-07-26 19:11:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
for s = 1, screen.count() do
|
|
|
|
-- Create a promptbox for each screen
|
|
|
|
mypromptbox[s] = awful.widget.prompt()
|
|
|
|
|
|
|
|
-- Create a textbox widget which will contains a short string representing the
|
|
|
|
-- layout we're using. We need one layoutbox per screen.
|
|
|
|
txtlayoutbox[s] = wibox.widget.textbox(beautiful["layout_txt_" .. awful.layout.getname(awful.layout.get(s))])
|
|
|
|
awful.tag.attached_connect_signal(s, "property::selected", function ()
|
2013-09-13 19:20:22 +00:00
|
|
|
updatelayoutbox(txtlayoutbox[s], s)
|
2013-07-26 19:11:19 +00:00
|
|
|
end)
|
|
|
|
awful.tag.attached_connect_signal(s, "property::layout", function ()
|
2013-09-13 19:20:22 +00:00
|
|
|
updatelayoutbox(txtlayoutbox[s], s)
|
2013-07-26 19:11:19 +00:00
|
|
|
end)
|
|
|
|
txtlayoutbox[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.filter.all, mytaglist.buttons)
|
|
|
|
|
|
|
|
-- Create a tasklist widget
|
|
|
|
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
|
2013-09-13 19:20:22 +00:00
|
|
|
|
2013-07-26 19:11:19 +00:00
|
|
|
-- Create the wibox
|
|
|
|
mywibox[s] = awful.wibox({ position = "top", screen = s, height = 18 })
|
|
|
|
|
2013-09-13 19:20:22 +00:00
|
|
|
-- Widgets that are aligned to the left
|
2013-07-26 19:11:19 +00:00
|
|
|
local left_layout = wibox.layout.fixed.horizontal()
|
|
|
|
left_layout:add(small_spr)
|
|
|
|
left_layout:add(mytaglist[s])
|
|
|
|
left_layout:add(spr)
|
|
|
|
left_layout:add(txtlayoutbox[s])
|
|
|
|
left_layout:add(spr)
|
|
|
|
left_layout:add(mypromptbox[s])
|
|
|
|
|
2013-09-13 19:20:22 +00:00
|
|
|
-- Widgets that are aligned to the right
|
2013-07-26 19:11:19 +00:00
|
|
|
local right_layout = wibox.layout.fixed.horizontal()
|
|
|
|
if s == 1 then right_layout:add(wibox.widget.systray()) end
|
|
|
|
right_layout:add(small_spr)
|
|
|
|
right_layout:add(mpdwidget)
|
2013-09-13 19:20:22 +00:00
|
|
|
--right_layout:add(mailwidget)
|
|
|
|
right_layout:add(fshome)
|
|
|
|
right_layout:add(med_spr)
|
|
|
|
right_layout:add(volumewidget)
|
2013-07-26 19:11:19 +00:00
|
|
|
right_layout:add(mytextclock)
|
|
|
|
|
|
|
|
-- Now bring it all together (with the tasklist in the middle)
|
|
|
|
local layout = wibox.layout.align.horizontal()
|
|
|
|
layout:set_left(left_layout)
|
|
|
|
layout:set_middle(mytasklist[s])
|
|
|
|
layout:set_right(right_layout)
|
|
|
|
|
|
|
|
mywibox[s]:set_widget(layout)
|
|
|
|
end
|
|
|
|
-- }}}
|
|
|
|
|
2014-05-11 20:53:37 +00:00
|
|
|
-- Bindings
|
|
|
|
require("settings.binds")
|
2013-07-26 19:11:19 +00:00
|
|
|
|
|
|
|
-- {{{ Key bindings
|
2014-05-11 21:27:50 +00:00
|
|
|
globalkeys = awful.util.table.join(globalkeys,
|
2013-07-26 19:11:19 +00:00
|
|
|
-- Show/Hide Wibox
|
|
|
|
awful.key({ modkey }, "b", function ()
|
|
|
|
mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible
|
|
|
|
end),
|
|
|
|
|
2013-09-19 18:54:11 +00:00
|
|
|
-- On the fly useless gaps change
|
|
|
|
awful.key({ altkey, "Control" }, "+", function () lain.util.useless_gaps_resize(1) end),
|
|
|
|
awful.key({ altkey, "Control" }, "-", function () lain.util.useless_gaps_resize(-1) end),
|
|
|
|
|
2013-07-26 19:11:19 +00:00
|
|
|
-- Widgets popups
|
2013-09-13 19:20:22 +00:00
|
|
|
awful.key({ altkey, }, "c", function () lain.widgets.calendar:show(7) end),
|
|
|
|
awful.key({ altkey, }, "h", function () fshome.show(7) end),
|
|
|
|
awful.key({ altkey, }, "w", function () yawn.show(7) end),
|
|
|
|
|
|
|
|
-- ALSA volume control
|
|
|
|
awful.key({ altkey }, "Up",
|
|
|
|
function ()
|
|
|
|
awful.util.spawn("amixer -q set " .. volume.channel .. " " .. volume.step .. "+")
|
2013-09-13 21:08:18 +00:00
|
|
|
volume.notify()
|
2013-09-13 19:20:22 +00:00
|
|
|
end),
|
|
|
|
awful.key({ altkey }, "Down",
|
|
|
|
function ()
|
|
|
|
awful.util.spawn("amixer -q set " .. volume.channel .. " " .. volume.step .. "-")
|
2013-09-13 21:08:18 +00:00
|
|
|
volume.notify()
|
2013-09-13 19:20:22 +00:00
|
|
|
end),
|
|
|
|
awful.key({ altkey }, "m",
|
|
|
|
function ()
|
|
|
|
awful.util.spawn("amixer -q set " .. volume.channel .. " playback toggle")
|
2013-09-13 21:08:18 +00:00
|
|
|
volume.notify()
|
2013-09-13 19:20:22 +00:00
|
|
|
end),
|
|
|
|
awful.key({ altkey, "Control" }, "m",
|
|
|
|
function ()
|
|
|
|
awful.util.spawn("amixer -q set " .. volume.channel .. " playback 100%")
|
2013-09-13 21:08:18 +00:00
|
|
|
volume.notify()
|
2014-05-11 23:05:24 +00:00
|
|
|
end)
|
2013-07-26 19:11:19 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
-- Set keys
|
|
|
|
root.keys(globalkeys)
|
|
|
|
-- }}}
|
|
|
|
|
2014-05-11 00:06:54 +00:00
|
|
|
-- Rules
|
|
|
|
require("settings.rules")
|
2013-07-26 19:11:19 +00:00
|
|
|
|
2014-05-11 20:28:00 +00:00
|
|
|
-- Signals
|
2014-05-11 23:17:50 +00:00
|
|
|
require("stock.signals")
|