Advertisement
Guest User

Untitled

a guest
Apr 13th, 2010
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 23.16 KB | None | 0 0
  1. -- Standard awesome library
  2. require("awful")
  3. require("awful.autofocus")
  4. require("awful.rules")
  5. require("awful.tooltip")
  6. require("awful.placement")
  7. -- Theme handling library
  8. require("beautiful")
  9. -- Notification library
  10. require("naughty")
  11. -- Bashets
  12. require("bashets")
  13. -- My Awesome Widgets
  14. require("myaw")
  15. -- fd.org menu
  16. require("freedesktop.menu")
  17. -- Presets
  18. require("presets")
  19.  
  20. local capi = { screen = screen,
  21.                awesome = awesome,
  22.                dbus = dbus,
  23.                widget = widget,
  24.                wibox = wibox,
  25.                image = image,
  26.                timer = timer }
  27.  
  28. -- {{{ Variable definitions
  29. -- Global variables
  30. bright_color="#000000"   -- Color to highlight widget elements
  31. --bright_color="#cacaca"   -- Color to highlight widget elements
  32. --bright_color="#E1C596"   -- Color to highlight widget elements
  33. --bright_color="#1a1a1a"   -- Color to highlight widget elements
  34. --bright_color="#f3f2f8"   -- Color to highlight widget elements
  35. modkey = "Mod4"          -- Default modkey
  36.  
  37. -- Do some obvious things
  38. presets.locale()                      -- Set correct locale
  39. presets.set_theme("rb")           -- Set beautiful theme
  40. presets.autorun({                     -- Autorun apps
  41.     "xcompmgr",
  42.     "xscreensaver -no-splash",
  43. --  "xbindkeys",
  44.     "wmname LG3D",
  45.     "sh /home/anton/.fehbg",
  46.     "pulseaudio &"
  47. --  "xxkb"
  48. --  "ivman"
  49. })
  50. local run = presets.runner
  51.  
  52. -- Commands table
  53. local commands = {}
  54. commands.terminal = "xterm"
  55. commands.editor = "xterm -e vim"
  56. commands.mail = "firefox http://gmail.com"
  57. commands.lock = "xscreensaver-command --lock"
  58. commands.fileman = "pcmanfm"
  59. commands.calc = "xcalc"
  60. commands.mute = "mute.sh"
  61. commands.browser = "firefox"
  62. commands.raisevol = "amixer set Master 5%+"
  63. commands.lowervol = "amixer set Master 5%-"
  64. commands.playpause = "mpc toggle"
  65. commands.player = "xterm -e ncmpc"
  66. commands.nexttrack = "mpc next"
  67. commands.prevtrack = "mpc prev"
  68. commands.playstop = "mpc stop"
  69. commands.screenshot = "scrot -e 'mv $f ~/screenshots'"
  70. commands.screenwin = "scrot -s -b -e 'mv $f ~/screenshots'"
  71.  
  72. -- Naughty position
  73. naughty.config.presets.normal.position = "top_right"
  74.  
  75. -- MyAW widget options
  76. myaw.calendar.options.position = "top_right"        -- Calendar position
  77. myaw.coverart.options.position = "bottom_right"     -- Cover art position
  78.  
  79. -- Layout table
  80. layouts =
  81. {
  82.     awful.layout.suit.tile,
  83.     awful.layout.suit.tile.left,
  84.     awful.layout.suit.tile.bottom,
  85.     awful.layout.suit.tile.top,
  86.     awful.layout.suit.fair,
  87.     awful.layout.suit.fair.horizontal,
  88.     awful.layout.suit.spiral,
  89.     awful.layout.suit.spiral.dwindle,
  90.     awful.layout.suit.max,
  91.     awful.layout.suit.max.fullscreen,
  92.     awful.layout.suit.magnifier,
  93.     awful.layout.suit.floating
  94. }
  95. -- }}}
  96.  
  97.  
  98. -- {{{ Tags
  99. -- Define a tag table which hold all screen tags.
  100. tags = {}
  101. for s = 1, screen.count() do
  102.     -- Each screen has its own tag table.
  103.     tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[1])
  104. end
  105. -- }}}
  106.  
  107.  
  108. -- {{{ Menu
  109. -- Create a laucher widget and a main menu
  110. awesomemenu = {
  111.    { "manual", commands.terminal .. " -e man awesome" },
  112.    { "edit config", commands.editor .. " " .. awful.util.getdir("config") .. "/rc.lua" },
  113.    { "restart", awesome.restart },
  114.    { "quit", awesome.quit }
  115. }
  116.  
  117. menuitems = {
  118.     { "awesome", awesomemenu, beautiful.awesome_icon },
  119.     { "matlab", "matlab -desktop"},
  120.         { "open terminal", commands.terminal }
  121. }
  122.  
  123. menuitems = awful.util.table.join(menuitems, freedesktop.menu.new()) -- Join with freedesktop menu
  124.  
  125. mymainmenu = awful.menu({ items = menuitems })
  126. mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
  127.                                      menu = mymainmenu })
  128. -- }}}
  129.  
  130. -- {{{ Bashets widgets
  131. datew = widget({ type = "textbox", name = "datew", align="right" })
  132. --bashets.register(datew, "date.sh", '<span color="' .. bright_color ..'">  $1  </span>', 60, '|')
  133. bashets.register(datew, "date.sh", '<span weight="bold">  $1  </span>', 60, '|')
  134.  
  135. mpdw = widget({ type = "textbox", name = "mpdw"})
  136. bashets.register(mpdw, "mpd.sh", '<span color="' .. bright_color .. '" face="Monospace">$1</span> $2 | $3', 1, '|')
  137.  
  138. memw = widget({type="textbox",name="memw"})
  139. bashets.register(memw, "mem.sh", ' <span color="' .. bright_color .. '">M:</span> $1%', 3)
  140.  
  141. cpuw = widget({type="textbox",name="cpuw"})
  142. bashets.register(cpuw, "cpu.sh", ' <span color="' .. bright_color .. '">C:</span> $1%', 2)
  143. --bashets.register({memw, cpuw}, "cpu.sh", {' <span color="' .. bright_color .. '">C:</span> $1%', '$1'}, 2)
  144.  
  145. gapw = widget({type="textbox", name="gapw", align="right"})
  146. gapw.text = " "
  147.  
  148. ww = widget({type="textbox", name="ww"})
  149. bashets.register_async(ww, "forecast.sh", ' <span face="ConkyWeather" font="10" color="' .. bright_color .. '" weight="bold" rise="-1400">$1</span><span font="5"> </span><span rise="1400">$2</span>', 3600)
  150.  
  151. mw = widget({type="textbox", name="mw"})
  152. bashets.register_async(mw, "checkmail.sh", ' <span face="MarVoSym" font="12" color="' .. bright_color .. '" weight="bold" rise="1500">B</span><span font="5"> </span><span rise="1800">$1</span>', 3600)
  153.  
  154. xkbw = widget({type="textbox", name="xkbw", align="right"})
  155. bashets.register_async(xkbw, "xkb.sh", ' <span color="' .. bright_color .. '">$1</span>  ')
  156.  
  157. datew:add_signal("mouse::enter", myaw.calendar.actions.show)
  158. datew:add_signal("mouse::leave", myaw.calendar.actions.hide)
  159. datew:buttons(awful.util.table.join(
  160.     awful.button({ }, 4, myaw.calendar.actions.prev),
  161.     awful.button({ }, 5, myaw.calendar.actions.next)
  162. ))
  163.  
  164. mpdw:add_signal("mouse::enter", myaw.coverart.actions.popup)
  165. mpdw:add_signal("mouse::leave", myaw.coverart.actions.hide)
  166. -- }}}
  167.  
  168. -- {{{ Wibox
  169. -- Create a systray
  170. mysystray = widget({ type = "systray" })
  171.  
  172. -- Create a wibox for each screen and add it
  173. topbar = {}
  174. bottombar = {}
  175.  
  176. mypromptbox = {}
  177. mylayoutbox = {}
  178. mytaglist = {}
  179. mytaglist.buttons = awful.util.table.join(
  180.                     awful.button({ }, 1, awful.tag.viewonly),
  181.                     awful.button({ modkey }, 1, awful.client.movetotag),
  182.                     awful.button({ }, 3, awful.tag.viewtoggle),
  183.                     awful.button({ modkey }, 3, awful.client.toggletag),
  184.                     awful.button({ }, 4, awful.tag.viewnext),
  185.                     awful.button({ }, 5, awful.tag.viewprev)
  186. )
  187. mytasklist = {}
  188. mytasklist.buttons = awful.util.table.join(
  189.                      awful.button({ }, 1, function (c)
  190.                                               if not c:isvisible() then
  191.                                                   awful.tag.viewonly(c:tags()[1])
  192.                                               end
  193.                                               client.focus = c
  194.                                               c:raise()
  195.                                           end),
  196.                      awful.button({ }, 3, function ()
  197.                                               if instance then
  198.                                                   instance:hide()
  199.                                                   instance = nil
  200.                                               else
  201.                                                   instance = awful.menu.clients({ width=250 })
  202.                                               end
  203.                                           end),
  204.                      awful.button({ }, 4, function ()
  205.                                               awful.client.focus.byidx(1)
  206.                                               if client.focus then client.focus:raise() end
  207.                                           end),
  208.                      awful.button({ }, 5, function ()
  209.                                               awful.client.focus.byidx(-1)
  210.                                               if client.focus then client.focus:raise() end
  211.                                           end)
  212. )
  213.  
  214. --bgi = image("/home/anton/tst/Vienna VWindowFrameBottom.tga")
  215. --bgi = image("/home/anton/.config/awesome/bg1.png")
  216. --bgi = image("/home/anton/tst/Vienna VStartPanelLogoff.tga")
  217. --bgi2 = image("/home/anton/tst/Vienna VWindowFrameTop.tga")
  218. --bgi = bgi:crop_and_scale(0, 0, 643, 18, 1280, 23)
  219. --bgi2 = bgi:rotate(math.pi / 8)
  220. --bgi2 = bgi
  221. --bgi = bgi:crop_and_scale(0, 0, 407, 31, 1280, 23)
  222. --bgi2 = bgi2:crop_and_scale(0, 0, 643, 18, 1280, 23)
  223. --/usr/share/icons/Tango/128x128/actions/format-text-strikethrough.png")
  224. for s = 1, screen.count() do
  225.     -- Create a promptbox for each screen
  226.     mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
  227.     -- Create an imagebox widget which will contains an icon indicating which layout we're using.
  228.     -- We need one layoutbox per screen.
  229.     mylayoutbox[s] = awful.widget.layoutbox(s)
  230.     mylayoutbox[s]:buttons(awful.util.table.join(
  231.                            awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
  232.                            awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
  233.                            awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
  234.                            awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
  235.     -- Create a taglist widget
  236.     mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
  237.     --mytaglist[s].layout = awful.widget.layout.horizontal.rightleft;
  238.  
  239.     -- Create a tasklist widget
  240.     mytasklist[s] = awful.widget.tasklist(function(c)
  241.                                               return awful.widget.tasklist.label.currenttags(c, s)
  242.                                           end, mytasklist.buttons)
  243.     -- Create the wiboxes
  244.     topbar[s] = awful.wibox({ position = "top", screen = s })
  245.   --  topbar[s].bg_image = bgi
  246.   --  topbar[s].bg = "#ffffff00"
  247.     bottombar[s] = awful.wibox({ position = "bottom", screen = s})
  248.   --  bottombar[s].bg_image = bgi
  249.   --  bottombar[s].bg = "#ffffff00"
  250.  
  251.     -- memw, cpuw, fsw, vlw,
  252.     bottombar[s].widgets ={
  253.         { mypromptbox[s], gapw, mw, cpuw, memw, layout = awful.widget.layout.horizontal.leftright},
  254.         mylayoutbox[s], gapw, mpdw,
  255.         layout = awful.widget.layout.horizontal.rightleft
  256.     }
  257.     topbar[s].widgets = {gapw, gapw, gapw, datew, ww, xkbw, mysystray, gapw,
  258.             {mylauncher, gapw,  mytaglist[s], gapw, mytasklist[s], layout = awful.widget.layout.horizontal.leftright},
  259.         layout = awful.widget.layout.horizontal.rightleft
  260.     }
  261. end
  262. -- }}}
  263.  
  264.  
  265. -- {{{ Free-form desktop wiboxes aka "widgets"
  266.  
  267. --wcolor = "#f8f9f1"
  268. wcolor = beautiful.fg_normal
  269. calendtext = widget({type="textbox", name="calendtext"})
  270. calendtext.text = "<span font=\"14\" color=\"" .. wcolor .. "\">" .. os.date("%B") .. "</span>\n<span font=\"12\" color=\"" .. wcolor .. "\">" .. os.date("%A") .. "</span>\n<span font=\"25\" color=\"" .. wcolor .. "\">" .. os.date("%d") .. "</span>"
  271. --bg="#ffffff00"
  272. --bgi = bgi:crop_and_scale(0, 0, calendtext:extents().width, calendtext:extents().height, calendtext:extents().width, calendtext:extents().height)
  273. calendbox = wibox({width=calendtext:extents().width, height=100, bg="#ffffff00"})
  274. calendbox.widgets = {calendtext, layout = awful.widget.layout.horizontal.leftright}
  275. --calendbox:geometry({x=1280 - calendtext:extents().width - 30, y=40})
  276. calendbox:geometry({x=1280 - calendtext:extents().width - 30, y=130})
  277. calendbox.screen = mouse.screen
  278. --calendbox.bg_image = bgi
  279.  
  280. --mailtext = widget({type="textbox", name="mailtext"})
  281. --mailtext.text = awful.util.pread("/usr/share/awesome/bashets/fullmail.sh")
  282. --mailbox = wibox({width=mailtext:extents().width, height=mailtext:extents().height, bg="#ffffff00"})
  283. --mailbox.widgets = {mailtext, layout = awful.widget.layout.horizontal.leftright}
  284. --mailbox:geometry({x=30, y=1024 - mailtext:extents().height - 30})
  285. --mailbox.screen = mouse.screen
  286. --bashets.register(mailtext, "fullmail.sh", "<span face=\"Monospace\">$1</span>", 3600, '|')
  287.  
  288. pstext = widget({type="textbox", name="pstext"})
  289. pstext.text = "<span face=\"Monospace\" color=\"" .. wcolor .. "\">" .. awful.util.escape(awful.util.pread("ps axk -%cpu,-%mem o pid,comm,%cpu,%mem | head -n 6")) .. "</span>"
  290. psbox = wibox({width=pstext:extents().width, height=pstext:extents().height, bg="#ffffff00"})
  291. psbox.widgets = {pstext, layout = awful.widget.layout.horizontal.leftright}
  292. --psbox:geometry({x=1280 - pstext:extents().width - 30, y=1024 - 50 - pstext:extents().height})
  293. --psbox:geometry({x=30, y=1024 - 30 - pstext:extents().height})
  294. psbox:geometry({x=30, y=1024 - 20 - pstext:extents().height})
  295. psbox.screen = mouse.screen
  296. bashets.register(pstext, "ps.sh", "<span face=\"Monospace\" color=\"" .. wcolor .. "\">$1</span>", 2, '|')
  297.  
  298. --launchbox = wibox({width=16, height=16*5})
  299. --launchbox:geometry({x=0, y=60})
  300.  
  301. --launchbox.widgets = {
  302. --  awful.widget.launcher({image = image("/usr/share/icons/hicolor/16x16/apps/writer.png"), command = "soffice -writer"}),
  303. --  awful.widget.launcher({image = image("/usr/share/icons/gnome-brave/16x16/apps/pcmanfm.png"), command = "pcmanfm"}),
  304. --  awful.widget.launcher({image = image("/usr/share/icons/hicolor/16x16/apps/freedcpp.png"), command = "freedcpp"}),
  305. --  awful.widget.launcher({image = image("/usr/share/icons/hicolor/16x16/apps/matlab.png"), command = "matlab -desktop"}),
  306. --  awful.widget.launcher({image = image("/usr/share/icons/balanzan/16x16/apps/firefox.png"), command = "firefox"}),
  307. --  layout = awful.widget.layout.vertical.flex
  308. --}
  309.  
  310. --launchbox.screen = mouse.screen
  311.  
  312. --catext = widget({type="textbox", name="catext"})
  313. --catext.text = "<span face=\"Monospace\">" .. awful.util.escape(awful.util.pread("ca axk -%cpu,-%mem o pid,comm,%cpu,%mem | head -n 6")) .. "</span>"
  314. --cabox = wibox({width=catext:extents().width, height=catext:extents().height, bg="#ffffff00"})
  315. --cabox.widgets = {catext, layout = awful.widget.layout.horizontal.leftright}
  316. --cabox:geometry({x=1280 - catext:extents().width - 30, y=1024 - 50 - catext:extents().height})
  317. --cabox:geometry({x=1280 - catext:extents().width, y=1024 - 50 - catext:extents().height})
  318. --cabox.screen = mouse.screen
  319. --bashets.register(catext, "ca.sh", "<span face=\"Monospace\">$1</span>", 2, '|')
  320. -- }}}
  321.  
  322. -- {{{ Start updates for bashets
  323. bashets.start()
  324. -- }}}
  325.  
  326. -- {{{ Mouse bindings
  327. -- Mouse bindings for root window
  328. root.buttons(awful.util.table.join(
  329.     awful.button({ }, 3, function () mymainmenu:toggle() end),
  330.     awful.button({ }, 4, awful.tag.viewnext),
  331.     awful.button({ }, 5, awful.tag.viewprev)
  332. ))
  333. -- Mouse bindings for client window
  334. clientbuttons = awful.util.table.join(
  335.     awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  336.     awful.button({ modkey }, 1, awful.mouse.client.move),
  337.     awful.button({ modkey }, 3, awful.mouse.client.resize)
  338. )
  339. -- }}}   //Mouse bindings
  340.  
  341. -- {{{ Key bindings
  342. -- Key bindings for root window
  343. globalkeys = awful.util.table.join(
  344.     -- User defined commands
  345.     awful.key({}, "XF86AudioMute", run(commands.mute)),
  346.     awful.key({}, "XF86AudioRaiseVolume", run(commands.raisevol)),
  347.     awful.key({}, "XF86AudioLowerVolume", run(commands.lowervol)),
  348.     awful.key({}, "XF86AudioPlay", run(commands.playpause)),
  349.     awful.key({}, "XF86AudioMedia", run(commands.player)),
  350.     awful.key({}, "XF86AudioStop", run(commands.playstop)),
  351.     awful.key({}, "XF86AudioNext", run(commands.nexttrack)),
  352.     awful.key({}, "XF86AudioPrev", run(commands.prevtrack)),
  353.     awful.key({}, "XF86MyComputer", run(commands.fileman)),
  354.     awful.key({}, "XF86Mail", run(commands.mail)),
  355.     awful.key({}, "XF86HomePage", run(commands.browser)),
  356.     awful.key({}, "XF86Calculator", run(commands.calc)),
  357.     awful.key({"Mod1"}, "Print", run(commands.screenwin)),
  358.     awful.key({}, "Print", run(commands.screenshot)),
  359.     awful.key({}, "XF86Sleep", run(commands.lock)),
  360.     awful.key({"Control", "Mod1"}, "l", run(commands.lock)),
  361.     awful.key({ modkey,           }, "Return", run(commands.terminal)),
  362.    
  363.     -- Tag switching
  364.     awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
  365.     awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
  366.     awful.key({ modkey,           }, "Escape", awful.tag.history.restore),
  367.  
  368.     -- Client switching
  369.     awful.key({ modkey,           }, "j",
  370.         function ()
  371.             awful.client.focus.byidx( 1)
  372.             if client.focus then client.focus:raise() end
  373.         end),
  374.     awful.key({ modkey,           }, "k",
  375.         function ()
  376.             awful.client.focus.byidx(-1)
  377.             if client.focus then client.focus:raise() end
  378.         end),
  379.  
  380.     -- Menu key
  381.     awful.key({ modkey,           }, "w", function () mymainmenu:show(true)        end),
  382.  
  383.     -- Client manipulation within layout
  384.     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
  385.     awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
  386.     awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
  387.     awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
  388.     awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
  389.     awful.key({ modkey,           }, "Tab",
  390.         function ()
  391.             awful.client.focus.history.previous()
  392.             if client.focus then
  393.                 client.focus:raise()
  394.             end
  395.         end),
  396.  
  397.     -- Awesome commands
  398.     awful.key({ modkey, "Control" }, "r", awesome.restart),
  399.     awful.key({ modkey, "Shift"   }, "q", awesome.quit),
  400.  
  401.     -- Client area manipulation
  402.     awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
  403.     awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
  404.     awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
  405.     awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
  406.     awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
  407.     awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
  408.  
  409.     -- Layout switching
  410.     awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
  411.     awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),
  412.  
  413.     -- Prompt
  414.     --awful.key({ modkey },            "r",     function () mypromptbox[mouse.screen]:run() end)
  415.     --No, thanks, dmenu is better :)
  416.     awful.key({ modkey },            "r",     run("dmenu_run -sb gray -sf black -b"))
  417.  
  418.     -- Lua prompt
  419.     --awful.key({ modkey }, "x",
  420.     --          function ()
  421.     --              awful.prompt.run({ prompt = "Run Lua code: " },
  422.     --              mypromptbox[mouse.screen].widget,
  423.     --              awful.util.eval, nil,
  424.     --              awful.util.getdir("cache") .. "/history_eval")
  425.     --          end)
  426. )
  427.  
  428. -- Default 9-tag keybindings
  429. -- Compute the maximum number of digit we need, limited to 9
  430. keynumber = 0
  431. for s = 1, screen.count() do
  432.    keynumber = math.min(9, math.max(#tags[s], keynumber));
  433. end
  434.  
  435. for i = 1, keynumber do
  436.     globalkeys = awful.util.table.join(globalkeys,
  437.         awful.key({ modkey }, i,
  438.                   function ()
  439.                         local screen = mouse.screen
  440.                         if tags[screen][i] then
  441.                             awful.tag.viewonly(tags[screen][i])
  442.                         end
  443.                   end),
  444.         awful.key({ modkey, "Control" }, i,
  445.                   function ()
  446.                       local screen = mouse.screen
  447.                       if tags[screen][i] then
  448.                           awful.tag.viewtoggle(tags[screen][i])
  449.                       end
  450.                   end),
  451.         awful.key({ modkey, "Shift" }, i,
  452.                   function ()
  453.                       if client.focus and tags[client.focus.screen][i] then
  454.                           awful.client.movetotag(tags[client.focus.screen][i])
  455.                       end
  456.                   end),
  457.         awful.key({ modkey, "Control", "Shift" }, i,
  458.                   function ()
  459.                       if client.focus and tags[client.focus.screen][i] then
  460.                           awful.client.toggletag(tags[client.focus.screen][i])
  461.                       end
  462.                   end)
  463.     )
  464. end
  465.  
  466. -- Set root window keys
  467. root.keys(globalkeys)
  468.  
  469. -- Key bindings for client window
  470. clientkeys = awful.util.table.join(
  471.     awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
  472.     awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end),
  473.     awful.key({ modkey,           }, "q",      function (c) c:kill()                         end),
  474.     awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
  475.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  476.     awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
  477.     awful.key({ modkey, "Shift"   }, "r",      function (c) c:redraw()                       end),
  478.     awful.key({ modkey,           }, "n",      function (c) c.minimized = not c.minimized    end),
  479.     awful.key({ modkey,           }, "m",
  480.         function (c)
  481.             c.maximized_horizontal = not c.maximized_horizontal
  482.             c.maximized_vertical   = not c.maximized_vertical
  483.         end)
  484. )
  485. -- }}}   //Key bindings
  486.  
  487. -- {{{ Rules
  488. awful.rules.rules = {
  489.     -- All clients will match this rule.
  490.     { rule = { },
  491.       properties = { border_width = beautiful.border_width,
  492.                      border_color = beautiful.border_normal,
  493.                      focus = true,
  494.                      keys = clientkeys,
  495.                      buttons = clientbuttons } },
  496.     { rule = { class = "MPlayer" },
  497.       properties = { floating = true } },
  498.     { rule = { class = "Vlc" },
  499.       properties = { floating = true } },
  500.     { rule = { class = "pinentry" },
  501.       properties = { floating = true } },
  502.     { rule = { class = "Gajim" },
  503.       properties = { floating = true } },
  504.     { rule = { class = "Empathy" },
  505.       properties = { floating = true } },
  506.     { rule = { class = "Cairo-clock" },
  507.       properties = { floating = true } },
  508.     { rule = { class = "XClock" },
  509.       properties = { floating = true } },
  510.     { rule = { class = "XTerm"},
  511.       properties = { opacity = 0.96 } },
  512.       --properties = { opacity = 0.9 } },
  513.     -- Set Firefox to always map on tags number 2 of screen 1.
  514.     -- { rule = { class = "Firefox" },
  515.     --   properties = { tag = tags[1][2] } },
  516. }
  517. -- }}}   //Rules
  518.  
  519. -- {{{ Signals
  520. -- Signal function to execute when a new client appears.
  521. client.add_signal("manage", function (c, startup)
  522.     -- Add a titlebar
  523.     -- awful.titlebar.add(c, { modkey = modkey })
  524.  
  525.     -- Enable sloppy focus
  526.     c:add_signal("mouse::enter", function(c)
  527.         if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  528.             and awful.client.focus.filter(c) then
  529.             client.focus = c
  530.         end
  531.     end)
  532.  
  533.     -- Set the windows at the slave,
  534.     -- i.e. put it at the end of others instead of setting it master.
  535.     -- awful.client.setslave(c)
  536.     c.size_hints_honor = false
  537. end)
  538.  
  539. client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  540. client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  541. -- }}}   // Signals
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement