Advertisement
Guest User

rc.lua

a guest
Aug 18th, 2020
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 26.14 KB | None | 0 0
  1. -- If LuaRocks is installed, make sure that packages installed through it are
  2. -- found (e.g. lgi). If LuaRocks is not installed, do nothing.
  3. pcall(require, "luarocks.loader")
  4.  
  5. -- Standard awesome library
  6. local gears = require("gears")
  7. local awful = require("awful")
  8. require("awful.autofocus")
  9. -- Widget and layout library
  10. local wibox = require("wibox")
  11. -- Theme handling library
  12. local beautiful = require("beautiful")
  13. -- Notification library
  14. local naughty = require("naughty")
  15. local menubar = require("menubar")
  16. local hotkeys_popup = require("awful.hotkeys_popup")
  17. -- Enable hotkeys help widget for VIM and other apps
  18. -- when client with a matching name is opened:
  19. require("awful.hotkeys_popup.keys")
  20. local volume_widget = require("awesome-wm-widgets.volume-widget.volume")
  21. local weather_widget = require("awesome-wm-widgets.weather-widget.weather")
  22.  
  23.  
  24. --xdg_menu = require("archmenu")
  25.  
  26. -- {{{ Error handling
  27. -- Check if awesome encountered an error during startup and fell back to
  28. -- another config (This code will only ever execute for the fallback config)
  29. if awesome.startup_errors then
  30.     naughty.notify({ preset = naughty.config.presets.critical,
  31.                      title = "Oops, there were errors during startup!",
  32.                      text = awesome.startup_errors })
  33. end
  34.  
  35. -- Handle runtime errors after startup
  36. do
  37.     local in_error = false
  38.     awesome.connect_signal("debug::error", function (err)
  39.         -- Make sure we don't go into an endless error loop
  40.         if in_error then return end
  41.         in_error = true
  42.  
  43.         naughty.notify({ preset = naughty.config.presets.critical,
  44.                          title = "Oops, an error happened!",
  45.                          text = tostring(err) })
  46.         in_error = false
  47.     end)
  48. end
  49. -- }}}
  50.  
  51. -- {{{ Variable definitions
  52. -- Themes define colours, icons, font and wallpapers.
  53. beautiful.init("/home/zoltar/.config/awesome/themes/default/theme.lua")
  54.  
  55. -- This is used later as the default terminal and editor to run.
  56. terminal = "xfce4-terminal"
  57. editor = "mousepad"
  58. editor_cmd = terminal .. " -e " .. editor
  59.  
  60. -- Default modkey.
  61. -- Usually, Mod4 is the key with a logo between Control and Alt.
  62. -- If you do not like this or do not have such a key,
  63. -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
  64. -- However, you can use another modifier like Mod1, but it may interact with others.
  65. modkey = "Mod4"
  66.  
  67. -- Table of layouts to cover with awful.layout.inc, order matters.
  68. awful.layout.layouts = {
  69.    
  70.     awful.layout.suit.tile,
  71.     awful.layout.suit.floating,
  72.    -- awful.layout.suit.tile.left,
  73.    -- awful.layout.suit.tile.bottom,
  74.    -- awful.layout.suit.tile.top,
  75.    -- awful.layout.suit.fair,
  76.    -- awful.layout.suit.fair.horizontal,
  77.    -- awful.layout.suit.spiral,
  78.     --awful.layout.suit.spiral.dwindle,
  79.     awful.layout.suit.max,
  80.     awful.layout.suit.max.fullscreen,
  81.    -- awful.layout.suit.magnifier,
  82.   --  awful.layout.suit.corner.nw,
  83.     -- awful.layout.suit.corner.ne,
  84.     -- awful.layout.suit.corner.sw,
  85.     -- awful.layout.suit.corner.se,
  86. }
  87. -- }}}
  88.  
  89. -- {{{ Menu
  90. -- Create a launcher widget and a main menu
  91. myawesomemenu = {
  92.    { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
  93.    { "manual", terminal .. " -e man awesome" },
  94.    { "edit config", editor_cmd .. " " .. awesome.conffile },
  95.    { "restart", awesome.restart },
  96.    { "quit", function() awesome.quit() end },
  97. }
  98.  
  99. mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
  100.                     { "Applications", "xfce4-appfinder" },
  101.                                     { "open terminal", terminal }
  102.                                   }
  103.                         })
  104.  
  105. mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
  106.                                      menu = mymainmenu })
  107.  
  108. -- Menubar configuration
  109. menubar.utils.terminal = terminal -- Set the terminal for applications that require it
  110. -- }}}
  111.  
  112. -- Keyboard map indicator and switcher
  113. mykeyboardlayout = awful.widget.keyboardlayout()
  114.  
  115. -- {{{ Wibar
  116. -- Create a textclock widget
  117. mytextclock = wibox.widget.textclock(" %a, %d %B | %H:%M ")
  118.  
  119. local calendar_widget = require("awesome-wm-widgets.calendar-widget.calendar")
  120. -- ...
  121. -- Create a textclock widget
  122. mytextclock = wibox.widget.textclock()
  123. -- default
  124. local cw = calendar_widget()
  125. -- or customized
  126. local cw = calendar_widget({
  127.     theme = 'nord',
  128.     placement = 'top_right'
  129. })
  130. mytextclock:connect_signal("button::press",
  131.     function(_, _, _, button)
  132.         if button == 1 then cw.toggle() end
  133.     end)
  134.  
  135. -- Create a wibox for each screen and add it
  136. local taglist_buttons = gears.table.join(
  137.                     awful.button({ }, 1, function(t) t:view_only() end),
  138.                     awful.button({ modkey }, 1, function(t)
  139.                                               if client.focus then
  140.                                                   client.focus:move_to_tag(t)
  141.                                               end
  142.                                           end),
  143.                     awful.button({ }, 3, awful.tag.viewtoggle),
  144.                     awful.button({ modkey }, 3, function(t)
  145.                                               if client.focus then
  146.                                                   client.focus:toggle_tag(t)
  147.                                               end
  148.                                           end),
  149.                     awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
  150.                     awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
  151.                 )
  152.  
  153. local tasklist_buttons = gears.table.join(
  154.                      awful.button({ }, 1, function (c)
  155.                                               if c == client.focus then
  156.                                                   c.minimized = true
  157.                                               else
  158.                                                   c:emit_signal(
  159.                                                       "request::activate",
  160.                                                       "tasklist",
  161.                                                       {raise = true}
  162.                                                   )
  163.                                               end
  164.                                           end),
  165.                      awful.button({ }, 3, function()
  166.                                               awful.menu.client_list({ theme = { width = 250 } })
  167.                                           end),
  168.                      awful.button({ }, 4, function ()
  169.                                               awful.client.focus.byidx(1)
  170.                                           end),
  171.                      awful.button({ }, 5, function ()
  172.                                               awful.client.focus.byidx(-1)
  173.                                           end))
  174.  
  175. local function set_wallpaper(s)
  176.     -- Wallpaper
  177.     if beautiful.wallpaper then
  178.         local wallpaper = beautiful.wallpaper
  179.         -- If wallpaper is a function, call it with the screen
  180.         if type(wallpaper) == "function" then
  181.             wallpaper = wallpaper(s)
  182.         end
  183.         gears.wallpaper.maximized(wallpaper, s, true)
  184.     end
  185. end
  186.  
  187. -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
  188. screen.connect_signal("property::geometry", set_wallpaper)
  189.  
  190. awful.screen.connect_for_each_screen(function(s)
  191.     -- Wallpaper
  192.     set_wallpaper(s)
  193.  
  194.     -- Each screen has its own tag table.
  195.     --awful.tag({ "Web", "Hdd", "Txt", "Rdm", "Img", "Vid", "Sys", "Top" }, s, awful.layout.layouts[1])
  196.  
  197.  
  198.  
  199.     awful.tag.add("",{
  200.     icon = "/home/zoltar/Pictures/interface/tags/firefox.png",
  201.     layout = awful.layout.suit.tile,
  202.     screen = s,
  203.     })
  204.     awful.tag.add("",{
  205.     icon = "/home/zoltar/Pictures/interface/tags/hdd.png",
  206.     layout = awful.layout.suit.tile,
  207.     screen = s,
  208.     })
  209.     awful.tag.add("", {
  210.     icon = "/home/zoltar/Pictures/interface/tags/txt.png",
  211.     layout = awful.layout.suit.tile,
  212.     screen = s,
  213.     })
  214.     awful.tag.add("", {
  215.     icon = "/home/zoltar/Pictures/interface/tags/gimp.png",
  216.     layout = awful.layout.suit.tile,
  217.     screen = s,
  218.     })
  219.     awful.tag.add("", {
  220.     icon = "/home/zoltar/Pictures/interface/tags/rdm.png",
  221.     layout = awful.layout.suit.tile,
  222.     screen = s,
  223.     })
  224.     awful.tag.add("", {
  225.     icon = "/home/zoltar/Pictures/interface/tags/sys.png",
  226.     layout = awful.layout.suit.tile,
  227.     screen = s,
  228.     })
  229.     awful.tag.add("", {
  230.     icon = "/home/zoltar/Pictures/interface/tags/top.png",
  231.     layout = awful.layout.suit.tile,
  232.     screen = s,
  233.     })
  234.  
  235.  
  236.  
  237.  
  238.     -- Create a promptbox for each screen
  239.     s.mypromptbox = awful.widget.prompt()
  240.     -- Create an imagebox widget which will contain an icon indicating which layout we're using.
  241.     -- We need one layoutbox per screen.
  242.     s.mylayoutbox = awful.widget.layoutbox(s)
  243.     s.mylayoutbox:buttons(gears.table.join(
  244.                            awful.button({ }, 1, function () awful.layout.inc( 1) end),
  245.                            awful.button({ }, 3, function () awful.layout.inc(-1) end),
  246.                            awful.button({ }, 4, function () awful.layout.inc( 1) end),
  247.                            awful.button({ }, 5, function () awful.layout.inc(-1) end)))
  248.     -- Create a taglist widget
  249.     s.mytaglist = awful.widget.taglist {
  250.         screen  = s,
  251.         filter  = awful.widget.taglist.filter.all,
  252.         buttons = taglist_buttons
  253.     }
  254.  
  255.     -- Create a tasklist widget
  256.     s.mytasklist = awful.widget.tasklist {
  257.         screen  = s,
  258.         filter  = awful.widget.tasklist.filter.currenttags,
  259.         buttons = tasklist_buttons
  260.     }
  261.  
  262. local vert_sep = wibox.widget {
  263.     widget = wibox.widget.separator,
  264.     orientation = "vertical",
  265.     forced_width = 5,
  266.     color = "#222D3200",
  267. }
  268.  
  269.     -- Create the wibox
  270.     s.mywibox = awful.wibar({ position = "top", y = "5", height = "21", width = "1520",shape = gears.shape.rounded_rect, border_width = "1", border_color = "#222d32", screen = s })
  271.     --s.mywibox2 = awful.wibar({ position = "bottom", height = "9", screen = 1, bg = "222D3200" })
  272.  
  273.     -- Add widgets to the wibox
  274.     s.mywibox:setup {
  275.         layout = wibox.layout.align.horizontal,
  276.         { -- Left widgets
  277.             layout = wibox.layout.fixed.horizontal,
  278.             --mylauncher,
  279.          vert_sep,
  280.             s.mytaglist,
  281.             s.mypromptbox,
  282.         },
  283.         s.mytasklist, -- Middle widget
  284.         { -- Right widgets
  285.             mytextclock,
  286.         vert_sep,
  287.             layout = wibox.layout.fixed.horizontal,
  288.             --mykeyboardlayout,
  289.             volume_widget({display_notification = true}),
  290.             --vert_sep,
  291.            -- weather_widget({
  292.               --  api_key='765942bba75ca4777eeba10c5e8433e7',
  293.                -- coordinates = {43.2744, 5.4218},
  294.         --  font_name = 'Noto Sans Regular',
  295.     --  icons = 'weather-underground-icons',
  296.    -- show_hourly_forecast = false,
  297.    -- show_daily_forecast = true,
  298.        
  299.     --        }),
  300.             vert_sep,
  301.  
  302.             s.mylayoutbox,
  303.         vert_sep,
  304.             wibox.widget.systray(),
  305.         },
  306.     }
  307. end)
  308. -- }}}
  309.  
  310. -- {{{ Mouse bindings
  311. root.buttons(gears.table.join(
  312.     awful.button({ }, 3, function () mymainmenu:toggle() end),
  313.     awful.button({ }, 4, awful.tag.viewnext),
  314.     awful.button({ }, 5, awful.tag.viewprev)
  315. ))
  316. -- }}}
  317.  
  318. -- {{{ Key bindings
  319. globalkeys = gears.table.join(
  320.     awful.key({ modkey,           }, "s",      hotkeys_popup.show_help,
  321.               {description="show help", group="awesome"}),
  322.     awful.key({ modkey,           }, "Left",   awful.tag.viewprev,
  323.               {description = "view previous", group = "tag"}),
  324.     awful.key({ modkey,           }, "Right",  awful.tag.viewnext,
  325.               {description = "view next", group = "tag"}),
  326.     awful.key({ modkey,           }, "Escape", awful.tag.history.restore,
  327.               {description = "go back", group = "tag"}),
  328.  
  329.     awful.key({ modkey,           }, "j",
  330.         function ()
  331.             awful.client.focus.byidx( 1)
  332.         end,
  333.         {description = "focus next by index", group = "client"}
  334.     ),
  335.     awful.key({ modkey,           }, "k",
  336.         function ()
  337.             awful.client.focus.byidx(-1)
  338.         end,
  339.         {description = "focus previous by index", group = "client"}
  340.     ),
  341.     awful.key({ modkey,           }, "w", function () mymainmenu:show() end,
  342.               {description = "show main menu", group = "awesome"}),
  343.  
  344.     -- Layout manipulation
  345.     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end,
  346.               {description = "swap with next client by index", group = "client"}),
  347.     awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end,
  348.               {description = "swap with previous client by index", group = "client"}),
  349.     awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
  350.               {description = "focus the next screen", group = "screen"}),
  351.     awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
  352.               {description = "focus the previous screen", group = "screen"}),
  353.     awful.key({ modkey,           }, "u", awful.client.urgent.jumpto,
  354.               {description = "jump to urgent client", group = "client"}),
  355.     awful.key({ modkey,           }, "Tab",
  356.         function ()
  357.             awful.client.focus.history.previous()
  358.             if client.focus then
  359.                 client.focus:raise()
  360.             end
  361.         end,
  362.         {description = "go back", group = "client"}),
  363.  
  364.     -- Standard program
  365.     awful.key({ modkey,           }, "Return", function () awful.spawn(terminal) end,
  366.               {description = "open a terminal", group = "launcher"}),
  367.     awful.key({ modkey, "Control" }, "r", awesome.restart,
  368.               {description = "reload awesome", group = "awesome"}),
  369.     awful.key({ modkey, "Shift"   }, "q", awesome.quit,
  370.               {description = "quit awesome", group = "awesome"}),
  371.  
  372.     awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)          end,
  373.               {description = "increase master width factor", group = "layout"}),
  374.     awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)          end,
  375.               {description = "decrease master width factor", group = "layout"}),
  376.     awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1, nil, true) end,
  377.               {description = "increase the number of master clients", group = "layout"}),
  378.     awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1, nil, true) end,
  379.               {description = "decrease the number of master clients", group = "layout"}),
  380.     awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1, nil, true)    end,
  381.               {description = "increase the number of columns", group = "layout"}),
  382.     awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1, nil, true)    end,
  383.               {description = "decrease the number of columns", group = "layout"}),
  384.     awful.key({ modkey,           }, "space", function () awful.layout.inc( 1)                end,
  385.               {description = "select next", group = "layout"}),
  386.     awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(-1)                end,
  387.               {description = "select previous", group = "layout"}),
  388.  
  389.     awful.key({ modkey, "Control" }, "n",
  390.               function ()
  391.                   local c = awful.client.restore()
  392.                   -- Focus restored client
  393.                   if c then
  394.                     c:emit_signal(
  395.                         "request::activate", "key.unminimize", {raise = true}
  396.                     )
  397.                   end
  398.               end,
  399.               {description = "restore minimized", group = "client"}),
  400.  
  401.     -- Prompt
  402.     awful.key({ modkey },            "r",     function () awful.screen.focused().mypromptbox:run() end,
  403.               {description = "run prompt", group = "launcher"}),
  404.  
  405.     awful.key({ modkey }, "x",
  406.               function ()
  407.                   awful.prompt.run {
  408.                     prompt       = "Run Lua code: ",
  409.                     textbox      = awful.screen.focused().mypromptbox.widget,
  410.                     exe_callback = awful.util.eval,
  411.                     history_path = awful.util.get_cache_dir() .. "/history_eval"
  412.                   }
  413.               end,
  414.               {description = "lua execute prompt", group = "awesome"}),
  415.     -- Menubar
  416.     awful.key({ modkey }, "p", function() menubar.show() end,
  417.               {description = "show the menubar", group = "launcher"})
  418. )
  419.  
  420. clientkeys = gears.table.join(
  421.     awful.key({ modkey,           }, "f",
  422.         function (c)
  423.             c.fullscreen = not c.fullscreen
  424.             c:raise()
  425.         end,
  426.         {description = "toggle fullscreen", group = "client"}),
  427.     awful.key({ modkey, "Shift"   }, "x",      function (c) c:kill()                         end,
  428.               {description = "close", group = "client"}),
  429.     awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ,
  430.               {description = "toggle floating", group = "client"}),
  431.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
  432.               {description = "move to master", group = "client"}),
  433.     awful.key({ modkey,           }, "o",      function (c) c:move_to_screen()               end,
  434.               {description = "move to screen", group = "client"}),
  435.     awful.key({ modkey,           }, "t",      function (c) c.ontop = not c.ontop            end,
  436.               {description = "toggle keep on top", group = "client"}),
  437.     awful.key({ modkey,           }, "n",
  438.         function (c)
  439.             -- The client currently has the input focus, so it cannot be
  440.             -- minimized, since minimized clients can't have the focus.
  441.             c.minimized = true
  442.         end ,
  443.         {description = "minimize", group = "client"}),
  444.     awful.key({ modkey,           }, "m",
  445.         function (c)
  446.             c.maximized = not c.maximized
  447.             c:raise()
  448.         end ,
  449.         {description = "(un)maximize", group = "client"}),
  450.     awful.key({ modkey, "Control" }, "m",
  451.         function (c)
  452.             c.maximized_vertical = not c.maximized_vertical
  453.             c:raise()
  454.         end ,
  455.         {description = "(un)maximize vertically", group = "client"}),
  456.     awful.key({ modkey, "Shift"   }, "m",
  457.         function (c)
  458.             c.maximized_horizontal = not c.maximized_horizontal
  459.             c:raise()
  460.         end ,
  461.         {description = "(un)maximize horizontally", group = "client"})
  462. )
  463.  
  464. -- Bind all key numbers to tags.
  465. -- Be careful: we use keycodes to make it work on any keyboard layout.
  466. -- This should map on the top row of your keyboard, usually 1 to 9.
  467. for i = 1, 9 do
  468.     globalkeys = gears.table.join(globalkeys,
  469.         -- View tag only.
  470.         awful.key({ modkey }, "#" .. i + 9,
  471.                   function ()
  472.                         local screen = awful.screen.focused()
  473.                         local tag = screen.tags[i]
  474.                         if tag then
  475.                            tag:view_only()
  476.                         end
  477.                   end,
  478.                   {description = "view tag #"..i, group = "tag"}),
  479.         -- Toggle tag display.
  480.         awful.key({ modkey, "Control" }, "#" .. i + 9,
  481.                   function ()
  482.                       local screen = awful.screen.focused()
  483.                       local tag = screen.tags[i]
  484.                       if tag then
  485.                          awful.tag.viewtoggle(tag)
  486.                       end
  487.                   end,
  488.                   {description = "toggle tag #" .. i, group = "tag"}),
  489.         -- Move client to tag.
  490.         awful.key({ modkey, "Shift" }, "#" .. i + 9,
  491.                   function ()
  492.                       if client.focus then
  493.                           local tag = client.focus.screen.tags[i]
  494.                           if tag then
  495.                               client.focus:move_to_tag(tag)
  496.                           end
  497.                      end
  498.                   end,
  499.                   {description = "move focused client to tag #"..i, group = "tag"}),
  500.         -- Toggle tag on focused client.
  501.         awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  502.                   function ()
  503.                       if client.focus then
  504.                           local tag = client.focus.screen.tags[i]
  505.                           if tag then
  506.                               client.focus:toggle_tag(tag)
  507.                           end
  508.                       end
  509.                   end,
  510.                   {description = "toggle focused client on tag #" .. i, group = "tag"})
  511.     )
  512. end
  513.  
  514. clientbuttons = gears.table.join(
  515.     awful.button({ }, 1, function (c)
  516.         c:emit_signal("request::activate", "mouse_click", {raise = true})
  517.     end),
  518.     awful.button({ modkey }, 1, function (c)
  519.         c:emit_signal("request::activate", "mouse_click", {raise = true})
  520.         awful.mouse.client.move(c)
  521.     end),
  522.     awful.button({ modkey }, 3, function (c)
  523.         c:emit_signal("request::activate", "mouse_click", {raise = true})
  524.         awful.mouse.client.resize(c)
  525.     end)
  526. )
  527.  
  528. -- Set keys
  529. root.keys(globalkeys)
  530. -- }}}
  531.  
  532. -- {{{ Rules
  533. -- Rules to apply to new clients (through the "manage" signal).
  534. awful.rules.rules = {
  535.     -- All clients will match this rule.
  536.     { rule = { },
  537.       properties = { border_width = beautiful.border_width,
  538.                      border_color = beautiful.border_normal,
  539.                      focus = awful.client.focus.filter,
  540.                      raise = true,
  541.                      keys = clientkeys,
  542.                      buttons = clientbuttons,
  543.                      screen = awful.screen.preferred,
  544.                      placement = awful.placement.no_overlap+awful.placement.no_offscreen
  545.      }
  546.     },
  547.  
  548.     -- Floating clients.
  549.     { rule_any = {
  550.         instance = {
  551.           "DTA",  -- Firefox addon DownThemAll.
  552.           "copyq",  -- Includes session name in class.
  553.           "pinentry",
  554.       "galculator",
  555.         },
  556.         class = {
  557.           "Arandr",
  558.           "Blueman-manager",
  559.       "galculator",
  560.           "Gpick",
  561.           "Kruler",
  562.           "MessageWin",  -- kalarm.
  563.           "Sxiv",
  564.           "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size.
  565.           "Wpa_gui",
  566.           "veromix",
  567.           "xtightvncviewer"},
  568.  
  569.         -- Note that the name property shown in xprop might be set slightly after creation of the client
  570.         -- and the name shown there might not match defined rules here.
  571.         name = {
  572.           "Event Tester",  -- xev.
  573.         },
  574.         role = {
  575.           "AlarmWindow",  -- Thunderbird's calendar.
  576.           "ConfigManager",  -- Thunderbird's about:config.
  577.           "pop-up",       -- e.g. Google Chrome's (detached) Developer Tools.
  578.         }
  579.       }, properties = { floating = true }},
  580.  
  581.     -- Add titlebars to normal clients and dialogs
  582.     { rule_any = {type = { "normal", "dialog" }
  583.     }, properties = { titlebars_enabled = true }
  584.     },
  585.  
  586.     -- Set Firefox to always map on the tag named "2" on screen 1.
  587.  
  588.  
  589. }
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596. -- }}}
  597.  
  598. -- {{{ Signals
  599. -- Signal function to execute when a new client appears.
  600. client.connect_signal("manage", function (c)
  601.     -- Set the windows at the slave,
  602.     -- i.e. put it at the end of others instead of setting it master.
  603.     -- if not awesome.startup then awful.client.setslave(c) end
  604.  
  605.     if awesome.startup
  606.       and not c.size_hints.user_position
  607.       and not c.size_hints.program_position then
  608.         -- Prevent clients from being unreachable after screen count changes.
  609.         awful.placement.no_offscreen(c)
  610.     end
  611. end)
  612.  
  613. -- Add a titlebar if titlebars_enabled is set to true in the rules.
  614. client.connect_signal("request::titlebars", function(c)
  615.  
  616. c.shape = gears.shape.rounded_rect
  617.  
  618.     -- buttons for the titlebar
  619.     local buttons = gears.table.join(
  620.         awful.button({ }, 1, function()
  621.             c:emit_signal("request::activate", "titlebar", {raise = true})
  622.             awful.mouse.client.move(c)
  623.         end),
  624.         awful.button({ }, 3, function()
  625.             c:emit_signal("request::activate", "titlebar", {raise = true})
  626.             awful.mouse.client.resize(c)
  627.         end)
  628.     )
  629.  
  630.     awful.titlebar(c) : setup {
  631.         { -- Left
  632.             awful.titlebar.widget.iconwidget(c),
  633.             buttons = buttons,
  634.             layout  = wibox.layout.fixed.horizontal
  635.         },
  636.         { -- Middle
  637.             { -- Title
  638.                 align  = "center",
  639.                 widget = awful.titlebar.widget.titlewidget(c)
  640.             },
  641.             buttons = buttons,
  642.             layout  = wibox.layout.flex.horizontal
  643.         },
  644.         { -- Right
  645.        awful.titlebar.widget.floatingbutton (c),
  646.             awful.titlebar.widget.minimizebutton (c),
  647.             awful.titlebar.widget.maximizedbutton(c),
  648.             awful.titlebar.widget.stickybutton   (c),
  649.             awful.titlebar.widget.ontopbutton    (c),
  650.             awful.titlebar.widget.closebutton    (c),
  651.             layout = wibox.layout.fixed.horizontal()
  652.         },
  653.         layout = wibox.layout.align.horizontal
  654.     }
  655. end)
  656.  
  657. -- Enable sloppy focus, so that focus follows mouse.
  658. client.connect_signal("mouse::enter", function(c)
  659.     c:emit_signal("request::activate", "mouse_enter", {raise = false})
  660. end)
  661.  
  662.  
  663. -- runonce
  664.  
  665. function run_once(cmd)
  666.   findme = cmd
  667.   firstspace = cmd:find(" ")
  668.   if firstspace then
  669.     findme = cmd:sub(0, firstspace-1)
  670.   end
  671.   awful.spawn.with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. cmd .. ")")
  672. end
  673. --run_once("killall conky")
  674. --run_once("psensor")
  675. run_once("nm-applet")
  676. run_once("xfce4-volumed")
  677. --run_once("start-pulseaudio-x11")
  678. run_once("xfsettingsd")
  679. --run_once("compton --config .compton.conf")
  680. --run_once("picom")
  681. run_once("blueman-tray")
  682. --run_once("conky")
  683. run_once("nvidia-settings --load-config-only")
  684.  
  685. client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  686. client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  687. -- }}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement