Advertisement
Guest User

rc.lua

a guest
Jul 26th, 2012
1,732
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Standard awesome library
  2. require("awful")
  3. require("awful.autofocus")
  4. require("awful.rules")
  5. -- Widget and layout library
  6. require("wibox")
  7. require("vicious")
  8. -- Theme handling library
  9. require("beautiful")
  10. -- Notification library
  11. require("naughty")
  12. require("menubar")
  13.  
  14. -- {{{ Error handling
  15. -- Check if awesome encountered an error during startup and fell back to
  16. -- another config (This code will only ever execute for the fallback config)
  17. if awesome.startup_errors then
  18.     naughty.notify({ preset = naughty.config.presets.critical,
  19.                      title = "Oops, there were errors during startup!",
  20.                      text = awesome.startup_errors })
  21. end
  22.  
  23. -- Handle runtime errors after startup
  24. do
  25.     local in_error = false
  26.     awesome.connect_signal("debug::error", function (err)
  27.         -- Make sure we don't go into an endless error loop
  28.         if in_error then return end
  29.         in_error = true
  30.  
  31.         naughty.notify({ preset = naughty.config.presets.critical,
  32.                          title = "Oops, an error happened!",
  33.                          text = err })
  34.         in_error = false
  35.     end)
  36. end
  37. -- }}}
  38.  
  39. -- {{{ Variable definitions
  40. -- Themes define colours, icons, and wallpapers
  41. -- beautiful.init("/usr/share/awesome/themes/default/theme.lua")
  42. beautiful.init(awful.util.getdir("config") .. "/themes/fb0x.lua")
  43.  
  44. -- This is used later as the default terminal and editor to run.
  45. terminal = "urxvt"
  46. editor = os.getenv("EDITOR") or "vim"
  47. editor_cmd = terminal .. " -e vim" -- .. editor
  48. fm = "thunar"
  49. -- Default modkey.
  50. -- Usually, Mod4 is the key with a logo between Control and Alt.
  51. -- If you do not like this or do not have such a key,
  52. -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
  53. -- However, you can use another modifier like Mod1, but it may interact with others.
  54. modkey = "Mod1"
  55.  
  56. -- Table of layouts to cover with awful.layout.inc, order matters.
  57. layouts =
  58. {
  59.     awful.layout.suit.floating,
  60.     awful.layout.suit.tile,
  61.     awful.layout.suit.tile.left,
  62.     awful.layout.suit.tile.bottom,
  63.     awful.layout.suit.tile.top,
  64.     awful.layout.suit.fair,
  65.     awful.layout.suit.fair.horizontal,
  66.     awful.layout.suit.spiral,
  67.     awful.layout.suit.spiral.dwindle,
  68.     awful.layout.suit.max,
  69.     awful.layout.suit.max.fullscreen,
  70.     awful.layout.suit.magnifier
  71. }
  72. -- }}}
  73.  
  74.  -- {{{ Tags
  75.  -- Define a tag table which will hold all screen tags.
  76.  tags = {
  77.    names  = { "main", "www", "development", "misc", "chat", "docs" },
  78.    layout = { layouts[1], layouts[4], layouts[4], layouts[1], layouts[1], layouts[4]
  79.  }}
  80.  for s = 1, screen.count() do
  81.      -- Each screen has its own tag table.
  82.      tags[s] = awful.tag(tags.names, s, tags.layout)
  83.  end
  84.  -- }}}
  85.  
  86. -- {{{ Menu
  87. -- Create a laucher widget and a main menu
  88. myawesomemenu = {
  89.    { "manual", terminal .. " -e man awesome" },
  90.    { "edit config", editor_cmd .. " " .. awesome.conffile },
  91.    { "restart", awesome.restart },
  92.    { "quit", awesome.quit }
  93. }
  94.  
  95. mysystemmenu = {
  96.    { "lock", "xflock4" },
  97.    { "Taskmanager", "xfce4-taskmanager" },
  98.    { "VirtualBox", "virtualbox" },
  99. }
  100.  
  101. myfoldermenu = {
  102.    { "Download", fm .. " /home/bagy/Downloads" },
  103.    { "Movies", fm .. " /media/Bagy/Filmovi" },
  104.    { "Music", fm .. " /media/Bagy/Muzika" },
  105.    { "Desktop", fm .. " /home/bagy/Desktop" },
  106.    { "Scrots", fm .. " /home/bagy/Scrots" },
  107. }
  108.  
  109. myappmenu = {
  110.    { "Audacious", "audacious" },
  111.    { "irc", terminal .. " -e weechat" },
  112.    { "CodeBlocks", "codeblocks" },
  113.    { "SMplayer", "smplayer" },
  114.    { "vlc", "vlc" },
  115.    { "VIM", terminal .. " -e vim" },
  116.    { "Gedit", "gedit" },
  117.    { "gimp", "gimp" },
  118.    { "Google-Chrome", "google-chrome"},
  119.    { "Transmission", "transmission-gtk" },
  120.    { "JDownloader", "~/.jd/./jd.sh" },
  121.    { "pidgin", "pidgin" },
  122.    { "Parcellite", "parcellite" },
  123.    { "Skype", "skype" },
  124.    { "XChat", "xchat" },
  125.    { "Thunderbird", "thunderbird" },
  126.    { "firefox", "firefox" },  
  127.    { "calculator", "galculator" }
  128. }
  129.  
  130.  
  131. mymainmenu = awful.menu({ items = {     { "folder", myfoldermenu, },
  132.                                         { "system", mysystemmenu, },
  133.                                         { "awesome", myawesomemenu, },
  134.                                         { "applications", myappmenu, },
  135.                                         { "terminal", terminal },
  136.                                         { "browser", "firefox" },
  137.                                         { "filemanager", fm },
  138.                                         { "editor", "gedit" }
  139.                         }
  140.                         })
  141.  
  142. mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
  143.                                      menu = mymainmenu })
  144.  
  145. -- Menubar configuration
  146. menubar.utils.terminal = terminal -- Set the terminal for applications that require it
  147. -- }}}
  148.  
  149. -- {{{ Wibox
  150.  
  151. -- separator
  152. separator = wibox.widget.textbox()
  153. separator:set_text(" :: ")
  154. -- spacer
  155. spacer = wibox.widget.textbox()
  156. spacer.text = " "
  157.  
  158. -- {{{ Wibox
  159. --
  160. --{{{ eth0
  161. netwidget = wibox.widget.textbox()
  162. neticon = wibox.widget.imagebox()
  163. neticon:set_image("/home/bagy/.config/awesome/icons/red/wired.png")
  164. --netwidget:set_width(100)
  165.  
  166. vicious.register(netwidget, vicious.widgets.net, '<span color="#A90000"></span>down: ${eth0 down_kb}kb/s / up: ${eth0 up_kb}kb/s  ', 1)
  167. --{{{ memory
  168. memwidget = wibox.widget.textbox()
  169. memicon = wibox.widget.imagebox()
  170. memicon:set_image("/home/bagy/.config/awesome/icons/red/mem.png")
  171. vicious.register(memwidget, vicious.widgets.mem, "<span color='#A90000'></span>$1% ($2MB/$3MB)", 2)
  172. --}}}
  173. --{{{ mail
  174. gmailicon = wibox.widget.imagebox()
  175. gmailicon:set_image("/home/bagy/.config/awesome/icons/red/mail.png")
  176. gmailwidget = wibox.widget.textbox()
  177. vicious.register(gmailwidget, vicious.widgets.gmail, "<span color='#aaaaaa'>Mail: ${count} | ${subject} </span>", 600)
  178. --}}}
  179.  
  180. --{{{ cpu
  181. cpuwidget = wibox.widget.textbox()
  182. cpuicon = wibox.widget.imagebox()
  183. cpuicon:set_image("/home/bagy/.config/awesome/icons/red/cpu.png")
  184. vicious.register(cpuwidget, vicious.widgets.cpu, "<span color='#A90000'></span>$2%", 1)
  185. --}}}
  186. --{{{ hdd
  187. hddwidget = wibox.widget.textbox()
  188. hddicon = wibox.widget.imagebox()
  189. hddicon:set_image("/home/bagy/.config/awesome/icons/red/diskette.png")
  190. vicious.register(hddwidget, vicious.widgets.fs, "<span color='#aaaaaa'>system</span> ${/ used_gb}GB / ${/ size_gb}GB | <span color='#aaaaaa'>bagy</span> ${/media/Bagy used_gb}GB / ${/media/Bagy size_gb}GB", 10)
  191.  
  192. --}}}
  193.  
  194. --{{{ volume
  195. volumewidget = wibox.widget.textbox()
  196. volumeicon = wibox.widget.imagebox()
  197. volumeicon:set_image("/home/bagy/.config/awesome/icons/red/spkr_01.png")
  198. vicious.register(volumewidget, vicious.widgets.volume, "<span color='#A90000'></span>$1%", 15, "Master")
  199. --volumewidget:buttons(awful.util.table.join(
  200. --awful.button({ }, 1, function () exec("amixer -q set Master 2dB+", false) end)
  201. --))
  202. --}}}
  203.  
  204. -- Create a textclock widget
  205. mytextclock = awful.widget.textclock()
  206. --calendar2.addCalendarToWidget(mytextclock)
  207.  
  208. -- Create a wibox for each screen and add it
  209. mywibox = {}
  210. mywibox_bottom = {}
  211. mypromptbox = {}
  212. mylayoutbox = {}
  213. mytaglist = {}
  214. mytaglist.buttons = awful.util.table.join(
  215.                     awful.button({ }, 1, awful.tag.viewonly),
  216.                     awful.button({ modkey }, 1, awful.client.movetotag),
  217.                     awful.button({ }, 3, awful.tag.viewtoggle),
  218.                     awful.button({ modkey }, 3, awful.client.toggletag),
  219.                     awful.button({ }, 4, awful.tag.viewnext),
  220.                     awful.button({ }, 5, awful.tag.viewprev)
  221.                     )
  222. mytasklist = {}
  223. mytasklist.buttons = awful.util.table.join(
  224.                      awful.button({ }, 1, function (c)
  225.                                               if c == client.focus then
  226.                                                   c.minimized = true
  227.                                               else
  228.                                                   if not c:isvisible() then
  229.                                                       awful.tag.viewonly(c:tags()[1])
  230.                                                   end
  231.                                                   -- This will also un-minimize
  232.                                                   -- the client, if needed
  233.                                                   client.focus = c
  234.                                                   c:raise()
  235.                                               end
  236.                                           end),
  237.                      awful.button({ }, 3, function ()
  238.                                               if instance then
  239.                                                   instance:hide()
  240.                                                   instance = nil
  241.                                               else
  242.                                                   instance = awful.menu.clients({ width=250 })
  243.                                               end
  244.                                           end),
  245.                      awful.button({ }, 4, function ()
  246.                                               awful.client.focus.byidx(1)
  247.                                               if client.focus then client.focus:raise() end
  248.                                           end),
  249.                      awful.button({ }, 5, function ()
  250.                                               awful.client.focus.byidx(-1)
  251.                                               if client.focus then client.focus:raise() end
  252.                                           end))
  253.  
  254. for s = 1, screen.count() do
  255.     -- Create a promptbox for each screen
  256.     mypromptbox[s] = awful.widget.prompt()
  257.     -- Create an imagebox widget which will contains an icon indicating which layout we're using.
  258.     -- We need one layoutbox per screen.
  259.     mylayoutbox[s] = awful.widget.layoutbox(s)
  260.     mylayoutbox[s]:buttons(awful.util.table.join(
  261.                            awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
  262.                            awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
  263.                            awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
  264.                            awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
  265.     -- Create a taglist widget
  266.     mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
  267.  
  268.     -- Create a tasklist widget
  269.     mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
  270.  
  271.  
  272.     -- Create the top wibox
  273.     mywibox[s] = awful.wibox({ position = "top", screen = s })
  274.  
  275.     -- Widgets that are aligned to the left
  276.     local left_layout = wibox.layout.fixed.horizontal()
  277.     left_layout:add(mylauncher)
  278.     left_layout:add(separator)
  279.     left_layout:add(mytaglist[s])
  280.     left_layout:add(separator)
  281.     left_layout:add(mypromptbox[s])
  282.  
  283.     -- Widgets that are aligned to the right
  284.     local right_layout = wibox.layout.fixed.horizontal()
  285.     if s == 1 then right_layout:add(wibox.widget.systray()) end
  286. right_layout:add(separator)
  287. right_layout:add(volumeicon)
  288. right_layout:add(volumewidget)
  289. right_layout:add(separator)
  290. right_layout:add(mytextclock)
  291. right_layout:add(mylayoutbox[s])
  292.  
  293.     -- Now bring it all together (with the tasklist in the middle)
  294.     local layout = wibox.layout.align.horizontal()
  295.     layout:set_left(left_layout)
  296.     layout:set_middle(mytasklist[s])
  297.     layout:set_right(right_layout)
  298.  
  299.     mywibox[s]:set_widget(layout)
  300.  
  301.  
  302. -- Create the bottom wibox
  303. mywibox_bottom[s] = awful.wibox({ position = "bottom", screen = s })
  304.  
  305.     -- Widgets that are aligned to the left
  306.     left_layout = wibox.layout.fixed.horizontal()
  307. left_layout:add(gmailicon)
  308. left_layout:add(gmailwidget)
  309.  
  310.     -- Widgets that are aligned to the right
  311.     right_layout = wibox.layout.fixed.horizontal()
  312.  
  313. right_layout:add(hddicon)
  314. right_layout:add(hddwidget)
  315. right_layout:add(separator)
  316. right_layout:add(memicon)
  317. right_layout:add(memwidget)
  318. right_layout:add(separator)
  319. right_layout:add(cpuicon)
  320. right_layout:add(cpuwidget)
  321. right_layout:add(separator)
  322. right_layout:add(neticon)
  323. right_layout:add(netwidget)
  324. right_layout:add(spacer)
  325.  
  326. -- Now bring it all together
  327. layout = wibox.layout.align.horizontal()
  328. layout:set_left(left_layout)
  329. layout:set_right(right_layout)
  330.  
  331. mywibox_bottom[s]:set_widget(layout)
  332. end
  333. -- }}}
  334.  
  335. -- {{{ Mouse bindings
  336. root.buttons(awful.util.table.join(
  337.     awful.button({ }, 3, function () mymainmenu:toggle() end),
  338.     awful.button({ }, 4, awful.tag.viewnext),
  339.     awful.button({ }, 5, awful.tag.viewprev)
  340. ))
  341. -- }}}
  342.  
  343. -- {{{ Key bindings
  344. globalkeys = awful.util.table.join(
  345. --    awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
  346. --    awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
  347.     awful.key({ modkey,           }, "Escape", awful.tag.history.restore),
  348.  
  349.     awful.key({ modkey,           }, "j",
  350.         function ()
  351.             awful.client.focus.byidx( 1)
  352.             if client.focus then client.focus:raise() end
  353.         end),
  354.     awful.key({ modkey,           }, "k",
  355.         function ()
  356.             awful.client.focus.byidx(-1)
  357.             if client.focus then client.focus:raise() end
  358.         end),
  359.     awful.key({ modkey,           }, "w", function () mymainmenu:show() end),
  360.  
  361.     -- Layout manipulation
  362.     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
  363.     awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
  364.     awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
  365.     awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
  366.     awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
  367.     awful.key({ modkey,           }, "Tab",
  368.         function ()
  369.             awful.client.focus.history.previous()
  370.             if client.focus then
  371.                 client.focus:raise()
  372.             end
  373.         end),
  374.  
  375.     -- Standard program
  376. --    awful.key({ modkey,           }, "Return", function () awful.util.spawn(terminal) end),
  377.     awful.key({ modkey, "Control" }, "r", awesome.restart),
  378.     awful.key({ modkey, "Shift"   }, "q", awesome.quit),
  379.  
  380.    -- User shortcuts
  381.     awful.key({ modkey, }, "F12", function () awful.util.spawn(terminal) end),
  382.     awful.key({ modkey, }, "F11", function () awful.util.spawn("thunar Desktop") end),
  383.     awful.key({ modkey, }, "F10", function () awful.util.spawn("google-chrome") end),
  384.     awful.key({ modkey, }, "F4", function () awful.util.spawn("firefox") end),
  385.     awful.key({ modkey, }, "F9",  function () awful.util.spawn("audacious") end),
  386.     awful.key({ modkey, }, "F8",  function () awful.util.spawn("gedit") end),
  387.     awful.key({ modkey, }, "F7",  function () awful.util.spawn("pidgin") end),
  388.     awful.key({ modkey, }, "F6",  function () awful.util.spawn("skype") end),
  389.     awful.key({ modkey, }, "F5",  function () awful.util.spawn(terminal .. "-e vim") end),
  390.     awful.key({ modkey, }, "F2",  function () awful.util.spawn("fbrun") end),
  391. --    awful.key({ modkey, "Shift" }, "o",  function () awful.util.spawn("ncmpcpp pause") end),
  392. --    awful.key({ modkey, "Shift" }, "i",  function () awful.util.spawn("ncmpcpp play") end),
  393. --    awful.key({ modkey, "Shift" }, "p",  function () awful.util.spawn("ncmpcpp prev") end),
  394. --    awful.key({ modkey, "Shift" }, "n",  function () awful.util.spawn("ncmpcpp next") end),
  395.     awful.key({ modkey, "Shift" }, "o",  function () awful.util.spawn("audtool --playback-pause") end),
  396.     awful.key({ modkey, "Shift" }, "i",  function () awful.util.spawn("audtool --playback-play") end),
  397.     awful.key({ modkey, "Shift" }, "p",  function () awful.util.spawn("audtool --playlist-reverse") end),
  398.     awful.key({ modkey, "Shift" }, "n",  function () awful.util.spawn("audtool --playlist-advance") end),
  399.  
  400.  
  401.     awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
  402.     awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
  403.     awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
  404.     awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
  405.     awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
  406.     awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
  407.     awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
  408.     awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),
  409.  
  410.     awful.key({ modkey, "Control" }, "n", awful.client.restore),
  411.  
  412.     -- Prompt
  413.     awful.key({ modkey },            "r",     function () mypromptbox[mouse.screen]:run() end),
  414.  
  415.     awful.key({ modkey }, "x",
  416.               function ()
  417.                   awful.prompt.run({ prompt = "Run Lua code: " },
  418.                   mypromptbox[mouse.screen].widget,
  419.                   awful.util.eval, nil,
  420.                   awful.util.getdir("cache") .. "/history_eval")
  421.               end),
  422.     -- Menubar
  423.     awful.key({ modkey }, "p", function() menubar.show() end)
  424. )
  425.  
  426. clientkeys = awful.util.table.join(
  427.     awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
  428.     awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end),
  429.     awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
  430.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  431.     awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
  432.     awful.key({ modkey,           }, "t",      function (c) c.ontop = not c.ontop            end),
  433.     awful.key({ modkey,           }, "n",
  434.         function (c)
  435.             -- The client currently has the input focus, so it cannot be
  436.             -- minimized, since minimized clients can't have the focus.
  437.             c.minimized = true
  438.         end),
  439.     awful.key({ modkey,           }, "m",
  440.         function (c)
  441.             c.maximized_horizontal = not c.maximized_horizontal
  442.             c.maximized_vertical   = not c.maximized_vertical
  443.         end)
  444. )
  445.  
  446. -- Compute the maximum number of digit we need, limited to 9
  447. keynumber = 0
  448. for s = 1, screen.count() do
  449.    keynumber = math.min(9, math.max(#tags[s], keynumber));
  450. end
  451.  
  452. -- Bind all key numbers to tags.
  453. -- Be careful: we use keycodes to make it works on any keyboard layout.
  454. -- This should map on the top row of your keyboard, usually 1 to 9.
  455. for i = 1, keynumber do
  456.     globalkeys = awful.util.table.join(globalkeys,
  457.         awful.key({ modkey }, "#" .. i + 9,
  458.                   function ()
  459.                         local screen = mouse.screen
  460.                         if tags[screen][i] then
  461.                             awful.tag.viewonly(tags[screen][i])
  462.                         end
  463.                   end),
  464.         awful.key({ modkey, "Control" }, "#" .. i + 9,
  465.                   function ()
  466.                       local screen = mouse.screen
  467.                       if tags[screen][i] then
  468.                           awful.tag.viewtoggle(tags[screen][i])
  469.                       end
  470.                   end),
  471.         awful.key({ modkey, "Shift" }, "#" .. i + 9,
  472.                   function ()
  473.                       if client.focus and tags[client.focus.screen][i] then
  474.                           awful.client.movetotag(tags[client.focus.screen][i])
  475.                       end
  476.                   end),
  477.         awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  478.                   function ()
  479.                       if client.focus and tags[client.focus.screen][i] then
  480.                           awful.client.toggletag(tags[client.focus.screen][i])
  481.                       end
  482.                   end))
  483. end
  484.  
  485. clientbuttons = awful.util.table.join(
  486.     awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  487.     awful.button({ modkey }, 1, awful.mouse.client.move),
  488.     awful.button({ modkey }, 3, awful.mouse.client.resize))
  489.  
  490. -- Set keys
  491. root.keys(globalkeys)
  492. -- }}}
  493.  
  494. -- {{{ Rules
  495. awful.rules.rules = {
  496.     -- All clients will match this rule.
  497.     { rule = { },
  498.       properties = { border_width = beautiful.border_width,
  499.                      border_color = beautiful.border_normal,
  500.                      focus = true,
  501.                      size_hints_honor = false,
  502.                      keys = clientkeys,
  503.                      buttons = clientbuttons } },
  504.     { rule = { class = "MPlayer" },
  505.       properties = { floating = true } },
  506.     { rule = { class = "pinentry" },
  507.       properties = { floating = true } },
  508.     { rule = { class = "gimp" },
  509.       properties = { floating = true } },
  510.     -- Set Firefox to always map on tags number 2 of screen 1.
  511. --  { rule = { class = "Firefox" },
  512. --    properties = { tag = tags[1][2] } },
  513.     { rule = { class = "Firefox" },
  514.       properties = { floating = true } },
  515.     { rule = { instance = "plugin-container" },
  516.       properties = { floating = false } },
  517.     { rule = { class = "Avidemux" },
  518.       properties = { floating = true } },
  519.     { rule = { class = "Transmission" },
  520.       properties = { floating = true } },
  521.     { rule = { class = "Pidgin" },
  522.       properties = { floating = true } },
  523.     { rule = { class = "Skype" },
  524.       properties = { floating = true } },
  525.     { rule = { class = "Audacious" },
  526.       properties = { floating = true } },
  527.     { rule = { class = "Vlc" },
  528.       properties = { floating = true } },
  529.     { rule = { class = "Thunar" },
  530.       properties = { floating = true } },
  531.     { rule = { class = "Mirage" },
  532.       properties = { floating = true } },
  533.     { rule = { class = "gedit" },
  534.       properties = { floating = true } },
  535.     { rule = { class = "Thunderbird" },
  536.       properties = { floating = true } },
  537. }
  538. -- }}}
  539.  
  540. -- {{{ Signals
  541. -- Signal function to execute when a new client appears.
  542. client.connect_signal("manage", function (c, startup)
  543.     -- Enable sloppy focus
  544.     c:connect_signal("mouse::enter", function(c)
  545.         if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  546.             and awful.client.focus.filter(c) then
  547.             client.focus = c
  548.         end
  549.     end)
  550.  
  551.     if not startup then
  552.         -- Set the windows at the slave,
  553.         -- i.e. put it at the end of others instead of setting it master.
  554.         -- awful.client.setslave(c)
  555.  
  556.         -- Put windows in a smart way, only if they does not set an initial position.
  557.         if not c.size_hints.user_position and not c.size_hints.program_position then
  558.             awful.placement.no_overlap(c)
  559.             awful.placement.no_offscreen(c)
  560.         end
  561.     end
  562. end)
  563.  
  564. client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  565. client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  566. -- }}}
Advertisement
RAW Paste Data Copied
Advertisement