Advertisement
edps

awesome-rc.lua

Oct 19th, 2015
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 23.97 KB | None | 0 0
  1. -- Standard awesome library
  2. local gears = require("gears")
  3. local awful = require("awful")
  4. awful.rules = require("awful.rules")
  5. require("awful.autofocus")
  6. require("revelation")
  7. require("applicationsmenu")
  8.  
  9. -- Widget and layout library
  10. local wibox = require("wibox")
  11.  
  12. -- Theme handling library
  13. local beautiful = require("beautiful")
  14.  
  15. -- Notification library
  16. local naughty = require("naughty")
  17. local menubar = require("menubar")
  18.  
  19. -- {{{ Error handling
  20. -- Check if awesome encountered an error during startup and fell back to
  21. -- another config (This code will only ever execute for the fallback config)
  22. if awesome.startup_errors then
  23.     naughty.notify({ preset = naughty.config.presets.critical,
  24.                      title = "Oops, there were errors during startup!",
  25.                      text = awesome.startup_errors })
  26. end
  27.  
  28. -- Handle runtime errors after startup
  29. do
  30.     local in_error = false
  31.     awesome.connect_signal("debug::error", function (err)
  32.         -- Make sure we don't go into an endless error loop
  33.         if in_error then return end
  34.         in_error = true
  35.  
  36.         naughty.notify({ preset = naughty.config.presets.critical,
  37.                          title = "Oops, an error happened!",
  38.                          text = err })
  39.         in_error = false
  40.     end)
  41. end
  42. -- }}}
  43.  
  44. -- {{{ Variable definitions
  45. -- Themes define colours, icons, font and wallpapers.
  46. -- beautiful.init("/usr/share/awesome/themes/default/theme.lua")
  47. -- beautiful.init("/usr/share/awesome/themes/sky/theme.lua")
  48. -- beautiful.init("/usr/share/awesome/themes/zenburn/theme.lua")
  49. -- beautiful.init("~/.config/awesome/themes/anon/theme.lua")
  50. -- beautiful.init("~/.config/awesome/themes/arch/theme.lua")
  51. -- beautiful.init("~/.config/awesome/themes/bamboo/theme.lua")
  52. -- beautiful.init("~/.config/awesome/themes/bio/theme.lua")
  53. -- beautiful.init("~/.config/awesome/themes/blackburn/theme.lua")
  54. -- beautiful.init("~/.config/awesome/themes/blue/theme.lua")
  55. -- beautiful.init("~/.config/awesome/themes/blue-black-red/theme.lua")
  56. -- beautiful.init("~/.config/awesome/themes/blue-black-red-2/theme.lua")
  57. -- beautiful.init("~/.config/awesome/themes/brown/theme.lua")
  58. -- beautiful.init("~/.config/awesome/themes/byte/theme.lua")
  59. -- beautiful.init("~/.config/awesome/themes/citrus/theme.lua")
  60. -- beautiful.init("~/.config/awesome/themes/cool-blue/theme.lua")
  61. -- beautiful.init("~/.config/awesome/themes/copland/theme.lua")
  62. -- beautiful.init("~/.config/awesome/themes/crown/theme.lua")
  63. -- beautiful.init("~/.config/awesome/themes/dk-grey/theme.lua")
  64. beautiful.init("~/.config/awesome/themes/dremora/theme.lua")
  65. -- beautiful.init("~/.config/awesome/themes/dunzor/theme.lua")
  66. -- beautiful.init("~/.config/awesome/themes/dunzor2/theme.lua")
  67. -- beautiful.init("~/.config/awesome/themes/dust/theme.lua")
  68. -- beautiful.init("~/.config/awesome/themes/dwm/theme.lua")
  69. -- beautiful.init("~/.config/awesome/themes/elric/theme.lua")
  70. -- beautiful.init("~/.config/awesome/themes/fence/theme.lua")
  71. -- beautiful.init("~/.config/awesome/themes/fluizing/theme.lua")
  72. -- beautiful.init("~/.config/awesome/themes/foo/theme.lua")
  73. -- beautiful.init("~/.config/awesome/themes/gray/theme.lua")
  74. -- beautiful.init("~/.config/awesome/themes/green-owl/theme.lua")
  75. -- beautiful.init("~/.config/awesome/themes/grey/theme.lua")
  76. -- beautiful.init("~/.config/awesome/themes/grey-new/theme.lua")
  77. -- beautiful.init("~/.config/awesome/themes/grey-old/theme.lua")
  78. -- beautiful.init("~/.config/awesome/themes/him/theme.lua")
  79. -- beautiful.init("~/.config/awesome/themes/holo/theme.lua")
  80. -- beautiful.init("~/.config/awesome/themes/lined/theme.lua")
  81. -- beautiful.init("~/.config/awesome/themes/matrix/theme.lua")
  82. -- beautiful.init("~/.config/awesome/themes/multicolor/theme.lua")
  83. -- beautiful.init("~/.config/awesome/themes/muted-dream-tree/theme.lua")
  84. -- beautiful.init("~/.config/awesome/themes/niceandclean/theme.lua")
  85. -- beautiful.init("~/.config/awesome/themes/obscur/theme.lua")
  86. -- beautiful.init("~/.config/awesome/themes/powerarrow-darker/theme.lua")
  87. -- beautiful.init("~/.config/awesome/themes/rainbow/theme.lua")
  88. -- beautiful.init("~/.config/awesome/themes/rbow/theme.lua")
  89. -- beautiful.init("~/.config/awesome/themes/redhalo/theme.lua")
  90. -- beautiful.init("~/.config/awesome/themes/roig/theme.lua")
  91. -- beautiful.init("~/.config/awesome/themes/sky-grey/theme.lua")
  92. -- beautiful.init("~/.config/awesome/themes/smoked/theme.lua")
  93. -- beautiful.init("~/.config/awesome/themes/snow/theme.lua")
  94. -- beautiful.init("~/.config/awesome/themes/spectrum/theme.lua")
  95. -- beautiful.init("~/.config/awesome/themes/steamburn/theme.lua")
  96. -- beautiful.init("~/.config/awesome/themes/strict/theme.lua")
  97. -- beautiful.init("~/.config/awesome/themes/sunjack/theme.lua")
  98. -- beautiful.init("~/.config/awesome/themes/tree/theme.lua")
  99. -- beautiful.init("~/.config/awesome/themes/vinyl/theme.lua")
  100. -- beautiful.init("~/.config/awesome/themes/wabbit/theme.lua")
  101. -- beautiful.init("~/.config/awesome/themes/wmii/theme.lua")
  102. -- beautiful.init("~/.config/awesome/themes/wombat/theme.lua")
  103. -- beautiful.init("~/.config/awesome/themes/worm/theme.lua")
  104. -- beautiful.init("~/.config/awesome/themes/zenburn-custom/theme.lua")
  105. -- beautiful.init("~/.config/awesome/themes/zenburn-red/theme.lua")
  106. -- beautiful.init("~/.config/awesome/themes/pro-dark/theme.lua")
  107. -- beautiful.init("~/.config/awesome/themes/pro-gotham/theme.lua")
  108. -- beautiful.init("~/.config/awesome/themes/pro-light/theme.lua")
  109. -- beautiful.init("~/.config/awesome/themes/pro-medium-dark/theme.lua")
  110. -- beautiful.init("~/.config/awesome/themes/pro-medium-light/theme.lua")
  111.  
  112. -- This is used later as the default terminal and editor to run.
  113. terminal = "sakura"
  114. editor = os.getenv("EDITOR") or "nano"
  115. editor_cmd = terminal .. " -e " .. editor
  116.  
  117. -- Default modkey.
  118. -- Usually, Mod4 is the key with a logo between Control and Alt.
  119. -- If you do not like this or do not have such a key,
  120. -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
  121. -- However, you can use another modifier like Mod1, but it may interact with others.
  122. modkey = "Mod4"
  123.  
  124. -- Table of layouts to cover with awful.layout.inc, order matters.
  125. local layouts =
  126. {
  127.     awful.layout.suit.floating,
  128.     awful.layout.suit.tile,
  129.     awful.layout.suit.tile.left,
  130.     awful.layout.suit.tile.bottom,
  131.     awful.layout.suit.tile.top,
  132.     awful.layout.suit.fair,
  133.     awful.layout.suit.fair.horizontal,
  134.     awful.layout.suit.spiral,
  135.     awful.layout.suit.spiral.dwindle,
  136.     awful.layout.suit.max,
  137.     awful.layout.suit.max.fullscreen,
  138.     awful.layout.suit.magnifier
  139. }
  140. -- }}}
  141.  
  142. -- {{{ Wallpaper
  143. if beautiful.wallpaper then
  144.     for s = 1, screen.count() do
  145.         gears.wallpaper.maximized(beautiful.wallpaper, s, true)
  146.     end
  147. end
  148. -- }}}
  149.  
  150. -- {{{ Tags
  151. -- Define a tag table which hold all screen tags.
  152. tags = {}
  153. for s = 1, screen.count() do
  154.     -- Each screen has its own tag table.
  155.     -- tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[1])
  156.     tags[s] = awful.tag({ 1, 2, 3, 4 }, s, layouts[1])
  157. end
  158. -- }}}
  159.  
  160. -- {{{ Menu
  161. -- Create a laucher widget and a main menu
  162. myawesomemenu = {
  163.    { "manual", terminal .. " -e man awesome" },
  164.    { "edit config", editor_cmd .. " " .. awesome.conffile },
  165.    { "restart", awesome.restart },
  166.    { "quit", awesome.quit }
  167. }
  168.  
  169. mymainmenu = awful.menu({ items = { { "accessories",    
  170. applicationsmenu.applicationsmenu(), beautiful.awesome_icon     },
  171.                                     { "edit config", editor_cmd .. " " .. awesome.conffile },
  172.                                     {"", nil },
  173.                                     {"Audio Player", "pogo" },
  174.                                     {"BitTorrent Client", "transmission-gtk" },
  175.                                     {"File Manager", "thunar" },
  176.                                     {"LibreOffice", "libreoffice5.0 --writer" },
  177.                                     {"Screenshot", "xfce4-xscreenshooter" },
  178.                                     {"Terminal",  terminal},
  179.                                     {"Text Editor", "leafpad" },
  180.                                     {"Web Browser", "opera" },
  181.                                     {"", nil },
  182.                                     {"restart-awesome",        awesome.restart},
  183.                                     {"quit-awesome",           awesome.quit},
  184.                                     {"", nil },
  185.                                     {"run Command", "gmrun" },
  186.                                     {"", nil },
  187.                                     {"restart", "sudo /sbin/shutdown -r now" },
  188.                                     {"shutdown", "sudo /sbin/shutdown -h now" }
  189.                                   }
  190.                         })
  191. mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
  192.                                      menu = mymainmenu })
  193.  
  194. -- Menubar configuration
  195. menubar.utils.terminal = terminal -- Set the terminal for applications that require it
  196. -- }}}
  197.  
  198. -- {{{ Wibox
  199. -- Create a textclock widget
  200. mytextclock = awful.widget.textclock()
  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 })
  271.  
  272.     -- Widgets that are aligned to the left
  273.     local left_layout = wibox.layout.fixed.horizontal()
  274.     left_layout:add(mylauncher)
  275.     left_layout:add(mytaglist[s])
  276.     left_layout:add(mypromptbox[s])
  277.  
  278.     -- Widgets that are aligned to the right
  279.     local right_layout = wibox.layout.fixed.horizontal()
  280.     if s == 1 then right_layout:add(wibox.widget.systray()) end
  281.     right_layout:add(mytextclock)
  282.     right_layout:add(mylayoutbox[s])
  283.  
  284.     -- Now bring it all together (with the tasklist in the middle)
  285.     local layout = wibox.layout.align.horizontal()
  286.     layout:set_left(left_layout)
  287.     layout:set_middle(mytasklist[s])
  288.     layout:set_right(right_layout)
  289.  
  290.     mywibox[s]:set_widget(layout)
  291. end
  292. -- }}}
  293.  
  294. -- {{{ Mouse bindings
  295. root.buttons(awful.util.table.join(
  296.     awful.button({ }, 3, function () mymainmenu:toggle() end),
  297.     awful.button({ }, 4, awful.tag.viewnext),
  298.     awful.button({ }, 5, awful.tag.viewprev)
  299. ))
  300. -- }}}
  301.  
  302. -- {{{ Key bindings
  303. globalkeys = awful.util.table.join(
  304. --    awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
  305. --    awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
  306. --    awful.key({ modkey,           }, "Escape", awful.tag.history.restore),
  307.       awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
  308.       awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
  309.       awful.key({ modkey,           }, "Escape", awful.tag.history.restore),
  310.       awful.key({ modkey}, "e", revelation),  -- Insert this line
  311.  
  312.     awful.key({ modkey,           }, "j",
  313.         function ()
  314.             awful.client.focus.byidx( 1)
  315.             if client.focus then client.focus:raise() end
  316.         end),
  317.     awful.key({ modkey,           }, "k",
  318.         function ()
  319.             awful.client.focus.byidx(-1)
  320.             if client.focus then client.focus:raise() end
  321.         end),
  322.     awful.key({ modkey,           }, "w", function () mymainmenu:show() end),
  323.  
  324.     -- Layout manipulation
  325.     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
  326.     awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
  327.     awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
  328.     awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
  329.     awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
  330.     awful.key({ modkey,           }, "Tab",
  331.         function ()
  332.             awful.client.focus.history.previous()
  333.             if client.focus then
  334.                 client.focus:raise()
  335.             end
  336.         end),
  337.  
  338.     -- Standard program
  339.     awful.key({ modkey,           }, "Return", function () awful.util.spawn(terminal) end),
  340.     awful.key({ modkey, "Control" }, "r", awesome.restart),
  341.     awful.key({ modkey, "Shift"   }, "q", awesome.quit),
  342.  
  343.     awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
  344.     awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
  345.     awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
  346.     awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
  347.     awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
  348.     awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
  349.     awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
  350.     awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),
  351.  
  352.     awful.key({ modkey, "Control" }, "n", awful.client.restore),
  353.  
  354.     -- Prompt
  355.     awful.key({ modkey },            "r",     function () mypromptbox[mouse.screen]:run() end),
  356.  
  357.     awful.key({ modkey }, "x",
  358.               function ()
  359.                   awful.prompt.run({ prompt = "Run Lua code: " },
  360.                   mypromptbox[mouse.screen].widget,
  361.                   awful.util.eval, nil,
  362.                   awful.util.getdir("cache") .. "/history_eval")
  363.               end),
  364.     -- Menubar
  365.     awful.key({ modkey }, "p", function() menubar.show() end)
  366. )
  367.  
  368. clientkeys = awful.util.table.join(
  369.     awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
  370.     awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end),
  371.     awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
  372.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  373.     awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
  374.     awful.key({ modkey,           }, "t",      function (c) c.ontop = not c.ontop            end),
  375.     awful.key({ modkey,           }, "n",
  376.         function (c)
  377.             -- The client currently has the input focus, so it cannot be
  378.             -- minimized, since minimized clients can't have the focus.
  379.             c.minimized = true
  380.         end),
  381.     awful.key({ modkey,           }, "m",
  382.         function (c)
  383.             c.maximized_horizontal = not c.maximized_horizontal
  384.             c.maximized_vertical   = not c.maximized_vertical
  385.         end)
  386. )
  387.  
  388. -- Bind all key numbers to tags.
  389. -- Be careful: we use keycodes to make it works on any keyboard layout.
  390. -- This should map on the top row of your keyboard, usually 1 to 9.
  391. for i = 1, 9 do
  392.     globalkeys = awful.util.table.join(globalkeys,
  393.         -- View tag only.
  394.         awful.key({ modkey }, "#" .. i + 9,
  395.                   function ()
  396.                         local screen = mouse.screen
  397.                         local tag = awful.tag.gettags(screen)[i]
  398.                         if tag then
  399.                            awful.tag.viewonly(tag)
  400.                         end
  401.                   end),
  402.         -- Toggle tag.
  403.         awful.key({ modkey, "Control" }, "#" .. i + 9,
  404.                   function ()
  405.                       local screen = mouse.screen
  406.                       local tag = awful.tag.gettags(screen)[i]
  407.                       if tag then
  408.                          awful.tag.viewtoggle(tag)
  409.                       end
  410.                   end),
  411.         -- Move client to tag.
  412.         awful.key({ modkey, "Shift" }, "#" .. i + 9,
  413.                   function ()
  414.                       if client.focus then
  415.                           local tag = awful.tag.gettags(client.focus.screen)[i]
  416.                           if tag then
  417.                               awful.client.movetotag(tag)
  418.                           end
  419.                      end
  420.                   end),
  421.         -- Toggle tag.
  422.         awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  423.                   function ()
  424.                       if client.focus then
  425.                           local tag = awful.tag.gettags(client.focus.screen)[i]
  426.                           if tag then
  427.                               awful.client.toggletag(tag)
  428.                           end
  429.                       end
  430.                   end))
  431. end
  432.  
  433. clientbuttons = awful.util.table.join(
  434.     awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  435.     awful.button({ modkey }, 1, awful.mouse.client.move),
  436.     awful.button({ modkey }, 3, awful.mouse.client.resize))
  437.  
  438. -- Set keys
  439. root.keys(globalkeys)
  440. -- }}}
  441.  
  442. -- {{{ Rules
  443. -- Rules to apply to new clients (through the "manage" signal).
  444. awful.rules.rules = {
  445.     -- All clients will match this rule.
  446.     { rule = { },
  447.       properties = { border_width = beautiful.border_width,
  448.                      border_color = beautiful.border_normal,
  449.                      focus = awful.client.focus.filter,
  450.                      raise = true,
  451.                      keys = clientkeys,
  452.                      buttons = clientbuttons } },
  453.     { rule = { class = "MPlayer" },
  454.       properties = { floating = true } },
  455.     { rule = { class = "pinentry" },
  456.       properties = { floating = true } },
  457.     { rule = { class = "gimp" },
  458.       properties = { floating = true } },
  459.     -- Set Firefox to always map on tags number 2 of screen 1.
  460.     -- { rule = { class = "Firefox" },
  461.     --   properties = { tag = tags[1][2] } },
  462. }
  463. -- }}}
  464.  
  465. -- {{{ Signals
  466. -- Signal function to execute when a new client appears.
  467. client.connect_signal("manage", function (c, startup)
  468.     -- Enable sloppy focus
  469.     c:connect_signal("mouse::enter", function(c)
  470.         if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  471.             and awful.client.focus.filter(c) then
  472.             client.focus = c
  473.         end
  474.     end)
  475.  
  476.     if not startup then
  477.         -- Set the windows at the slave,
  478.         -- i.e. put it at the end of others instead of setting it master.
  479.         -- awful.client.setslave(c)
  480.  
  481.         -- Put windows in a smart way, only if they does not set an initial position.
  482.         if not c.size_hints.user_position and not c.size_hints.program_position then
  483.             awful.placement.no_overlap(c)
  484.             awful.placement.no_offscreen(c)
  485.         end
  486.     end
  487.  
  488.     local titlebars_enabled = true
  489.     if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
  490.         -- buttons for the titlebar
  491.         local buttons = awful.util.table.join(
  492.                 awful.button({ }, 1, function()
  493.                     client.focus = c
  494.                     c:raise()
  495.                     awful.mouse.client.move(c)
  496.                 end),
  497.                 awful.button({ }, 3, function()
  498.                     client.focus = c
  499.                     c:raise()
  500.                     awful.mouse.client.resize(c)
  501.                 end)
  502.                 )
  503.  
  504.         -- Widgets that are aligned to the left
  505.         local left_layout = wibox.layout.fixed.horizontal()
  506.         left_layout:add(awful.titlebar.widget.iconwidget(c))
  507.         left_layout:buttons(buttons)
  508.  
  509.         -- Widgets that are aligned to the right
  510.         local right_layout = wibox.layout.fixed.horizontal()
  511.         right_layout:add(awful.titlebar.widget.floatingbutton(c))
  512.         right_layout:add(awful.titlebar.widget.maximizedbutton(c))
  513.         right_layout:add(awful.titlebar.widget.stickybutton(c))
  514.         right_layout:add(awful.titlebar.widget.ontopbutton(c))
  515.         right_layout:add(awful.titlebar.widget.closebutton(c))
  516.  
  517.         -- The title goes in the middle
  518.         local middle_layout = wibox.layout.flex.horizontal()
  519.         local title = awful.titlebar.widget.titlewidget(c)
  520.         title:set_align("center")
  521.         middle_layout:add(title)
  522.         middle_layout:buttons(buttons)
  523.  
  524.         -- Now bring it all together
  525.         local layout = wibox.layout.align.horizontal()
  526.         layout:set_left(left_layout)
  527.         layout:set_right(right_layout)
  528.         layout:set_middle(middle_layout)
  529.  
  530.         awful.titlebar(c):set_widget(layout)
  531.     end
  532. end)
  533.  
  534. -- autostart Programs:
  535. awful.util.spawn_with_shell("numlockx &")
  536. awful.util.spawn_with_shell("compton &")
  537. awful.util.spawn_with_shell("tint2 &")
  538. awful.util.spawn_with_shell("volti &")
  539. awful.util.spawn_with_shell("wicd-gtk --tray &")
  540. awful.util.spawn_with_shell("conky -c .conkyrc &")
  541. -- }}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement