Guest User

rc.lua

a guest
Jun 2nd, 2015
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.44 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("eminent")
  6. require("awful.autofocus")
  7. local wibox = require("wibox")
  8. local beautiful = require("beautiful")
  9. local naughty = require("naughty")
  10. local menubar = require("menubar")
  11. local vicious = require("vicious")
  12. --local lain = require("lain")
  13. --local vain = require("vain")
  14. local minitray = require("minitray")
  15. --local redflat = require("redflat")
  16.  
  17.  
  18. -- {{{ Error handling
  19. -- Check if awesome encountered an error during startup and fell back to
  20. -- another config (This code will only ever execute for the fallback config)
  21. if awesome.startup_errors then
  22.     naughty.notify({ preset = naughty.config.presets.critical,
  23.                      title = "Oops, there were errors during startup!",
  24.                      text = awesome.startup_errors })
  25. end
  26.  
  27. -- Handle runtime errors after startup
  28. do
  29.     local in_error = false
  30.     awesome.connect_signal("debug::error", function (err)
  31.         -- Make sure we don't go into an endless error loop
  32.         if in_error then return end
  33.         in_error = true
  34.  
  35.         naughty.notify({ preset = naughty.config.presets.critical,
  36.                          title = "Oops, an error happened!",
  37.                          text = err })
  38.         in_error = false
  39.     end)
  40. end
  41. -- }}}
  42.  
  43. -- {{{ Variable definitions
  44. -- Themes define colours, icons, font and wallpapers.
  45. beautiful.init("~/.config/awesome/themes/powerarrow-darker/theme.lua")
  46.  
  47. --rofi = "rofi [ -fg '#DDDDFF' ] [ -fg-active '#B0C4DE' ] [ -fg-urgent '#DDDDFF' ] [ -bg '#474a51' ] [ -bw 3 ] [ -disable-history ] [ -opacity 93% ] [ -padding 10 ] [ -columns 3 ] [ -width 30 ] [ -bc '#535d6c'] -show run"
  48. rofi = "/home/user/.config/awesome/rofi.sh"
  49. terminal = "terminator  --geometry=855x480"
  50. editor = os.getenv("EDITOR") or "subl3"
  51. editor_cmd = terminal .. " -e " .. editor
  52. fm = 'pcmanfm'
  53. browser = "bash -c \"GTK2_RC_FILES=/home/user/.themes/gtkrc-firefox firefox\" "
  54. --office = "bash -c \"GTK2_RC_FILES=/home/user/.themes/gtkrc-firefox libreoffice\" "
  55.  
  56. modkey = "Mod4"
  57.  
  58. -- Table of layouts to cover with awful.layout.inc, order matters.
  59. local layouts =
  60. {
  61.     awful.layout.suit.floating,
  62.     awful.layout.suit.tile,
  63.     --lain.layout.uselesspiral,
  64.     --redflat.layout.map,
  65.     awful.layout.suit.tile.left,
  66.     --awful.layout.suit.tile.bottom,
  67.     --awful.layout.suit.tile.top,
  68.     awful.layout.suit.fair,
  69.     --vain.layout.uselessfair,
  70.     --awful.layout.suit.fair.horizontal,
  71.     --awful.layout.suit.spiral,
  72.     --awful.layout.suit.spiral.dwindle,
  73.     --awful.layout.suit.max,
  74.     --awful.layout.suit.max.fullscreen,
  75.     --awful.layout.suit.magnifier
  76. }
  77. -- }}}
  78.  
  79. -- {{{ Wallpaper
  80. if beautiful.wallpaper then
  81.     for s = 1, screen.count() do
  82.         gears.wallpaper.maximized(beautiful.wallpaper, s, true)
  83.     end
  84. end
  85. -- }}}
  86.  
  87. -- {{{ Tags
  88. -- Define a tag table which hold all screen tags.
  89. --tags = {}
  90. --for s = 1, screen.count() do
  91. --    -- Each screen has its own tag table.
  92. --    tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[1])
  93. --end
  94. tags = {
  95.    names  = { " 火  ", "  水  ", "  土  ", "  天  "},
  96.    
  97.    layout = { layouts[1], layouts[2], layouts[3], layouts[4], }
  98. }
  99.  
  100. for s = 1, screen.count() do
  101.    tags[s] = awful.tag(tags.names, s, tags.layout)
  102. end
  103. -- }}}
  104. -- {{{ Menu
  105. -- Create a laucher widget and a main menu
  106. myawesomemenu = {
  107.    {"reboot", "gksudo 'shutdown -r now' "},
  108.    {"shut down", "gksudo 'shutdown -h now' "},
  109.    {"restart", awesome.restart },
  110.    {"quit", awesome.quit }
  111. }
  112.  
  113. mymainmenu = awful.menu({ items = {
  114.                                     {"terminal", terminal },
  115.                                     {"web browser",browser},
  116.                                     {"file manager",fm},
  117.                                     {"editor", editor },
  118.                                   --  {"office",office},
  119.                                     { "quit", myawesomemenu},
  120.                                   }
  121.                         })
  122.  
  123. mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
  124.                                      menu = mymainmenu })
  125.  
  126. -- Menubar configuration
  127. menubar.utils.terminal = terminal -- Set the terminal for applications that require it
  128. -- }}}
  129.  
  130. minitray.toggle ()
  131. minitray.toggle({ x = 1815,y = 1015, height = 30 })
  132. -- {{{ Wibox
  133. -- Create a textclock widget
  134. mytextclock = awful.widget.textclock( "%H:%M:%S ", 1)
  135.  
  136. --Systreay
  137. tray = awful.widget.button ({image = "/home/user/.config/awesome/themes/powerarrow-darker/icons/warning.svg"
  138. })
  139. tray:buttons(awful.util.table.join (awful.button ({ }, 1, function() minitray.toggle() end ))
  140. )
  141.  
  142.  
  143. -- Keyboard layout widget
  144. kbdwidget = wibox.widget.textbox()
  145. kbdcolb = ""
  146. kbdcole = ""
  147. kbdwidget.border_width = 0
  148. kbdwidget.border_color = beautiful.fg_normal
  149. kbdwidget:set_markup(kbdcolb.." EN "..kbdcole)
  150. dbus.request_name("session", "ru.gentoo.kbdd")
  151. dbus.add_match("session", "interface='ru.gentoo.kbdd',member='layoutChanged'")
  152. dbus.connect_signal("ru.gentoo.kbdd", function(...)
  153. local data = {...}
  154. local layout = data[2]
  155. lts = {[0] = " EN", [1] = " RU"}
  156. kbdwidget:set_markup (kbdcolb..""..lts[layout].." "..kbdcole)
  157. end
  158. )
  159. --arrl_ld = wibox.widget.imagebox()
  160. --arrl_ld:set_image(beautiful.arrl_ld)
  161. arrl = wibox.widget.imagebox()
  162. arrl:set_image(beautiful.arrl)
  163. arrl_r = wibox.widget.imagebox()
  164. arrl_r:set_image(beautiful.arrl_r)
  165. space = wibox.widget.textbox()
  166. space:set_text(" ")
  167. separator = wibox.widget.textbox()
  168. separator:set_text ("")
  169. separator_l = wibox.widget.textbox()
  170. separator_l:set_text ("")
  171.  
  172. -- Memory
  173. memwidget = wibox.widget.textbox()
  174. vicious.register(memwidget, vicious.widgets.mem, "$2MB/$3MB", 1)
  175. fixedmemwidget = wibox.layout.constraint(memwidget, "exact", 140)
  176. memwidget:set_align("center")
  177. memicon = wibox.widget.imagebox(beautiful.widget_mem)
  178.  
  179. -- Create a wibox for each screen and add it
  180. mywibox = {}
  181. mypromptbox = {}
  182. mylayoutbox = {}
  183. mytaglist = {}
  184. mytaglist.buttons = awful.util.table.join(
  185.                     awful.button({ }, 1, awful.tag.viewonly)
  186.                     --awful.button({ modkey }, 1, awful.client.movetotag),
  187.                     --awful.button({ }, 3, awful.tag.viewtoggle),
  188.                     --awful.button({ modkey }, 3, awful.client.toggletag),
  189.                     --awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
  190.                     --awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
  191.                     )
  192. mytasklist = {}
  193. mytasklist.buttons = awful.util.table.join(
  194.                      awful.button({ }, 1, function (c)
  195.                                               if c == client.focus then
  196.                                                   c.minimized = true
  197.                                               else
  198.                                                   -- Without this, the following
  199.                                                   -- :isvisible() makes no sense
  200.                                                   c.minimized = false
  201.                                                   if not c:isvisible() then
  202.                                                       awful.tag.viewonly(c:tags()[1])
  203.                                                   end
  204.                                                   -- This will also un-minimize
  205.                                                   -- the client, if needed
  206.                                                   client.focus = c
  207.                                                   c:raise()
  208.                                               end
  209.                                           end),
  210.                      awful.button({ }, 3, function (c)
  211.                                               c:kill()
  212.                                               end)
  213.                      )
  214.  
  215. for s = 1, screen.count() do
  216.     -- Create a promptbox for each screen
  217.     mypromptbox[s] = awful.widget.prompt()
  218.     -- Create an imagebox widget which will contains an icon indicating which layout we're using.
  219.     -- We need one layoutbox per screen.
  220.     mylayoutbox[s] = awful.widget.layoutbox(s)
  221.     mylayoutbox[s]:buttons(awful.util.table.join(
  222.                            awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
  223.                            awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
  224.                            awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
  225.                            awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
  226.     -- Create a taglist widget
  227.     mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
  228.  
  229.     -- Create a tasklist widget
  230.     mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
  231.  
  232.     -- Create the wibox
  233.     mywibox[s] = awful.wibox({border_width = 2.5, border_color ="#535d6c", position = "bottom", height = 27, screen = s })
  234.  
  235.     -- Widgets that are aligned to the left
  236.     local left_layout = wibox.layout.fixed.horizontal()
  237.     left_layout:add(mylauncher)
  238.     left_layout:add(space)
  239.     left_layout:add(arrl_r)
  240.     left_layout:add(space)
  241.     left_layout:add(mytaglist[s])
  242.     left_layout:add(arrl_r)
  243.     left_layout:add(separator_l)
  244.     left_layout:add(space)
  245.     left_layout:add(mypromptbox[s])
  246.  
  247.     -- Widgets that are aligned to the right
  248.     local right_layout = wibox.layout.fixed.horizontal()
  249.     --if s == 1 then right_layout:add(wibox.widget.systray()) end
  250.     right_layout:add(separator)
  251.     right_layout:add(arrl)
  252.     --right_layout:add(separator)
  253.     right_layout:add(kbdwidget)
  254.     right_layout:add(arrl)
  255.     --right_layout:add(separator)
  256.     right_layout:add(memicon)
  257.     right_layout:add(fixedmemwidget)
  258.     right_layout:add(arrl)
  259.     --right_layout:add(separator)
  260.     right_layout:add(space)
  261.     --right_layout:add(fixedcpuwidget)
  262.     right_layout:add(mytextclock)
  263.     --right_layout:add(separator)
  264.     right_layout:add(arrl)
  265.     right_layout:add(space)
  266.     right_layout:add(tray)
  267.     right_layout:add(space)
  268.     --right_layout:add(separator)
  269.     right_layout:add(arrl)
  270.     right_layout:add(space)
  271.     right_layout:add(mylayoutbox[s])
  272.     right_layout:add(space)
  273.  
  274.     -- Now bring it all together (with the tasklist in the middle)
  275.     local layout = wibox.layout.align.horizontal()
  276.     layout:set_left(left_layout)
  277.     layout:set_middle(mytasklist[s])
  278.     layout:set_right(right_layout)
  279.  
  280.     mywibox[s]:set_widget(layout)
  281. end
  282. -- }}}
  283.  
  284. -- {{{ Mouse bindings
  285. root.buttons(awful.util.table.join(
  286.     awful.button({ }, 1, function () mymainmenu:hide() end),
  287.     awful.button({ }, 3, function () mymainmenu:toggle() end)
  288.     --awful.button({ }, 4, awful.tag.viewnext),
  289.     --awful.button({ }, 5, awful.tag.viewprev)
  290. ))
  291. -- }}}
  292.  
  293. -- {{{ Key bindings
  294. globalkeys = awful.util.table.join(
  295.  
  296.     --awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
  297.     --awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
  298.     awful.key({ modkey,           }, "Escape", awful.tag.history.restore),
  299.  
  300.     awful.key({ modkey,           }, "j",
  301.         function ()
  302.             awful.client.focus.byidx( 1)
  303.             if client.focus then client.focus:raise() end
  304.         end),
  305.     awful.key({ modkey,           }, "k",
  306.         function ()
  307.             awful.client.focus.byidx(-1)
  308.             if client.focus then client.focus:raise() end
  309.         end),
  310.     awful.key({ modkey,           }, "w", function () mymainmenu:toggle() end),
  311.  
  312.     -- Layout manipulation
  313.     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
  314.     awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
  315.     awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
  316.     awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
  317.     awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
  318.     awful.key({ modkey,           }, "Tab",
  319.         function ()
  320.             awful.client.focus.history.previous()
  321.             if client.focus then
  322.                 client.focus:raise()
  323.             end
  324.         end),
  325.  
  326.  
  327.     -- Standard program
  328.     awful.key({ modkey,           }, "t", function () awful.util.spawn(terminal) end),
  329.     awful.key({ modkey,           }, "i", function () awful.util.spawn(browser) end),
  330.     awful.key({ modkey            }, "f", function () awful.util.spawn(fm) end),
  331.     awful.key({                   }, "Print", function () awful.util.spawn("scrot '%Y-%m-%d_%H:%M:%S.png' -e 'mv $f ~/Изображения/scr/ 2>/dev/null'") end),
  332.     awful.key({ modkey, "Control" }, "r", awesome.restart),
  333.     --awful.key({ modkey, "Shift"   }, "q", awesome.quit),
  334.     awful.key({ modkey,           }, "l",        function () awful.tag.incmwfact( 0.05)    end),
  335.     awful.key({ modkey,           }, "h",        function () awful.tag.incmwfact(-0.05)    end),
  336.     awful.key({ modkey, "Shift"   }, "h",        function () awful.tag.incnmaster( 1)      end),
  337.     awful.key({ modkey, "Control" }, "h",        function () awful.tag.incncol( 1)         end),
  338.     awful.key({ modkey, "Shift"   }, "l",        function () awful.tag.incnmaster(-1)      end),
  339.     awful.key({ modkey, "Control" }, "l",        function () awful.tag.incncol(-1)         end),
  340.  
  341.     --awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
  342.     --awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
  343.     --awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
  344.     --awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
  345.     --awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
  346.     --awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
  347.     awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
  348.     awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),
  349.  
  350.     awful.key({ modkey, "Control" }, "n", awful.client.restore),
  351.     -- Prompt
  352.     --awful.key({ modkey },            "r",     function () mypromptbox[mouse.screen]:run() end),
  353.     awful.key({ modkey            }, "r",      function () awful.util.spawn(rofi)           end),
  354.     -- Menubar
  355.  
  356.     awful.key({ modkey }, "p", function() menubar.show() end)
  357. )
  358.  
  359. clientkeys = awful.util.table.join(
  360.     awful.key({ modkey }, "Next",  function () awful.client.moveresize( 20,  20, -40, -40) end),
  361.     awful.key({ modkey }, "Prior", function () awful.client.moveresize(-20, -20,  40,  40) end),
  362.     awful.key({ modkey }, "Down",  function () awful.client.moveresize(  0,  20,   0,   0) end),
  363.     awful.key({ modkey }, "Up",    function () awful.client.moveresize(  0, -20,   0,   0) end),
  364.     awful.key({ modkey }, "Left",  function () awful.client.moveresize(-20,   0,   0,   0) end),
  365.     awful.key({ modkey }, "Right", function () awful.client.moveresize( 20,   0,   0,   0) end),
  366.     awful.key({ modkey, "Shift"  }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
  367.     awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end),
  368.     awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
  369.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  370.     awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
  371.     --awful.key({ modkey,           }, "t",      function (c) c.ontop = not c.ontop            end),
  372.     awful.key({ modkey,           }, "n",
  373.         function (c)
  374.             -- The client currently has the input focus, so it cannot be
  375.             -- minimized, since minimized clients can't have the focus.
  376.             c.minimized = true
  377.         end),
  378.     awful.key({ modkey,           }, "m",
  379.         function (c)
  380.             c.maximized_horizontal = not c.maximized_horizontal
  381.             c.maximized_vertical   = not c.maximized_vertical
  382.         end)
  383. )
  384.  
  385. -- Bind all key numbers to tags.
  386. -- Be careful: we use keycodes to make it works on any keyboard layout.
  387. -- This should map on the top row of your keyboard, usually 1 to 9.
  388. for i = 1, 9 do
  389.     globalkeys = awful.util.table.join(globalkeys,
  390.         -- View tag only.
  391.         awful.key({ modkey }, "#" .. i + 9,
  392.                   function ()
  393.                         local screen = mouse.screen
  394.                         local tag = awful.tag.gettags(screen)[i]
  395.                         if tag then
  396.                            awful.tag.viewonly(tag)
  397.                         end
  398.                   end),
  399.         -- Toggle tag.
  400.         awful.key({ modkey, "Control" }, "#" .. i + 9,
  401.                   function ()
  402.                       local screen = mouse.screen
  403.                       local tag = awful.tag.gettags(screen)[i]
  404.                       if tag then
  405.                          awful.tag.viewtoggle(tag)
  406.                       end
  407.                   end),
  408.         -- Move client to tag.
  409.         awful.key({ modkey, "Shift" }, "#" .. i + 9,
  410.                   function ()
  411.                       if client.focus then
  412.                           local tag = awful.tag.gettags(client.focus.screen)[i]
  413.                           if tag then
  414.                               awful.client.movetotag(tag)
  415.                           end
  416.                      end
  417.                   end),
  418.         -- Toggle tag.
  419.         awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  420.                   function ()
  421.                       if client.focus then
  422.                           local tag = awful.tag.gettags(client.focus.screen)[i]
  423.                           if tag then
  424.                               awful.client.toggletag(tag)
  425.                           end
  426.                       end
  427.                   end))
  428. end
  429.  
  430. clientbuttons = awful.util.table.join(
  431.     awful.button({ }, 1, function () mymainmenu:hide() end),
  432.     awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  433.     awful.button({ modkey }, 1, awful.mouse.client.move),
  434.     awful.button({ }, 3, function () mymainmenu:hide() end),
  435.     awful.button({ modkey }, 3, awful.mouse.client.resize)),
  436.    
  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.     { rule = { instance = "plugin-container" },
  460.       properties = { floating = true } },
  461.     { rule = { class = "Pcmanfm" },
  462.     properties = {
  463.         width = 1110,
  464.         height = 600
  465.     } },
  466.     { rule = { class = "Pcmanfm" , type = "dialog" },
  467.     properties = {
  468.         width = 300,
  469.         height = 20
  470.     } },
  471.    
  472. }
  473. -- }}}
  474.  
  475. -- {{{ Signals
  476. -- Signal function to execute when a new client appears.
  477. client.connect_signal("manage", function (c, startup)
  478.     -- Enable sloppy focus
  479. --    c:connect_signal("mouse::enter", function(c)
  480. --       if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  481. --            and awful.client.focus.filter(c) then
  482. --            client.focus = c
  483. --        end
  484. --    end)
  485.  
  486.     --if not startup then
  487.         -- Set the windows at the slave,
  488.         -- i.e. put it at the end of others instead of setting it master.
  489.         -- awful.client.setslave(c)
  490.  
  491.         -- Put windows in a smart way, only if they does not set an initial position.
  492.      --   if not c.size_hints.user_position and not c.size_hints.program_position then
  493.         awful.placement.centered(c)
  494.      --       awful.placement.no_offscreen(c)
  495.      --   end
  496.    -- end
  497.  
  498.     local titlebars_enabled = false
  499.     if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
  500.         -- buttons for the titlebar
  501.         local buttons = awful.util.table.join(
  502.                 awful.button({ }, 1, function()
  503.                     client.focus = c
  504.                     c:raise()
  505.                     awful.mouse.client.move(c)
  506.                 end),
  507.                 awful.button({ }, 3, function()
  508.                     client.focus = c
  509.                     c:raise()
  510.                     awful.mouse.client.resize(c)
  511.                 end)
  512.                 )
  513.         -- Widgets that are aligned to the left
  514.         local left_layout = wibox.layout.fixed.horizontal()
  515.         left_layout:add(awful.titlebar.widget.iconwidget(c))
  516.         left_layout:buttons(buttons)
  517.  
  518.         -- Widgets that are aligned to the right
  519.         local right_layout = wibox.layout.fixed.horizontal()
  520.         right_layout:add(awful.titlebar.widget.floatingbutton(c))
  521.         right_layout:add(awful.titlebar.widget.maximizedbutton(c))
  522.         right_layout:add(awful.titlebar.widget.stickybutton(c))
  523.         right_layout:add(awful.titlebar.widget.ontopbutton(c))
  524.         right_layout:add(awful.titlebar.widget.closebutton(c))
  525.  
  526.         -- The title goes in the middle
  527.         local middle_layout = wibox.layout.flex.horizontal()
  528.         local title = awful.titlebar.widget.titlewidget(c)
  529.         title:set_align("center")
  530.         middle_layout:add(title)
  531.         middle_layout:buttons(buttons)
  532.  
  533.         -- Now bring it all together
  534.         local layout = wibox.layout.align.horizontal()
  535.         layout:set_left(left_layout)
  536.         layout:set_right(right_layout)
  537.         layout:set_middle(middle_layout)
  538.  
  539.         awful.titlebar(c):set_widget(layout)
  540.     end
  541. end)
  542.  
  543. client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  544. client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  545. -- }}}
  546.  
  547. --{{{
  548.  
  549. function run_once(cmd)
  550.     findme = cmd
  551.     firstspace = cmd:find(" ")
  552.     if firstspace then
  553.         findme = cmd:sub(0, firstspace-1)
  554.     end
  555.     awful.util.spawn_with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. cmd .. ")")
  556. end
  557. run_once ("setxkbmap -layout 'us,ru' -option 'grp:alt_shift_toggle' ")
  558. run_once ("kbdd &")
  559. run_once ("compton --config ~/.config/compton/config -b &")
  560. run_once ("conky")
  561.  
  562. -- }}}
Advertisement
Add Comment
Please, Sign In to add comment