Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 7th, 2012  |  syntax: Lua  |  size: 23.04 KB  |  views: 255  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. -- Standard awesome library
  2. require("awful")
  3. require("awful.autofocus")
  4. require("awful.rules")
  5. -- Theme handling library
  6. require("beautiful")
  7. -- Notification library
  8. require("naughty")
  9. -- Widgets
  10. require("vicious")
  11.  
  12. -- {{{ Error handling
  13. -- Check if awesome encountered an error during startup and fell back to
  14. -- another config (This code will only ever execute for the fallback config)
  15. if awesome.startup_errors then
  16.     naughty.notify({ preset = naughty.config.presets.critical,
  17.                      title = "Oops, there were errors during startup!",
  18.                      text = awesome.startup_errors })
  19. end
  20.  
  21. -- Handle runtime errors after startup
  22. do
  23.     local in_error = false
  24.     awesome.add_signal("debug::error", function (err)
  25.         -- Make sure we don't go into an endless error loop
  26.         if in_error then return end
  27.         in_error = true
  28.  
  29.         naughty.notify({ preset = naughty.config.presets.critical,
  30.                          title = "Oops, an error happened!",
  31.                          text = err })
  32.         in_error = false
  33.     end)
  34. end
  35. -- }}}
  36.  
  37. -- {{{ Variable definitions
  38. -- Themes define colours, icons, and wallpapers
  39. -- beautiful.init("/usr/share/awesome/themes/default/theme.lua")
  40.  beautiful.init("/home/jarvis/.config/awesome/themes/Zoltan/theme.lua")
  41. -- This is used later as the default terminal and editor to run.
  42. terminal = "urxvt"
  43. editor = os.getenv("EDITOR") or "nano"
  44. editor_cmd = terminal .. " -e " .. editor
  45.  
  46. -- Default modkey.
  47. -- Usually, Mod4 is the key with a logo between Control and Alt.
  48. -- If you do not like this or do not have such a key,
  49. -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
  50. -- However, you can use another modifier like Mod1, but it may interact with others.
  51. modkey = "Mod4"
  52.  
  53. -- Table of layouts to cover with awful.layout.inc, order matters.
  54. layouts =
  55. {
  56.     awful.layout.suit.floating,
  57.     awful.layout.suit.tile,
  58.     awful.layout.suit.tile.left,
  59.     awful.layout.suit.tile.bottom,
  60.     awful.layout.suit.tile.top,
  61.     awful.layout.suit.fair,
  62.     awful.layout.suit.fair.horizontal,
  63.     awful.layout.suit.spiral,
  64.     awful.layout.suit.spiral.dwindle,
  65.     awful.layout.suit.max,
  66.     awful.layout.suit.max.fullscreen,
  67.     awful.layout.suit.magnifier
  68. }
  69. -- }}}
  70.  
  71. -- {{{ Tags
  72. -- Define a tag table which hold all screen tags.
  73. tags = {}
  74. for s = 1, screen.count() do
  75.     -- Each screen has its own tag table.
  76.     tags[s] = awful.tag(
  77.      { "⢷", "⣨", "⡪", "⣌", "⣪", "⡝"}, s,
  78.     {layouts[2], layouts[2], layouts[7], -- Tags: 1, 2, 3
  79.      layouts[7], layouts[4], layouts[4], --       4, 5 ,6
  80.      layouts[1], layouts[1], layouts[1]  --       7, 8, 9
  81.     })
  82. end
  83.  
  84. -- }}}
  85.  
  86. -- {{{ Menu
  87. -- Create a laucher widget and a main menu
  88.  
  89. editors = {
  90.    { "gedit", "gedit" },
  91.    { "eclipse", "eclipse" },
  92.    { "netbeans", "netbeans" },
  93.    { "gimp", "gimp" }
  94. }
  95. media = {
  96.    { "music", terminal .. " -e ncmpcpp" },
  97.    { "vids", "mplayer" },
  98.    { "death", terminal .. " -e prboom" }
  99. }
  100. power = {
  101.    { "reboot", terminal .. " -e sudo reboot" },
  102.    { "power off", terminal .. " -e sudo poweroff" }
  103. }
  104. inet = {
  105.    { "chrome", "chromium" }
  106. }
  107.  
  108. mymainmenu = awful.menu({ items = { { "editors", editors },
  109.                                     { "media", media },
  110.                                     { "intertubes", inet },
  111.                                     { "files", "pcmanfm" },
  112.                                     { "power", power }
  113.                                   }
  114.                         })
  115.  
  116. mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
  117.                                      menu = mymainmenu })
  118. -- }}}
  119.  
  120. -- {{{ Wibox
  121.  
  122. -- Weather widget
  123. weatherwidget = widget({ type = "textbox" })
  124. weather_t = awful.tooltip({ objects = { weatherwidget },})
  125.  
  126. vicious.register(weatherwidget, vicious.widgets.weather,
  127.                 function (widget, args)
  128.                     weather_t:set_text("City: " .. args["{city}"] .."\nWind: " .. args["{windmph}"] .. " mp/h " .. args["{wind}"] .. "\nSky: " .. args["{sky}"] .. "\nHumidity: " .. args["{humid}"] .. "%")
  129.                     return args["{tempf}"] .. "F"
  130.                 end, 1800, "KPAE")
  131.                 --'1800': check every 30 minutes.
  132.                 --'CYUL': the Montreal ICAO code.
  133.  
  134.  
  135. -- Create a textclock widget
  136. mytextclock = awful.widget.textclock({ align = "right" })
  137. -- Calendar widget to attach to the textclock
  138. require('calendar2')
  139. calendar2.addCalendarToWidget(mytextclock)
  140.  
  141. -- Temp Icon
  142. tempicon = widget({ type = "imagebox" })
  143. tempicon.image = image(beautiful.widget_temp)
  144. -- Temp Widget
  145. tempwidget = widget({ type = "textbox" })
  146. vicious.register(tempwidget, vicious.widgets.thermal, "$1C", 9, "thermal_zone0")
  147.  
  148.  
  149. -- gmail widget and tooltip
  150. mygmail = widget({ type = "textbox" })
  151. gmail_t = awful.tooltip({ objects = { mygmail },})
  152.  
  153. mygmailimg = widget({ type = "imagebox" })
  154. mygmailimg.image = image(beautiful.widget_gmail)
  155.  
  156. vicious.register(mygmail, vicious.widgets.gmail,
  157.                 function (widget, args)
  158.                     gmail_t:set_text(args["{subject}"])
  159.                     gmail_t:add_to_object(mygmailimg)
  160.                     return args["{count}"]
  161.                  end, 240)
  162.                  --the '120' here means check every 2 minutes.
  163. -- Pacman Icon
  164. pacicon = widget({type = "imagebox" })
  165. pacicon.image = image(beautiful.widget_pac)
  166. -- Pacman Widget
  167. pacwidget = widget({type = "textbox"})
  168. pacwidget_t = awful.tooltip({ objects = { pacwidget},})
  169. vicious.register(pacwidget, vicious.widgets.pkg,
  170.                 function(widget,args)
  171.                     local io = { popen = io.popen }
  172.                     local s = io.popen("pacman -Qu")
  173.                     local str = ''
  174.                     for line in s:lines() do
  175.                         str = str .. line .. "\n"
  176.                     end
  177.                     pacwidget_t:set_text(str)
  178.                     s:close()
  179.                     return " " .. args[1]
  180.                 end, 1800, "Arch")
  181.                 --'1800' means check every 30 minutes
  182.  
  183. -- CPU Icon
  184. cpuicon = widget({ type = "imagebox" })
  185. cpuicon.image = image(beautiful.widget_cpu)
  186. -- CPU Widget
  187. cpubar = awful.widget.progressbar()
  188. cpubar:set_width(50)
  189. cpubar:set_height(6)
  190. cpubar:set_vertical(false)
  191. cpubar:set_background_color("#434343")
  192. cpubar:set_gradient_colors({ beautiful.fg_normal, beautiful.fg_normal, beautiful.fg_normal, beautiful.bar })
  193. vicious.register(cpubar, vicious.widgets.cpu, "$1", 7)
  194. awful.widget.layout.margins[cpubar.widget] = { top = 6 }
  195.  
  196. -- BATT Icon
  197. baticon = widget ({type = "imagebox" })
  198. baticon.image = image(beautiful.widget_batt)
  199. -- Initialize BATT widget
  200. batwidget = awful.widget.progressbar()
  201. batwidget:set_width(50)
  202. batwidget:set_height(6)
  203. batwidget:set_vertical(false)
  204. batwidget:set_background_color("#434343")
  205. batwidget:set_border_color(nil)
  206. batwidget:set_gradient_colors({ beautiful.fg_normal, beautiful.fg_normal, beautiful.fg_normal, beautiful.bar })
  207. awful.widget.layout.margins[batwidget.widget] = { top = 6 }
  208. vicious.register(batwidget, vicious.widgets.bat, "$2", 120, "BAT0")
  209.  
  210. -- Vol Icon
  211. volicon = widget ({type = "imagebox" })
  212. volicon.image = image(beautiful.widget_vol)
  213. -- Vol bar Widget
  214. volbar = awful.widget.progressbar()
  215. volbar:set_width(50)
  216. volbar:set_height(6)
  217. volbar:set_vertical(false)
  218. volbar:set_background_color("#434343")
  219. volbar:set_border_color(nil)
  220. volbar:set_gradient_colors({ beautiful.fg_normal, beautiful.fg_normal, beautiful.fg_normal, beautiful.bar })
  221. awful.widget.layout.margins[volbar.widget] = { top = 6 }
  222. vicious.register(volbar, vicious.widgets.volume,  "$1",  1, "Master")
  223.  
  224. -- MEM icon
  225. memicon = widget ({type = "imagebox" })
  226. memicon.image = image(beautiful.widget_mem)
  227. -- Initialize MEMBar widget
  228. membar = awful.widget.progressbar()
  229. membar:set_width(50)
  230. membar:set_height(6)
  231. membar:set_vertical(false)
  232. membar:set_background_color("#434343")
  233. membar:set_border_color(nil)
  234. membar:set_gradient_colors({ beautiful.fg_normal, beautiful.fg_normal, beautiful.fg_normal, beautiful.bar })
  235. awful.widget.layout.margins[membar.widget] = { top = 6 }
  236. vicious.register(membar, vicious.widgets.mem, "$1", 13)
  237.  
  238. -- MPD Icon
  239. mpdicon = widget({ type = "imagebox" })
  240. mpdicon.image = image(beautiful.widget_mpd)
  241. -- Initialize MPD Widget
  242. mpdwidget = widget({ type = "textbox" })
  243. vicious.register(mpdwidget, vicious.widgets.mpd,
  244.     function (widget, args)
  245.         if args["{state}"] == "Stop" then
  246.             return " - "
  247.         else
  248.             return args["{Artist}"]..' - '.. args["{Title}"]
  249.         end
  250.     end, 10)
  251.  
  252. -- Spacers
  253. rbracket = widget({type = "textbox" })
  254. rbracket.text = "]"
  255. lbracket = widget({type = "textbox" })
  256. lbracket.text = "["
  257.  
  258. -- Space
  259. space = widget({ type = "textbox" })
  260. space.text = " "
  261.  
  262. -- MPD controls
  263. music_play = awful.widget.launcher({
  264.     image = beautiful.widget_play,
  265.     command = "ncmpcpp toggle && echo -e 'vicious.force({ mpdwidget, })' | awesome-client"
  266.   })
  267.  
  268.   music_pause = awful.widget.launcher({
  269.     image = beautiful.widget_pause,
  270.     command = "ncmpcpp toggle && echo -e 'vicious.force({ mpdwidget, })' | awesome-client"
  271.   })
  272.   music_pause.visible = false
  273.  
  274.   music_stop = awful.widget.launcher({
  275.     image = beautiful.widget_stop,
  276.     command = "ncmpcpp stop && echo -e 'vicious.force({ mpdwidget, })' | awesome-client"
  277.   })
  278.  
  279.   music_prev = awful.widget.launcher({
  280.     image = beautiful.widget_prev,
  281.     command = "ncmpcpp prev && echo -e 'vicious.force({ mpdwidget, })' | awesome-client"
  282.   })
  283.  
  284.   music_next = awful.widget.launcher({
  285.     image = beautiful.widget_next,
  286.     command = "ncmpcpp next && echo -e 'vicious.force({ mpdwidget, })' | awesome-client"
  287.   })
  288.  
  289. -- Create a systray
  290. mysystray = widget({ type = "systray" })
  291.  
  292. -- Create a wibox for each screen and add it
  293. mywibox = {}
  294. mybottomwibox = {}
  295. mystatusbar = {}
  296. mypromptbox = {}
  297. mylayoutbox = {}
  298. mytaglist = {}
  299. mytaglist.buttons = awful.util.table.join(
  300.                     awful.button({ }, 1, awful.tag.viewonly),
  301.                     awful.button({ modkey }, 1, awful.client.movetotag),
  302.                     awful.button({ }, 3, awful.tag.viewtoggle),
  303.                     awful.button({ modkey }, 3, awful.client.toggletag),
  304.                     awful.button({ }, 4, awful.tag.viewnext),
  305.                     awful.button({ }, 5, awful.tag.viewprev)
  306.                     )
  307. mytasklist = {}
  308. mytasklist.buttons = awful.util.table.join(
  309.                      awful.button({ }, 1, function (c)
  310.                                               if c == client.focus then
  311.                                                   c.minimized = true
  312.                                               else
  313.                                                   if not c:isvisible() then
  314.                                                       awful.tag.viewonly(c:tags()[1])
  315.                                                   end
  316.                                                   -- This will also un-minimize
  317.                                                   -- the client, if needed
  318.                                                   client.focus = c
  319.                                                   c:raise()
  320.                                               end
  321.                                           end),
  322.                      awful.button({ }, 3, function ()
  323.                                               if instance then
  324.                                                   instance:hide()
  325.                                                   instance = nil
  326.                                               else
  327.                                                   instance = awful.menu.clients({ width=250 })
  328.                                               end
  329.                                           end),
  330.                      awful.button({ }, 4, function ()
  331.                                               awful.client.focus.byidx(1)
  332.                                               if client.focus then client.focus:raise() end
  333.                                           end),
  334.                      awful.button({ }, 5, function ()
  335.                                               awful.client.focus.byidx(-1)
  336.                                               if client.focus then client.focus:raise() end
  337.                                           end))
  338.  
  339. for s = 1, screen.count() do
  340.     -- Create a promptbox for each screen
  341.     mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
  342.     -- Create an imagebox widget which will contains an icon indicating which layout we're using.
  343.     -- We need one layoutbox per screen.
  344.     mylayoutbox[s] = awful.widget.layoutbox(s)
  345.     mylayoutbox[s]:buttons(awful.util.table.join(
  346.                            awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
  347.                            awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
  348.                            awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
  349.                            awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
  350.     -- Create a taglist widget
  351.     mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
  352.  
  353.     -- Create a tasklist widget
  354.     mytasklist[s] = awful.widget.tasklist(function(c)
  355.                                               return awful.widget.tasklist.label.currenttags(c, s)
  356.                                           end, mytasklist.buttons)
  357.  
  358.     -- Create the upper wibox
  359.     mywibox[s] = awful.wibox({ position = "top", screen = s })
  360.     -- Add widgets to the wibox - order matters
  361.     mywibox[s].widgets = {
  362.         {
  363.             mylauncher,
  364.             mytaglist[s],
  365.             mypromptbox[s],
  366.             layout = awful.widget.layout.horizontal.leftright
  367.         },
  368.         mylayoutbox[s],
  369.         mytextclock,
  370.         weatherwidget,
  371.         space,
  372.         s == 1 and mysystray or nil,
  373.         mytasklist[s],
  374.         layout = awful.widget.layout.horizontal.rightleft
  375.     }
  376.      mybottomwibox[s] = awful.wibox({ position = "bottom", screen = s, border_width = 0, height = 18 })
  377.  
  378.      mybottomwibox[s].widgets = {
  379.      {
  380.         space, lbracket, space, cpuicon, space, cpubar, space, rbracket, space, lbracket, space, memicon, space, membar, space, rbracket, space, lbracket, space, baticon, space, batwidget, space, rbracket, space, lbracket, space, volicon, space, volbar, space, rbracket,
  381.         layout = awful.widget.layout.horizontal.leftright
  382.      },
  383.         space,rbracket, space, tempwidget,space, tempicon, space, lbracket, space, rbracket, space, pacwidget, pacicon, space, lbracket, space, rbracket, space, mygmail, space, mygmailimg, space, lbracket, space, rbracket, space, music_stop, music_pause, music_play, music_next, music_prev, space, mpdwidget, space, mpdicon, space, lbracket,
  384.         layout = awful.widget.layout.horizontal.rightleft
  385.       }
  386.    end
  387.  
  388. -- }}}
  389.  
  390. -- {{{ Mouse bindings
  391. root.buttons(awful.util.table.join(
  392.     awful.button({ }, 3, function () mymainmenu:toggle() end),
  393.     awful.button({ }, 4, awful.tag.viewnext),
  394.     awful.button({ }, 5, awful.tag.viewprev)
  395. ))
  396. -- }}}
  397.  
  398. -- {{{ Key bindings
  399. globalkeys = awful.util.table.join(
  400.     awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
  401.     awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
  402.     awful.key({ modkey,           }, "Escape", awful.tag.history.restore),
  403.  
  404.     awful.key({ modkey,           }, "j",
  405.         function ()
  406.             awful.client.focus.byidx( 1)
  407.             if client.focus then client.focus:raise() end
  408.         end),
  409.     awful.key({ modkey,           }, "k",
  410.         function ()
  411.             awful.client.focus.byidx(-1)
  412.             if client.focus then client.focus:raise() end
  413.         end),
  414.     awful.key({ modkey,           }, "w", function () mymainmenu:show({keygrabber=true}) end),
  415.  
  416.     -- Layout manipulation
  417.     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
  418.     awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
  419.     awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
  420.     awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
  421.     awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
  422.     awful.key({ modkey,           }, "Tab",
  423.         function ()
  424.             awful.client.focus.history.previous()
  425.             if client.focus then
  426.                 client.focus:raise()
  427.             end
  428.         end),
  429.  
  430.     -- Volume Keys
  431.     awful.key({ }, "XF86AudioRaiseVolume", function ()
  432.        awful.util.spawn("amixer set Master 5%+") end),
  433.    awful.key({ }, "XF86AudioLowerVolume", function ()
  434.        awful.util.spawn("amixer set Master 5%-") end),
  435.    awful.key({ }, "XF86AudioMute", function ()
  436.        awful.util.spawn("amixer set Master toggle") end),
  437.  
  438.     -- Standard program
  439.     awful.key({ modkey,           }, "Return", function () awful.util.spawn(terminal) end),
  440.     awful.key({ modkey, "Control" }, "r", awesome.restart),
  441.     awful.key({ modkey, "Shift"   }, "q", awesome.quit),
  442.  
  443.     awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
  444.     awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
  445.     awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
  446.     awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
  447.     awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
  448.     awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
  449.     awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
  450.     awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),
  451.  
  452.     awful.key({ modkey, "Control" }, "n", awful.client.restore),
  453.  
  454.     -- Prompt
  455.     awful.key({ modkey },            "r",     function () mypromptbox[mouse.screen]:run() end),
  456.  
  457.     awful.key({ modkey }, "x",
  458.               function ()
  459.                   awful.prompt.run({ prompt = "Run Lua code: " },
  460.                   mypromptbox[mouse.screen].widget,
  461.                   awful.util.eval, nil,
  462.                   awful.util.getdir("cache") .. "/history_eval")
  463.               end)
  464. )
  465.  
  466.  
  467. clientkeys = awful.util.table.join(
  468.     awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
  469.     awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end),
  470.     awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
  471.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  472.     awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
  473.     awful.key({ modkey, "Shift"   }, "r",      function (c) c:redraw()                       end),
  474.     awful.key({ modkey,           }, "t",      function (c) c.ontop = not c.ontop            end),
  475.     awful.key({ modkey,           }, "n",
  476.         function (c)
  477.             -- The client currently has the input focus, so it cannot be
  478.             -- minimized, since minimized clients can't have the focus.
  479.             c.minimized = true
  480.         end),
  481.     awful.key({ modkey,           }, "m",
  482.         function (c)
  483.             c.maximized_horizontal = not c.maximized_horizontal
  484.             c.maximized_vertical   = not c.maximized_vertical
  485.         end)
  486. )
  487.  
  488. -- Compute the maximum number of digit we need, limited to 9
  489. keynumber = 0
  490. for s = 1, screen.count() do
  491.    keynumber = math.min(9, math.max(#tags[s], keynumber));
  492. end
  493.  
  494. -- Bind all key numbers to tags.
  495. -- Be careful: we use keycodes to make it works on any keyboard layout.
  496. -- This should map on the top row of your keyboard, usually 1 to 9.
  497. for i = 1, keynumber do
  498.     globalkeys = awful.util.table.join(globalkeys,
  499.         awful.key({ modkey }, "#" .. i + 9,
  500.                   function ()
  501.                         local screen = mouse.screen
  502.                         if tags[screen][i] then
  503.                             awful.tag.viewonly(tags[screen][i])
  504.                         end
  505.                   end),
  506.         awful.key({ modkey, "Control" }, "#" .. i + 9,
  507.                   function ()
  508.                       local screen = mouse.screen
  509.                       if tags[screen][i] then
  510.                           awful.tag.viewtoggle(tags[screen][i])
  511.                       end
  512.                   end),
  513.         awful.key({ modkey, "Shift" }, "#" .. i + 9,
  514.                   function ()
  515.                       if client.focus and tags[client.focus.screen][i] then
  516.                           awful.client.movetotag(tags[client.focus.screen][i])
  517.                       end
  518.                   end),
  519.         awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  520.                   function ()
  521.                       if client.focus and tags[client.focus.screen][i] then
  522.                           awful.client.toggletag(tags[client.focus.screen][i])
  523.                       end
  524.                   end))
  525. end
  526.  
  527. clientbuttons = awful.util.table.join(
  528.     awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  529.     awful.button({ modkey }, 1, awful.mouse.client.move),
  530.     awful.button({ modkey }, 3, awful.mouse.client.resize))
  531.  
  532. -- Set keys
  533. root.keys(globalkeys)
  534. -- }}}
  535.  
  536. -- {{{ Rules
  537. awful.rules.rules = {
  538.     -- All clients will match this rule.
  539.     { rule = { },
  540.       properties = { border_width = beautiful.border_width,
  541.                      border_color = beautiful.border_normal,
  542.                      focus = true,
  543.                      size_hints_honor = false,
  544.                      keys = clientkeys,
  545.                      buttons = clientbuttons } },
  546.     { rule = { class = "MPlayer" },
  547.       properties = { floating = true } },
  548.     { rule = { class = "pinentry" },
  549.       properties = { floating = true } },
  550.     { rule = { class = "gimp" },
  551.       properties = { floating = true } },
  552.     -- Set Firefox to always map on tags number 2 of screen 1.
  553.     -- { rule = { class = "Firefox" },
  554.     --   properties = { tag = tags[1][2] } },
  555. }
  556. -- }}}
  557.  
  558. -- {{{ Signals
  559. -- Signal function to execute when a new client appears.
  560. client.add_signal("manage", function (c, startup)
  561.     -- Add a titlebar
  562.     -- awful.titlebar.add(c, { modkey = modkey })
  563.  
  564.     -- Enable sloppy focus
  565.     c:add_signal("mouse::enter", function(c)
  566.         if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  567.             and awful.client.focus.filter(c) then
  568.             client.focus = c
  569.         end
  570.     end)
  571.  
  572.     if not startup then
  573.         -- Set the windows at the slave,
  574.         -- i.e. put it at the end of others instead of setting it master.
  575.          awful.client.setslave(c)
  576.  
  577.         -- Put windows in a smart way, only if they does not set an initial position.
  578.         if not c.size_hints.user_position and not c.size_hints.program_position then
  579.             awful.placement.no_overlap(c)
  580.             awful.placement.no_offscreen(c)
  581.         end
  582.     end
  583. end)
  584.  
  585. client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  586. client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  587. -- }}}