lpfManiak

~/.config/awesome/rc.lua

Sep 27th, 2015
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 24.01 KB | None | 0 0
  1. -- require("daze")
  2. vicious = require("vicious")
  3. beautiful = require("beautiful")
  4. -- Standard awesome library
  5. local gears = require("gears")
  6. local awful = require("awful")
  7. awful.rules = require("awful.rules")
  8. require("awful.autofocus")
  9. -- Widget and layout library
  10. local wibox = require("wibox")
  11. -- Theme handling library
  12. local beautiful = require("beautiful")
  13. -- Notification library
  14. local naughty = require("naughty")
  15. local menubar = require("menubar")
  16.  
  17. -- {{{ Error handling
  18. -- Check if awesome encountered an error during startup and fell back to
  19. -- another config (This code will only ever execute for the fallback config)
  20. if awesome.startup_errors then
  21.     naughty.notify({ preset = naughty.config.presets.critical,
  22.                      title = "Oops, there were errors during startup!",
  23.                      text = awesome.startup_errors })
  24. end
  25.  
  26. -- Handle runtime errors after startup
  27. do
  28.     local in_error = false
  29.     awesome.connect_signal("debug::error", function (err)
  30.         -- Make sure we don't go into an endless error loop
  31.         if in_error then return end
  32.         in_error = true
  33.  
  34.         naughty.notify({ preset = naughty.config.presets.critical,
  35.                          title = "Oops, an error happened!",
  36.                          text = err })
  37.         in_error = false
  38.     end)
  39. end
  40. -- }}}
  41.  
  42. -- {{{ Variable definitions
  43. -- Themes define colours, icons, and wallpapers
  44. beautiful.init("~/.config/awesome/themes/sky/theme.lua")
  45.  
  46. -- This is used later as the default terminal and editor to run.
  47. terminal = "urxvt"
  48. editor = os.getenv("EDITOR") or "nano"
  49. editor_cmd = terminal .. " -e " .. editor
  50.  
  51. -- Default modkey.
  52. -- Usually, Mod4 is the key with a logo between Control and Alt.
  53. -- If you do not like this or do not have such a key,
  54. -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
  55. -- However, you can use another modifier like Mod1, but it may interact with others.
  56. modkey = "Mod4"
  57.  
  58. -- Table of layouts to cover with awful.layout.inc, order matters.
  59. local layouts =
  60. {
  61.     awful.layout.suit.tile,
  62.     awful.layout.suit.floating,
  63.     awful.layout.suit.tile.left,
  64.     awful.layout.suit.tile.bottom,
  65.     awful.layout.suit.tile.top,
  66.     awful.layout.suit.fair,
  67.     awful.layout.suit.fair.horizontal,
  68. --    awful.layout.suit.spiral,
  69. --    awful.layout.suit.spiral.dwindle,
  70. --    awful.layout.suit.max,
  71. --    awful.layout.suit.max.fullscreen,
  72. --    awful.layout.suit.magnifier
  73. }
  74. -- }}}
  75.  
  76. -- {{{ Wallpaper
  77. if beautiful.wallpaper then
  78.     for s = 1, screen.count() do
  79.         gears.wallpaper.maximized(beautiful.wallpaper, s, true)
  80.     end
  81. end
  82. -- }}}
  83.  
  84.  -- {{{ Remember layout
  85.  -- }}}
  86.  
  87.  -- {{{ Tags main im gimp etc
  88.  -- Define a tag table which will hold all screen tags.
  89.  tags = {
  90.    names  = { "⮛", "⮙", "⮚" },
  91.    layout = { layouts[2], layouts[2], layouts[2]
  92.  }}
  93.  for s = 1, screen.count() do
  94.      -- Each screen has its own tag table.
  95.      tags[s] = awful.tag(tags.names, s, tags.layout)
  96.  end
  97.  -- }}}
  98.  
  99. --set the layout
  100. --awful.layout.set(daze.layout.tile, tags[1][5])
  101. --set master window width in percentage
  102. --awful.tag.setmwfact(0.7, tags[1][5])
  103. --set number of column windows
  104. --awful.tag.setncol(1, tags[1][5])
  105.  
  106. -- {{{ Menu
  107. -- Create a laucher widget and a main menu
  108. myawesomemenu = {
  109.    { "manual", terminal .. " -e man awesome" },
  110.    { "edit config", editor_cmd .. " " .. awesome.conffile },
  111.    { "restart", awesome.restart },
  112.    { "quit", awesome.quit }
  113. }
  114.  
  115. mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu},
  116.                                     { "open terminal", terminal }
  117. }
  118.                         })
  119.  
  120. mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
  121.                                      menu = mymainmenu })
  122.  
  123. -- Menubar configuration
  124. menubar.utils.terminal = terminal -- Set the terminal for applications that require it
  125. -- }}}
  126.  
  127. -- {{{ Wibox
  128. --  Network usage widget
  129. -- Initialize widget, use widget({ type = "textbox" }) for awesome < 3.5
  130. netwidget = wibox.widget.textbox()
  131. -- Register widget
  132. vicious.register(netwidget, vicious.widgets.net, '<span color="#CC9393">${eth0 down_kb}</span> <span color="#7F9F7F">${eth0 up_kb}</span>', 3)
  133.  
  134. -- Initialize widget
  135. memwidget = wibox.widget.textbox()
  136. -- Register widget
  137. vicious.register(memwidget, vicious.widgets.mem, "⮡ $1% ", 13)
  138.  
  139. -- Initialize widget
  140. clockicon = wibox.widget.textbox()
  141. clockicon:set_text("⮖ ")
  142. verticalbar = wibox.widget.textbox()
  143. verticalbar:set_text(" ")
  144. void = wibox.widget.textbox()
  145. void:set_text(" ")
  146. -- Register widget
  147. -- vicious.register(clockicon, "⮖", 13)
  148.  
  149. -- Initialize widget
  150. cpuwidget = wibox.widget.textbox()
  151. -- Register widget
  152. vicious.register(cpuwidget, vicious.widgets.cpu, " ⮦ $1%  ")
  153.  
  154. -- Create a textclock widget
  155. mytextclock = awful.widget.textclock()
  156.  
  157.  
  158.  
  159. -- Create a wibox for each screen and add it
  160.  
  161. mywibox = {}
  162. mypromptbox = {}
  163. mylayoutbox = {}
  164. mytaglist = {}
  165. mytaglist.buttons = awful.util.table.join(
  166.                     awful.button({ }, 1, awful.tag.viewonly),
  167.                     awful.button({ modkey }, 1, awful.client.movetotag),
  168.                     awful.button({ }, 3, awful.tag.viewtoggle),
  169.                     awful.button({ modkey }, 3, awful.client.toggletag),
  170.                     awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
  171.                     awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
  172.                     )
  173. mytasklist = {}
  174. mytasklist.buttons = awful.util.table.join(
  175.                      awful.button({ }, 1, function (c)
  176.                                               if c == client.focus then
  177.                                                   c.minimized = true
  178.                                               else
  179.                                                   -- Without this, the following
  180.                                                   -- :isvisible() makes no sense
  181.                                                   c.minimized = false
  182.                                                   if not c:isvisible() then
  183.                                                       awful.tag.viewonly(c:tags()[1])
  184.                                                   end
  185.                                                   -- This will also un-minimize
  186.                                                   -- the client, if needed
  187.                                                   client.focus = c
  188.                                                   c:raise()
  189.                                               end
  190.                                           end),
  191.                      awful.button({ }, 3, function ()
  192.                                               if instance then
  193.                                                   instance:hide()
  194.                                                   instance = nil
  195.                                               else
  196.                                                   instance = awful.menu.clients({ width=250 })
  197.                                               end
  198.                                           end),
  199.                      awful.button({ }, 4, function ()
  200.                                               awful.client.focus.byidx(1)
  201.                                               if client.focus then client.focus:raise() end
  202.                                           end),
  203.                      awful.button({ }, 5, function ()
  204.                                               awful.client.focus.byidx(-1)
  205.                                               if client.focus then client.focus:raise() end
  206.                                           end))
  207.  
  208. for s = 1, screen.count() do
  209.     -- Create a promptbox for each screen
  210.     mypromptbox[s] = awful.widget.prompt()
  211.     -- Create an imagebox widget which will contains an icon indicating which layout we're using.
  212.     -- We need one layoutbox per screen.
  213.     mylayoutbox[s] = awful.widget.layoutbox(s)
  214.     mylayoutbox[s]:buttons(awful.util.table.join(
  215.                            awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
  216.                            awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
  217.                            awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
  218.                            awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
  219.     -- Create a taglist widget
  220.     mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
  221.  
  222.     -- Create a tasklist widget
  223.     mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
  224.  
  225.     -- Create the wibox
  226.     mywibox[s] = awful.wibox({ position = "top", screen = s, height= "16" })
  227.  
  228.     -- Widgets that are aligned to the left
  229.     local left_layout = wibox.layout.fixed.horizontal()
  230.     left_layout:add(void)
  231.     -- left_layout:add(mylauncher)
  232.     left_layout:add(mytaglist[s])
  233.     left_layout:add(verticalbar)
  234.     left_layout:add(mypromptbox[s])
  235.  
  236.     -- Widgets that are aligned to the right
  237.     local right_layout = wibox.layout.fixed.horizontal()
  238.     if s == 1 then right_layout:add(wibox.widget.systray()) end
  239.     right_layout:add(cpuwidget)
  240.     right_layout:add(memwidget)
  241.     right_layout:add(mytextclock)
  242.     right_layout:add(clockicon)
  243.     -- right_layout:add(mylayoutbox[s])
  244.     right_layout:add(void)
  245.     -- Now bring it all together (with the tasklist in the middle)
  246.     local layout = wibox.layout.align.horizontal()
  247.     layout:set_left(left_layout)
  248.     layout:set_middle(mytasklist[s])
  249.     layout:set_right(right_layout)
  250.  
  251.     mywibox[s]:set_widget(layout)
  252. end
  253. -- }}}
  254.  
  255. -- {{{ Mouse bindings
  256. root.buttons(awful.util.table.join(
  257.     awful.button({ }, 3, function () mymainmenu:toggle() end),
  258.     awful.button({ }, 4, awful.tag.viewnext),
  259.     awful.button({ }, 5, awful.tag.viewprev)
  260. ))
  261. -- }}}
  262.  
  263. -- {{{ Key bindings
  264. globalkeys = awful.util.table.join(
  265.     awful.key({ modkey, "Shift"   }, "Left",   awful.tag.viewprev       ),
  266.     awful.key({ modkey, "Shift"   }, "Right",  awful.tag.viewnext       ),
  267.     awful.key({ modkey,           }, "Escape", awful.tag.history.restore),
  268.     --awful.key({ modkey,           }, "i", function () run_or_raise("urxvt -name irssi -geometry 90x40 -e irssi", { instance = "irssi" }) end),
  269.     --awful.key({ modkey,           }, "n", function () run_or_raise("urxvt -name ncmpcpp -geometry 90x15 -e ncmpcpp", { instance = "ncmpcpp" }) end),
  270.    awful.key({ modkey }, "Next",  function () awful.client.moveresize( 0,  0, -40, -40) end),
  271.    awful.key({ modkey }, "Prior", function () awful.client.moveresize( 0, 0,  40,  40) end),
  272.    awful.key({ modkey }, "2", function () awful.client.moveresize( 0, 0,  40,  0) end),
  273.    awful.key({ modkey }, "Down",  function () awful.client.moveresize(  0,  20,   0,   0) end),
  274.    awful.key({ modkey }, "Up",    function () awful.client.moveresize(  0, -20,   0,   0) end),
  275.    awful.key({ modkey }, "Left",  function () awful.client.moveresize(-20,   0,   0,   0) end),
  276.    awful.key({ modkey }, "Right", function () awful.client.moveresize( 20,   0,   0,   0) end),
  277.  
  278.    awful.key({ modkey, "Control" }, "Next",  function () awful.client.moveresize( 0,  0, -1, -1) end),
  279.    awful.key({ modkey, "Control" }, "Prior", function () awful.client.moveresize( 0, 0,  1,  1) end),
  280.    awful.key({ modkey, "Control" }, "Down",  function () awful.client.moveresize(  0,  1,   0,   0) end),
  281.    awful.key({ modkey, "Control" }, "Up",    function () awful.client.moveresize(  0, -1,   0,   0) end),
  282.    awful.key({ modkey, "Control" }, "Left",  function () awful.client.moveresize(-1,   0,   0,   0) end),
  283.    awful.key({ modkey, "Control" }, "Right", function () awful.client.moveresize( 1,   0,   0,   0) end),
  284.  
  285.     awful.key({ modkey,           }, "j",
  286.         function ()
  287.             awful.client.focus.byidx( 1)
  288.             if client.focus then client.focus:raise() end
  289.         end),
  290.     awful.key({ modkey,           }, "k",
  291.         function ()
  292.             awful.client.focus.byidx(-1)
  293.             if client.focus then client.focus:raise() end
  294.         end),
  295.     awful.key({ modkey,           }, "w", function () mymainmenu:show() end),
  296.  
  297.     -- Layout manipulation
  298.     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
  299.     awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
  300.     awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
  301.     awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
  302.     awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
  303.     awful.key({ modkey,           }, "Tab",
  304.         function ()
  305.             awful.client.focus.history.previous()
  306.             if client.focus then
  307.                 client.focus:raise()
  308.             end
  309.         end),
  310.  
  311.     -- Standard program
  312.     awful.key({ modkey,           }, "Return", function () awful.util.spawn(terminal) end),
  313.     awful.key({ modkey, "Control" }, "r", awesome.restart),
  314.     awful.key({ modkey, "Shift"   }, "q", awesome.quit),
  315.  
  316.     awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
  317.     awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
  318.     awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
  319.     awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
  320.     awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
  321.     awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
  322.     awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
  323.     awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),
  324.  
  325.     awful.key({ modkey, "Control" }, "n", awful.client.restore),
  326.  
  327.     -- Prompt
  328.     awful.key({ modkey },            "r",     function () mypromptbox[mouse.screen]:run() end),
  329.  
  330.     awful.key({ modkey }, "x",
  331.               function ()
  332.                   awful.prompt.run({ prompt = "Run Lua code: " },
  333.                   mypromptbox[mouse.screen].widget,
  334.                   awful.util.eval, nil,
  335.                   awful.util.getdir("cache") .. "/history_eval")
  336.               end),
  337.     -- Menubar
  338.     awful.key({ modkey }, "p", function() menubar.show() end)
  339. )
  340.  
  341. clientkeys = awful.util.table.join(
  342.     awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
  343.     awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end),
  344.     awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
  345.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  346.     awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
  347.     awful.key({ modkey,           }, "t",      function (c) c.ontop = not c.ontop            end),
  348.     awful.key({ modkey,           }, "n",
  349.         function (c)
  350.             -- The client currently has the input focus, so it cannot be
  351.             -- minimized, since minimized clients can't have the focus.
  352.             c.minimized = true
  353.         end),
  354.     awful.key({ modkey,           }, "m",
  355.         function (c)
  356.             c.maximized_horizontal = not c.maximized_horizontal
  357.             c.maximized_vertical   = not c.maximized_vertical
  358.         end)
  359. )
  360.  
  361. -- Bind all key numbers to tags.
  362. -- Be careful: we use keycodes to make it works on any keyboard layout.
  363. -- This should map on the top row of your keyboard, usually 1 to 9.
  364. for i = 1, 9 do
  365.     globalkeys = awful.util.table.join(globalkeys,
  366.         awful.key({ modkey }, "#" .. i + 9,
  367.                   function ()
  368.                         local screen = mouse.screen
  369.                         local tag = awful.tag.gettags(screen)[i]
  370.                         if tag then
  371.                            awful.tag.viewonly(tag)
  372.                         end
  373.                   end),
  374.         awful.key({ modkey, "Control" }, "#" .. i + 9,
  375.                   function ()
  376.                       local screen = mouse.screen
  377.                       local tag = awful.tag.gettags(screen)[i]
  378.                       if tag then
  379.                          awful.tag.viewtoggle(tag)
  380.                       end
  381.                   end),
  382.         awful.key({ modkey, "Shift" }, "#" .. i + 9,
  383.                   function ()
  384.                       local tag = awful.tag.gettags(client.focus.screen)[i]
  385.                       if client.focus and tag then
  386.                           awful.client.movetotag(tag)
  387.                      end
  388.                   end),
  389.         awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  390.                   function ()
  391.                       local tag = awful.tag.gettags(client.focus.screen)[i]
  392.                       if client.focus and tag then
  393.                           awful.client.toggletag(tag)
  394.                       end
  395.                   end))
  396. end
  397.  
  398. clientbuttons = awful.util.table.join(
  399.     awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  400.     awful.button({ modkey }, 1, awful.mouse.client.move),
  401.     awful.button({ modkey }, 3, awful.mouse.client.resize))
  402.  
  403. -- load the 'run or raise' function
  404. local ror = require("aweror")
  405.  
  406. -- generate and add the 'run or raise' key bindings to the globalkeys table
  407. globalkeys = awful.util.table.join(globalkeys, ror.genkeys(modkey))
  408.  
  409. root.keys(globalkeys)
  410.  
  411. -- Set keys
  412. root.keys(globalkeys)
  413. -- }}}
  414.  
  415. -- {{{ Rules
  416. awful.rules.rules = {
  417.     -- All clients willg match this rule.
  418.     { rule = { },
  419.       properties = { border_width = beautiful.border_width,
  420.                      border_color = beautiful.border_normal,
  421.                      focus = awful.client.focus.filter,
  422.                      keys = clientkeys,
  423.                      buttons = clientbuttons } },
  424.   --{ rule = { class = "mplayer2" },
  425.       --properties = { tag = tags[1][2], floating = true, switchtotag = true, x = 121, y = 42, width = 1036} },
  426.     { rule = { class = "mplayer2" },
  427.       properties = { tag = tags[1][2], floating = true, switchtotag = true },
  428.       callback = function(c) c:geometry({x=121, y=42, width=1036}) end },
  429.     { rule = { class = "pinentry" },
  430.       properties = { floating = true } },
  431.     { rule_any = { name = {"Options for Menu Editor", "Firefox Preferences", "Page Info", "Tab Mix Plus Options", "Library"} },
  432.       properties = { floating = true },
  433.       callback = awful.placement.centered },
  434.     { rule = { class = "gimp" },
  435.       properties = { tag = tags[1][3], floating = true, switchtotag = true } },
  436.     { rule = { name = "win*" },
  437.       properties = { border_width = 0 } },
  438.  --   { rule = { name = "gedit" },
  439. --      properties = { border_width = 0 } },
  440.   { rule = { instance = "irssi" },
  441.       properties = { floating = true, switchtotag = true, x = 820, y = 183, callback = function(c) c:tags({tags[1][1], tags[1][2]}) end} },
  442.   { rule = { instance = "ncmpcpp" },
  443.       properties = { floating = true, switchtotag = true, x = 820, y = 500, callback = function(c) c:tags({tags[1][1], tags[1][2]}) end} },
  444.   { rule = { instance = "term" },
  445.       properties = { floating = true, switchtotag = true, x = 820, y = 616, callback = function(c) c:tags({tags[1][1], tags[1][2]}) end} },
  446.   { rule = { instance = "ranger" },
  447.       properties = { floating = true, switchtotag = true, x = 820, y = 27, callback = function(c) c:tags({tags[1][1], tags[1][2]}) end} },
  448.   { rule = { class = "Firefox" },
  449.       properties = { tag = tags[1][1], floating = true, switchtotag = true, x = 10, y = 27, height = 763, width = 800} },
  450.   { rule = { class = "Google-chrome" },
  451.       properties = { tag = tags[1][1], floating = true, switchtotag = true, x = 10, y = 27, height = 763, width = 800} },
  452.   { rule = { class = "OpenOffice.org 3.4" },
  453.       properties = { tag = tags[1][1], floating = true, switchtotag = true, x = 10, y = 27, height = 763, width = 800} },  
  454. { rule = { class = "Chromium" },
  455.       properties = { tag = tags[1][1], floating = true, switchtotag = true, x = 121, y = 42, height = 1004, width = 1036} },
  456.   { rule = { class = "libreoffice-writer" },
  457.       properties = { tag = tags[1][1], floating = true, switchtotag = true, x = 121, y = 42, height = 1004, width = 1036} },
  458.   { rule = { class = "MComix" },
  459.       properties = { tag = tags[1][1], floating = true, switchtotag = true, x = 121, y = 42, height = 1004, width = 1036} },
  460.   { rule = { class = "Pynorama" },
  461.       properties = { tag = tags[1][1], floating = true, switchtotag = true, x = 121, y = 42, height = 1004, width = 1036} },
  462.  
  463.     -- Set Firefox to always map on tags number 2 of screen 1.
  464.     -- { rule = { class = "Firefox" },
  465.     --   properties = { tag = tags[1][2] } },
  466. }
  467. -- }}}
  468.  
  469. -- {{{ Signals
  470. -- Signal function to execute when a new client appears.
  471. client.connect_signal("manage", function (c, startup)
  472.     -- Enable sloppy focus
  473.     c:connect_signal("mouse::enter", function(c)
  474.         if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  475.             and awful.client.focus.filter(c) then
  476.             client.focus = c
  477.         end
  478.     end)
  479.  
  480.     if not startup then
  481.         -- Set the windows at the slave,
  482.         -- i.e. put it at the end of others instead of setting it master.
  483.         -- awful.client.setslave(c)
  484.  
  485.         -- Put windows in a smart way, only if they does not set an initial position.
  486.         if not c.size_hints.user_position and not c.size_hints.program_position then
  487.             awful.placement.no_overlap(c)
  488.             awful.placement.no_offscreen(c)
  489.         end
  490.     end
  491.  
  492.     local titlebars_enabled = false
  493.     if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
  494.         -- buttons for the titlebar
  495.         local buttons = awful.util.table.join(
  496.                 awful.button({ }, 1, function()
  497.                     client.focus = c
  498.                     c:raise()
  499.                     awful.mouse.client.move(c)
  500.                 end),
  501.                 awful.button({ }, 3, function()
  502.                     client.focus = c
  503.                     c:raise()
  504.                     awful.mouse.client.resize(c)
  505.                 end)
  506.                 )
  507.  
  508.         -- Widgets that are aligned to the left
  509.         local left_layout = wibox.layout.fixed.horizontal()
  510.         left_layout:add(awful.titlebar.widget.iconwidget(c))
  511.         left_layout:buttons(buttons)
  512.  
  513.         -- Widgets that are aligned to the right
  514.         local right_layout = wibox.layout.fixed.horizontal()
  515.         right_layout:add(awful.titlebar.widget.floatingbutton(c))
  516.         right_layout:add(awful.titlebar.widget.maximizedbutton(c))
  517.         right_layout:add(awful.titlebar.widget.stickybutton(c))
  518.         right_layout:add(awful.titlebar.widget.ontopbutton(c))
  519.         right_layout:add(awful.titlebar.widget.closebutton(c))
  520.  
  521.         -- The title goes in the middle
  522.         local middle_layout = wibox.layout.flex.horizontal()
  523.         local title = awful.titlebar.widget.titlewidget(c)
  524.         title:set_align("center")
  525.         middle_layout:add(title)
  526.         middle_layout:buttons(buttons)
  527.  
  528.         -- Now bring it all together
  529.         local layout = wibox.layout.align.horizontal()
  530.         layout:set_left(left_layout)
  531.         layout:set_right(right_layout)
  532.         layout:set_middle(middle_layout)   
  533.  
  534.         awful.titlebar(c):set_widget(layout)
  535.     end
  536. end)
  537.  
  538. --client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  539. --client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  540.  
  541. --run_or_raise("urxvt -name irssi -geometry 90x32 -e irssi",  { instance = "irssi" })
  542. --run_or_raise("urxvt -name ncmpcpp -geometry 90x10 -e ncmpcpp", { instance = "ncmpcpp" })
  543. --run_or_raise("urxvt -name ranger -geometry 90x12 -e ranger", { instance = "ranger" })
  544. --run_or_raise("urxvt -name term3 -geometry 90x21", { instance = "term3" })
  545. --run_or_raise("firefox",  { instance = "Firefox" })
  546.  
  547.  
  548.  
  549. client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  550. client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  551. -- }}}
Advertisement
Add Comment
Please, Sign In to add comment