\ Untitled - /g/pasta 2.4
From Edgy Meerkat, 5 Years ago, written in Plain Text.
This paste will in 1 Second.
Embed
  1. -- {{{ License
  2. --
  3. -- Awesome configuration, using awesome 3.4.10 on Ubuntu 11.10
  4. --   * Tony N <tony@git-pull.com>
  5. --
  6. -- This work is licensed under the Creative Commons Attribution-Share
  7. -- Alike License: http://creativecommons.org/licenses/by-sa/3.0/
  8. -- based off Adrian C. <anrxc@sysphere.org>'s rc.lua
  9. -- }}}
  10.  
  11.  
  12. -- {{{ Libraries
  13. awful = require("awful")
  14. beautiful = require("beautiful")
  15. awful.rules = require("awful.rules")
  16. awful.autofocus = require("awful.autofocus")
  17. naughty = require("naughty")
  18. wibox = ("wibox")
  19. widget = ("widget")
  20. -- User libraries
  21. vicious = require("vicious")
  22. helpers = require("helpers")
  23. -- }}}
  24.  
  25. -- {{{ Default configuration
  26. altkey = "Mod1"
  27. modkey = "Mod4" -- your windows/apple key
  28.  
  29. terminal = whereis_app('urxvtcd') and 'urxvtcd' or 'x-terminal-emulator' -- also accepts full path
  30. editor = os.getenv("EDITOR") or "vim"
  31. editor_cmd = terminal .. " -e " .. editor
  32.  
  33. wallpaper_app = "feh" -- if you want to check for app before trying
  34. wallpaper_dir = os.getenv("HOME") .. "/Pictures/Wallpaper" -- wallpaper dir
  35.  
  36. -- taglist numerals
  37. --- arabic, chinese, {east|persian}_arabic, roman, thai, random
  38. taglist_numbers = "chinese" -- we support arabic (1,2,3...),
  39.  
  40. cpugraph_enable = true -- Show CPU graph
  41. cputext_format = " $1%" -- %1 average cpu, %[2..] every other thread individually
  42.  
  43. membar_enable = true -- Show memory bar
  44. memtext_format = " $1%" -- %1 percentage, %2 used %3 total %4 free
  45.  
  46. date_format = "%a %m/%d/%Y %l:%M%p" -- refer to http://en.wikipedia.org/wiki/Date_(Unix) specifiers
  47.  
  48. networks = {'eth0'} -- add your devices network interface here netwidget, only shows first one thats up.
  49.  
  50. require_safe('personal')
  51.  
  52. -- Create personal.lua in this same directory to override these defaults
  53.  
  54.  
  55. -- }}}
  56.  
  57. -- {{{ Variable definitions
  58. local wallpaper_cmd = "find " .. wallpaper_dir .. " -type f -name '*.jpg'  -print0 | shuf -n1 -z | xargs -0 feh --bg-scale"
  59. local home   = os.getenv("HOME")
  60. local exec   = awful.util.spawn
  61. local sexec  = awful.util.spawn_with_shell
  62.  
  63. -- Beautiful theme
  64. beautiful.init(awful.util.getdir("config") .. "/themes/zhongguo/zhongguo.lua")
  65.  
  66. -- Window management layouts
  67. layouts = {
  68.   awful.layout.suit.tile,
  69.   awful.layout.suit.tile.bottom,
  70.   awful.layout.suit.tile.top,
  71.   --awful.layout.suit.fair,
  72.   awful.layout.suit.max,
  73.   awful.layout.suit.magnifier,
  74.   --awful.layout.suit.floating
  75. }
  76. -- }}}
  77.  
  78. -- {{{ Tags
  79.  
  80. -- Taglist numerals
  81. taglist_numbers_langs = { 'arabic', 'chinese', 'traditional_chinese', 'east_arabic', 'persian_arabic', }
  82. taglist_numbers_sets = {
  83.         arabic={ 1, 2, 3, 4, 5, 6, 7, 8, 9 },
  84.         chinese={"一", "二", "三", "四", "五", "六", "七", "八", "九", "十"},
  85.         traditional_chinese={"壹", "貳", "叄", "肆", "伍", "陸", "柒", "捌", "玖", "拾"},
  86.         east_arabic={'١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'}, -- '٠' 0
  87.         persian_arabic={'٠', '١', '٢', '٣', '۴', '۵', '۶', '٧', '٨', '٩'},
  88.         roman={'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X'},
  89.         thai={'๑', '๒', '๓', '๔', '๕', '๖', '๗', '๘', '๙', '๑๐'},
  90. }
  91. -- }}}
  92.  
  93. tags = {}
  94. for s = 1, screen.count() do
  95.     -- Each screen has its own tag table.
  96.       --tags[s] = awful.tag({"一", "二", "三", "四", "五", "六", "七", "八", "九", "十"}, s, layouts[1])
  97.       --tags[s] = awful.tag(taglist_numbers_sets[taglist_numbers], s, layouts[1])
  98.         if taglist_numbers == 'random' then
  99.                 math.randomseed(os.time())
  100.                 local taglist = taglist_numbers_sets[taglist_numbers_langs[math.random(table.getn(taglist_numbers_langs))]]
  101.                 tags[s] = awful.tag(taglist, s, layouts[1])
  102.         else
  103.                 tags[s] = awful.tag(taglist_numbers_sets[taglist_numbers], s, layouts[1])
  104.         end
  105.     --tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[1])
  106. end
  107. -- }}}
  108.  
  109.  
  110. -- {{{ Wibox
  111. --
  112. -- {{{ Widgets configuration
  113. --
  114. -- {{{ Reusable separator
  115. seperator = wibox.widget.imagebox()
  116. separator.image = image(beautiful.widget_sep)
  117.  
  118. spacer = wibox.widget.textbox()
  119. spacer.width = 3
  120. -- }}}
  121.  
  122. -- {{{ CPU usage
  123.  
  124. -- cpu icon
  125. cpuicon = widget({ type = "imagebox" })
  126. cpuicon.image = image(beautiful.widget_cpu)
  127.  
  128. -- check for cpugraph_enable == true in config
  129. if cpugraph_enable then
  130.         -- Initialize widget
  131.         cpugraph  = awful.widget.graph()
  132.  
  133.         -- Graph properties
  134.         cpugraph:set_width(40):set_height(16)
  135.         cpugraph:set_background_color(beautiful.fg_off_widget)
  136.         cpugraph:set_gradient_angle(0):set_gradient_colors({
  137.            beautiful.fg_end_widget, beautiful.fg_center_widget, beautiful.fg_widget
  138.         })
  139.  
  140.         -- Register graph widget
  141.         vicious.register(cpugraph,  vicious.widgets.cpu,      "$1")
  142. end
  143.  
  144. -- cpu text widget
  145. cpuwidget = widget({ type = "textbox" }) -- initialize
  146. vicious.register(cpuwidget, vicious.widgets.cpu, cputext_format, 3) -- register
  147.  
  148. -- temperature
  149. tzswidget = widget({ type = "textbox" })
  150. vicious.register(tzswidget, vicious.widgets.thermal,
  151.         function (widget, args)
  152.                 if args[1] > 0 then
  153.                         tzfound = true
  154.                         return " " .. args[1] .. "C°"
  155.                 else return ""
  156.                 end
  157.         end
  158.         , 19, "thermal_zone0")
  159.  
  160. -- }}}
  161.  
  162.  
  163. -- {{{ Battery state
  164.  
  165. -- Initialize widget
  166. batwidget = widget({ type = "textbox" })
  167. baticon = widget({ type = "imagebox" })
  168.  
  169. -- Register widget
  170. vicious.register(batwidget, vicious.widgets.bat,
  171.         function (widget, args)
  172.                 if args[2] == 0 then return ""
  173.                 else
  174.                         baticon.image = image(beautiful.widget_bat)
  175.                         return "<span color='white'>".. args[2] .. "%</span>"
  176.                 end
  177.         end, 61, "BAT0"
  178. )
  179. -- }}}
  180.  
  181.  
  182. -- {{{ Memory usage
  183.  
  184. -- icon
  185. memicon = widget({ type = "imagebox" })
  186. memicon.image = image(beautiful.widget_mem)
  187.  
  188. if membar_enable then
  189.         -- Initialize widget
  190.         membar = awful.widget.progressbar()
  191.         -- Pogressbar properties
  192.         membar:set_vertical(true):set_ticks(true)
  193.         membar:set_height(16):set_width(8):set_ticks_size(2)
  194.         membar:set_background_color(beautiful.fg_off_widget)
  195.         membar:set_gradient_colors({ beautiful.fg_widget,
  196.            beautiful.fg_center_widget, beautiful.fg_end_widget
  197.         }) -- Register widget
  198.         vicious.register(membar, vicious.widgets.mem, "$1", 13)
  199. end
  200.  
  201. -- mem text output
  202. memtext = widget({ type = "textbox" })
  203. vicious.register(memtext, vicious.widgets.mem, memtext_format, 13)
  204. -- }}}
  205.  
  206. -- {{{ File system usage
  207. fsicon = widget({ type = "imagebox" })
  208. fsicon.image = image(beautiful.widget_fs)
  209. -- Initialize widgets
  210. fs = {
  211.   r = awful.widget.progressbar(), s = awful.widget.progressbar()
  212. }
  213. -- Progressbar properties
  214. for _, w in pairs(fs) do
  215.   w:set_vertical(true):set_ticks(true)
  216.   w:set_height(16):set_width(5):set_ticks_size(2)
  217.   w:set_border_color(beautiful.border_widget)
  218.   w:set_background_color(beautiful.fg_off_widget)
  219.   w:set_gradient_colors({ beautiful.fg_widget,
  220.      beautiful.fg_center_widget, beautiful.fg_end_widget
  221.   }) -- Register buttons
  222.   w.widget:buttons(awful.util.table.join(
  223.     awful.button({ }, 1, function () exec("dolphin", false) end)
  224.   ))
  225. end -- Enable caching
  226. vicious.cache(vicious.widgets.fs)
  227. -- Register widgets
  228. vicious.register(fs.r, vicious.widgets.fs, "${/ used_p}",            599)
  229. vicious.register(fs.s, vicious.widgets.fs, "${/media/files used_p}", 599)
  230. -- }}}
  231.  
  232. -- {{{ Network usage
  233. function print_net(name, down, up)
  234.         return '<span color="'
  235.         .. beautiful.fg_netdn_widget ..'">' .. down .. '</span> <span color="'
  236.         .. beautiful.fg_netup_widget ..'">' .. up  .. '</span>'
  237. end
  238.  
  239. dnicon = widget({ type = "imagebox" })
  240. upicon = widget({ type = "imagebox" })
  241.  
  242. -- Initialize widget
  243. netwidget = widget({ type = "textbox" })
  244. -- Register widget
  245. vicious.register(netwidget, vicious.widgets.net,
  246.         function (widget, args)
  247.                 for _,device in pairs(networks) do
  248.                         if tonumber(args["{".. device .." carrier}"]) > 0 then
  249.                                 netwidget.found = true
  250.                                 dnicon.image = image(beautiful.widget_net)
  251.                                 upicon.image = image(beautiful.widget_netup)
  252.                                 return print_net(device, args["{"..device .." down_kb}"], args["{"..device.." up_kb}"])
  253.                         end
  254.                 end
  255.         end, 3)
  256. -- }}}
  257.  
  258.  
  259.  
  260. -- {{{ Volume level
  261. volicon = widget({ type = "imagebox" })
  262. volicon.image = image(beautiful.widget_vol)
  263. -- Initialize widgets
  264. volbar    = awful.widget.progressbar()
  265. volwidget = widget({ type = "textbox" })
  266. -- Progressbar properties
  267. volbar:set_vertical(true):set_ticks(true)
  268. volbar:set_height(16):set_width(8):set_ticks_size(2)
  269. volbar:set_background_color(beautiful.fg_off_widget)
  270. volbar:set_gradient_colors({ beautiful.fg_widget,
  271.    beautiful.fg_center_widget, beautiful.fg_end_widget
  272. }) -- Enable caching
  273. vicious.cache(vicious.widgets.volume)
  274. -- Register widgets
  275. vicious.register(volbar,    vicious.widgets.volume,  "$1",  2, "PCM")
  276. vicious.register(volwidget, vicious.widgets.volume, " $1%", 2, "PCM")
  277. -- Register buttons
  278. volbar.widget:buttons(awful.util.table.join(
  279.    awful.button({ }, 1, function () exec("kmix") end),
  280.    awful.button({ }, 4, function () exec("amixer -q set PCM 2dB+", false) vicious.force({volbar, volwidget}) end),
  281.    awful.button({ }, 5, function () exec("amixer -q set PCM 2dB-", false) vicious.force({volbar, volwidget}) end)
  282. )) -- Register assigned buttons
  283. volwidget:buttons(volbar.widget:buttons())
  284. -- }}}
  285.  
  286. -- {{{ Date and time
  287. dateicon = widget({ type = "imagebox" })
  288. dateicon.image = image(beautiful.widget_date)
  289. -- Initialize widget
  290. datewidget = widget({ type = "textbox" })
  291. -- Register widget
  292. vicious.register(datewidget, vicious.widgets.date, date_format, 61)
  293. -- }}}
  294.  
  295. -- {{{ mpd
  296.  
  297. if whereis_app('curl') and whereis_app('mpd') then
  298.         mpdwidget = widget({ type = "textbox" })
  299.         vicious.register(mpdwidget, vicious.widgets.mpd,
  300.                 function (widget, args)
  301.                         if args["{state}"] == "Stop" or args["{state}"] == "Pause" or args["{state}"] == "N/A"
  302.                                 or (args["{Artist}"] == "N/A" and args["{Title}"] == "N/A") then return ""
  303.                         else return '<span color="white">музыка:</span> '..
  304.                              args["{Artist}"]..' - '.. args["{Title}"]
  305.                         end
  306.                 end
  307.         )
  308. end
  309.  
  310. -- }}}
  311.  
  312.  
  313. -- {{{ System tray
  314. systray = widget({ type = "systray" })
  315. -- }}}
  316. -- }}}
  317.  
  318. -- {{{ Wibox initialisation
  319. wibox     = {}
  320. promptbox = {}
  321. layoutbox = {}
  322. taglist   = {}
  323. taglist.buttons = awful.util.table.join(
  324.     awful.button({ },        1, awful.tag.viewonly),
  325.     awful.button({ modkey }, 1, awful.client.movetotag),
  326.     awful.button({ },        3, awful.tag.viewtoggle),
  327.     awful.button({ modkey }, 3, awful.client.toggletag),
  328.     awful.button({ },        4, awful.tag.viewnext),
  329.     awful.button({ },        5, awful.tag.viewprev
  330. ))
  331.  
  332.  
  333. for s = 1, screen.count() do
  334.     -- Create a promptbox
  335.     promptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
  336.     -- Create a layoutbox
  337.     layoutbox[s] = awful.widget.layoutbox(s)
  338.     layoutbox[s]:buttons(awful.util.table.join(
  339.         awful.button({ }, 1, function () awful.layout.inc(layouts,  1) end),
  340.         awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
  341.         awful.button({ }, 4, function () awful.layout.inc(layouts,  1) end),
  342.         awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)
  343.     ))
  344.  
  345.     -- Create the taglist
  346.     taglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, taglist.buttons)
  347.     -- Create the wibox
  348.     wibox[s] = awful.wibox({      screen = s,
  349.         fg = beautiful.fg_normal, height = 16,
  350.         bg = beautiful.bg_normal, position = "top",
  351.         border_color = beautiful.border_normal,
  352.         border_width = beautiful.border_width
  353.     })
  354.     -- Add widgets to the wibox
  355.     wibox[s].widgets = {
  356.         {   taglist[s], layoutbox[s], separator, promptbox[s],
  357.             mpdwidget and spacer, mpdwidget or nil,
  358.             ["layout"] = awful.widget.layout.horizontal.leftright
  359.         },
  360.         --s == screen.count() and systray or nil, -- show tray on last screen
  361.         s == 1 and systray or nil, -- only show tray on first screen
  362.         s == 1 and separator or nil, -- only show on first screen
  363.         datewidget, dateicon,
  364.         baticon.image and separator, batwidget, baticon or nil,
  365.         separator, volwidget,  volbar.widget, volicon,
  366.         dnicon.image and separator, upicon, netwidget, dnicon or nil,
  367.         separator, fs.r.widget, fs.s.widget, fsicon,
  368.         separator, memtext, membar_enable and membar.widget or nil, memicon,
  369.         separator, tzfound and tzswidget or nil,
  370.         cpugraph_enable and cpugraph.widget or nil, cpuwidget, cpuicon,
  371.         ["layout"] = awful.widget.layout.horizontal.rightleft
  372.     }
  373. end
  374. -- }}}
  375. -- }}}
  376.  
  377.  
  378. -- {{{ Mouse bindings
  379. root.buttons(awful.util.table.join(
  380.     awful.button({ }, 4, awful.tag.viewnext),
  381.     awful.button({ }, 5, awful.tag.viewprev)
  382. ))
  383.  
  384. -- Client bindings
  385. clientbuttons = awful.util.table.join(
  386.     awful.button({ },        1, function (c) client.focus = c; c:raise() end),
  387.     awful.button({ modkey }, 1, awful.mouse.client.move),
  388.     awful.button({ modkey }, 3, awful.mouse.client.resize)
  389. )
  390. -- }}}
  391.  
  392.  
  393. -- {{{ Key bindings
  394. globalkeys = awful.util.table.join(
  395.     awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
  396.     awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
  397.     awful.key({ modkey,           }, "Escape", awful.tag.history.restore),
  398.  
  399.     awful.key({ modkey,           }, "j",
  400.         function ()
  401.             awful.client.focus.byidx( 1)
  402.             if client.focus then client.focus:raise() end
  403.         end),
  404.     awful.key({ modkey,           }, "k",
  405.         function ()
  406.             awful.client.focus.byidx(-1)
  407.             if client.focus then client.focus:raise() end
  408.         end),
  409.     awful.key({ modkey,           }, "w", function () mymainmenu:show({keygrabber=true}) end),
  410.  
  411.     -- Layout manipulation
  412.     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
  413.     awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
  414.     awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
  415.     awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
  416.     awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
  417.     awful.key({ modkey,           }, "Tab",
  418.         function ()
  419.             awful.client.focus.history.previous()
  420.             if client.focus then
  421.                 client.focus:raise()
  422.             end
  423.         end),
  424.  
  425.     -- Standard program
  426.     awful.key({ modkey, "Shift"   }, "Return", function () awful.util.spawn(terminal) end),
  427.     awful.key({ modkey, "Control" }, "r", awesome.restart),
  428.     awful.key({ modkey, "Shift"   }, "q", awesome.quit),
  429.     awful.key({modkey }, "p", function() awful.util.spawn( "dmenu_run" ) end),
  430.     awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
  431.     awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
  432.     awful.key({ modkey,           }, ",",     function () awful.tag.incnmaster( 1)      end),
  433.     awful.key({ modkey,           }, ".",     function () awful.tag.incnmaster(-1)      end),
  434.     awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
  435.     awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
  436.     awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
  437.     awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),
  438.  
  439.     awful.key({ modkey }, "b", function ()
  440.          wibox[mouse.screen].visible = not wibox[mouse.screen].visible
  441.     end),
  442.  
  443.     -- Prompt
  444.     awful.key({ modkey },            "r",     function () promptbox[mouse.screen]:run() end),
  445.  
  446.     awful.key({ modkey }, "x",
  447.               function ()
  448.                   awful.prompt.run({ prompt = "Run Lua code: " },
  449.                   mypromptbox[mouse.screen].widget,
  450.                   awful.util.eval, nil,
  451.                   awful.util.getdir("cache") .. "/history_eval")
  452.               end)
  453. )
  454.  
  455. clientkeys = awful.util.table.join(
  456.     awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
  457.     awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end),
  458.     awful.key({ modkey,           }, "t",  awful.client.floating.toggle                     ),
  459.     awful.key({ modkey, "Shift" }, "t", function (c)
  460.         if   c.titlebar then awful.titlebar.remove(c)
  461.            else awful.titlebar.add(c, { modkey = modkey }) end
  462.     end),
  463.     awful.key({ modkey,           }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  464.     awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
  465.     awful.key({ modkey, "Shift"   }, "r",      function (c) c:redraw()                       end),
  466.     awful.key({ modkey,           }, "m",
  467.         function (c)
  468.             c.maximized_horizontal = not c.maximized_horizontal
  469.             c.maximized_vertical   = not c.maximized_vertical
  470.         end)
  471. )
  472.  
  473. -- Compute the maximum number of digit we need, limited to 9
  474. keynumber = 0
  475. for s = 1, screen.count() do
  476.    keynumber = math.min(9, math.max(#tags[s], keynumber));
  477. end
  478.  
  479. -- Bind all key numbers to tags.
  480. -- Be careful: we use keycodes to make it works on any keyboard layout.
  481. -- This should map on the top row of your keyboard, usually 1 to 9.
  482. for i = 1, keynumber do
  483.     globalkeys = awful.util.table.join(globalkeys,
  484.         awful.key({ modkey }, "#" .. i + 9,
  485.                   function ()
  486.                         local screen = mouse.screen
  487.                         if tags[screen][i] then
  488.                             awful.tag.viewonly(tags[screen][i])
  489.                         end
  490.                   end),
  491.         awful.key({ modkey, "Control" }, "#" .. i + 9,
  492.                   function ()
  493.                       local screen = mouse.screen
  494.                       if tags[screen][i] then
  495.                           awful.tag.viewtoggle(tags[screen][i])
  496.                       end
  497.                   end),
  498.         awful.key({ modkey, "Shift" }, "#" .. i + 9,
  499.                   function ()
  500.                       if client.focus and tags[client.focus.screen][i] then
  501.                           awful.client.movetotag(tags[client.focus.screen][i])
  502.                       end
  503.                   end),
  504.         awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  505.                   function ()
  506.                       if client.focus and tags[client.focus.screen][i] then
  507.                           awful.client.toggletag(tags[client.focus.screen][i])
  508.                       end
  509.                   end))
  510. end
  511.  
  512. clientbuttons = awful.util.table.join(
  513.     awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  514.     awful.button({ modkey }, 1, awful.mouse.client.move),
  515.     awful.button({ modkey }, 3, awful.mouse.client.resize))
  516.  
  517. -- Set keys
  518. root.keys(globalkeys)
  519. -- }}}
  520.  
  521.  
  522. -- {{{ Rules
  523. awful.rules.rules = {
  524.     { rule = { }, properties = {
  525.       focus = true,      size_hints_honor = false,
  526.       keys = clientkeys, buttons = clientbuttons,
  527.       border_width = beautiful.border_width,
  528.       border_color = beautiful.border_normal }
  529.     },
  530.     { rule = { class = "ROX-Filer" },   properties = { floating = true } },
  531.     { rule = { class = "Chromium-browser" },   properties = { floating = false } },
  532.     { rule = { class = "Google-chrome" },   properties = { floating = false } },
  533.     { rule = { class = "Firefox" },   properties = { floating = false } },
  534. }
  535. -- }}}
  536.  
  537.  
  538. -- {{{ Signals
  539. --
  540. -- {{{ Manage signal handler
  541. client.add_signal("manage", function (c, startup)
  542.     -- Add titlebar to floaters, but remove those from rule callback
  543.     if awful.client.floating.get(c)
  544.     or awful.layout.get(c.screen) == awful.layout.suit.floating then
  545.         if   c.titlebar then awful.titlebar.remove(c)
  546.         else awful.titlebar.add(c, {modkey = modkey}) end
  547.     end
  548.  
  549.     -- Enable sloppy focus
  550.     c:add_signal("mouse::enter", function (c)
  551.         if  awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  552.         and awful.client.focus.filter(c) then
  553.             client.focus = c
  554.         end
  555.     end)
  556.  
  557.     -- Client placement
  558.     if not startup then
  559.         awful.client.setslave(c)
  560.  
  561.         if  not c.size_hints.program_position
  562.         and not c.size_hints.user_position then
  563.             awful.placement.no_overlap(c)
  564.             awful.placement.no_offscreen(c)
  565.         end
  566.     end
  567. end)
  568. -- }}}
  569.  
  570. -- {{{ Focus signal handlers
  571. client.add_signal("focus",   function (c) c.border_color = beautiful.border_focus  end)
  572. client.add_signal("unfocus", function (c) c.border_color = beautiful.border_normal end)
  573. -- }}}
  574.  
  575. -- {{{ Arrange signal handler
  576. for s = 1, screen.count() do screen[s]:add_signal("arrange", function ()
  577.     local clients = awful.client.visible(s)
  578.     local layout = awful.layout.getname(awful.layout.get(s))
  579.  
  580.     for _, c in pairs(clients) do -- Floaters are always on top
  581.         if   awful.client.floating.get(c) or layout == "floating"
  582.         then if not c.fullscreen then c.above       =  true  end
  583.         else                          c.above       =  false end
  584.     end
  585.   end)
  586. end
  587. -- }}}
  588. -- }}}
  589.  
  590. x = 0
  591.  
  592. -- setup the timer
  593. mytimer = timer { timeout = x }
  594. mytimer:add_signal("timeout", function()
  595.  
  596.   -- tell awsetbg to randomly choose a wallpaper from your wallpaper directory
  597.   if file_exists(wallpaper_dir) and whereis_app('feh') then
  598.           os.execute(wallpaper_cmd)
  599.   end
  600.   -- stop the timer (we don't need multiple instances running at the same time)
  601.   mytimer:stop()
  602.  
  603.   -- define the interval in which the next wallpaper change should occur in seconds
  604.   -- (in this case anytime between 10 and 20 minutes)
  605.   x = math.random( 600, 1200)
  606.  
  607.   --restart the timer
  608.   mytimer.timeout = x
  609.   mytimer:start()
  610. end)
  611.  
  612. -- initial start when rc.lua is first run
  613. mytimer:start()
  614.  
  615. require_safe('autorun')