-- Standard awesome library require("awful") require("awful.autofocus") require("awful.rules") -- Theme handling library require("beautiful") -- Notification library require("naughty") require("vicious") -- space between icons space = 40 -- 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 = "time to debug", text = err, timeout = 1 }) in_error = false end) end -- {{{ 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 -- }}} -- {{{ Variable definitions -- Themes define colours, icons, and wallpapers beautiful.init("/usr/share/awesome/themes/redhalo/theme.lua") -- This is used later as the default terminal and editor to run. config = awful.util.getdir("config") terminal = "urxvt" editor = os.getenv("EDITOR") or "vim" editor_cmd = terminal .. " -e " .. editor exec = awful.util.spawn sexec = awful.util.spawn_with_shell -- 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" winkey = "Mod4" altkey = "Mod1" barheight = 16 borderwidth = 0 -- Table of layouts to cover with awful.layout.inc, order matters. layouts = { awful.layout.suit.floating, awful.layout.suit.tile, awful.layout.suit.tile.left, awful.layout.suit.tile.bottom, awful.layout.suit.tile.top, awful.layout.suit.fair, awful.layout.suit.fair.horizontal, awful.layout.suit.spiral, awful.layout.suit.spiral.dwindle, awful.layout.suit.max, awful.layout.suit.max.fullscreen, awful.layout.suit.magnifier } -- }}} -- {{{ Tags -- Define a tag table which hold all screen tags. tags = { -- names = { "intrntbrn:", "www >", "dev >", "mail >", "media >", "pdf >", "☊"}, -- names = { "intrntbrn:", "/web ", "/dev ", "/mail ", "/media ", "/pdf ", "/mpd"}, names = { "sys", "web", "doc", "dev", "irc", "foo"}, -- names = { "α ", "β ", "δ ", "ε ", "ζ "}, layout = { layouts[1], layouts[10], layouts[8], layouts[8], layouts[2], layouts[1] }} for s = 1, screen.count() do tags[s] = awful.tag(tags.names, s, tags.layout) end -- }}} -- {{{ Menu -- Create a laucher widget and a main menu myawesomemenu = { { "edit rc.lua", function () sexec("medit -t rc.lua") end}, { "edit theme", function () sexec("gvim /usr/share/awesome/themes/redhalo/theme.lua") end }, { "testmode", function () sexec("bash ~/bin/awsm.sh") end}, { "restart", awesome.restart }, { "quit", awesome.quit } } mysystemmenu = { { "shutdown", function () sexec("sudo shutdown -h 0") end}, { "reboot", function () sexec("sudo reboot") end}, { "lock", function () sexec("slimlock") end}, { "suspend", function () sexec("sudo pm-suspend") end}, { "hibernate", function () sexec("sudo pm-hibernate") end} } myfoldermenu = { { "Downloads", function () exec("thunar Downloads") end}, { "Movies", function () exec("spacefm HDD/Film") end}, { "Music", function () exec("spacefm HDD/Musik") end}, { "Downloads JD", function () exec("spacefm HDD/Downloads_JD") end}, { "Workspace", function () exec("spacefm Workspace") end}, { "Dropbox W", function () exec("spacefm /Dropbox/WORKSPACE") end}, { "Netbeans", function () exec("spacefm Workspace/NetBeansProjects") end}, { "SE", function () exec("spacefm Dropbox/SS2011/SS2012/SE") end}, { "DB", function () exec("spacefm Dropbox/SS2011/SS2012/Datenbanken") end}, { "MPS", function () exec("spacefm Dropbox/SS2011/SS2012/MPS-ARM") end}, { "OS", function () exec("spacefm Dropbox/SS2011/SS2012/Betriebssysteme") end}, } myappmenu = { { "mp3", terminal .. " -e ncmpcpp"}, { "mail", "xterm -e alpine"}, { "jabber", terminal .. " -e mcabber" }, { "irc", terminal .. " -e weechat-curses" }, { "watch tv", "vlc Downloads/stream.m3u" }, { "eclipse", "eclipse" }, { "netbeans", function () sexec("netbeans --laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel") end}, { "mplayer", function () exec("gnome-mplayer") end}, { "vlc", function () exec("vlc") end}, { "gimp", function () exec("gimp") end}, { "jdownloader", function () exec("jdownloader") end}, { "pidgin", function () exec("pidgin") end}, { "dwb", function () exec("dwb") end}, { "firefox", function () exec("firefox") end}, { "calculator", function () exec("gnome-calculator") end} } mymainmenu = awful.menu({ items = { { "folder", myfoldermenu, "/usr/share/awesome/icons/ontop_focus_inactive.png" }, { "system", mysystemmenu, "/usr/share/awesome/icons/arch-red.png" }, { "awesome", myawesomemenu, "/usr/share/awesome/icons/awesome-blue.png" }, { "applications", myappmenu, "/usr/share/awesome/icons/arch-green.png" }, { "terminal", terminal }, { "browser", function () exec("dwb") end}, { "filemanager", function () exec("spacefm") end}, { "editor", function () sexec("medit -t") end}, { "youtube", terminal .. " -e youtube-viewer"} } }) mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu }) -- }}} -- {{{ Wibox -- Create a textclock widget --"%a %d %b %H:%M" --mytextclock = awful.widget.textclock({ align = "right",}, "%a, %d. %b - %H:%M", 60) --mytextclock = awful.widget.textclock({ align = "right" }) mytextclock = awful.widget.textclock({ align = "right",}, "%H:%M", 60) mytextclock.width = space --test oocairo require("blingbling") my_cal =blingbling.calendar.new({type = "imagebox", image = "/usr/share/awesome/icons/blind-alien/icons/clock_blue.png"}) my_cal:set_cell_padding(2) my_cal:set_title_font_size(8) my_cal:set_font_size(8) my_cal:set_inter_margin(1) my_cal:set_columns_lines_titles_font_size(8) my_cal:set_columns_lines_titles_text_color("#1692d0ff") my_cal:set_link_to_external_calendar(true) -- Create a systray mysystray = widget({ type = "systray" }) -- Create a wibox for each screen and add it mywibox = {} mywib = {} mypromptbox = {} 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) ) mytasklist = {} mytasklist.buttons = awful.util.table.join( awful.button({ }, 1, function (c) if c == client.focus then -- c.minimized = true client.focus = c c:swap(awful.client.getmaster()) else if not c:isvisible() then awful.tag.viewonly(c:tags()[1]) client.focus = c c:swap(awful.client.getmaster()) end -- This will also un-minimize -- the client, if needed client.focus = c c:raise() c:swap(awful.client.getmaster()) 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({ }, 8, function () awful.client.focus.byidx(-1) if client.focus then client.focus:raise() end end), -- middle mouse awful.button({ }, 0, function (c) if c == client.focus then c.minimized = true else client.focus = c c:raise() end end)) for s = 1, screen.count() do -- Create a promptbox for each screen mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright }) -- Create an imagebox widget which will contains an icon indicating which layout we're using. -- 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))) -- 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) -- spacer spacer = widget({ type = "textbox" }) spacer.text = " " -- WLAN UP DOWN netwidget = widget({ type = "textbox" }) vicious.register(netwidget, vicious.widgets.net, function (widget, args) if (args["{wlan0 down_kb}"] ~= nil) then return round(args["{wlan0 down_kb}"], 0) .. "kb" else return "" end end) netwidget.width = space neticon = widget({ type = "imagebox" }) neticon.image = image("/home/intrntbrn/icons/netdown_blue.png") -- WLAN widget wlanwidget = widget({ type = "textbox" }) --vicious.register(wlanwidget, vicious.widgets.wifi, "${link}%", 10, "wlan0") vicious.register(wlanwidget, vicious.widgets.wifi, function (widget, args) if (args["{link}"] == 0) then netwidget.width = 0 netwidget.visible = false neticon.visible = false return "off" else netwidget.width = space netwidget.visible = true neticon.visible = true return round(((args["{link}"] *100) / 70), 0) .. "%" end end, 10, "wlan0") wlanwidget.width = space wlanicon = widget({ type = "imagebox" }) wlanicon.image = image("/home/intrntbrn/icons/wifi_blue.png") -- mem load mymem = widget({ type = "textbox" }) vicious.register(mymem, vicious.widgets.mem, "$1%", 30) mymem.width = space mymemicon = widget({ type = "imagebox" }) mymemicon.image = image("/usr/share/awesome/icons/blind-alien/icons/mem_blue.png") -- cpu load mycpuload = widget({ type = "textbox" }) vicious.register(mycpuload, vicious.widgets.cpu, "$1%", 1) mycpuload.width = space mycpuloadicon = widget({ type = "imagebox" }) mycpuloadicon.image = image("/usr/share/awesome/icons/blind-alien/icons/cpu_blue.png") -- fan function fan() local file = io.open("/sys/devices/platform/thinkpad_hwmon/fan1_input", "r") local fan = file:read("*n") file:close() return fan end -- cputmp function cputemp() local file = io.open("/sys/class/thermal/thermal_zone0/temp", "r") local tmp = file:read("*n") file:close() output = tmp / 1000 return output end -- cpu popup mycpuloadicon:add_signal("mouse::enter", function() batnotify = naughty.notify({ text = "Fan: " .. fan() .. " RPM\n" .. "Temp: " .. cputemp() .. " °C", title = "CPU Info", timeout = 0 }) end) mycpuloadicon:add_signal("mouse::leave", function () if batnotify then naughty.destroy(batnotify) batnotify = nil end end) -- cpu temp mycpu = widget({ type = "textbox" }) vicious.register(mycpu, vicious.widgets.thermal,"$1°", 30, "thermal_zone0") mycpuicon = widget({ type = "imagebox" }) mycpuicon.image = image("/usr/share/awesome/icons/intel_white.png") -- volume myvolicon = widget({ type = "imagebox" }) myvolicon.image = image("/usr/share/awesome/icons/blind-alien/icons/volume_blue.png") myvol = widget({ type = "textbox" }) vicious.register(myvol, vicious.widgets.volume, function (widget, args) if args[1] < 1 then myvolicon.image = image("/usr/share/awesome/icons/blind-alien/icons/volume_low_blue.png") return "mute" else myvolicon.image = image("/usr/share/awesome/icons/blind-alien/icons/volume_blue.png") return args[1] .. "%" end end, 2, "Master") myvol.width = space -- battery mybaticon = widget({ type = "imagebox" }) mybaticon.image = image("/usr/share/awesome/icons/blind-alien/icons/battery_full_blue.png") -- batstate() function batstate() local fileee = io.open("/sys/class/power_supply/BAT0/status", "r") local batstate = fileee:read("*line") if ((batstate == 'Discharging') or (batstate == 'Charging')) then return batstate else return "Fully charged" end end -- round() function round(num, idp) if ((num ~= nil) and (num ~= 0)) then local mult = 10^(idp or 0) return math.floor(num * mult + 0.5) / mult else return 0 end end -- shutdown() function shdown() sexec("sudo pm-suspend") end -- watt() function watt() if (batstate() == 'Discharging') then if(io.open("/sys/devices/platform/smapi/BAT0/power_avg", "r")) then local file = io.open("/sys/devices/platform/smapi/BAT0/power_avg", "r") local currentnow = file:read("*n") file:close() cur = ((currentnow * -1) / 1000) return "\nUsage: ".. round(cur, 2) .. "W" else return "\nUsage: Error" end else return "" end end -- remaining() function remaining() if (batstate() == 'Fully charged') then return "" end if (batstate() == 'Discharging') then if (io.open("/sys/devices/platform/smapi/BAT0/remaining_running_time", "r")) then local file = (io.open("/sys/devices/platform/smapi/BAT0/remaining_running_time", "r")) local remain = file:read("*n") file:close() return "\nRemaining: " .. remain .. " min" else return "\nRemaining: Error" end else if (io.open("/sys/devices/platform/smapi/BAT0/remaining_charging_time", "r")) then local filee = io.open("/sys/devices/platform/smapi/BAT0/remaining_charging_time", "r") local charge = filee:read("*n") filee:close() return "\nRemaining: " .. charge .. " min" else return "\nRemaining: Error" end end end -- batterypopup mybaticon:add_signal("mouse::enter", function() batnotify = naughty.notify({ text = "Status: " .. batstate() .. watt() .. remaining(), title = "Battery Info", timeout = 0 }) end) mybaticon:add_signal("mouse::leave", function () if batnotify then naughty.destroy(batnotify) batnotify = nil end end) mybat = widget({ type = "textbox" }) vicious.register(mybat, vicious.widgets.bat, function (widget, args) batnofiy = nil -- critical if (args[2] < 4 and batstate() == 'Discharging') then naughty.notify({ text = "hybernating to disk now", title = "Critical Battery", position = "top_right", timeout = 30, fg="#262729", bg="#f92671", screen = 1, ontop = true, run = function () sexec("sudo pm-suspend") end }) shdown() mybaticon.image = image("/usr/share/awesome/icons/blind-alien/icons/battery_low_blue.png") return args[2] .. "%" -- low elseif (args[2] <= 9 and batstate() == 'Discharging') then naughty.notify({ text = "charge now", title = "Low Battery", position = "top_right", timeout = 1, fg="#262729", bg="#f92671", screen = 1, ontop = true, }) mybaticon.image = image("/usr/share/awesome/icons/blind-alien/icons/battery_low_blue.png") return args[2] .. "%" -- normal discharging elseif (batstate() == 'Discharging') then mybaticon.image = image("/usr/share/awesome/icons/blind-alien/icons/battery_full_blue.png") return args[2] .. "%" -- charging else mybaticon.image = image("/usr/share/awesome/icons/blind-alien/icons/ac_blue.png") return args[2] .. "%" end end, 61, 'BAT0') mybat.width = space -- gmail awful.widget.gmail = require('awful.widget.gmail') gmailwidget = awful.widget.gmail.new() gmailcount = gmailwidget["{count}"] -- spacer spacer = widget({ type = "textbox" }) spacer.text = " " -- MPD widthMpd = 450 --Width of MPD widget useMpd = true -- MPD Widget if useMpd == true then -- PLAY, STOP, PREV/NEXT Buttons -- requires modification of /usr/share/awesome/lib/awful/widget/launcher.lua -- b = util.table.join(w:buttons(), button({}, 1, nil, function () util.spawn(args.command) end)) -- to: -- b = util.table.join(w:buttons(), button({}, 1, nil, function () util.spawn_with_shell(args.command) end)) music_play = awful.widget.launcher({ image = image("/usr/share/awesome/icons/blind-alien/icons/play_blue.png"), command = "ncmpcpp toggle" }) music_pause = awful.widget.launcher({ image = image("/usr/share/awesome/icons/blind-alien/icons/pause_blue.png"), command = "ncmpcpp toggle && echo -e 'vicious.force({ mpdwidget, })' | awesome-client" }) music_pause.visible = false music_stop = awful.widget.launcher({ image = image("/usr/share/awesome/icons/blind-alien/icons/stop_blue.png"), command = "ncmpcpp stop && echo -e 'vicious.force({ mpdwidget, })' | awesome-client" }) music_prev = awful.widget.launcher({ image = image("/usr/share/awesome/icons/blind-alien/icons/prev_blue.png"), command = "ncmpcpp prev && echo -e 'vicious.force({ mpdwidget, })' | awesome-client" }) music_next = awful.widget.launcher({ image = image("/usr/share/awesome/icons/blind-alien/icons/next_blue.png"), command = "ncmpcpp next && echo -e 'vicious.force({ mpdwidget, })' | awesome-client" }) maxlength = 15 mpdicon = awful.widget.launcher({ image = image("/usr/share/awesome/icons/blind-alien/icons/note_blue.png"), command = "ncmpcpp toggle && echo -e 'vicious.force({ mpdwidget, })' | awesome-client" }) -- Initialize widget mpdwidget = widget({ type = "textbox" }) --mpdwidget.wrap = "none" mpdwidget.width = widthMpd --mpdwidget.wrap = "word_char" -- Register Widget --vicious.register(mpdwidget, vicious.widgets.mpd, "(${state}) : ${Artist} - ${Title} ]", 13) -- Set the maximum width of the MPD widget inside the string.format function as "%.s" vicious.register(mpdwidget, vicious.widgets.mpd, function(widget, args) local string = args["{Artist}"] .. " - " .. args["{Title}"] --local string = "[" .. args["{state}"] .. "]" .. " : " .. args["{Artist}"] .. " - " .. args["{Title}"] -- play if (args["{state}"] == "Play") then music_play.visible = false music_pause.visible = true music_next.visible = true music_prev.visible = true music_stop.visible = true mpdwidget.visible = true mpdicon.visible = false return string -- pause elseif (args["{state}"] == "Pause") then music_play.visible = true music_pause.visible = false music_next.visible = true music_prev.visible = true music_stop.visible = true mpdwidget.visible = true mpdicon.visible = false return string -- stop else mpdicon.visible = true music_play.visible = false music_pause.visible = false music_next.visible = false music_prev.visible = false music_stop.visible = false mpdwidget.visible = false return string end end, 2) end -- Create the wibox -- TOP mywibox[s] = awful.wibox({ position = "top", screen = s }) -- BOTTOM mywib[s] = awful.wibox({ position = "bottom", screen = s}) -- Add widgets to the wibox - order matters mywibox[s].widgets = { { mylauncher, mytaglist[s], spacer, gmailwidget, spacer, mpdicon, music_play, music_pause, music_stop, music_prev, music_next, spacer, spacer, spacer, spacer, mpdwidget, spacer, mypromptbox[s], layout = awful.widget.layout.horizontal.leftright, }, mylayoutbox[s], mytextclock, my_cal.widget, netwidget, neticon, mymem, mymemicon, mycpuload, mycpuloadicon, wlanwidget, wlanicon, mybat, mybaticon, myvol, myvolicon, s == 1 or nil, layout = awful.widget.layout.horizontal.rightleft } mywib[s].widgets = { -- s == 1 and mysystray or nil, mysystray, mytasklist[s], layout = awful.widget.layout.horizontal.rightleft } end -- }}} -- {{{ Mouse bindings root.buttons(awful.util.table.join( awful.button({ }, 3, function () mymainmenu:toggle() end), awful.button({ }, 4, awful.tag.viewnext), awful.button({ }, 5, awful.tag.viewprev) )) -- }}} -- {{{ Key bindings globalkeys = awful.util.table.join( awful.key({ "Control" }, "Left", awful.tag.viewprev ), awful.key({ "Control" }, "Right", awful.tag.viewnext ), awful.key({ "Control" }, "Escape", awful.tag.history.restore), awful.key({}, "#122", function () sexec("sh ~/bin/vol.sh down" ) end), awful.key({}, "#123", function () sexec("sh ~/bin/vol.sh up") end), awful.key({}, "#121", function () sexec("sh ~/bin/vol.sh mute") end), awful.key({}, "#233", function () sexec("sh ~/bin/bright.sh") end), awful.key({}, "#232", function () sexec("sh ~/bin/bright.sh") end), awful.key({ altkey, }, "Tab", function () awful.client.focus.byidx( 1) if client.focus then client.focus:raise() end end), awful.key({ altkey, }, "k", function () awful.client.focus.byidx(-1) if client.focus then client.focus:raise() end end), awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end), -- Layout manipulation awful.key({ modkey }, "Tab", function () awful.client.swap.byidx( 1) end), awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end), awful.key({ altkey }, "j", function () awful.screen.focus_relative( 1) end), awful.key({ altkey }, "k", function () awful.screen.focus_relative(-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), -- Standard program awful.key({ "Control" }, "y", function () awful.util.spawn(terminal) end), awful.key({ modkey, "Control" }, "r", awesome.restart), -- awful.key({ modkey, "Shift" }, "q", awesome.quit), awful.key({ }, "F1", function () exec("dwb") end), awful.key({ }, "F8", function () exec("firefox") end), awful.key({}, "#160", function () exec("slimlock") end), awful.key({}, "#150", function () sexec("sudo pm-suspend") 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({ "Control", }, "space", function () awful.layout.inc(layouts, 1) end), awful.key({ modkey }, "space", function () awful.layout.inc(layouts, -1) end), awful.key({ modkey, "Control" }, "n", awful.client.restore), -- Prompt awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end), awful.key({ modkey }, "x", function () awful.prompt.run({ prompt = "Run Lua code: " }, mypromptbox[mouse.screen].widget, awful.util.eval, nil, awful.util.getdir("cache") .. "/history_eval") end) ) clientkeys = awful.util.table.join( awful.key({ altkey }, "m", function (c) c.fullscreen = not c.fullscreen end), awful.key({ "Control" }, "q", function (c) c:kill() end), awful.key({ altkey }, "d", awful.client.floating.toggle ), awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end), awful.key({ modkey, }, "o", awful.client.movetoscreen ), awful.key({ altkey, }, "t", function (c) c.ontop = not c.ontop end), awful.key({ altkey }, "n", function (c) -- The client currently has the input focus, so it cannot be -- minimized, since minimized clients can't have the focus. c.minimized = true end), awful.key({ altkey }, "f", function (c) c.maximized_horizontal = not c.maximized_horizontal c.maximized_vertical = not c.maximized_vertical end) ) -- 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, awful.key({ "Control" }, "#" .. 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({ altkey }, "#" .. 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( awful.button({ }, 1, function (c) client.focus = c; c:raise() end), awful.button({ altkey }, 1, awful.mouse.client.move), awful.button({ altkey }, 3, awful.mouse.client.resize)) -- Set keys root.keys(globalkeys) -- }}} -- {{{ Rules awful.rules.rules = { -- All clients will match this rule. { rule = { }, properties = { border_width = beautiful.border_width, border_color = beautiful.border_normal, focus = true, keys = clientkeys, buttons = clientbuttons } }, { rule = { class = "gimp" }, properties = { floating = true } }, -- Set Firefox to always map on tags number 2 of screen 1. { rule = { class = "Firefox" }, properties = { tag = tags[1][2] } }, -- 1: sys -- 2: web { rule = { class = "Firefox" }, except = { instance = "Navigator" }, properties = { tag = tags[1][2], floating = true, switchtotag = true }, -- callback = awful.placement.centered }, { rule = { class = "Firefox", instance = "Navigator" }, properties = { tag = tags[1][2], switchtotag = true } }, { rule = { class = "Firefox", instance = "Dialog" }, properties = { tag = tags[1][2], switchtotag = true } }, { rule = { class = "Midori" }, properties = { tag = tags[1][2], switchtotag = true } }, { rule = { class = "Dwb" }, properties = { tag = tags[1][2], switchtotag = true } }, -- 3: doc { rule = { class = ".*[Mm]edit.*", name = ".*[Mm]edit.*", instance = ".*[Mm]edit.*" }, except = { name = "Find" }, properties = { tag = tags[1][3], switchtotag = true } }, { rule = { class = "medit" }, except = { name = "Find" }, properties = { tag = tags[1][3], switchtotag = true } }, { rule = { instance = "medit" }, except = { name = "Find" }, properties = { tag = tags[1][3], switchtotag = true } }, { rule = { instance = "medit.*" }, except = { name = "Find" }, properties = { tag = tags[1][3], switchtotag = true } }, { rule = { name = "^medit\ %-.*" }, except = { name = "Find" }, properties = { tag = tags[1][3], switchtotag = true } }, { rule = { name = "medit.*" }, except = { name = "Find" }, properties = { tag = tags[1][3], switchtotag = true } }, { rule = { class = "epdfview" }, properties = { tag = tags[1][3], switchtotag = true } }, { rule = { class = "Epdfview" }, properties = { tag = tags[1][3], switchtotag = true } }, { rule = { class = "zathura" }, properties = { tag = tags[1][3], switchtotag = true } }, { rule = { class = "Zathura" }, properties = { tag = tags[1][3], switchtotag = true } }, -- 4: dev { rule = { class = "NetBeans" }, properties = { tag = tags[1][4], switchtotag = true } }, { rule = { class = "netbeans" }, properties = { tag = tags[1][4], switchtotag = true } }, { rule = { class = "sun-awt-X11-XFramePeer" }, properties = { tag = tags[1][4], switchtotag = true } }, { rule = { class = "java-lang-Thread" }, properties = { tag = tags[1][4], switchtotag = true } }, { rule = { class = "Eclipse" }, properties = { tag = tags[1][4], switchtotag = true } }, -- 5: irc -- 6: foo { rule = { class = "Mplayer" }, properties = { tag = tags[1][6], switchtotag = true } }, { rule = { class = "mplayer" }, properties = { tag = tags[1][6], switchtotag = true } }, -- { rule = { class = "Gnome-mplayer" }, -- properties = { tag = tags[1][5], switchtotag = true } -- }, -- 6: pdf -- Set Firefox to always map on tags number 2 of screen 1. -- { rule = { class = "Firefox" }, -- properties = { tag = tags[1][2] } }, --] } -- }}} -- {{{ 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 }) -- Enable sloppy focus c:add_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 end end) if not startup then -- Set the windows at the slave, -- i.e. put it at the end of others instead of setting it master. -- awful.client.setslave(c) -- Put windows in a smart way, only if they does not set an initial position. if not c.size_hints.user_position and not c.size_hints.program_position then awful.placement.no_overlap(c) awful.placement.no_offscreen(c) end 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) -- }}} naughty.config.presets.online = { bg = "#1f880e80", fg = "#ffffff", } naughty.config.presets.chat = naughty.config.presets.online naughty.config.presets.away = { bg = "#eb4b1380", fg = "#ffffff", } naughty.config.presets.xa = { bg = "#65000080", fg = "#ffffff", } naughty.config.presets.dnd = { bg = "#65340080", fg = "#ffffff", } naughty.config.presets.invisible = { bg = "#ffffff80", fg = "#000000", } naughty.config.presets.offline = { bg = "#64636380", fg = "#ffffff", } naughty.config.presets.requested = naughty.config.presets.offline naughty.config.presets.error = { bg = "#ff000080", fg = "#ffffff", } -- mcabber notifcation wrapper muc_nick = "fsafsafsaafs" function mcabber_event_hook(kind, direction, jid, msg) if kind == "MSG" then if direction == "IN" or direction == "MUC" then local filehandle = io.open(msg) local txt = filehandle:read("*all") filehandle:close() awful.util.spawn("rm "..msg) if direction == "MUC" and txt:match("^<" .. muc_nick .. ">") then return end naughty.notify{ -- icon = "chat_msg_recv", text = awful.util.escape(txt), title = jid } end elseif kind == "STATUS" then local mapping = { [ "O" ] = "online", [ "F" ] = "chat", [ "A" ] = "away", [ "N" ] = "xa", [ "D" ] = "dnd", [ "I" ] = "invisible", [ "_" ] = "offline", [ "?" ] = "error", [ "X" ] = "requested" } local status = mapping[direction] local iconstatus = status if not status then status = "error" end if jid:match("icq") then iconstatus = "icq/" .. status end naughty.notify{ preset = naughty.config.presets[status], text = jid, -- icon = iconstatus } end end -- disable startup-notification globally local oldspawn = awful.util.spawn awful.util.spawn = function (s) oldspawn(s, false) end