Advertisement
Guest User

rc.lua

a guest
Apr 24th, 2016
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.31 KB | None | 0 0
  1. -- {{{ Библиотеки
  2. local awful     = require("awful")
  3. local gears     = require("gears")
  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("scratchdrop")
  10. local lain      = require("lain")
  11. local helpers   = require("lain.helpers")
  12. -- local imglib = require("imlib2")
  13.  
  14.  
  15. -- }}}
  16.  
  17. -- {{{ Вывод ошибок
  18. if awesome.startup_errors then
  19.     naughty.notify({ preset = naughty.config.presets.critical,
  20.                      title = "Ошибка при запуске",
  21.                      text = awesome.startup_errors })
  22. end
  23.  
  24. do
  25.     local in_error = false
  26.     awesome.connect_signal("debug::error", function (err)
  27.         if in_error then return end
  28.         in_error = true
  29.  
  30.         naughty.notify({ preset = naughty.config.presets.critical,
  31.                          title = "Произошла ошибка",
  32.                          text = err })
  33.         in_error = false
  34.     end)
  35. end
  36. -- }}}
  37.  
  38. -- {{{ Автостарт при запуске
  39. function run_once(cmd)
  40.   findme = cmd
  41.   firstspace = cmd:find(" ")
  42.   if firstspace then
  43.      findme = cmd:sub(0, firstspace-1)
  44.   end
  45.   awful.util.spawn_with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. cmd .. ")")
  46. end
  47.  
  48. run_once("sudo netctl start Maks")
  49. run_once("pulseaudio --start")
  50. run_once("compton")
  51. run_once("unclutter -root")
  52. run_once("nautilus -n")
  53. run_once("xset dpms 0 0 0")
  54. run_once("xset s off")
  55.  
  56. -- }}}
  57.  
  58. -- {{{ Переменные
  59.  
  60. beautiful.init(os.getenv("HOME") .. "/.config/awesome/themes/powerarrow-darker/theme.lua")
  61.  
  62. modkey     = "Mod4"
  63. altkey     = "Mod1"
  64. terminal   = "gnome-terminal"
  65. editor     = os.getenv("EDITOR") or "sudo gedit"
  66. editor_cmd = terminal .. " -e " .. editor
  67.  
  68. local layouts =
  69. {
  70.     awful.layout.suit.floating,         --1
  71.     awful.layout.suit.tile,             --2
  72.     awful.layout.suit.tile.left,        --3
  73.     awful.layout.suit.tile.bottom,      --4
  74.     awful.layout.suit.tile.top,         --5
  75.     awful.layout.suit.fair,             --6
  76.     awful.layout.suit.fair.horizontal,  --7
  77.     awful.layout.suit.spiral,           --8
  78.     awful.layout.suit.spiral.dwindle,   --9
  79. }
  80. -- }}}
  81.  
  82. -- {{{ Теги
  83. tags = {
  84.    names = { " Ø ", " ^.^ ", " >_ ", " ± ", " * " },
  85.    layout = { layouts[1], layouts[1], layouts[7], layouts[3], layouts[1] }
  86. }
  87.  
  88. for s = 1, screen.count() do
  89.    tags[s] = awful.tag(tags.names, s, tags.layout)
  90. end
  91. -- }}}
  92.  
  93. -- {{{ Заставка рабочего стола
  94. if beautiful.wallpaper then
  95.     for s = 1, screen.count() do
  96.         gears.wallpaper.maximized(beautiful.wallpaper, s, true)
  97.     end
  98. end
  99. -- }}}
  100.  
  101. -- {{{ Меню
  102.  
  103. mymainmenu = awful.menu.new({ items = require("menugen").build_menu()})
  104. mypowermenu = awful.menu.new({ items = {{"Системный монитор", "gnome-system-monitor"}, {"Сделать скриншот", "deepin-screenshot"}, {}, {"Рестарт Awesome", awesome.restart}, {}, {"Заблокировать", "xtrlock"},  {"Выйти", awesome.quit}, {}, {"Перезагрузить", "sudo shutdown -r now"}, {"Выключить", "sudo shutdown -h now"}}})
  105. mywifimenu = awful.menu.new({ items = {{"Открыть менеджер", terminal .. " -e 'sudo wifi-menu'"}, {}, {"Запустить Xampp", terminal .. " -e 'sudo /opt/lampp/lampp restart'"}, {"Остановить Xampp", terminal .. " -e 'sudo /opt/lampp/lampp stop'"}}})
  106. myvolumemenu = awful.menu.new({ items = {{"Микшер громкости", "pavucontrol"}, {}, {"Эквалайзер", terminal .. " -e 'vis'"}}})
  107.  
  108. -- Контекстное меню окна
  109. function context_menu(c)
  110.     tag_menu = { }
  111.     for i,t in pairs(tags.names) do
  112.          if not tags[c.screen][i].selected then
  113.              table.insert(tag_menu, { tostring(t), function() awful.client.movetotag(tags[c.screen][i]) end } )
  114.          end
  115.     end
  116.     taskmenu = awful.menu.new({ items = { { "Переместить", tag_menu }, {},
  117.                                           { "Закрыть", function() c:kill() end }}})
  118.     taskmenu:show()
  119.     return taskmenu
  120. end
  121.  
  122. -- }}}
  123.  
  124. -- {{{ Wibox
  125. markup = lain.util.markup
  126. separators = lain.util.separators
  127.  
  128. -- Часы
  129. clockicon = wibox.widget.imagebox(beautiful.widget_clock)
  130. --mytextclock = awful.widget.textclock(" %a %d %b  %H:%M")
  131.  
  132. mytextclock = lain.widgets.abase({
  133.     timeout  = 60,
  134.     cmd      = "date +'%a %d %b %R'",
  135.     settings = function()
  136.         widget:set_text(" " .. output)
  137.     end
  138. })
  139.  
  140. -- Громкость Pulseaudio
  141. volicon = wibox.widget.imagebox(beautiful.widget_vol)
  142. volumewidget = lain.widgets.pulseaudio({
  143.     settings = function()
  144.         if volume_now.status == "off" then
  145.             volicon:set_image(beautiful.widget_vol_mute)
  146.         elseif tonumber(volume_now.left) == 0 then
  147.             volicon:set_image(beautiful.widget_vol_no)
  148.         elseif tonumber(volume_now.left) <= 50 then
  149.             volicon:set_image(beautiful.widget_vol_low)
  150.         else
  151.             volicon:set_image(beautiful.widget_vol)
  152.         end
  153.  
  154.         widget:set_text(" " .. volume_now.left .. "% ")
  155.     end
  156. })
  157. volumewidget:buttons(awful.util.table.join(awful.button({ }, 1, function () myvolumemenu:toggle() end)))
  158. volicon:buttons(awful.util.table.join(awful.button({ }, 1, function () myvolumemenu:toggle() end)))
  159.  
  160. -- Память
  161. memicon = wibox.widget.imagebox(beautiful.widget_mem)
  162. memwidget = lain.widgets.mem({
  163.     settings = function()
  164.         widget:set_text(" " .. mem_now.used .. "мб ")
  165.     end
  166. })
  167.  
  168. -- Процессор
  169. cpuicon = wibox.widget.imagebox(beautiful.widget_cpu)
  170. cpuwidget = lain.widgets.cpu({
  171.     settings = function()
  172.         widget:set_text(" " .. cpu_now.usage .. "% ")
  173.     end
  174. })
  175.  
  176. -- Раскладка клавиатуры
  177. kbdcfg = {}
  178. kbdcfg.cmd = "setxkbmap"
  179. kbdcfg.layout = { { "us", "", "en" }, { "ru,us" , "", "ru" } }
  180. kbdcfg.current = 1
  181. kbdcfg.widget = wibox.widget.textbox()
  182. kbdcfg.widget:set_text(" " .. kbdcfg.layout[kbdcfg.current][3] .. " ")
  183. kbdcfg.switch = function ()
  184.   kbdcfg.current = kbdcfg.current % #(kbdcfg.layout) + 1
  185.   local t = kbdcfg.layout[kbdcfg.current]
  186.   kbdcfg.widget:set_text(" " .. t[3] .. " ")
  187.   os.execute( kbdcfg.cmd .. " " .. t[1] .. " " .. t[2] )
  188. end
  189.  
  190. kbdcfg.widget:buttons(
  191.  awful.util.table.join(awful.button({ }, 1, function () kbdcfg.switch() end))
  192. )
  193.  
  194. -- / fs
  195. fsicon = wibox.widget.imagebox(beautiful.widget_hdd)
  196. fswidget = lain.widgets.fs({
  197.     settings  = function()
  198.         widget:set_text(" " .. fs_now.used .. "% ")
  199.     end
  200. })
  201. fswidget:buttons(awful.util.table.join(awful.button({ }, 1, function () mymainmenu:toggle() fswidget.hide() end)))
  202. fsicon:buttons(awful.util.table.join(awful.button({ }, 1, function () mymainmenu:toggle() end)))
  203.  
  204. -- Меню выключения
  205. powicon = wibox.widget.imagebox(beautiful.widget_ac)
  206. powicon:buttons(awful.util.table.join(awful.button({ }, 1, function () mypowermenu:toggle() end)))
  207.  
  208. -- Сеть
  209. neticon = wibox.widget.imagebox(beautiful.widget_net)
  210. netwidget = lain.widgets.net({
  211.     settings = function()
  212.         widget:set_markup(markup("#7AC82E", " " .. net_now.received)
  213.                           .. " " ..
  214.                           markup("#46A8C3", " " .. net_now.sent .. " "))
  215.     end
  216. })
  217. netwidget:buttons(awful.util.table.join(awful.button({ }, 1, function () mywifimenu:toggle() end)))
  218. neticon:buttons(awful.util.table.join(awful.button({ }, 1, function () mywifimenu:toggle() end)))
  219.  
  220. -- Разделитель
  221. spr = wibox.widget.textbox(' ')
  222. arrl = wibox.widget.imagebox()
  223. arrl:set_image(beautiful.arrl)
  224. arrl_dl = separators.arrow_left(beautiful.bg_focus, "alpha")
  225. arrl_ld = separators.arrow_left("alpha", beautiful.bg_focus)
  226.  
  227. lain.widgets.calendar:attach(mytextclock)
  228.  
  229. -- Создать wibox
  230. mywibox = {}
  231. mypromptbox = {}
  232. mylayoutbox = {}
  233. mytaglist = {}
  234. mytaglist.buttons = awful.util.table.join(
  235.                     awful.button({ }, 1, awful.tag.viewonly),
  236.                     awful.button({ modkey }, 1, awful.client.movetotag),
  237.                     awful.button({ }, 3, awful.tag.viewtoggle),
  238.                     awful.button({ modkey }, 3, awful.client.toggletag)
  239.                     )
  240. mytasklist = {}
  241. mytasklist.buttons = awful.util.table.join(
  242.                      awful.button({ }, 1, function (c)
  243.                                               if c == client.focus then
  244.                                                   c.minimized = true
  245.                                               else
  246.                                                   c.minimized = false
  247.                                                   if not c:isvisible() then
  248.                                                       awful.tag.viewonly(c:tags()[1])
  249.                                                   end
  250.                                                   client.focus = c
  251.                                                   c:raise()
  252.                                               end
  253.                                           end),
  254.                      awful.button({ }, 3, function (c)
  255.                                               if instance then
  256.                                                   instance:hide()
  257.                                                  instance = nil
  258.                                               else
  259.                                                  instance = context_menu(c)
  260.                                               end
  261.                                            end ))
  262.  
  263. for s = 1, screen.count() do
  264.     mypromptbox[s] = awful.widget.prompt()
  265.     mylayoutbox[s] = awful.widget.layoutbox(s)
  266.     mylayoutbox[s]:buttons(awful.util.table.join(
  267.                             awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
  268.                             awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
  269.                             awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
  270.                             awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
  271.     mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
  272.     mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
  273. --    mytasklist[s]:add_signal("mouse::enter", function() mytasklist[s].show() end)
  274. --    mytasklist[s]:add_signal("mouse::leave", function() mytasklist[s].hide() end)
  275.     mywibox[s] = awful.wibox({ position = "top", ontop=true, screen = s, height = 18, bg =
  276. beautiful.bg_normal})
  277.  
  278.     -- Виджеты слева сверху
  279.     local left_layout = wibox.layout.fixed.horizontal()
  280.     left_layout:add(spr)
  281.     left_layout:add(mypromptbox[s])
  282.  
  283.     -- Виджеты справа сверху
  284.     local right_layout_toggle = true
  285.     local function right_layout_add (...)
  286.         local arg = {...}
  287.         if right_layout_toggle then
  288.             right_layout:add(arrl_ld)
  289.             for i, n in pairs(arg) do
  290.                 right_layout:add(wibox.widget.background(n ,beautiful.bg_focus))
  291.             end
  292.         else
  293.             right_layout:add(arrl_dl)
  294.             for i, n in pairs(arg) do
  295.                 right_layout:add(n)
  296.             end
  297.         end
  298.         right_layout_toggle = not right_layout_toggle
  299.     end
  300.  
  301.     right_layout = wibox.layout.fixed.horizontal()
  302.     if s == 1 then
  303.         local systray = wibox.widget.systray()
  304.         local systray_margin = wibox.layout.margin()
  305.         systray_margin:set_margins(2)
  306.         systray_margin:set_widget(systray)
  307.         right_layout:add(systray_margin)
  308.     end
  309.     right_layout_add(mytaglist[s])
  310.     right_layout_add(kbdcfg.widget)
  311.     right_layout_add(memicon, memwidget)
  312.     right_layout_add(cpuicon, cpuwidget)
  313.     right_layout_add(fsicon, fswidget)
  314.     right_layout_add(neticon, netwidget)
  315.     right_layout_add(volicon, volumewidget)
  316.     right_layout_add(mytextclock, spr)
  317.     right_layout_add(powicon)
  318.     right_layout_add(mylayoutbox[s])
  319.  
  320.     -- Сборка вместе
  321.     local layout = wibox.layout.align.horizontal()
  322.     layout:set_left(left_layout)
  323.     layout:set_middle(mytasklist[s])
  324.     layout:set_right(right_layout)
  325.     mywibox[s]:set_widget(layout)
  326.  
  327. end
  328. -- }}}
  329.  
  330. -- {{{ Сочетания мыши
  331. root.buttons(awful.util.table.join())
  332. -- }}}
  333.  
  334. -- {{{ Сочетания клавиш клавиатуры
  335. globalkeys = awful.util.table.join(
  336.     -- скриншот
  337.      awful.key({ }, "Print", function () run_once("deepin-screenshot") end),
  338.  
  339.     -- смена тегов
  340.     awful.key({ modkey }, "Left",   awful.tag.viewprev       ),
  341.     awful.key({ modkey }, "Right",  awful.tag.viewnext       ),
  342.  
  343.     -- Громкость Pulseaudio
  344.     awful.key({ altkey }, "Up",
  345.         function ()
  346.             os.execute("pactl set-sink-volume 0 +5%")
  347.             os.execute("pactl set-sink-volume 1 +5%")
  348.             os.execute("pactl set-sink-volume 2 +5%")
  349.             volumewidget.update()
  350.         end),
  351.     awful.key({ altkey }, "Down",
  352.         function ()
  353.             os.execute("pactl set-sink-volume 0 -5%")
  354.             os.execute("pactl set-sink-volume 1 -5%")
  355.             os.execute("pactl set-sink-volume 2 -5%")
  356.             volumewidget.update()
  357.         end),
  358.     awful.key({ altkey }, "Left",
  359.         function ()
  360.             os.execute("pactl set-sink-volume 0 0%")
  361.             os.execute("pactl set-sink-volume 1 0%")
  362.             os.execute("pactl set-sink-volume 2 0%")
  363.             volumewidget.update()
  364.         end),
  365.     awful.key({ altkey }, "Right",
  366.         function ()
  367.             os.execute("pactl set-sink-volume 0 100%")
  368.             os.execute("pactl set-sink-volume 1 100%")
  369.             os.execute("pactl set-sink-volume 2 100%")
  370.             volumewidget.update()
  371.         end),
  372.  
  373.     -- Показать/скрыть Wibox
  374.     awful.key({ modkey }, "b", function ()
  375.         mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible
  376.     end),
  377.  
  378.     -- Запуск программ
  379.     awful.key({ modkey,           }, "Return", function () awful.util.spawn(terminal) end),
  380.     awful.key({ modkey,           }, "Delete", function () awful.util.spawn('nautilus') end),
  381.     awful.key({ modkey,           }, "End",    function () awful.util.spawn('sudo nautilus') end),
  382.     awful.key({ modkey,           }, "Insert", function () awful.util.spawn(editor) end),
  383.     awful.key({ modkey, "Control" }, "r",      awesome.restart),
  384.     awful.key({ modkey, "Shift"   }, "q",      awesome.quit),
  385.  
  386.     -- Блокировка
  387.     awful.key({ modkey,           }, "l",      function () awful.util.spawn("xtrlock") end),
  388.  
  389.     -- Терминал как часть таскбара
  390.     awful.key({ modkey,           }, "Shift_R",      function () drop(terminal) end),
  391.  
  392.     -- Смена раскладки
  393.     awful.key({ "Mod1" }, "Shift_L",           function () kbdcfg.switch() end),
  394.  
  395.     -- Копировать
  396.     awful.key({ modkey }, "c", function () os.execute("xsel -p -o | xsel -i -b") end),
  397.  
  398.     -- Консоль
  399.     awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
  400.     awful.key({ modkey }, "x",
  401.               function ()
  402.                   awful.prompt.run({ prompt = "Выполнить Lua-скрипт: " },
  403.                   mypromptbox[mouse.screen].widget,
  404.                   awful.util.eval, nil,
  405.                   awful.util.getdir("cache") .. "/history_eval")
  406.               end)
  407. )
  408.  
  409. clientkeys = awful.util.table.join(
  410.     awful.key({ modkey }, "F7", function(c) c.maximized_horizontal = not c.maximized_horizontal end),
  411.     awful.key({ modkey }, "F8", function(c) c.maximized_vertical   = not c.maximized_vertical end),
  412.     awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
  413.     awful.key({ modkey,           }, "q",      function (c) c:kill()                         end),
  414.     awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
  415.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  416.     awful.key({ modkey, "Control" }, "Delete", function () awful.util.spawn('gnome-system-monitor') end),
  417.     awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
  418.     awful.key({ modkey,           }, "t",      function (c) c.ontop = not c.ontop            end),
  419.     awful.key({ modkey,           }, "n",
  420.         function (c)
  421.             c.minimized = true
  422.         end),
  423.     awful.key({ modkey,           }, "m",
  424.         function (c)
  425.             c.maximized_horizontal = not c.maximized_horizontal
  426.             c.maximized_vertical   = not c.maximized_vertical
  427.         end)
  428. )
  429.  
  430. clientbuttons = awful.util.table.join(
  431.     awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  432.     awful.button({ modkey }, 1, awful.mouse.client.move),
  433.     awful.button({ modkey }, 3, awful.mouse.client.resize))
  434.  
  435. root.keys(globalkeys)
  436. -- }}}
  437.  
  438. -- {{{ Правила для окон
  439. awful.rules.rules = {
  440.     { rule = { },
  441.       properties = { border_width = beautiful.border_width,
  442.                      border_color = beautiful.border_normal,
  443.                      focus = awful.client.focus.filter,
  444.                      keys = clientkeys,
  445.                      buttons = clientbuttons,
  446.                  size_hints_honor = false,
  447.                  switchtotag = true } },
  448.     { rule = { class = "Nautilus",
  449.                instance = "desktop_window" },
  450.       properties = { maximized_vertical = true,
  451.                      maximized_horizontal = true,
  452.                      sticky = true } },
  453.     { rule = { instance = "nautilus" },
  454.       properties = { maximized_vertical = false,
  455.                      maximized_horizontal = false,
  456.                      sticky = false } },
  457.     { rule = { instance = "chrome"},
  458.       properties = { tag = tags[1][1] } },
  459.     { rule = { instance = "Telegram"},
  460.       properties = { tag = tags[1][2] } },
  461.     { rule = { instance = "skype"},
  462.       properties = { tag = tags[1][2] } },
  463.     { rule = { instance = "gimp"},
  464.       properties = { tag = tags[1][5] } },
  465.     { rule = { instance = "gnome-system-monitor"},
  466.       properties = { floating = true } },
  467.     { rule = { instance = "pavucontrol"},
  468.       properties = { floating = true } },
  469.     { rule = { instance = "gedit"},
  470.       properties = { tag = tags[1][4] } }
  471.     }
  472. -- }}}
  473.  
  474. -- {{{ Сигналы
  475. -- сигнальная функция для вызова при появлении новых окон
  476. local sloppyfocus_last = {c=nil}
  477.  
  478. client.connect_signal("manage", function (c, startup)
  479.     client.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.              if c ~= sloppyfocus_last.c then
  483.                  client.focus = c
  484.                  sloppyfocus_last.c = c
  485.              end
  486.          end
  487.     end)
  488.  
  489.     if not startup then
  490.         if not c.size_hints.user_position and not c.size_hints.program_position then
  491.             awful.placement.centered(c)
  492.             awful.placement.no_offscreen(c)
  493.         end
  494.     end
  495.  
  496.     local titlebars_enabled = false
  497.     if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
  498.         local buttons = awful.util.table.join(
  499.                 awful.button({ }, 1, function()
  500.                     client.focus = c
  501.                     c:raise()
  502.                     awful.mouse.client.move(c)
  503.                 end),
  504.                 awful.button({ }, 3, function()
  505.                     client.focus = c
  506.                     c:raise()
  507.                     awful.mouse.client.resize(c)
  508.                 end)
  509.                 )
  510.  
  511.         --
  512.         local right_layout = wibox.layout.fixed.horizontal()
  513.         right_layout:add(awful.titlebar.widget.floatingbutton(c))
  514.         right_layout:add(awful.titlebar.widget.maximizedbutton(c))
  515.         right_layout:add(awful.titlebar.widget.stickybutton(c))
  516.         right_layout:add(awful.titlebar.widget.ontopbutton(c))
  517.         right_layout:add(awful.titlebar.widget.closebutton(c))
  518.  
  519.         local middle_layout = wibox.layout.flex.horizontal()
  520.         local title = awful.titlebar.widget.titlewidget(c)
  521.         title:set_align("center")
  522.         middle_layout:add(title)
  523.         middle_layout:buttons(buttons)
  524.  
  525.         local layout = wibox.layout.align.horizontal()
  526.         layout:set_right(right_layout)
  527.         layout:set_middle(middle_layout)
  528.  
  529.         awful.titlebar(c,{size=16}):set_widget(layout)
  530.     end
  531. end)
  532.  
  533. floatgeoms = {}
  534.  
  535. tag.connect_signal("property::layout", function(t)
  536.     for k, c in ipairs(t:clients()) do
  537.         if ((awful.layout.get(mouse.screen) == awful.layout.suit.floating) or (awful.client.floating.get(c) == true)) then
  538.             c:geometry(floatgeoms[c.window])
  539.         end
  540.     end
  541. end)
  542.  
  543. client.connect_signal("property::geometry", function(c)
  544.     if ((awful.layout.get(mouse.screen) == awful.layout.suit.floating) or (awful.client.floating.get(c) == true)) then
  545.         floatgeoms[c.window] = c:geometry()
  546.     end
  547. end)
  548.  
  549. client.connect_signal("unmanage", function(c) floatgeoms[c.window] = nil end)    
  550.  
  551. client.connect_signal("manage", function(c)
  552.     if ((awful.layout.get(mouse.screen) == awful.layout.suit.floating) or (awful.client.floating.get(c) == true)) then
  553.         floatgeoms[c.window] = c:geometry()
  554.     end
  555. end)
  556.  
  557. client.connect_signal("focus",
  558.     function(c)
  559.         if c.maximized_horizontal == true and c.maximized_vertical == true then
  560.             c.border_color = beautiful.border_normal
  561.         else
  562.             c.border_color = beautiful.border_normal
  563.         end
  564.     end)
  565. client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  566. -- }}}
  567.  
  568. -- {{{
  569. for s = 1, screen.count() do screen[s]:connect_signal("arrange", function ()
  570.         local clients = awful.client.visible(s)
  571.         local layout  = awful.layout.getname(awful.layout.get(s))
  572.  
  573.         if #clients > 0 then
  574.             for _, c in pairs(clients) do
  575.                 if awful.client.floating.get(c) or layout == "floating" then
  576.                     c.border_width = beautiful.border_width
  577.  
  578.                 elseif #clients == 1 or layout == "max" then
  579.                     c.border_width = 0
  580.                 else
  581.                     c.border_width = beautiful.border_width
  582.                 end
  583.             end
  584.         end
  585.       end)
  586. end
  587. -- }}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement