bssanchez93

[Awesome WM] rc.lua

Apr 4th, 2015
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 23.28 KB | None | 0 0
  1. -- {{{ Required libraries
  2. local gears     = require("gears")
  3. local awful     = require("awful")
  4. awful.rules     = require("awful.rules")
  5. require("awful.autofocus")
  6. local wibox     = require("wibox")
  7. local beautiful = require("beautiful")
  8. local naughty   = require("naughty")
  9. local drop      = require("scratch.drop")
  10. local lain      = require("lain")
  11. -- }}}
  12.  
  13.  
  14. -- {{{ Error handling
  15. -- Check if awesome encountered an error during startup and fell back to
  16. -- another config (This code will only ever execute for the fallback config)
  17. if awesome.startup_errors then
  18.     naughty.notify({ preset = naughty.config.presets.critical,
  19.                      title = "Oops, hubo un error durante el inicio!",
  20.                      text = awesome.startup_errors })
  21. end
  22.  
  23. -- Handle runtime errors after startup
  24. do
  25.     local in_error = false
  26.     awesome.connect_signal("debug::error", function (err)
  27.         -- Make sure we don't go into an endless error loop
  28.         if in_error then return end
  29.         in_error = true
  30.  
  31.         naughty.notify({ preset = naughty.config.presets.critical,
  32.                          title = "Oops, un error ocurrido!",
  33.                          text = err })
  34.         in_error = false
  35.     end)
  36. end
  37. -- }}}
  38.  
  39. -- {{{ Autostart applications
  40. function run_once(cmd)
  41.   findme = cmd
  42.   firstspace = cmd:find(" ")
  43.   if firstspace then
  44.      findme = cmd:sub(0, firstspace-1)
  45.   end
  46.   awful.util.spawn_with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. cmd .. ")")
  47. end
  48.  
  49. awful.util.spawn_with_shell("caffeine")
  50. run_once("urxvtd")
  51. run_once("unclutter")
  52. run_once("compton")
  53. -- }}}
  54.  
  55. -- {{{ Variable definitions
  56. -- Themes define colours, icons, font and wallpapers.
  57.  
  58. -- Home path
  59. homedir = os.getenv("HOME") .. "/.config/awesome/"
  60.  
  61. -- Iniciar tema
  62. confdir = homedir .. "themes/darkgrey/"
  63. beautiful.init(confdir .. "theme.lua")
  64.  
  65. -- teclas de mod y terminal
  66. modkey      = "Mod4"
  67. altkey      = "Mod1"
  68. terminal    = "urxvtc"
  69. editor      = os.getenv("EDITOR") or "vim"
  70. editor_cmd  = terminal .. " -e " .. editor
  71.  
  72. -- aplicaciones predeterminadas
  73.  
  74. browser     = "firefox"
  75. browser2    = "chromium"
  76. gui_editor  = "leafpad"
  77. graphics    = "gimp"
  78.  
  79. -- Table of layouts to cover with awful.layout.inc, order matters.
  80. local layouts =
  81. {
  82.     awful.layout.suit.floating,
  83.     lain.layout.uselesstile,
  84. --    awful.layout.suit.tile,
  85. --    awful.layout.suit.tile.left,
  86. --    awful.layout.suit.tile.bottom,
  87.     awful.layout.suit.tile.top,
  88.     awful.layout.suit.fair,
  89.     awful.layout.suit.fair.horizontal,
  90.     lain.layout.uselesstile.left,
  91.     lain.layout.uselesstile.top
  92. --    awful.layout.suit.spiral,
  93. --    awful.layout.suit.spiral.dwindle,
  94. --    awful.layout.suit.max,
  95. --    awful.layout.suit.max.fullscreen,
  96. --    awful.layout.suit.magnifier
  97. }
  98. -- }}}
  99.  
  100. -- {{{ Wallpaper
  101. if beautiful.wallpaper then
  102.     for s = 1, screen.count() do
  103.         gears.wallpaper.maximized(beautiful.wallpaper, s, true)
  104.     end
  105. end
  106. -- }}}
  107.  
  108. -- {{{ Tags
  109. -- Define a tag table which hold all screen tags.
  110. tags = {
  111.     names = { "一", "二", "三", "四", "五" },
  112.     layout = { layouts[1], layouts[1], layouts[1], layouts[4], layouts[1], layouts[1] }
  113. }
  114. for s = 1, screen.count() do
  115.     -- Each screen has its own tag table.
  116.     --tags[s] = awful.tag({ "_web", "_irc", "_moc", "_dev", "/b/", "_pr0n" }, s, layouts[1])
  117.     tags[s] = awful.tag(tags.names, s, tags.layout)
  118. end
  119. -- }}}
  120.  
  121. -- {{{ Menu
  122. -- Create a laucher widget and a main menu
  123. --require("freedesktop/freedesktop")
  124.  
  125. myawesomemenu = {
  126.    { "manual", terminal .. " -e man awesome" },
  127.    { "edit config", editor_cmd .. " " .. awesome.conffile },
  128.    { "restart", awesome.restart },
  129.    { "quit", awesome.quit }
  130. }
  131.  
  132. mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
  133.                                     { "open terminal", terminal }
  134.                                   }
  135.                         })
  136.  
  137. mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
  138.                                      menu = mymainmenu })
  139.  
  140. -- Menubar configuration
  141. --menubar.utils.terminal = terminal -- Set the terminal for applications that require it
  142. -- }}}
  143.  
  144. -- {{{ Wibox
  145. markup = lain.util.markup
  146. white  = beautiful.fg_focus
  147. gray   = "#858585"
  148.  
  149. -- Textclock
  150. mytextclock = awful.widget.textclock(markup(gray, "%a")
  151. .. markup(white, " %d ") .. markup(gray, "%b ") ..  markup(white, "%H:%M "))
  152.  
  153. -- Calendar
  154. lain.widgets.calendar:attach(mytextclock, { fg = white })
  155.  
  156. -- Battery
  157. batwidget = lain.widgets.bat({
  158.     settings = function()
  159.         bat_header = " Bat "
  160.         bat_p      = bat_now.perc .. " % "
  161.  
  162.         if bat_now.status == "Not present" then
  163.             bat_header = ""
  164.             bat_p      = ""
  165.         end
  166.  
  167.         widget:set_markup(markup(gray, bat_header) .. markup(white, bat_p))
  168.     end
  169. })
  170.  
  171. -- ALSA volume
  172. volumewidget = lain.widgets.alsa({
  173.     settings = function()
  174.         header = " Vol "
  175.         vlevel  = volume_now.level
  176.  
  177.         if volume_now.status == "off" then
  178.             vlevel = vlevel .. "M "
  179.         else
  180.             vlevel = vlevel .. " "
  181.         end
  182.  
  183.         widget:set_markup(markup(gray, header) .. markup(white, vlevel))
  184.     end
  185. })
  186.  
  187. -- Weather
  188. yawn = lain.widgets.yawn(123456,
  189. {
  190.     settings = function()
  191.         yawn_notification_preset.fg = white
  192.     end
  193. })
  194.  
  195. -- Separators
  196. first = wibox.widget.textbox('<span font="Tamsyn 4"> </span>')
  197. arrl_pre = wibox.widget.imagebox()
  198. arrl_pre:set_image(beautiful.arrl_lr_pre)
  199. arrl_post = wibox.widget.imagebox()
  200. arrl_post:set_image(beautiful.arrl_lr_post)
  201.  
  202. -- Create a wibox for each screen and add it
  203. mywibox = {}
  204. mypromptbox = {}
  205. mylayoutbox = {}
  206. mytaglist = {}
  207. mytaglist.buttons = awful.util.table.join(
  208.                     awful.button({ }, 1, awful.tag.viewonly),
  209.                     awful.button({ modkey }, 1, awful.client.movetotag),
  210.                     awful.button({ }, 3, awful.tag.viewtoggle),
  211.                     awful.button({ modkey }, 3, awful.client.toggletag),
  212.                     awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
  213.                     awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
  214.                     )
  215. mytasklist = {}
  216. mytasklist.buttons = awful.util.table.join(
  217.                      awful.button({ }, 1, function (c)
  218.                                               if c == client.focus then
  219.                                                   c.minimized = true
  220.                                               else
  221.                                                   -- Without this, the following
  222.                                                   -- :isvisible() makes no sense
  223.                                                   c.minimized = false
  224.                                                   if not c:isvisible() then
  225.                                                       awful.tag.viewonly(c:tags()[1])
  226.                                                   end
  227.                                                   -- This will also un-minimize
  228.                                                   -- the client, if needed
  229.                                                   client.focus = c
  230.                                                   c:raise()
  231.                                               end
  232.                                           end),
  233.                      awful.button({ }, 3, function ()
  234.                                               if instance then
  235.                                                   instance:hide()
  236.                                                   instance = nil
  237.                                               else
  238.                                                   instance = awful.menu.clients({
  239.                                                       theme = { width = 250 }
  240.                                                   })
  241.                                               end
  242.                                           end),
  243.                      awful.button({ }, 4, function ()
  244.                                               awful.client.focus.byidx(1)
  245.                                               if client.focus then client.focus:raise() end
  246.                                           end),
  247.                      awful.button({ }, 5, function ()
  248.                                               awful.client.focus.byidx(-1)
  249.                                               if client.focus then client.focus:raise() end
  250.                                           end))
  251.  
  252. for s = 1, screen.count() do
  253.     -- Create a promptbox for each screen
  254.     mypromptbox[s] = awful.widget.prompt()
  255.     -- Create an imagebox widget which will contains an icon indicating which layout we're using.
  256.     -- We need one layoutbox per screen.
  257.     mylayoutbox[s] = awful.widget.layoutbox(s)
  258.     mylayoutbox[s]:buttons(awful.util.table.join(
  259.                            awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
  260.                            awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
  261.                            awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
  262.                            awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
  263.     -- Create a taglist widget
  264.     mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
  265.  
  266.     -- Create a tasklist widget
  267.     mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
  268.  
  269.     -- Create the wibox
  270.     mywibox[s] = awful.wibox({ position = "top", screen = s, height = 18 })
  271.  
  272.     -- Widgets that are aligned to the left
  273.     local left_layout = wibox.layout.fixed.horizontal()
  274.     left_layout:add(first)
  275.     left_layout:add(mylauncher)
  276.     left_layout:add(arrl_pre)
  277.     left_layout:add(arrl_post)
  278.     left_layout:add(first)
  279.     left_layout:add(mytaglist[s])
  280.     left_layout:add(arrl_pre)
  281.     left_layout:add(mylayoutbox[s])
  282.     left_layout:add(arrl_post)
  283.     left_layout:add(mypromptbox[s])
  284.     left_layout:add(first)    
  285.  
  286.     -- Widgets that are aligned to the right
  287.     local right_layout = wibox.layout.fixed.horizontal()
  288.     if s == 1 then right_layout:add(wibox.widget.systray()) end
  289.     left_layout:add(first)
  290.     right_layout:add(batwidget)
  291.     right_layout:add(volumewidget)
  292.     right_layout:add(mytextclock)
  293.     --right_layout:add(mylayoutbox[s])
  294.  
  295.     -- Now bring it all together (with the tasklist in the middle)
  296.     local layout = wibox.layout.align.horizontal()
  297.     layout:set_left(left_layout)
  298.     layout:set_middle(mytasklist[s])
  299.     layout:set_right(right_layout)
  300.  
  301.     mywibox[s]:set_widget(layout)
  302. end
  303. -- }}}
  304.  
  305. -- {{{ Mouse bindings
  306. root.buttons(awful.util.table.join(
  307.     awful.button({ }, 3, function () mymainmenu:toggle() end),
  308.     awful.button({ }, 4, awful.tag.viewnext),
  309.     awful.button({ }, 5, awful.tag.viewprev)
  310. ))
  311. -- }}}
  312.  
  313. -- {{{ Key bindings
  314. globalkeys = awful.util.table.join(
  315.     awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
  316.     awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
  317.     awful.key({ modkey,           }, "Escape", awful.tag.history.restore),
  318.  
  319.     -- Non-empty tag browsing
  320.     awful.key({ altkey }, "Left", function () lain.util.tag_view_nonempty(-1) end),
  321.     awful.key({ altkey }, "Right", function () lain.util.tag_view_nonempty(1) end),
  322.  
  323.     -- Dynamic tag renaming
  324.     awful.key({ altkey, "Shift" }, "r",
  325.         function ()
  326.             lain.util.prompt_rename_tag(mypromptbox)
  327.         end ),
  328.  
  329.     -- Default client focus
  330.     awful.key({ altkey }, "k",
  331.         function ()
  332.             awful.client.focus.byidx( 1)
  333.             if client.focus then client.focus:raise() end
  334.         end),
  335.     awful.key({ altkey }, "j",
  336.         function ()
  337.             awful.client.focus.byidx(-1)
  338.             if client.focus then client.focus:raise() end
  339.         end),
  340.  
  341.     awful.key({ modkey,           }, "j",
  342.         function ()
  343.             awful.client.focus.byidx( 1)
  344.             if client.focus then client.focus:raise() end
  345.         end),
  346.     awful.key({ modkey,           }, "k",
  347.         function ()
  348.             awful.client.focus.byidx(-1)
  349.             if client.focus then client.focus:raise() end
  350.         end),
  351.     awful.key({ modkey,           }, "w", function () mymainmenu:show() end),
  352.  
  353.     -- Layout manipulation
  354.     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
  355.     awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
  356.     awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
  357.     awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
  358.     awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
  359.     awful.key({ modkey,           }, "Tab",
  360.         function ()
  361.             awful.client.focus.history.previous()
  362.             if client.focus then
  363.                 client.focus:raise()
  364.             end
  365.         end),
  366.  
  367.     -- Standard program
  368.     awful.key({ modkey,           }, "Return", function () awful.util.spawn(terminal) end),
  369.     awful.key({ modkey,           }, "BackSpace", function () awful.util.spawn('thunar') end),
  370.     awful.key({ modkey, "Control" }, "r", awesome.restart),
  371.     awful.key({ modkey, "Shift"   }, "q", awesome.quit),
  372.  
  373.     -- Dropdown terminal
  374.     awful.key({ modkey,           }, "z",      function () drop(terminal) end),
  375.  
  376.     -- Widgets popups
  377.     awful.key({ altkey,           }, "c",      function () lain.widgets.calendar:show(7) end),
  378.     --awful.key({ altkey,           }, "h",      function () fshome.show(7) end),
  379.     awful.key({ altkey,           }, "w",      function () yawn.show(7) end),
  380.  
  381.     -- ALSA volume control
  382.     awful.key({ altkey }, "Up",
  383.         function ()
  384.             awful.util.spawn("amixer -q set Master 1%+")
  385.             volumewidget.update()
  386.         end),
  387.     awful.key({ altkey }, "Down",
  388.         function ()
  389.             awful.util.spawn("amixer -q set Master 1%-")
  390.             volumewidget.update()
  391.         end),
  392.     awful.key({ altkey }, "m",
  393.         function ()
  394.             awful.util.spawn("amixer -q set Master playback toggle")
  395.             volumewidget.update()
  396.         end),
  397.     awful.key({ altkey, "Control" }, "m",
  398.         function ()
  399.             awful.util.spawn("amixer -q set Master playback 100%")
  400.             volumewidget.update()
  401.         end),
  402.    
  403.     -- Copy to clipboard
  404.     awful.key({ modkey }, "c", function () os.execute("xsel -p -o | xsel -i -b") end),    
  405.  
  406.     awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
  407.     awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
  408.     awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
  409.     awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
  410.     awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
  411.     awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
  412.     awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
  413.     awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),
  414.  
  415.     awful.key({ modkey, "Control" }, "n", awful.client.restore),
  416.  
  417.     -- Prompt
  418.     awful.key({ modkey },            "r",     function () mypromptbox[mouse.screen]:run() end),
  419.  
  420.     awful.key({ modkey }, "x",
  421.               function ()
  422.                   awful.prompt.run({ prompt = "Run Lua code: " },
  423.                   mypromptbox[mouse.screen].widget,
  424.                   awful.util.eval, nil,
  425.                   awful.util.getdir("cache") .. "/history_eval")
  426.               end),
  427.     -- Menubar
  428.     awful.key({ modkey }, "p", function() menubar.show() end)
  429. )
  430.  
  431. clientkeys = awful.util.table.join(
  432.     awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
  433.     awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end),
  434.     awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
  435.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  436.     awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
  437.     awful.key({ modkey,           }, "t",      function (c) c.ontop = not c.ontop            end),
  438.     awful.key({ modkey,           }, "n",
  439.         function (c)
  440.             -- The client currently has the input focus, so it cannot be
  441.             -- minimized, since minimized clients can't have the focus.
  442.             c.minimized = true
  443.         end),
  444.     awful.key({ modkey,           }, "m",
  445.         function (c)
  446.             c.maximized_horizontal = not c.maximized_horizontal
  447.             c.maximized_vertical   = not c.maximized_vertical
  448.         end)
  449. )
  450.  
  451. -- Bind all key numbers to tags.
  452. -- Be careful: we use keycodes to make it works on any keyboard layout.
  453. -- This should map on the top row of your keyboard, usually 1 to 9.
  454. for i = 1, 9 do
  455.     globalkeys = awful.util.table.join(globalkeys,
  456.         -- View tag only.
  457.         awful.key({ modkey }, "#" .. i + 9,
  458.                   function ()
  459.                         local screen = mouse.screen
  460.                         local tag = awful.tag.gettags(screen)[i]
  461.                         if tag then
  462.                            awful.tag.viewonly(tag)
  463.                         end
  464.                   end),
  465.         -- Toggle tag.
  466.         awful.key({ modkey, "Control" }, "#" .. i + 9,
  467.                   function ()
  468.                       local screen = mouse.screen
  469.                       local tag = awful.tag.gettags(screen)[i]
  470.                       if tag then
  471.                          awful.tag.viewtoggle(tag)
  472.                       end
  473.                   end),
  474.         -- Move client to tag.
  475.         awful.key({ modkey, "Shift" }, "#" .. i + 9,
  476.                   function ()
  477.                       if client.focus then
  478.                           local tag = awful.tag.gettags(client.focus.screen)[i]
  479.                           if tag then
  480.                               awful.client.movetotag(tag)
  481.                           end
  482.                      end
  483.                   end),
  484.         -- Toggle tag.
  485.         awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  486.                   function ()
  487.                       if client.focus then
  488.                           local tag = awful.tag.gettags(client.focus.screen)[i]
  489.                           if tag then
  490.                               awful.client.toggletag(tag)
  491.                           end
  492.                       end
  493.                   end))
  494. end
  495.  
  496. clientbuttons = awful.util.table.join(
  497.     awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  498.     awful.button({ modkey }, 1, awful.mouse.client.move),
  499.     awful.button({ modkey }, 3, awful.mouse.client.resize))
  500.  
  501. -- Set keys
  502. root.keys(globalkeys)
  503. -- }}}
  504.  
  505. -- {{{ Rules
  506. -- Rules to apply to new clients (through the "manage" signal).
  507. awful.rules.rules = {
  508.     -- All clients will match this rule.
  509.     { rule = { },
  510.       properties = { border_width = beautiful.border_width,
  511.                      border_color = beautiful.border_normal,
  512.                      focus = awful.client.focus.filter,
  513.                      raise = true,
  514.                      keys = clientkeys,
  515.                      buttons = clientbuttons } },
  516.     { rule = { class = "URxvt" },
  517.           properties = { opacity = 0.99 } },
  518.     { rule = { class = "MPlayer" },
  519.       properties = { floating = true } },
  520.    
  521.     { rule = { instance = "plugin-container" },
  522.           properties = { tag = tags[1][1] } },
  523.  
  524.       --{ rule = { class = "Gimp" },
  525.     --      properties = { tag = tags[1][4] } },
  526.  
  527.     --{ rule = { class = "Gimp", role = "gimp-image-window" },
  528.     --      properties = { maximized_horizontal = true,
  529.     --                     maximized_vertical = true } },
  530.     -- Set Firefox to always map on tags number 2 of screen 1.
  531.     -- { rule = { class = "Firefox" },
  532.     --   properties = { tag = tags[1][2] } },
  533. }
  534. -- }}}
  535.  
  536. -- {{{ Signals
  537. -- Signal function to execute when a new client appears.
  538. client.connect_signal("manage", function (c, startup)
  539.     -- Enable sloppy focus
  540.     c:connect_signal("mouse::click", function(c)
  541.         if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  542.             and awful.client.focus.filter(c) then
  543.             client.focus = c
  544.         end
  545.     end)
  546.  
  547.     if not startup then
  548.         -- Set the windows at the slave,
  549.         -- i.e. put it at the end of others instead of setting it master.
  550.         -- awful.client.setslave(c)
  551.  
  552.         -- Put windows in a smart way, only if they does not set an initial position.
  553.         if not c.size_hints.user_position and not c.size_hints.program_position then
  554.             awful.placement.no_overlap(c)
  555.             awful.placement.no_offscreen(c)
  556.         end
  557.     end
  558.  
  559.     local titlebars_enabled = false
  560.     if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
  561.         -- buttons for the titlebar
  562.         local buttons = awful.util.table.join(
  563.                 awful.button({ }, 1, function()
  564.                     client.focus = c
  565.                     c:raise()
  566.                     awful.mouse.client.move(c)
  567.                 end),
  568.                 awful.button({ }, 3, function()
  569.                     client.focus = c
  570.                     c:raise()
  571.                     awful.mouse.client.resize(c)
  572.                 end)
  573.                 )
  574.  
  575.         -- Widgets that are aligned to the left
  576.         local left_layout = wibox.layout.fixed.horizontal()
  577.         left_layout:add(awful.titlebar.widget.iconwidget(c))
  578.         left_layout:buttons(buttons)
  579.  
  580.         -- Widgets that are aligned to the right
  581.         local right_layout = wibox.layout.fixed.horizontal()
  582.     if s == 1 then right_layout:add(wibox.widget.systray()) end
  583.         right_layout:add(awful.titlebar.widget.floatingbutton(c))
  584.         right_layout:add(awful.titlebar.widget.maximizedbutton(c))
  585.         right_layout:add(awful.titlebar.widget.stickybutton(c))
  586.         right_layout:add(awful.titlebar.widget.ontopbutton(c))
  587.         right_layout:add(awful.titlebar.widget.closebutton(c))
  588.  
  589.         -- The title goes in the middle
  590.         local middle_layout = wibox.layout.flex.horizontal()
  591.         local title = awful.titlebar.widget.titlewidget(c)
  592.         title:set_align("center")
  593.         middle_layout:add(title)
  594.         middle_layout:buttons(buttons)
  595.  
  596.         -- Now bring it all together
  597.         local layout = wibox.layout.align.horizontal()
  598.         layout:set_left(left_layout)
  599.         layout:set_right(right_layout)
  600.         layout:set_middle(middle_layout)
  601.  
  602.         awful.titlebar(c):set_widget(layout)
  603.     end
  604. end)
  605.  
  606. -- No border for maximized clients
  607. --[[ client.connect_signal("click",
  608.     function(c)
  609.         if c.maximized_horizontal == true and c.maximized_vertical == true then
  610.             c.border_width = "0"
  611.             c.border_color = beautiful.border_normal
  612.         else
  613.             c.border_width = beautiful.border_width
  614.             c.border_color = beautiful.border_focus
  615.         end
  616.     end)--]]
  617. client.connect_signal("click", function(c) c.border_color = beautiful.border_focus end)
  618. --client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  619. -- }}}
Advertisement
Add Comment
Please, Sign In to add comment