Advertisement
discrust

rc.lua

Apr 4th, 2012 (edited)
630
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.50 KB | None | 0 0
  1. -- Standard awesome library
  2. require("awful")
  3. require("awful.autofocus")
  4. require("awful.rules")
  5. require("vicious")
  6. -- Theme handling library
  7. require("beautiful")
  8. -- Notification library
  9. require("naughty")
  10. os.setlocale("pl_PL.utf8")
  11. -- Load Debian menu entries
  12. require("debian.menu")
  13.  
  14. -- {{{ Variable definitions
  15. -- Themes define colours, icons, and wallpapers
  16. beautiful.init("/usr/share/awesome/themes/default/theme.lua")
  17.  
  18. -- This is used later as the default terminal and editor to run.
  19. terminal = "urxvt -T [terminal] -e screen -U"
  20. editor = os.getenv("EDITOR") or "editor"
  21. editor_cmd = terminal .. " -e " .. editor
  22. browser = "firefox"
  23.  
  24. -- Default modkey.
  25. -- Usually, Mod4 is the key with a logo between Control and Alt.
  26. -- If you do not like this or do not have such a key,
  27. -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
  28. -- However, you can use another modifier like Mod1, but it may interact with others.
  29. modkey = "Mod4"
  30.  
  31. -- Table of layouts to cover with awful.layout.inc, order matters.
  32. layouts =
  33. {
  34.     awful.layout.suit.floating,
  35.     awful.layout.suit.tile,
  36.     awful.layout.suit.tile.left,
  37.     awful.layout.suit.tile.bottom,
  38.     awful.layout.suit.tile.top,
  39.     awful.layout.suit.fair,
  40.     awful.layout.suit.fair.horizontal,
  41.     awful.layout.suit.spiral,
  42.     awful.layout.suit.spiral.dwindle,
  43.     awful.layout.suit.max,
  44.     awful.layout.suit.max.fullscreen,
  45.     awful.layout.suit.magnifier
  46. }
  47. -- }}}
  48.  
  49. -- {{{ Tags
  50. -- Define a tag table which hold all screen tags.
  51. tags = {}
  52. tagnames = { "irc",  "mpd", "net", "usr", "png", "msg", }
  53. taglayouts = {
  54.     awful.layout.suit.tile.top,
  55.         awful.layout.suit.tile.bottom,
  56.         awful.layout.suit.floating,
  57.         awful.layout.suit.fair,
  58.         awful.layout.suit.floating,
  59.         awful.layout.suit.floating }
  60.                
  61. for s = 1, screen.count() do
  62.     -- Each screen has its own tag table.
  63.     tags[s] = {}
  64.     for tagnumber = 1, 6 do
  65.         -- Add tags and name them.
  66.         tags[s][tagnumber] = tag(tagnames[tagnumber])
  67.         -- Add tags to screen one by one, giving them their layouts at the same time.
  68.         tags[s][tagnumber].screen = s
  69.         awful.layout.set(taglayouts[tagnumber], tags[s][tagnumber])
  70.     end
  71.     -- I'm sure you want to see at least one tag.
  72.     tags[s][1].selected = true
  73. end
  74. -- }}}
  75.  
  76. awful.util.spawn_with_shell("~/.scripts/mpd.sh")
  77. awful.util.spawn_with_shell("mpd &")
  78. awful.util.spawn_with_shell("mpdscribble &")
  79. awful.util.spawn_with_shell("xrandr -s 1800x1080")
  80. awful.util.spawn_with_shell("fbxkb &")
  81. awful.util.spawn_with_shell("xcompmgr -c -F -t-2 -l-4 -r4 -o.80 &")
  82. awful.util.spawn_with_shell("setxkbmap -option grp:sclk_toggle,grp_led:scroll pl,epo,'ru(phonetic)' &")
  83. awful.util.spawn_with_shell("nitrogen --restore &")
  84.  
  85.  
  86. -- {{{ Menu
  87. -- Create a laucher widget and a main menu
  88. myawesomemenu = {
  89.    { "►  manual", terminal .. " -e man awesome" },
  90.    { "►  rc.lua", "mousepad /home/lukaso/.config/awesome/rc.lua" },
  91.    { "►  theme.lua", "gksu pcmanfm /usr/share/awesome" },
  92.    { "►  aw_themes", "gksu pcmanfm /usr/share/awesome" },
  93.    { "►  restart", awesome.restart },
  94.    { "►  exit", awesome.quit }
  95. }
  96.  
  97. musicmenu = {
  98.    { "►  moc", "urxvt -e mocp" },
  99.    { "►  ncmpcpp", "urxvt -T [ncmpcpp] -e ncmpcpp" },
  100.    { "►  deadbeef", "deadbeef" },
  101.    { "►  sonata", "sonata" }
  102. }
  103.  
  104. newsmenu = {
  105.    { "►  identicurse", "urxvt -e identicurse" },
  106.    { "►  newsbeuter", "urxvt -T [newsbeuter] -e screen -U newsbeuter -r" },
  107.    { "►  tudu", "urxvt -T [tudu] -e tudu" }
  108. }
  109.  
  110. netmenu = {
  111.    { "►  weechat" ,"urxvt -e weechat-curses" },
  112.    { "►  xchat", "xchat" },
  113.    { "►  uGet", "uget-gtk" },
  114.    { "►  gFTP", "gftp-gtk" },
  115.    { "►  linphone", "linphone" },
  116.    { "►  linphonec", "urxvt -T [linphone-cli] -e linphonec -V" }
  117. }
  118.  
  119. toolmenu = {
  120.    { "►  scrot", "xfce4-screenshooter" },
  121.    { "►  calibre", "calibre" },
  122.    { "►  gtk-conf", "gtk-chtheme" },
  123.    { "►  mc", "urxvt -e mc" },
  124.    { "►  ranger", "urxvt -T [ranger] -e ranger" },
  125.    { "►  glances", "urxvt -T [procesy] -e glances" },
  126.    { "►  nitrogen", "nitrogen" },
  127.    { "►  appfinder",  "xfce4-appfinder" },
  128.    { "►  htop",  "urxvt -T [procesy] -e htop" },
  129.    { "►  synaptic",  "gksu synaptic" },
  130.    { "►  xscreensaver", "xscreensaver-demo" }
  131. }
  132.  
  133. graphmenu = {
  134.    { "►  gimp", "gimp" },
  135.    { "►  inkscape", "inkscape" },
  136.    { "►  mirage", "mirage" }
  137. }
  138.  
  139. videomenu = {
  140.    { "►  smplayer", "smplayer" },
  141.    { "►  vlc", "vlc" }
  142. }
  143.  
  144. mymainmenu = awful.menu({ items = { { " ··· MENU ···" },
  145.                                     { "" },
  146.                                     { "▷  terminal", "urxvt" },
  147.                                     { "▷  firefox", "/home/lukaso/.firefox/firefox" },
  148.                                     { "▷  tor-firefox", "/home/lukaso/.tor-browser_pl/start-tor-browser" },
  149.                                     { "▷  thunderbird", "/home/lukaso/.thunderbird/thunderbird" },
  150.                                     { "▷  files", "pcmanfm /home/lukaso" },
  151.                                     { "▷  irc", "urxvt -e weechat-curses" },
  152.                                     { "" },
  153.                                     { "audio ", musicmenu },
  154.                                     { "irc|net", netmenu },
  155.                                     { "info ", newsmenu },
  156.                                     { "graph ", graphmenu },
  157.                                     { "video ", videomenu },
  158.                                     { "tools ", toolmenu },
  159.                     { "awesome", myawesomemenu },
  160.                     { "" },
  161.                     { "··· power|off ", "urxvt -T [ZAMYKANIE-SYSTEMU] -e gksu poweroff" },
  162.                     { "" }
  163.                                   }
  164.                    
  165.                         })
  166.                        
  167. mylauncher = awful.widget.launcher({ image = theme.awesome_icon,
  168.                                      menu = mymainmenu })
  169.                      
  170.  
  171. -- }}}
  172.  
  173. -- {{{ Wibox
  174. -- Create a netwidget
  175. dnicon = widget({ type = "imagebox" })
  176. upicon = widget({ type = "imagebox" })
  177. dnicon.image = image("/usr/share/awesome/icons_pixel/png/green/64x64/arrow1_s.png")
  178. upicon.image = image("/usr/share/awesome/icons_pixel/png/green/64x64/arrow1_n.png")
  179.  
  180. -- Create a cpuwidget
  181. cpuicon = widget({ type = "imagebox" })
  182. cpuicon.image = image("/usr/share/awesome/icons_pixel/png/green/64x64/loop.png")
  183.  
  184. -- Create a timewidget
  185. timeicon = widget({ type = "imagebox" })
  186. timeicon.image = image("/usr/share/awesome/icons_pixel/png/green/64x64/calendar.png")
  187.  
  188. -- Create a mpdwidget
  189. mpdicon = widget({ type = "imagebox" })
  190. mpdicon.image = image("/usr/share/awesome/icons_pixel/png/green/64x64/music.png")
  191.  
  192. -- Create a volumewidget
  193. volicon = widget({ type = "imagebox" })
  194. volicon.image = image("/usr/share/awesome/icons_pixel/png/green/64x64/volume_low.png")
  195.  
  196. -- Create a memuwidget
  197. memicon = widget({ type = "imagebox" })
  198. memicon.image = image("/usr/share/awesome/icons_pixel/png/green/64x64/graph.png")
  199.  
  200. -- Create a timewidget
  201. sysicon = widget({ type = "imagebox" })
  202. sysicon.image = image("/usr/share/awesome/icons/debian.png")
  203.  
  204. -- Create a timewidget
  205. uptimeicon = widget({ type = "imagebox" })
  206. uptimeicon.image = image("/usr/share/awesome/icons_pixel/png/green/64x64/time.png")
  207.  
  208.  
  209.  
  210. -- Initilize widget
  211. netwidget = widget({ type = "textbox" })
  212. -- Register widget
  213. vicious.register(netwidget, vicious.widgets.net, " ${eth0 up_kb}kb/s · ${eth0 down_kb}kb/s ", 1)
  214.  
  215. -- Initilize widget
  216. volwidget = widget({ type = "textbox" })
  217. -- Register widget
  218. vicious.register(volwidget, vicious.widgets.volume, " $1% ", 2, "Master")
  219.  
  220. -- Initialize widget
  221. mycpubox = widget({ type = "textbox" })
  222. mycpubox.text = "CPU "
  223.  
  224. -- Initialize widget
  225. mympdbox = widget({ type = "textbox" })
  226. mympdbox.text = " "
  227.  
  228. -- Initialize widget
  229. mymembox = widget({ type = "textbox" })
  230. mymembox.text = "MEM "
  231.  
  232. -- Initialize widget
  233. mynetbox = widget({ type = "textbox" })
  234. mynetbox.text = "NET "
  235.  
  236. -- Initialize widget
  237. myswapbox = widget({ type = "textbox" })
  238. myswapbox.text = "SWAP "
  239.  
  240. -- Initialize widget
  241. uptimewidget = widget({ type = "textbox" })
  242. -- Register widget
  243. vicious.register(uptimewidget, vicious.widgets.uptime,
  244.  function (widget, args)
  245.     return string.format("[uptm]: %02dd··%02dh··%02dm", args[1], args[2], args[3])
  246.  end, 61)
  247.  
  248.  
  249. -- Initialize widget
  250. syswidget = widget({ type = "textbox" })
  251. vicious.register( syswidget, vicious.widgets.os, "$4 $2")
  252.  
  253. -- Initialize widget
  254. myvolume = widget({ type = "textbox" })
  255. myvolume.text = "VOL "
  256.  
  257.  
  258. -- {{{ Reusable separators
  259. spacer    = widget({ type = "textbox"  })
  260. separator = widget({ type = "imagebox" })
  261. spacer.text     = " | "
  262. separator.image = image(beautiful.widget_sep)
  263.  
  264. -- Initialize widget
  265. memwidget = widget({ type = "textbox" })
  266. -- Register widget
  267. vicious.register(memwidget, vicious.widgets.mem, " $1% ", 2)
  268.  
  269. --- Initialize widget
  270. cpuwidget = widget({ type = "textbox" })
  271. -- Register widget
  272. vicious.register(cpuwidget, vicious.widgets.cpu, " $1% ")
  273.  
  274. -- Initialize widget
  275. mpd_text_box = widget({ type = "textbox" })
  276. mpd_text_box.text = ""
  277. mpd_time_box = widget({ type = "textbox" })
  278. mpd_time_box.text = ""
  279.  
  280. mpd_text_max_size = 30
  281. mpd_text = ""
  282.  
  283. -- Register widget
  284. function mpd_text_rotate()
  285.     if string.len(mpd_text) >= mpd_text_max_size then
  286.         mpd_text = string.gsub(mpd_text, '^(.)(.+)$', '%2%1')
  287.         mpd_text_box.text = string.sub(mpd_text, 1, mpd_text_max_size).."..."
  288.     else
  289.         mpd_text_box.text = mpd_text
  290.     end
  291. end
  292.  
  293. awful.hooks.timer.register(0.4, function()
  294.     mpd_text_rotate()
  295. end)
  296.  
  297. -- Create a textclock widget
  298. mytextclock = awful.widget.textclock({ align = "right" })
  299. -- Calendar widget to attach to the textclock
  300. require('calendar2')
  301. calendar2.addCalendarToWidget(mytextclock)
  302.  
  303. -- Create a systray
  304. mysystray = widget({ type = "systray" })
  305. -- Create a wibox for each screen and add it
  306. mywibox = {}
  307. mylayoutbox = {}
  308. mypromptbox = {}
  309. mytaglist = {}
  310. mytaglist.buttons = awful.util.table.join(
  311.                     awful.button({ }, 1, awful.tag.viewonly),
  312.                     awful.button({ modkey }, 1, awful.client.movetotag),
  313.                     awful.button({ }, 3, awful.tag.viewtoggle),
  314.                     awful.button({ modkey }, 3, awful.client.toggletag),
  315.                     awful.button({ }, 4, awful.tag.viewnext),
  316.                     awful.button({ }, 5, awful.tag.viewprev)
  317.                     )
  318. mytasklist = {}
  319. mytasklist.buttons = awful.util.table.join(
  320.                      awful.button({ }, 1, function (c)
  321.                                               if not c:isvisible() then
  322.                                                   awful.tag.viewonly(c:tags()[1])
  323.                                               end
  324.                                               client.focus = c
  325.                                               c:raise()
  326.                                           end),
  327.                      awful.button({ }, 3, function ()
  328.                                               if instance then
  329.                                                   instance:hide()
  330.                                                   instance = nil
  331.                                               else
  332.                                                   instance = awful.menu.clients({ width=250 })
  333.                                               end
  334.                                           end),
  335.                      awful.button({ }, 4, function ()
  336.                                               awful.client.focus.byidx(1)
  337.                                               if client.focus then client.focus:raise() end
  338.                                           end),
  339.                      awful.button({ }, 5, function ()
  340.                                               awful.client.focus.byidx(-1)
  341.                                               if client.focus then client.focus:raise() end
  342.                                           end))
  343.  
  344. for s = 1, screen.count() do
  345.     -- Create a promptbox for each screen
  346.     mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
  347.     -- Create an imagebox widget which will contains an icon indicating which layout we're using.
  348.     -- We need one layoutbox per screen.
  349.     mylayoutbox[s] = awful.widget.layoutbox(s)
  350.     mylayoutbox[s]:buttons(awful.util.table.join(
  351.                            awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
  352.                            awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
  353.                            awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
  354.                            awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
  355.     -- Create a taglist widget
  356.     mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
  357.  
  358.     -- Create a tasklist widget
  359.     mytasklist[s] = awful.widget.tasklist(function(c)
  360.                                               return awful.widget.tasklist.label.currenttags(c, s)
  361.                                           end, mytasklist.buttons)
  362.    
  363.         -- Create the wibox
  364.     mywibox[s] = awful.wibox({ position = "top", screen = s, height = 16 })
  365.     mywibox2 = awful.wibox({ position = "bottom", screen = 1, height = 16 })      
  366.     -- Add widgets to the wibox - order matters
  367.                    
  368.     mywibox[s].widgets = {
  369.         {
  370.             spacer,
  371.             mylauncher,
  372.             spacer,
  373.             mytaglist[s],
  374.             spacer,
  375.             mylayoutbox[s],
  376.             spacer,
  377.             mypromptbox[s],
  378.             layout = awful.widget.layout.horizontal.leftright
  379.         },
  380.         s == 1 and mysystray or nil,
  381.         mytextclock,
  382.         timeicon,
  383.     spacer,
  384.         mytasklist[s],
  385.     spacer,
  386.         mysystray,
  387.         layout = awful.widget.layout.horizontal.rightleft
  388.         }  
  389.     -- mywibox[s].border_width = "2"
  390.     -- mywibox[s].border_color = beautiful.fg_urgent
  391.     -- mywibox[s].width = "1366"
  392.    
  393.     mywibox2.widgets = {
  394.         {
  395.             spacer,
  396.             uptimewidget,
  397.         spacer,
  398.         syswidget,
  399.         spacer,
  400.             layout = awful.widget.layout.horizontal.leftright
  401.         },
  402.         mpd_text_box,
  403.     mympdbox,
  404.     mpdicon,
  405.         spacer,
  406.         volwidget, volicon,
  407.         spacer,
  408.         cpuwidget, cpuicon,
  409.         spacer,
  410.         memwidget, memicon,
  411.         spacer,
  412.         dnicon,
  413.         netwidget,
  414.         upicon,
  415.         layout = awful.widget.layout.horizontal.rightleft
  416.     }
  417. end
  418. -- }}}
  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. -- {{{ Key bindings
  429. globalkeys = awful.util.table.join(
  430.     awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
  431.     awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
  432.     awful.key({ modkey,           }, "Escape", awful.tag.history.restore),
  433.  
  434.     awful.key({ modkey,           }, "j",
  435.         function ()
  436.             awful.client.focus.byidx( 1)
  437.             if client.focus then client.focus:raise() end
  438.         end),
  439.     awful.key({ modkey,           }, "k",
  440.         function ()
  441.             awful.client.focus.byidx(-1)
  442.             if client.focus then client.focus:raise() end
  443.         end),
  444.     awful.key({ modkey,           }, "w", function () mymainmenu:show({keygrabber=true}) end),
  445.  
  446.     -- Layout manipulation
  447.     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
  448.     awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
  449.     awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
  450.     awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
  451.     awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
  452.     awful.key({ modkey,           }, "Tab",
  453.         function ()
  454.             awful.client.focus.history.previous()
  455.             if client.focus then
  456.                 client.focus:raise()
  457.             end
  458.         end),
  459.  
  460.     -- Standard program
  461.     awful.key({ modkey,           }, "Return", function () awful.util.spawn(terminal) end),
  462.     awful.key({ modkey, "Control" }, "r", awesome.restart),
  463.     awful.key({ modkey, "Shift"   }, "q", awesome.quit),
  464.  
  465.     awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
  466.     awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
  467.     awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
  468.     awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
  469.     awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
  470.     awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
  471.     awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
  472.     awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),
  473.     awful.key({ "Shift"           }, "#111",  function () awful.util.spawn("amixer -q sset Master 4+", false) end),
  474.     awful.key({ "Shift"           }, "#116",  function () awful.util.spawn("amixer -q sset Master 4-", false) end),
  475.  
  476.     -- Prompt
  477.     awful.key({ modkey },            "r",     function () mypromptbox[mouse.screen]:run() end),
  478.  
  479.     awful.key({ modkey }, "x",
  480.               function ()
  481.                   awful.prompt.run({ prompt = "Run Lua code: " },
  482.                   mypromptbox[mouse.screen].widget,
  483.                   awful.util.eval, nil,
  484.                   awful.util.getdir("cache") .. "/history_eval")
  485.               end)
  486. )
  487.  
  488. clientkeys = awful.util.table.join(
  489.     awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
  490.     awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end),
  491.     awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
  492.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  493.     awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
  494.     awful.key({ modkey, "Shift"   }, "r",      function (c) c:redraw()                       end),
  495.     awful.key({ modkey,           }, "t",      function (c) c.ontop = not c.ontop            end),
  496.     awful.key({ modkey,           }, "n",      function (c) c.minimized = not c.minimized    end),
  497.     awful.key({ modkey,           }, "m",
  498.         function (c)
  499.             c.maximized_horizontal = not c.maximized_horizontal
  500.             c.maximized_vertical   = not c.maximized_vertical
  501.         end)
  502. )
  503.  
  504. -- Compute the maximum number of digit we need, limited to 9
  505. keynumber = 0
  506. for s = 1, screen.count() do
  507.    keynumber = math.min(9, math.max(#tags[s], keynumber));
  508. end
  509.  
  510. -- Bind all key numbers to tags.
  511. -- Be careful: we use keycodes to make it works on any keyboard layout.
  512. -- This should map on the top row of your keyboard, usually 1 to 9.
  513. for i = 1, keynumber do
  514.     globalkeys = awful.util.table.join(globalkeys,
  515.         awful.key({ modkey }, "#" .. i + 9,
  516.                   function ()
  517.                         local screen = mouse.screen
  518.                         if tags[screen][i] then
  519.                             awful.tag.viewonly(tags[screen][i])
  520.                         end
  521.                   end),
  522.         awful.key({ modkey, "Control" }, "#" .. i + 9,
  523.                   function ()
  524.                       local screen = mouse.screen
  525.                       if tags[screen][i] then
  526.                           awful.tag.viewtoggle(tags[screen][i])
  527.                       end
  528.                   end),
  529.         awful.key({ modkey, "Shift" }, "#" .. i + 9,
  530.                   function ()
  531.                       if client.focus and tags[client.focus.screen][i] then
  532.                           awful.client.movetotag(tags[client.focus.screen][i])
  533.                       end
  534.                   end),
  535.         awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  536.                   function ()
  537.                       if client.focus and tags[client.focus.screen][i] then
  538.                           awful.client.toggletag(tags[client.focus.screen][i])
  539.                       end
  540.                   end))
  541. end
  542.  
  543. clientbuttons = awful.util.table.join(
  544.     awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  545.     awful.button({ modkey }, 1, awful.mouse.client.move),
  546.     awful.button({ modkey }, 3, awful.mouse.client.resize))
  547.  
  548. -- Set keys
  549. root.keys(globalkeys)
  550. -- }}}
  551.  
  552. -- {{{ Rules
  553. awful.rules.rules = {
  554.     -- All clients will match this rule.
  555.     { rule = { },
  556.       properties = { border_width = beautiful.border_width,
  557.                      border_color = beautiful.border_normal,
  558.                      focus = true,
  559.                      keys = clientkeys,
  560.                      buttons = clientbuttons } },
  561.     { rule = { class = "MPlayer" },
  562.       properties = { floating = true } },
  563.     { rule = { class = "pinentry" },
  564.       properties = { floating = true } },
  565.     { rule = { class = "gimp" },
  566.       properties = { floating = true } },
  567.     -- Set Firefox to always map on tags number 2 of screen 1.
  568.     -- { rule = { class = "Firefox" },
  569.     --   properties = { tag = tags[1][2] } },
  570. }
  571. -- }}}
  572.  
  573. -- {{{ Signals
  574. -- Signal function to execute when a new client appears.
  575. client.add_signal("manage", function (c, startup)
  576.     -- Add a titlebar
  577.     -- awful.titlebar.add(c, { modkey = modkey })
  578.  
  579.     -- Enable sloppy focus
  580.     c:add_signal("mouse::enter", function(c)
  581.         if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  582.             and awful.client.focus.filter(c) then
  583.             client.focus = c
  584.         end
  585.     end)
  586.  
  587.     if not startup then
  588.         -- Set the windows at the slave,
  589.         -- i.e. put it at the end of others instead of setting it master.
  590.         -- awful.client.setslave(c)
  591.  
  592.         -- Put windows in a smart way, only if they does not set an initial position.
  593.         if not c.size_hints.user_position and not c.size_hints.program_position then
  594.             awful.placement.no_overlap(c)
  595.             awful.placement.no_offscreen(c)
  596.         end
  597.     end
  598. end)
  599.  
  600. client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  601. client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  602. -- }}}
  603.  
  604. awful.util.spawn_with_shell("COMMAND1")
  605. awful.util.spawn_with_shell("COMMAND2")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement