|
@@ -1,3 +1,13 @@
|
|
|
+-- {{{ License
|
|
|
+-- Awesome main config file
|
|
|
+-- 2012, Emmanuel Bouthenot <kolter@openics.org>
|
|
|
+--
|
|
|
+-- This file is distributed in the hope that it will be useful,
|
|
|
+-- but WITHOUT ANY WARRANTY
|
|
|
+--
|
|
|
+-- }}}
|
|
|
+
|
|
|
+-- {{{ Libraries
|
|
|
-- Standard awesome library
|
|
|
require("awful")
|
|
|
require("awful.autofocus")
|
|
@@ -6,9 +16,15 @@ require("awful.rules")
|
|
|
require("beautiful")
|
|
|
-- Notification library
|
|
|
require("naughty")
|
|
|
-
|
|
|
-- Load Debian menu entries
|
|
|
require("debian.menu")
|
|
|
+-- Misc tools
|
|
|
+require("wicked")
|
|
|
+require("vicious")
|
|
|
+-- User libraries
|
|
|
+require("helpers")
|
|
|
+require("awqterm")
|
|
|
+-- }}}
|
|
|
|
|
|
-- {{{ Error handling
|
|
|
-- Check if awesome encountered an error during startup and fell back to
|
|
@@ -40,9 +56,9 @@ end
|
|
|
beautiful.init("/usr/share/awesome/themes/default/theme.lua")
|
|
|
|
|
|
-- This is used later as the default terminal and editor to run.
|
|
|
-terminal = "x-terminal-emulator"
|
|
|
-editor = os.getenv("EDITOR") or "editor"
|
|
|
-editor_cmd = terminal .. " -e " .. editor
|
|
|
+terminal = whereis('xterm') or 'x-terminal-emulator'
|
|
|
+editor = os.getenv('EDITOR') or 'sensible-editor'
|
|
|
+editor_cmd = terminal .. ' -e ' .. editor
|
|
|
|
|
|
-- Default modkey.
|
|
|
-- Usually, Mod4 is the key with a logo between Control and Alt.
|
|
@@ -50,6 +66,7 @@ editor_cmd = terminal .. " -e " .. editor
|
|
|
-- 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"
|
|
|
+altkey = "Mod1"
|
|
|
|
|
|
-- Table of layouts to cover with awful.layout.inc, order matters.
|
|
|
layouts =
|
|
@@ -97,9 +114,50 @@ mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
|
|
|
menu = mymainmenu })
|
|
|
-- }}}
|
|
|
|
|
|
+-- {{{ Widgets
|
|
|
+
|
|
|
+-- {{{ CPU widget
|
|
|
+-- cpuwidget = awful.widget.graph({ layout = awful.widget.layout.horizontal.rightleft })
|
|
|
+-- cpuwidget:set_width(30)
|
|
|
+-- cpuwidget:set_height(19)
|
|
|
+-- cpuwidget:set_max_value(1)
|
|
|
+-- cpuwidget:set_background_color("#333333")
|
|
|
+-- cpuwidget:set_border_color("#0a0a0a")
|
|
|
+-- cpuwidget:set_color("#FF5656")
|
|
|
+-- cpuwidget:set_gradient_angle(50)
|
|
|
+-- cpuwidget:set_gradient_colors({ "#AEC6D8", "#285577", "#285577" })
|
|
|
+-- vicious.register(cpuwidget, vicious.widgets.cpu, "$1")
|
|
|
+-- }}}
|
|
|
+
|
|
|
+-- {{{ MEM widget
|
|
|
+-- memwidget = awful.widget.progressbar({ layout = awful.widget.layout.horizontal.rightleft })
|
|
|
+-- memwidget:set_width(15)
|
|
|
+-- memwidget:set_height(19)
|
|
|
+-- memwidget:set_vertical(true)
|
|
|
+-- memwidget:set_background_color("#333333")
|
|
|
+-- memwidget:set_border_color("#0a0a0a")
|
|
|
+-- memwidget:set_color("#FF5656")
|
|
|
+-- memwidget:set_gradient_colors({ "#AEC6D8", "#285577", "#285577" })
|
|
|
+-- vicious.register(memwidget, vicious.widgets.mem, "$1", 19)
|
|
|
+-- }}}
|
|
|
+
|
|
|
+-- {{{ VOL widget
|
|
|
+volwidget = widget({
|
|
|
+ align = right,
|
|
|
+ type = "textbox"
|
|
|
+})
|
|
|
+vicious.register(volwidget, vicious.widgets.volume, ' ♬:$1٪', 5, 'Master')
|
|
|
+-- }}}
|
|
|
+
|
|
|
+-- }}}
|
|
|
+
|
|
|
-- {{{ Wibox
|
|
|
-- Create a textclock widget
|
|
|
-mytextclock = awful.widget.textclock({ align = "right" })
|
|
|
+mytextclock = awful.widget.textclock(
|
|
|
+ { align = "right" },
|
|
|
+ "%a %d, %H:%M",
|
|
|
+ 60
|
|
|
+)
|
|
|
|
|
|
-- Create a systray
|
|
|
mysystray = widget({ type = "systray" })
|
|
@@ -119,35 +177,36 @@ mytaglist.buttons = awful.util.table.join(
|
|
|
)
|
|
|
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))
|
|
|
+ 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)
|
|
|
+)
|
|
|
|
|
|
for s = 1, screen.count() do
|
|
|
-- Create a promptbox for each screen
|
|
@@ -156,17 +215,18 @@ for s = 1, screen.count() do
|
|
|
-- We need one layoutbox per screen.
|
|
|
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)))
|
|
|
+ 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 a tasklist widget
|
|
|
mytasklist[s] = awful.widget.tasklist(function(c)
|
|
|
- return awful.widget.tasklist.label.currenttags(c, s)
|
|
|
- end, mytasklist.buttons)
|
|
|
+ return awful.widget.tasklist.label.currenttags(c, s)
|
|
|
+ end, mytasklist.buttons)
|
|
|
|
|
|
-- Create the wibox
|
|
|
mywibox[s] = awful.wibox({ position = "top", screen = s })
|
|
@@ -179,6 +239,7 @@ for s = 1, screen.count() do
|
|
|
layout = awful.widget.layout.horizontal.leftright
|
|
|
},
|
|
|
mylayoutbox[s],
|
|
|
+ volwidget,
|
|
|
mytextclock,
|
|
|
s == 1 and mysystray or nil,
|
|
|
mytasklist[s],
|
|
@@ -219,7 +280,7 @@ globalkeys = awful.util.table.join(
|
|
|
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, }, "u", awful.client.urgent.jumpto),
|
|
|
- awful.key({ modkey, }, "Tab",
|
|
|
+ awful.key({ altkey, }, "Tab",
|
|
|
function ()
|
|
|
awful.client.focus.history.previous()
|
|
|
if client.focus then
|
|
@@ -252,9 +313,30 @@ globalkeys = awful.util.table.join(
|
|
|
mypromptbox[mouse.screen].widget,
|
|
|
awful.util.eval, nil,
|
|
|
awful.util.getdir("cache") .. "/history_eval")
|
|
|
- end)
|
|
|
+ end),
|
|
|
+
|
|
|
+ -- Screensaver
|
|
|
+ awful.key({ altkey, "Control"}, "l", function () awful.util.spawn("xscreensaver-command -lock") end),
|
|
|
+ -- Dropdown terminal
|
|
|
+ awful.key({ altkey }, "space", function () awqterm_toggle() end)
|
|
|
)
|
|
|
|
|
|
+-- Extend globalkeys
|
|
|
+for i = 1, table.getn(tags[mouse.screen]) do
|
|
|
+ globalkeys = awful.util.table.join(
|
|
|
+ globalkeys,
|
|
|
+ -- Ctrl Fx keys shows (goes to) tag X
|
|
|
+ awful.key({ "Control"}, 'F' .. i, function() awful.tag.viewonly(tags[mouse.screen][i]) end),
|
|
|
+ -- Shift Fx move focused application to tag X
|
|
|
+ awful.key({ "Control", "Shift" }, 'F' .. i,
|
|
|
+ function ()
|
|
|
+ if client.focus and tags[client.focus.screen][i] then
|
|
|
+ awful.client.movetotag(tags[client.focus.screen][i])
|
|
|
+ end
|
|
|
+ end)
|
|
|
+ )
|
|
|
+end
|
|
|
+
|
|
|
clientkeys = awful.util.table.join(
|
|
|
awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
|
|
|
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
|
|
@@ -333,12 +415,10 @@ awful.rules.rules = {
|
|
|
focus = true,
|
|
|
keys = clientkeys,
|
|
|
buttons = clientbuttons } },
|
|
|
- { rule = { class = "MPlayer" },
|
|
|
- properties = { floating = true } },
|
|
|
- { rule = { class = "pinentry" },
|
|
|
- properties = { floating = true } },
|
|
|
- { rule = { class = "gimp" },
|
|
|
- properties = { floating = true } },
|
|
|
+ { rule = { class = "MPlayer" }, properties = { floating = true } },
|
|
|
+ { rule = { class = "pinentry" }, properties = { floating = true } },
|
|
|
+ { rule = { class = "gimp" }, properties = { floating = true } },
|
|
|
+ { rule = { class = "pidgin" }, properties = { floating = true } },
|
|
|
-- Set Firefox to always map on tags number 2 of screen 1.
|
|
|
-- { rule = { class = "Firefox" },
|
|
|
-- properties = { tag = tags[1][2] } },
|
|
@@ -376,3 +456,5 @@ client.add_signal("focus", function(c) c.border_color = beautiful.border_focus e
|
|
|
client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
|
|
|
-- }}}
|
|
|
|
|
|
+
|
|
|
+-- vim: foldmethod=marker
|