Advertisement
Guest User

rc.lua

a guest
Sep 14th, 2013
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 20.33 KB | None | 0 0
  1. --   L O A D   L I B R A R Y   -------------------------------------------------
  2.  
  3. require("awful")
  4. require("awful.autofocus")
  5. require("awful.rules")
  6. require("beautiful")
  7. require("naughty")
  8. --calendar = require{"calendar"}
  9.  
  10. --require("vicious")
  11. --shifty = require("shifty")
  12. vicious = require("vicious")
  13. --require{"calendar"}
  14. cal = require("cal")
  15.  
  16. --   E R R O R S   -------------------------------------------------------------
  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. do
  23.     local in_error = false
  24.     awesome.add_signal("debug::error", function (err)
  25.         if in_error then return end
  26.         in_error = true
  27.         naughty.notify({ preset = naughty.config.presets.critical,
  28.             title = "Oops, an error happened!",
  29.             text = err })
  30.         in_error = false
  31.     end)
  32. end
  33.  
  34.  
  35. --   T H E M E   ---------------------------------------------------------------
  36. beautiful.init("/home/funeralismatic/.config/awesome/themes/funeralismatic/theme.lua")
  37.  
  38.  
  39. --   V A R I A B L E S   -------------------------------------------------------
  40. terminal = "terminator"
  41. editor = os.getenv("EDITOR") or "nano"
  42. editor_cmd = terminal .. " -e " .. editor
  43.  
  44.  
  45. --   D E F A U L T   M O D K E Y   ---------------------------------------------
  46. modkey = "Mod4"
  47.  
  48.  
  49. --   L A Y O U T   T A B L E   -------------------------------------------------
  50. layouts = {
  51.     awful.layout.suit.floating,
  52.     awful.layout.suit.tile.left,
  53.     awful.layout.suit.tile,
  54.     awful.layout.suit.tile.bottom,
  55.     awful.layout.suit.max
  56. --  awful.layout.suit.tile.top,
  57. --  awful.layout.suit.fair,
  58. --  awful.layout.suit.fair.horizontal,
  59. --  awful.layout.suit.spiral
  60. --  awful.layout.suit.spiral.dwindle
  61. --  awful.layout.suit.max.fullscreen,
  62. --  awful.layout.suit.magnifier
  63. }
  64.  
  65. --   T A G S   -----------------------------------------------------------------
  66. tags = {
  67.     names  = { "main", "internet", "terminal", "media", "design", "other"},
  68.     layout = { layouts[2], layouts[3], layouts[5], layouts[1], layouts[2], layouts[1]}
  69. }
  70.  
  71.  for s = 1, screen.count() do
  72.      tags[s] = awful.tag(tags.names, s, tags.layout)
  73.  end
  74.  
  75.  
  76. --   M E N U   -----------------------------------------------------------------
  77.  
  78. -- AWESOME MENU --
  79. myawesomemenu = {
  80.     { "manual", terminal .. " -e man awesome" },
  81.     { "edit config", editor_cmd .. " " .. awesome.conffile },
  82.     { "restart", awesome.restart },
  83.     { "quit", awesome.quit }
  84. }
  85.  
  86. -- INTERNET MENU --
  87. myinternetmenu = {
  88.     { "Chromium", "chromium" },
  89.     { "Firefox", "firefox" },
  90.     { "Thunderbird", "thunderbird" },
  91.     { "Deluge", "deluge" },
  92.     { "lICQ", "licq" },
  93.     { "Skype", "skype" },
  94.     { "Vacuum IM", "vacuum" }
  95. }
  96.  
  97. -- DESIGN MENU --
  98. mydesignmenu = {
  99.     { "Inkscape", "inkscape" },
  100.     { "Font Editor", "fontforge" },
  101.     { "MyPaint", "mypaint" },
  102.     { "gimp", "gimp" }
  103. }
  104.  
  105. -- MULTIMEDIA MENU --
  106. mymediamenu = {
  107.     { "Deadbeef", "deadbeef" },
  108.     { "Volume", "aumix" },
  109.     { "XfBurn", "xfburn" }
  110. }
  111.  
  112. -- SETTINGS MENU --
  113. mysettingsmenu = {
  114.     { "Awesome", myawesomemenu, beautiful.awesome_icon },
  115.     { "hTop", terminal .. " -e htop" },
  116.     { "GTK+ Theme", "lxappearance" },
  117.     { "Task Manager", "lxtask" },
  118.     { "Terminal", terminal },
  119.     { "ROOT Terminal", "ktsuss --user root terminator" },
  120.     { "Connections", "ktsuss --user root nm-connection-editor" },
  121.     { "Qt Configure", "qtconfig" },
  122.     { "Gparted", "ktsuss --user root gparted-pkexec" }
  123. }
  124.  
  125. -- OFFICE MENU --
  126. myofficemenu = {
  127.     { "Reader", "evince" },
  128.     { "Charmap", "mucharmap" },
  129.     { "Clipboard Manager", "parcellite" },
  130.     { "Calculator", "mate-calc" },
  131.     { "Osmo", "osmo" }
  132. }
  133.  
  134. -- MAIN MENU --
  135. mymainmenu = awful.menu({ items = {
  136.     { "Internet", myinternetmenu, beautiful.awesome_icon },
  137.     { "Design", mydesignmenu, beautiful.awesome_icon },
  138.     { "Multimedia", mymediamenu, beautiful.awesome_icon },
  139.     { "Settings", mysettingsmenu, beautiful.awesome_icon },
  140.     { "Office", myofficemenu, beautiful.awesome_icon },
  141.     { "Editra", "editra" },
  142.     { "Archive Manager", "engrampa" },
  143.     { "File Manager", "spacefm" },
  144.     { "RecordMyDesktop", "gtk-recordmydesktop" },
  145.     { "NEStopia", "nestopia" },
  146.     { "zDoom", "zdoom" }
  147. }})
  148.  
  149.  
  150. --   R E G I S T E R   W I D G E T S   -----------------------------------------
  151.  
  152. -- MENU LAUNCHER --
  153. mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), menu = mymainmenu })
  154.  
  155. -- INTERNET WIDGET --
  156. netwidget_down = widget({ type = "textbox" })
  157. vicious.register(netwidget_down, vicious.widgets.net, '<span color="#000000">${usb0 down_kb}</span>', 1)
  158. netwidget_up = widget({ type = "textbox" })
  159. vicious.register(netwidget_up, vicious.widgets.net, '<span color="#000000">${usb0 up_kb}</span>', 1)
  160.  
  161. --VOLUME WIDGET --
  162. volwidget = widget({ type = "textbox" })
  163. vicious.register(volwidget, vicious.widgets.volume, "$1%", 5, "Master")
  164. volwidget:buttons(awful.util.table.join(
  165.     awful.button({ }, 1, function () awful.util.spawn("aumix", false) end),
  166.     awful.button({ }, 2, function () awful.util.spawn("amixer sset Master toggle", false)   end),
  167.     awful.button({ }, 4, function () awful.util.spawn("aumix -v +5", false) end),
  168.     awful.button({ }, 5, function () awful.util.spawn("aumix -v -5", false) end)
  169. ))
  170.  
  171. -- IMAGES --
  172. netimg = widget({ type = "imagebox" })
  173. netimg.image = image("/home/funeralismatic/.config/awesome/icons/net_icon.png")
  174.  
  175. volimg = widget({ type = "imagebox" })
  176. volimg.image = image("/home/funeralismatic/.config/awesome/icons/volume.png")
  177.  
  178. kbdimg = widget({ type = "imagebox" })
  179. kbdimg.image = image("/home/funeralismatic/.config/awesome/icons/keyboard.png")
  180.  
  181. clkimg = widget({ type = "imagebox" })
  182. clkimg.image = image("/home/funeralismatic/.config/awesome/icons/clock.png")
  183.  
  184. -- DEADBEEF ALL-IN-ONE WIDGET --
  185. dbpp = widget({ type = "imagebox" })
  186. dbpp.image = image("/home/funeralismatic/.config/awesome/icons/deadbeef.png")
  187. dbpp:buttons(awful.util.table.join(
  188.     awful.button({ }, 1, function () awful.util.spawn("deadbeef --play-pause", false) end),
  189.     awful.button({ }, 2, function () awful.util.spawn("deadbeef --stop", false)   end),
  190.     awful.button({ }, 8, function () awful.util.spawn("deadbeef --prev", false) end),
  191.     awful.button({ }, 9, function () awful.util.spawn("deadbeef --next", false) end),
  192.     awful.button({ }, 3, function () awful.util.spawn("amixer sset Master toggle", false)   end),
  193.     awful.button({ }, 4, function () awful.util.spawn("aumix -v +5", false) end),
  194.     awful.button({ }, 5, function () awful.util.spawn("aumix -v -5", false) end)
  195. ))
  196. dbpp:add_signal("mouse::enter", function() coverart_show() end)
  197. dbpp:add_signal("mouse::leave", function() coverart_hide() end)
  198.  
  199. -- DEADBEEF POPUP NOTIFICATION --
  200. local coverart_nf
  201. function coverart_show()
  202.     local artcache = '/home/funeralismatic/.cache/deadbeef/covers'
  203.     local artist_var = io.popen("deadbeef --nowplaying %a", "r")
  204.     local artist = artist_var:read()
  205.     local title_var = io.popen("deadbeef --nowplaying %t", "r")
  206.     local title = title_var:read()
  207.     local album_var = io.popen("deadbeef --nowplaying %b", "r")
  208.     local album = album_var:read()
  209.     local year_var = io.popen("deadbeef --nowplaying %y", "r")
  210.     local year = year_var:read()
  211.     local time_var = io.popen("deadbeef --nowplaying \"%e | %l\"", "r")
  212.     local time = time_var:read()
  213.     local img = string.format("%s/%s/%s.jpg", artcache, artist, album)
  214.     local ico = image(img)
  215.     local txt = string.format('%s\nby %s\nfrom %s\n%s', title, artist, album, time)
  216.     coverart_nf = naughty.notify({icon = ico, icon_size = 72, text = txt,
  217.     position = "top_right", timeout = 10 })
  218. end
  219. function coverart_hide()
  220.     if coverart_nf ~= nil then
  221.         naughty.destroy(coverart_nf)
  222.     end
  223. end
  224.  
  225. -- TIME-DATE WIDGET --
  226. datewidget = widget({ type = "textbox" })
  227. vicious.register(datewidget, vicious.widgets.date, "%H:%M:%S", 1)
  228. --cal.register(datewidget, "<b>%s</b>")
  229. today = awful.tooltip({objects = {datewidget,clkimg},})
  230. function get_today()
  231.     return os.date('<span background="#000" color="#fff"> %A, %d.%m.%Y </span>')
  232. end
  233. today:set_text(get_today())
  234.  
  235. -- DEFAULT CLOCK WIDGET --
  236. --mytextclock = awful.widget.textclock({ align = "right" })
  237.  
  238. -- SYSTEM TRAY WIDGET --
  239. mysystray = widget({ type = "systray" })
  240.  
  241. -- SEPARATORS --
  242. spacer  = widget({ type = "textbox"  })
  243. separator = widget({ type = "imagebox" })
  244. spacer.text = " "
  245. separator.image = image(beautiful.widget_sep)
  246.  
  247. -- KEYBOARD WIDGET --
  248. kbdcfg = {}
  249. kbdcfg.cmd = "setxkbmap"
  250. kbdcfg.layout = { { "us", "" }, { "ru", "" } }
  251. kbdcfg.current = 1  -- us is our default layout
  252. kbdcfg.widget = widget({ type = "textbox", align = "right"})
  253. kbdcfg.border_width = 1
  254. kbdcfg.border_color = beautiful.bg_urgent
  255. kbdcfg.widget.text = "" .. kbdcfg.layout[kbdcfg.current][1] .. ""
  256. kbdcfg.switch = function ()
  257. kbdcfg.current = kbdcfg.current % #(kbdcfg.layout) + 1
  258. local t = kbdcfg.layout[kbdcfg.current]
  259.     kbdcfg.widget.text = "" .. t[1] .. ""
  260.     os.execute( kbdcfg.cmd .. " " .. t[1] .. " " .. t[2] )
  261. end
  262. kbdcfg.widget:buttons(awful.util.table.join(
  263.     awful.button({ }, 1, function () kbdcfg.switch() end)
  264. ))
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275. -- {{{ Keyboard layouts
  276. -- Create widget
  277. kbdwidget = widget({type = "textbox", name = "kbdwidget"})
  278. kbdwidget.border_color = beautiful.fg_normal
  279. kbdwidget.text = "en"
  280.  
  281. -- Listen DBUS
  282. dbus.request_name("session", "ru.gentoo.kbdd")
  283. dbus.add_match("session", "interface='ru.gentoo.kbdd',member='layoutChanged'")
  284. dbus.add_signal("ru.gentoo.kbdd", function(...)
  285.     local data = {...}
  286.     local layout = data[2]
  287.     lts = {[0] = "en", [1] = "ru"}
  288.     kbdwidget.text = " "..lts[layout].." "
  289.     end
  290. )
  291. -- }}} Keyboard layoutds
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310. -- CREATE WIDGETS --
  311. mywibox = {}
  312. mypromptbox = {}
  313. mylayoutbox = {}
  314.  
  315. -- TAGLIST --
  316. mytaglist = {}
  317. mytaglist.buttons = awful.util.table.join(
  318.     awful.button({ }, 1, awful.tag.viewonly),
  319.     awful.button({ modkey }, 1, awful.client.movetotag),
  320.     awful.button({ }, 3, awful.tag.viewtoggle),
  321.     awful.button({ modkey }, 3, awful.client.toggletag),
  322.     awful.button({ }, 4, awful.tag.viewnext),
  323.     awful.button({ }, 5, awful.tag.viewprev)
  324. )
  325.  
  326. -- TASKLIST --
  327. mytasklist = {}
  328. mytasklist.buttons = awful.util.table.join(
  329.     awful.button({ }, 1, function (c)
  330.         if c == client.focus then
  331.             c.minimized = true
  332.         else
  333.             if not c:isvisible() then
  334.                 awful.tag.viewonly(c:tags()[1])
  335.             end
  336.             client.focus = c
  337.             c:raise()
  338.         end
  339.     end),
  340.     awful.button({ }, 3, function ()
  341.         if instance then
  342.             instance:hide()
  343.             instance = nil
  344.         else
  345.             instance = awful.menu.clients({ width=250 })
  346.         end
  347.     end),
  348.     awful.button({ }, 4, function ()
  349.         awful.client.focus.byidx(1)
  350.         if client.focus then client.focus:raise() end
  351.     end),
  352.     awful.button({ }, 5, function ()
  353.         awful.client.focus.byidx(-1)
  354.         if client.focus then client.focus:raise() end
  355.     end))
  356. for s = 1, screen.count() do
  357.  
  358. -- PROMPTBOX WIGDET --
  359. mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
  360.  
  361. -- LAYOUT WIDGET --
  362. mylayoutbox[s] = awful.widget.layoutbox(s)
  363. mylayoutbox[s]:buttons(awful.util.table.join(
  364.     awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
  365.     awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
  366.     awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
  367.     awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
  368.  
  369. -- TAGS --
  370. mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
  371.  
  372. -- TASKLIST --
  373. mytasklist[s] = awful.widget.tasklist(function(c)
  374.     return awful.widget.tasklist.label.currenttags(c, s)
  375.     end,
  376.     mytasklist.buttons)
  377.  
  378. -- TASKLIST ICONS ONLY --
  379. --mytasklist[s] = awful.widget.tasklist(function(c)
  380. --  local task = { awful.widget.tasklist.label.currenttags(c, s) }
  381. --  return '', task[2], task[3], task[4]
  382. --end, mytasklist.buttons)
  383.  
  384. -- WIBOX --
  385. mywibox[s] = awful.wibox({ position = "top", screen = s, height="24" })
  386. mywibox[s].widgets = {{
  387.         mylauncher,
  388.         separator,
  389.         mylayoutbox[s],
  390.         separator,
  391.         mytaglist[s],
  392. --      separator,
  393.         mypromptbox[s],
  394.         separator,
  395.         layout = awful.widget.layout.horizontal.leftright},
  396.     spacer,
  397.     datewidget,
  398.     clkimg,
  399.     separator,
  400. --  kbdcfg.widget,
  401.     kbdwidget,
  402.     kbdimg,
  403.     separator,
  404.     netwidget_up,
  405.     netimg,
  406.     netwidget_down,
  407.     separator,
  408.     volwidget,
  409.     volimg,
  410.     separator,
  411.     dbpp,
  412.     separator,
  413.     s == 1 and mysystray or nil,
  414.     separator,
  415.     mytasklist[s],
  416.     layout = awful.widget.layout.horizontal.rightleft
  417.     }
  418. end
  419.  
  420. -- MOUSE BINDINGS --
  421. root.buttons(awful.util.table.join(
  422.     awful.button({ }, 3, function () mymainmenu:toggle() end),
  423.     awful.button({ }, 4, awful.tag.viewnext),
  424.     awful.button({ }, 5, awful.tag.viewprev)
  425. ))
  426.  
  427.  
  428. -- K E Y   B I N D I N G S   ---------------------------------------------------
  429. globalkeys = awful.util.table.join(
  430.  
  431.     awful.key({}, "Menu", function() mymainmenu:toggle() end),
  432.    
  433. -- KEYBOARD LAYOUT SWITCH --
  434. --  awful.key({modkey,}, "space", function() kbdcfg.switch() end),
  435.  
  436. -- VOLUME CONTROL --
  437.     awful.key({}, "XF86AudioRaiseVolume", function() awful.util.spawn("aumix -v +5") end),
  438.     awful.key({}, "XF86AudioLowerVolume", function() awful.util.spawn("aumix -v -5") end),
  439.     awful.key({}, "XF86AudioMute", function() awful.util.spawn("amixer sset Master toggle") end),
  440.  
  441. -- SCREENSHOT --
  442.     awful.key({"Control", "Shift"}, "Print", function() awful.util.spawn("screengrab --region") end),
  443.     awful.key({"Control",}, "Print", function() awful.util.spawn("screengrab --active") end),
  444.     awful.key({}, "Print", function() awful.util.spawn("screengrab --fullscreen") end),
  445.  
  446. -- LOCK SCREEN --
  447.     awful.key({modkey,}, "l", function() awful.util.spawn("xautolock -locknow") end),
  448.  
  449. -- APPLICATIONS --
  450.     awful.key({"Control", "Shift"}, "Escape", function() awful.util.spawn("lxtask") end),
  451.  
  452. -- TAGS SWITCH --
  453.     awful.key({modkey,}, "Left", awful.tag.viewprev),
  454.     awful.key({modkey,}, "Right", awful.tag.viewnext),
  455.     awful.key({modkey,}, "Escape", awful.tag.history.restore),
  456.  
  457. -- CLIENT SWITCH --
  458.     awful.key({modkey, "Control"}, "Tab", function() awful.client.focus.history.previous() if client.focus then client.focus:raise() end end),
  459.     awful.key({modkey,}, "Tab", function() awful.client.focus.byidx(1) if client.focus then client.focus:raise() end end),
  460.     awful.key({modkey, "Shift"}, "Tab", function() awful.client.focus.byidx(-1) if client.focus then client.focus:raise() end end),
  461.  
  462.  
  463.     -- Layout manipulation
  464.     awful.key({modkey, "Control"}, ".", function () awful.client.swap.byidx(  1)    end),
  465.     awful.key({modkey, "Control"}, ",", function () awful.client.swap.byidx( -1)    end),
  466.     awful.key({modkey, "Shift"}, ".", function () awful.screen.focus_relative( 1) end),
  467.     awful.key({modkey, "shift"}, ",", function () awful.screen.focus_relative(-1) end),
  468.     awful.key({modkey,}, "u", awful.client.urgent.jumpto),
  469.    
  470.     -- Standard program
  471.     awful.key({ modkey,      }, "Return", function () awful.util.spawn(terminal) end),
  472.     awful.key({ modkey, "Control" }, "r", awesome.restart),
  473.     awful.key({ modkey, "Shift" }, "q", awesome.quit),
  474.  
  475.     awful.key({ modkey,      }, "equal",    function () awful.tag.incmwfact( 0.05)  end),
  476.     awful.key({ modkey,      }, "minus",    function () awful.tag.incmwfact(-0.05)  end),
  477.     awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1)    end),
  478.     awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1)    end),
  479.     awful.key({ modkey, "Control" }, "h",   function () awful.tag.incncol( 1)       end),
  480.     awful.key({ modkey, "Control" }, "l",   function () awful.tag.incncol(-1)       end),
  481.    
  482.      --awful.key({ modkey,       }, "space", function () awful.layout.inc(layouts,  1) end),
  483.      --awful.key({ modkey, "Shift"  }, "space", function () awful.layout.inc(layouts, -1) end),
  484.  
  485.     awful.key({ modkey, "Control" }, "n", awful.client.restore),
  486.  
  487.     -- Prompt
  488.     awful.key({ modkey },           "r",    function () mypromptbox[mouse.screen]:run() end),
  489.  
  490.     awful.key({ modkey }, "x",
  491.             function ()
  492.                 awful.prompt.run({ prompt = "Run Lua code: " },
  493.                 mypromptbox[mouse.screen].widget,
  494.                 awful.util.eval, nil,
  495.                 awful.util.getdir("cache") .. "/history_eval")
  496.             end)
  497. )
  498.  
  499. clientkeys = awful.util.table.join(
  500.     awful.key({ modkey,}, "f",  awful.client.floating.toggle),
  501.    
  502. --  awful.key({ modkey,}, "f",  function (c) c.fullscreen = not c.fullscreen  end),
  503.     awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
  504.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  505.     awful.key({ modkey,      }, "o",    awful.client.movetoscreen),
  506.     awful.key({ modkey, "Shift" }, "r", function (c) c:redraw()                  end),
  507.     awful.key({ modkey,      }, "t",    function (c) c.ontop = not c.ontop          end),
  508.     awful.key({modkey,}, "n", function (c)c.minimized = true end),
  509.    
  510.     awful.key({modkey,}, "m", function (c) c.maximized_horizontal = not c.maximized_horizontal c.maximized_vertical = not c.maximized_vertical end)
  511. )
  512.  
  513. -- Compute the maximum number of digit we need, limited to 9
  514. keynumber = 0
  515. for s = 1, screen.count() do
  516.     keynumber = math.min(9, math.max(#tags[s], keynumber));
  517. end
  518.  
  519. -- Bind all key numbers to tags.
  520. -- Be careful: we use keycodes to make it works on any keyboard layout.
  521. -- This should map on the top row of your keyboard, usually 1 to 9.
  522. for i = 1, keynumber do
  523.     globalkeys = awful.util.table.join(globalkeys,
  524.         awful.key({ modkey }, "#" .. i + 9,
  525.                 function ()
  526.                         local screen = mouse.screen
  527.                         if tags[screen][i] then
  528.                             awful.tag.viewonly(tags[screen][i])
  529.                         end
  530.                 end),
  531.         awful.key({ modkey, "Control" }, "#" .. i + 9,
  532.                 function ()
  533.                     local screen = mouse.screen
  534.                     if tags[screen][i] then
  535.                         awful.tag.viewtoggle(tags[screen][i])
  536.                     end
  537.                 end),
  538.         awful.key({ modkey, "Shift" }, "#" .. i + 9,
  539.                 function ()
  540.                     if client.focus and tags[client.focus.screen][i] then
  541.                         awful.client.movetotag(tags[client.focus.screen][i])
  542.                     end
  543.                 end),
  544.         awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  545.                 function ()
  546.                     if client.focus and tags[client.focus.screen][i] then
  547.                         awful.client.toggletag(tags[client.focus.screen][i])
  548.                     end
  549.                 end))
  550. end
  551.  
  552. clientbuttons = awful.util.table.join(
  553.     awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  554.     awful.button({ modkey }, 1, awful.mouse.client.move),
  555.     awful.button({ modkey }, 3, awful.mouse.client.resize))
  556.    
  557.  
  558. -- Set keys
  559. root.keys(globalkeys)
  560. -- }}}
  561.  
  562. -- {{{ Rules
  563. awful.rules.rules = {
  564.     -- All clients will match this rule.
  565.     { rule = { },
  566.     properties = { border_width = beautiful.border_width,
  567.                     border_color = beautiful.border_normal,
  568.                     focus = true,
  569.                     keys = clientkeys,
  570.                     buttons = clientbuttons } },
  571. --  { rule = { class = "MPlayer" },
  572. --  properties = { floating = true } },
  573.     { rule = { class = "pinentry" },
  574.     properties = { floating = true } },
  575.     -- Set Firefox to always map on tags number 2 of screen 1.
  576.     -- { rule = { class = "Firefox" },
  577.     --  properties = { tag = tags[1][2] } },
  578.     { rule = { class = "Gimp" },
  579.      properties = { tag = tags[1][5] } },
  580.     { rule = { class = "Terminator" },
  581.      properties = { tag = tags[1][3] } },
  582.     { rule = { class = "Chromium" },
  583.      properties = { tag = tags[1][2] } },
  584.     { rule = { class = "Deadbeef" },
  585.      properties = { tag = tags[1][4] } },
  586.     { rule = { class = "Vacuum" },
  587.      properties = { tag = tags[1][2] } },
  588.     { rule = { class = "Firefox" },
  589.      properties = { tag = tags[1][2] } },
  590.     { rule = { class = "Licq" },
  591.      properties = { tag = tags[1][2] } },
  592.     { rule = { class = "mplayer2" },
  593.      properties = { tag = tags[1][4] } },
  594.     { rule = { class = "Aumix" },
  595.     properties = { floating = true } },
  596.     { rule = { class = "Xev" },
  597.     properties = { floating = true } },
  598.     { rule = { class = "Lxtask" },
  599.     properties = { floating = true } },
  600. }
  601. -- }}}
  602.  
  603. -- {{{ Signals
  604. -- Signal function to execute when a new client appears.
  605. client.add_signal("manage", function (c, startup)
  606.     -- Add a titlebar
  607.     -- awful.titlebar.add(c, { modkey = modkey })
  608.  
  609.  
  610.     -- Enable sloppy focus
  611.     c:add_signal("mouse::click", function(c)
  612.         if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  613.             and awful.client.focus.filter(c) then
  614.             client.focus = c
  615.         end
  616.     end)
  617.  
  618.     if not startup then
  619.         -- Set the windows at the slave,
  620.         -- i.e. put it at the end of others instead of setting it master.
  621.         -- awful.client.setslave(c)
  622.  
  623.         -- Put windows in a smart way, only if they does not set an initial position.
  624.         if not c.size_hints.user_position and not c.size_hints.program_position then
  625.             awful.placement.no_overlap(c)
  626.             awful.placement.no_offscreen(c)
  627. --          awful.placement.under_mouse(c)
  628.         end
  629.     end
  630. end)
  631.  
  632. client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  633. client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  634.  
  635. -- }}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement