Advertisement
Guest User

Untitled

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