diff options
author | David Robillard <d@drobilla.net> | 2014-12-02 20:44:46 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-12-02 23:57:09 -0500 |
commit | 114ee9aa4f683ed8b16c4ae09027daf248362774 (patch) | |
tree | 05f517041a6cbda770d8f3b182f1e14546cf1c04 /awesome | |
parent | ea5710ddce1b45a6604ecee4705d060b53c4b871 (diff) | |
download | dotfiles-114ee9aa4f683ed8b16c4ae09027daf248362774.tar.gz dotfiles-114ee9aa4f683ed8b16c4ae09027daf248362774.tar.bz2 dotfiles-114ee9aa4f683ed8b16c4ae09027daf248362774.zip |
Update awesome configuration.
Diffstat (limited to 'awesome')
-rw-r--r-- | awesome/rc.lua | 197 | ||||
-rw-r--r-- | awesome/theme/theme.lua | 27 |
2 files changed, 116 insertions, 108 deletions
diff --git a/awesome/rc.lua b/awesome/rc.lua index 6168ee4..fa8b7c0 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -16,16 +16,45 @@ require("vicious") -- Load Debian menu entries require("debian.menu") +-- {{{ 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.add_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 +-- }}} + -- {{{ Variable definitions -- Themes define colours, icons, and wallpapers beautiful.init("/home/drobilla/.config/awesome/theme/theme.lua") -- This is used later as the default terminal and editor to run. -terminal = "gnome-terminal" +terminal = "x-terminal-emulator" editor = os.getenv("EDITOR") or "editor" editor_cmd = terminal .. " -e " .. editor --- Modifier key +-- Default modkey. +-- Usually, Mod4 is the key with a logo between Control and Alt. +-- If you do not like this or do not have such a key, +-- I suggest you to remap Mod4 to another key using xmodmap or other tools. +-- However, you can use another modifier like Mod1, but it may interact with others. modkey = "Mod4" -- Table of layouts to cover with awful.layout.inc, order matters. @@ -47,11 +76,11 @@ layouts = -- }}} -- {{{ Tags --- Define tags table +-- Define a tag table which hold all screen tags. tags = {} for s = 1, screen.count() do -- Each screen has its own tag table. - tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }, s, layouts[1]) + tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[1]) end -- }}} @@ -59,7 +88,7 @@ end -- Create a laucher widget and a main menu myawesomemenu = { { "Manual", terminal .. " -e man awesome" }, - { "Configure", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" }, + { "Configure", editor_cmd .. " " .. awesome.conffile }, { "Restart", awesome.restart }, { "Quit", awesome.quit } } @@ -78,11 +107,10 @@ mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), -- {{{ Wibox -- Text clock ---mytextclock = awful.widget.textclock({ align = "right" }) mytextclock = awful.widget.textclock({ align = "right"}, - "%a %d %b %H:%M", - 10) - + "%a %d %b %H:%M", + 10) + -- {{{ Reusable separator (space) separator = widget({ type = "textbox" }) separator.text = " " @@ -125,7 +153,7 @@ vicious.register(ethwidget, vicious.widgets.net, '/<span color="#8F8">${eth0 up_kb}</span>', 4) wlanwidget = widget({ type = "textbox" }) vicious.register(wlanwidget, vicious.widgets.net, -'Wlan <span color="#F88">${wlan0 down_kb}</span>' .. +'Wifi <span color="#F88">${wlan0 down_kb}</span>' .. '/<span color="#8F8">${wlan0 up_kb}</span>', 4) -- Systray @@ -148,11 +176,17 @@ mytaglist.buttons = awful.util.table.join( mytasklist = {} mytasklist.buttons = awful.util.table.join( awful.button({ }, 1, function (c) - if not c:isvisible() then - awful.tag.viewonly(c:tags()[1]) + 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 - client.focus = c - c:raise() end), awful.button({ }, 3, function () if instance then @@ -180,19 +214,6 @@ for s = 1, screen.count() do vicious.cache(vicious.widgets.cpu) vicious.register(cpuwidget, vicious.widgets.cpu, "$1", 1) - -- freqwidgets = {} - -- for c = 0, 3 do - -- freqwidgets[c] = awful.widget.progressbar() - -- freqwidgets[c]:set_width(4) - -- freqwidgets[c]:set_vertical(true) - -- freqwidgets[c]:set_value(0.0) - -- freqwidgets[c]:set_background_color('#525242') - -- freqwidgets[c]:set_color('#929252') - -- vicious.register(freqwidgets[c], vicious.widgets.cpufreq, - -- function (widget, args) freqwidgets[c]:set_value(args[2] / 2.7) end, - -- 1, "cpu" .. c) - -- end - -- Memory usage graph memwidget = awful.widget.graph() memwidget:set_width(32) @@ -225,27 +246,19 @@ for s = 1, screen.count() do mywibox[s].widgets = { { mylauncher, separator, - cpuwidget, -- separator, freqwidgets[0], separator, freqwidgets[1], separator, freqwidgets[2], separator, freqwidgets[3], - separator, memwidget, separator, - bar, - tempwidget, - bar, - ethwidget, - bar, - wlanwidget, -- separator, ethwidget, - bar, - mytaglist[s], - bar, - mypromptbox[s], + mytaglist[s], separator, + cpuwidget, separator, + memwidget, separator, bar, + tempwidget, bar, + ethwidget, bar, + wlanwidget, bar, + mypromptbox[s], separator, layout = awful.widget.layout.horizontal.leftright }, - mylayoutbox[s], - separator, - mytextclock, - separator, - s == 1 and mysystray or nil, - bar, - mytasklist[s], + mylayoutbox[s], separator, + mytextclock, separator, + s == 1 and mysystray or nil, separator, + mytasklist[s], separator, layout = awful.widget.layout.horizontal.rightleft } end @@ -292,8 +305,8 @@ globalkeys = awful.util.table.join( -- Standard program awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), - awful.key({ modkey, }, "\\", function () awful.util.spawn("nautilus -n --no-desktop /home/drobilla") end), - --awful.key({ modkey, "Control" }, "r", awesome.restart), + awful.key({ modkey, }, "\\", function () awful.util.spawn("nautilus -n --no-desktop") end), + awful.key({ modkey, "Shift" }, "r", awesome.restart), --awful.key({ modkey, "Shift" }, "q", awesome.quit), awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), @@ -304,17 +317,17 @@ globalkeys = awful.util.table.join( awful.key({ modkey, }, "Left", function () awful.tag.incncol(-1) end), awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), - - -- Run browser - awful.key({ modkey, "Control" }, "b", function () awful.util.spawn("sensible-browser") end), + + -- Run browser + awful.key({ modkey, "Control" }, "b", function () awful.util.spawn("sensible-browser") end), -- Prompt awful.key({ modkey, "Control" }, "r", function () mypromptbox[mouse.screen]:run() end), - -- Toggle bar + -- Toggle bar awful.key({ modkey }, "b", function () - if mywibox[mouse.screen].screen == nil then + if mywibox[mouse.screen].screen == nil then mywibox[mouse.screen].screen = mouse.screen else mywibox[mouse.screen].screen = nil @@ -324,7 +337,7 @@ globalkeys = awful.util.table.join( -- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them clientkeys = awful.util.table.join( - awful.key({ modkey, "Control" }, "f", function (c) c.fullscreen = not c.fullscreen end), + awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end), awful.key({ modkey, "Control" }, "c", function (c) c:kill() end), awful.key({ modkey, "Control" }, "l", awful.client.floating.toggle ), awful.key({ modkey, "Control" }, "m", function (c) c:swap(awful.client.getmaster()) end), @@ -338,32 +351,43 @@ clientkeys = awful.util.table.join( end) ) --- Tag switching key bindings -keys = { - [1] = "q", [2] = "w", [3] = "e", [4] = "r", - [5] = "a", [6] = "s", [7] = "d", [8] = "f", - [9] = "z", [10] = "x", [11] = "c", [12] = "v" -} -for i = 1, 12 do - keychar = keys[i] - +-- Compute the maximum number of digit we need, limited to 9 +keynumber = 0 +for s = 1, screen.count() do + keynumber = math.min(9, 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. +for i = 1, keynumber do globalkeys = awful.util.table.join(globalkeys, - -- Show only tag - awful.key({ modkey }, keychar, - function () - local screen = mouse.screen - if tags[screen][i] then - awful.tag.viewonly(tags[screen][i]) - end - end), - - -- Move to tag - awful.key({ modkey, "Shift" }, keychar, - function () - if client.focus and tags[client.focus.screen][i] then - awful.client.movetotag(tags[client.focus.screen][i]) - end - end)) + awful.key({ modkey }, "#" .. i + 9, + function () + local screen = mouse.screen + if tags[screen][i] then + awful.tag.viewonly(tags[screen][i]) + end + end), + awful.key({ modkey, "Control" }, "#" .. i + 9, + function () + local screen = mouse.screen + if tags[screen][i] then + awful.tag.viewtoggle(tags[screen][i]) + end + end), + awful.key({ modkey, "Shift" }, "#" .. i + 9, + function () + if client.focus and tags[client.focus.screen][i] then + awful.client.movetotag(tags[client.focus.screen][i]) + end + end), + awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, + function () + if client.focus and tags[client.focus.screen][i] then + awful.client.toggletag(tags[client.focus.screen][i]) + end + end)) end clientbuttons = awful.util.table.join( @@ -425,19 +449,4 @@ 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) - --- {{{ Arrange signal handler -for s = 1, screen.count() do screen[s]:add_signal("arrange", function () - local clients = awful.client.visible(s) - local layout = awful.layout.getname(awful.layout.get(s)) - - for _, c in pairs(clients) do -- Floaters are always on top - if awful.client.floating.get(c) or layout == "floating" - then if not c.fullscreen then c.above = true end - else c.above = false end - end - end) -end --- }}} - -- }}} diff --git a/awesome/theme/theme.lua b/awesome/theme/theme.lua index 6dd591b..dce3884 100644 --- a/awesome/theme/theme.lua +++ b/awesome/theme/theme.lua @@ -1,25 +1,24 @@ ---------------------------- --- Default awesome theme -- ---------------------------- +--------------------------------------------- +-- David Robillard's Awesome Awesome Theme -- +--------------------------------------------- theme = {} theme.font = "DejaVu Sans 10" -theme.bg_normal = "#000000" -theme.bg_focus = "#5A8F47" -theme.bg_urgent = "#DFFF00" -- Chartreuse +theme.bg_focus = "#3F3F3F" theme.bg_minimize = "#444444" - -theme.fg_normal = "#aaaaaa" -theme.fg_focus = "#ffffff" -theme.fg_urgent = "#ffffff" +theme.bg_normal = "#202020" +theme.bg_urgent = "#DFFF00" +theme.fg_focus = "#F0F0F0" theme.fg_minimize = "#ffffff" +theme.fg_normal = "#CCCCCC" +theme.fg_urgent = "#FFFFFF" +theme.border_focus = "#3F3F3F" +theme.border_marked = "#DFFF00" +theme.border_normal = "#202020" theme.border_width = "2" -theme.border_normal = "#000000" -theme.border_focus = "#5A8F47" -theme.border_marked = "#91231c" -- There are other variable sets -- overriding the default one when @@ -74,7 +73,7 @@ theme.titlebar_maximized_button_normal_active = "/usr/share/awesome/themes/defau theme.titlebar_maximized_button_focus_active = "/usr/share/awesome/themes/default/titlebar/maximized_focus_active.png" -- You can use your own command to set your wallpaper -theme.wallpaper_cmd = { "xsetroot -solid black" } +theme.wallpaper_cmd = { "xsetroot -solid '#202020'" } -- You can use your own layout icons like this: theme.layout_fairh = "/usr/share/awesome/themes/default/layouts/fairhw.png" |