h8uthemost

rc.lua

Aug 29th, 2025
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.15 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.  
  12. -- Theme handling library
  13. local beautiful = require("beautiful")
  14. -- Notification library
  15. local naughty = require("naughty")
  16. local menubar = require("menubar")
  17. local hotkeys_popup = require("awful.hotkeys_popup")
  18. -- Enable hotkeys help widget for VIM and other apps
  19. -- when client with a matching name is opened:
  20. require("awful.hotkeys_popup.keys")
  21.  
  22. -- Load Debian menu entries
  23. local debian = require("debian.menu")
  24. local has_fdo, freedesktop = pcall(require, "freedesktop")
  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(gears.filesystem.get_themes_dir() .. "zenburn/theme.lua")
  54.  
  55. -- This is used later as the default terminal and editor to run.
  56. terminal = "kitty"
  57. editor = os.getenv("EDITOR") or "editor"
  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. awful.layout.suit.tile.left,
  70. awful.layout.suit.tile.bottom,
  71. awful.layout.suit.tile.top,
  72. awful.layout.suit.fair,
  73. awful.layout.suit.fair.horizontal,
  74. awful.layout.suit.spiral,
  75. awful.layout.suit.spiral.dwindle,
  76. awful.layout.suit.max,
  77. awful.layout.suit.max.fullscreen,
  78. awful.layout.suit.magnifier,
  79. awful.layout.suit.corner.nw,
  80. awful.layout.suit.floating,
  81. -- awful.layout.suit.corner.ne,
  82. -- awful.layout.suit.corner.sw,
  83. -- awful.layout.suit.corner.se,
  84. }
  85. -- }}}
  86.  
  87. -- {{{ Menu
  88. -- Create a launcher widget and a main menu
  89. myawesomemenu = {
  90. { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
  91. { "manual", terminal .. " -e man awesome" },
  92. { "edit config", editor_cmd .. " " .. awesome.conffile },
  93. { "restart", awesome.restart },
  94. { "quit", function() awesome.quit() end },
  95. }
  96.  
  97. local menu_awesome = { "awesome", myawesomemenu, beautiful.awesome_icon }
  98. local menu_terminal = { "open terminal", terminal }
  99.  
  100. if has_fdo then
  101. mymainmenu = freedesktop.menu.build({
  102. before = { menu_awesome },
  103. after = { menu_terminal }
  104. })
  105. else
  106. mymainmenu = awful.menu({
  107. items = {
  108. menu_awesome,
  109. { "Debian", debian.menu.Debian_menu.Debian },
  110. menu_terminal,
  111. }
  112. })
  113. end
  114.  
  115.  
  116. mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
  117. menu = mymainmenu })
  118.  
  119. -- Menubar configuration
  120. menubar.utils.terminal = terminal -- Set the terminal for applications that require it
  121. -- }}}
  122.  
  123. -- Keyboard map indicator and switcher
  124. mykeyboardlayout = awful.widget.keyboardlayout()
  125. local battery_widget = require("battery-widget")
  126.  
  127.  
  128. -- {{{ Wibar
  129. -- Create a textclock widget
  130. mytextclock = wibox.widget.textclock()
  131.  
  132.  
  133. -- Create a wibox for each screen and add it
  134. local taglist_buttons = gears.table.join(
  135. awful.button({ }, 1, function(t) t:view_only() end),
  136. awful.button({ modkey }, 1, function(t)
  137. if client.focus then
  138. client.focus:move_to_tag(t)
  139. end
  140. end),
  141. awful.button({ }, 3, awful.tag.viewtoggle),
  142. awful.button({ modkey }, 3, function(t)
  143. if client.focus then
  144. client.focus:toggle_tag(t)
  145. end
  146. end),
  147. awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
  148. awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
  149. )
  150.  
  151. local tasklist_buttons = gears.table.join(
  152. awful.button({ }, 1, function (c)
  153. if c == client.focus then
  154. c.minimized = true
  155. else
  156. c:emit_signal(
  157. "request::activate",
  158. "tasklist",
  159. {raise = true}
  160. )
  161. end
  162. end),
  163. awful.button({ }, 3, function()
  164. awful.menu.client_list({ theme = { width = 250 } })
  165. end),
  166. awful.button({ }, 4, function ()
  167. awful.client.focus.byidx(1)
  168. end),
  169. awful.button({ }, 5, function ()
  170. awful.client.focus.byidx(-1)
  171. end))
  172.  
  173. local function set_wallpaper(s)
  174. -- Wallpaper
  175. if beautiful.wallpaper then
  176. local wallpaper = beautiful.wallpaper
  177. -- If wallpaper is a function, call it with the screen
  178. if type(wallpaper) == "function" then
  179. wallpaper = wallpaper(s)
  180. end
  181. gears.wallpaper.maximized(wallpaper, s, true)
  182. end
  183. end
  184.  
  185. -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
  186. screen.connect_signal("property::geometry", set_wallpaper)
  187.  
  188. awful.screen.connect_for_each_screen(function(s)
  189. -- Wallpaper
  190. set_wallpaper(s)
  191.  
  192. -- Each screen has its own tag table.
  193. awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1])
  194.  
  195. -- Create a promptbox for each screen
  196. s.mypromptbox = awful.widget.prompt()
  197. -- Create an imagebox widget which will contain an icon indicating which layout we're using.
  198. -- We need one layoutbox per screen.
  199. s.mylayoutbox = awful.widget.layoutbox(s)
  200. s.mylayoutbox:buttons(gears.table.join(
  201. awful.button({ }, 1, function () awful.layout.inc( 1) end),
  202. awful.button({ }, 3, function () awful.layout.inc(-1) end),
  203. awful.button({ }, 4, function () awful.layout.inc( 1) end),
  204. awful.button({ }, 5, function () awful.layout.inc(-1) end)))
  205. -- Create a taglist widget
  206. s.mytaglist = awful.widget.taglist {
  207. screen = s,
  208. filter = awful.widget.taglist.filter.all,
  209. buttons = taglist_buttons
  210. }
  211.  
  212. -- Create a tasklist widget
  213. s.mytasklist = awful.widget.tasklist {
  214. screen = s,
  215. filter = awful.widget.tasklist.filter.currenttags,
  216. buttons = tasklist_buttons
  217. }
  218.  
  219. -- Create the wibox
  220. s.mywibox = awful.wibar({ position = "top", screen = s })
  221.  
  222. -- Add widgets to the wibox
  223. s.mywibox:setup {
  224. layout = wibox.layout.align.horizontal,
  225. { -- Left widgets
  226. layout = wibox.layout.fixed.horizontal,
  227. mylauncher,
  228. s.mytaglist,
  229. s.mypromptbox,
  230. },
  231. s.mytasklist, -- Middle widget
  232.  
  233. { -- Right widgets
  234. battery_widget {},
  235. mem_widget,
  236. ram_widget,
  237. brightness_widget,
  238. layout = wibox.layout.fixed.horizontal,
  239. mykeyboardlayout,
  240. wibox.widget.systray(),
  241. mytextclock,
  242. s.mylayoutbox,
  243.  
  244.  
  245. },
  246. }
  247. end)
  248. -- }}}
  249.  
  250. -- {{{ Mouse bindings
  251. root.buttons(gears.table.join(
  252. awful.button({ }, 3, function () mymainmenu:toggle() end),
  253. awful.button({ }, 4, awful.tag.viewnext),
  254. awful.button({ }, 5, awful.tag.viewprev)
  255. ))
  256. -- }}}
  257.  
  258. -- {{{ Key bindings
  259. globalkeys = gears.table.join(
  260. awful.key({ modkey, }, "s", hotkeys_popup.show_help,
  261. {description="show help", group="awesome"}),
  262. awful.key({ modkey, }, "Left", awful.tag.viewprev,
  263. {description = "view previous", group = "tag"}),
  264. awful.key({ modkey, }, "Right", awful.tag.viewnext,
  265. {description = "view next", group = "tag"}),
  266. awful.key({ modkey, }, "Escape", awful.tag.history.restore,
  267. {description = "go back", group = "tag"}),
  268.  
  269. awful.key({ modkey, }, "j",
  270. function ()
  271. awful.client.focus.byidx( 1)
  272. end,
  273. {description = "focus next by index", group = "client"}
  274. ),
  275. awful.key({ modkey, }, "k",
  276. function ()
  277. awful.client.focus.byidx(-1)
  278. end,
  279. {description = "focus previous by index", group = "client"}
  280. ),
  281. awful.key({ modkey, }, "w", function () mymainmenu:show() end,
  282. {description = "show main menu", group = "awesome"}),
  283.  
  284. -------------------------Custom Keybinds---------------------
  285. awful.key({ "Mod1" }, "f", function() awful.spawn.with_shell("firefox") naughty.notify({text ="Launching Firefox"}) end, {description = "Firefox", group = "launcher"}),
  286.  
  287. awful.key({ "Mod1" }, "p", function() awful.spawn.with_shell("pcmanfm") naughty.notify({text ="Launching Pcmanfm"}) end, {description = "Pcmanfm", group = "launcher"}),
  288.  
  289. awful.key({ "Mod1" }, "d", function() awful.spawn.with_shell("dmenu_run") naughty.notify({text ="Launching dmenu"}) end, {description = "dmenu", group = "launcher"}),
  290.  
  291. awful.key({ "Mod1" }, "a", function() awful.spawn.with_shell("kitty -e ranger") naughty.notify({text ="Launching Ranger"}) end, {description = "ranger", group = "launcher"}),
  292.  
  293. awful.key({ "Mod1" }, "Return", function() awful.spawn.with_shell("alacritty") naughty.notify({text ="Launching Alacritty"}) end, {description = "alacritty", group = "launcher"}),
  294.  
  295. awful.key({ "Mod1" }, "r", function() awful.spawn.with_shell("kitty -e rtorrent") naughty.notify({text ="Launching Rtorrent"}) end, {description = "rtorrent", group = "launcher"}),
  296.  
  297. awful.key({ "Mod1" }, "e", function() awful.spawn.with_shell("thunderbird") naughty.notify({text ="Launching Thunderbird"}) end, {description = "Thunderbird", group = "launcher"}),
  298.  
  299. awful.key({ "Mod1" }, "n", function() awful.spawn.with_shell("nicotine") naughty.notify({text ="Launching Nicotine+"}) end, {description = "Nicotine+", group = "launcher"}),
  300.  
  301. awful.key({ "Mod1" }, "s", function() awful.spawn.with_shell("soundconverter") naughty.notify({text ="Launching Soundconverter"}) end, {description = "Sounconverter", group = "launcher"}),
  302.  
  303. awful.key({ "Mod1" }, "t", function() awful.spawn.with_shell("thunar") naughty.notify({text ="Launching Thunar"}) end, {description = "Thunar", group = "launcher"}),
  304.  
  305. awful.key({ "Mod1" }, "v", function() awful.spawn.with_shell("vivaldi") naughty.notify({text ="Launching Vivaldi"}) end, {description = "Vivaldi", group = "launcher"}),
  306.  
  307. awful.key({ "Mod1" }, "Up", function() awful.spawn.with_shell("amixer set Master 2%+") naughty.notify({text ="Volume Increase"}) end, {description = "Volume", group = "launcher"}),
  308.  
  309. awful.key({ "Mod1" }, "Down", function() awful.spawn.with_shell("amixer set Master 2%-") naughty.notify({text ="Volume Decrease"}) end, {description = "Volume", group = "launcher"}),
  310. awful.key({ modkey }, ";", function () brightness_widget:inc() end, {description = "increase brightness", group = "custom"}),
  311. awful.key({ modkey, "Shift"}, ";", function () brightness_widget:dec() end, {description = "decrease brightness", group = "custom"}),
  312.  
  313.  
  314. --------------------Toggle the Wibar--------------------
  315. awful.key({modkey,}, "b", function() awful.screen.focused().mywibox.visible = not awful.screen.focused().mywibox.visible end),
  316.  
  317.  
  318. ------------------------------Custom Movement-----------------------
  319.  
  320. awful.key({modkey, }, "Left",
  321. function ()
  322. awful.client.focus.byidx( 1)
  323. end,
  324. {description = "focus next by index", group = "client"}
  325. ),
  326. awful.key({ modkey, }, "Right",
  327. function ()
  328. awful.client.focus.byidx( -1)
  329. end,
  330. {description = "focus next by index", group = "client"}
  331. ),
  332. awful.key({ modkey, "Shift" }, "Left", function () awful.client.swap.byidx( 1) end,
  333. {description = "swap with next client by index", group = "client"}),
  334. awful.key({ modkey, "Shift" }, "Right", function () awful.client.swap.byidx( -1) end,
  335. {description = "swap with previous client by index", group = "client"}),
  336.  
  337. awful.key({ modkey, "Control" }, "Right", function () awful.tag.incmwfact( 0.05) end,
  338. {description = "increase master width factor", group = "layout"}),
  339. awful.key({ modkey, "Control" }, "Left", function () awful.tag.incmwfact( -0.05) end,
  340. {description = "decrease master width factor", group = "layout"}),
  341.  
  342.  
  343. -- Layout manipulation
  344. awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
  345. {description = "swap with next client by index", group = "client"}),
  346. awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
  347. {description = "swap with previous client by index", group = "client"}),
  348. awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
  349. {description = "focus the next screen", group = "screen"}),
  350. awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
  351. {description = "focus the previous screen", group = "screen"}),
  352. awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
  353. {description = "jump to urgent client", group = "client"}),
  354. awful.key({ modkey, }, "Tab",
  355. function ()
  356. awful.client.focus.history.previous()
  357. if client.focus then
  358. client.focus:raise()
  359. end
  360. end,
  361. {description = "go back", group = "client"}),
  362.  
  363. -- Standard program
  364. awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
  365. {description = "open a terminal", group = "launcher"}),
  366. awful.key({ modkey, "Control" }, "r", awesome.restart,
  367. {description = "reload awesome", group = "awesome"}),
  368. awful.key({ modkey, "Shift" }, "q", awesome.quit,
  369. {description = "quit awesome", group = "awesome"}),
  370.  
  371. awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
  372. {description = "increase master width factor", group = "layout"}),
  373. awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
  374. {description = "decrease master width factor", group = "layout"}),
  375. awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
  376. {description = "increase the number of master clients", group = "layout"}),
  377. awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
  378. {description = "decrease the number of master clients", group = "layout"}),
  379. awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
  380. {description = "increase the number of columns", group = "layout"}),
  381. awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
  382. {description = "decrease the number of columns", group = "layout"}),
  383. awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end,
  384. {description = "select next", group = "layout"}),
  385. awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
  386. {description = "select previous", group = "layout"}),
  387.  
  388. awful.key({ modkey, "Control" }, "n",
  389. function ()
  390. local c = awful.client.restore()
  391. -- Focus restored client
  392. if c then
  393. c:emit_signal(
  394. "request::activate", "key.unminimize", {raise = true}
  395. )
  396. end
  397. end,
  398. {description = "restore minimized", group = "client"}),
  399.  
  400. -- Prompt
  401. awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
  402. {description = "run prompt", group = "launcher"}),
  403.  
  404. awful.key({ modkey }, "x",
  405. function ()
  406. awful.prompt.run {
  407. prompt = "Run Lua code: ",
  408. textbox = awful.screen.focused().mypromptbox.widget,
  409. exe_callback = awful.util.eval,
  410. history_path = awful.util.get_cache_dir() .. "/history_eval"
  411. }
  412. end,
  413. {description = "lua execute prompt", group = "awesome"}),
  414. -- Menubar
  415. awful.key({ modkey }, "p", function() menubar.show() end,
  416. {description = "show the menubar", group = "launcher"})
  417. )
  418.  
  419. clientkeys = gears.table.join(
  420. awful.key({ modkey, }, "f",
  421. function (c)
  422. c.fullscreen = not c.fullscreen
  423. c:raise()
  424. end,
  425. {description = "toggle fullscreen", group = "client"}),
  426. awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end,
  427. {description = "close", group = "client"}),
  428. awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
  429. {description = "toggle floating", group = "client"}),
  430. awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
  431. {description = "move to master", group = "client"}),
  432. awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
  433. {description = "move to screen", group = "client"}),
  434. awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
  435. {description = "toggle keep on top", group = "client"}),
  436. awful.key({ modkey, }, "n",
  437. function (c)
  438. -- The client currently has the input focus, so it cannot be
  439. -- minimized, since minimized clients can't have the focus.
  440. c.minimized = true
  441. end ,
  442. {description = "minimize", group = "client"}),
  443. awful.key({ modkey, }, "m",
  444. function (c)
  445. c.maximized = not c.maximized
  446. c:raise()
  447. end ,
  448. {description = "(un)maximize", group = "client"}),
  449. awful.key({ modkey, "Control" }, "m",
  450. function (c)
  451. c.maximized_vertical = not c.maximized_vertical
  452. c:raise()
  453. end ,
  454. {description = "(un)maximize vertically", group = "client"}),
  455. awful.key({ modkey, "Shift" }, "m",
  456. function (c)
  457. c.maximized_horizontal = not c.maximized_horizontal
  458. c:raise()
  459. end ,
  460. {description = "(un)maximize horizontally", group = "client"})
  461. )
  462.  
  463. -- Bind all key numbers to tags.
  464. -- Be careful: we use keycodes to make it work on any keyboard layout.
  465. -- This should map on the top row of your keyboard, usually 1 to 9.
  466. for i = 1, 9 do
  467. globalkeys = gears.table.join(globalkeys,
  468. -- View tag only.
  469. awful.key({ modkey }, "#" .. i + 9,
  470. function ()
  471. local screen = awful.screen.focused()
  472. local tag = screen.tags[i]
  473. if tag then
  474. tag:view_only()
  475. end
  476. end,
  477. {description = "view tag #"..i, group = "tag"}),
  478. -- Toggle tag display.
  479. awful.key({ modkey, "Control" }, "#" .. i + 9,
  480. function ()
  481. local screen = awful.screen.focused()
  482. local tag = screen.tags[i]
  483. if tag then
  484. awful.tag.viewtoggle(tag)
  485. end
  486. end,
  487. {description = "toggle tag #" .. i, group = "tag"}),
  488. -- Move client to tag.
  489. awful.key({ modkey, "Shift" }, "#" .. i + 9,
  490. function ()
  491. if client.focus then
  492. local tag = client.focus.screen.tags[i]
  493. if tag then
  494. client.focus:move_to_tag(tag)
  495. end
  496. end
  497. end,
  498. {description = "move focused client to tag #"..i, group = "tag"}),
  499. -- Toggle tag on focused client.
  500. awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  501. function ()
  502. if client.focus then
  503. local tag = client.focus.screen.tags[i]
  504. if tag then
  505. client.focus:toggle_tag(tag)
  506. end
  507. end
  508. end,
  509. {description = "toggle focused client on tag #" .. i, group = "tag"})
  510. )
  511. end
  512.  
  513. clientbuttons = gears.table.join(
  514. awful.button({ }, 1, function (c)
  515. c:emit_signal("request::activate", "mouse_click", {raise = true})
  516. end),
  517. awful.button({ modkey }, 1, function (c)
  518. c:emit_signal("request::activate", "mouse_click", {raise = true})
  519. awful.mouse.client.move(c)
  520. end),
  521. awful.button({ modkey }, 3, function (c)
  522. c:emit_signal("request::activate", "mouse_click", {raise = true})
  523. awful.mouse.client.resize(c)
  524. end)
  525. )
  526.  
  527. -- Set keys
  528. root.keys(globalkeys)
  529. -- }}}
  530.  
  531. -- {{{ Rules
  532. -- Rules to apply to new clients (through the "manage" signal).
  533. awful.rules.rules = {
  534. -- All clients will match this rule.
  535. { rule = { },
  536. properties = { border_width = beautiful.border_width,
  537. border_color = beautiful.border_normal,
  538. focus = awful.client.focus.filter,
  539. raise = true,
  540. keys = clientkeys,
  541. buttons = clientbuttons,
  542. screen = awful.screen.preferred,
  543. placement = awful.placement.no_overlap+awful.placement.no_offscreen
  544. }
  545. },
  546.  
  547. -- Floating clients.
  548. { rule_any = {
  549. instance = {
  550. "DTA", -- Firefox addon DownThemAll.
  551. "copyq", -- Includes session name in class.
  552. "pinentry",
  553. },
  554. class = {
  555. "Arandr",
  556. "Blueman-manager",
  557. "Gpick",
  558. "Kruler",
  559. "MessageWin", -- kalarm.
  560. "Sxiv",
  561. "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size.
  562. "Wpa_gui",
  563. "veromix",
  564. "xtightvncviewer"},
  565.  
  566. -- Note that the name property shown in xprop might be set slightly after creation of the client
  567. -- and the name shown there might not match defined rules here.
  568. name = {
  569. "Event Tester", -- xev.
  570. },
  571. role = {
  572. "AlarmWindow", -- Thunderbird's calendar.
  573. "ConfigManager", -- Thunderbird's about:config.
  574. "pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
  575. }
  576. }, properties = { floating = true }},
  577.  
  578. -- Add titlebars to normal clients and dialogs
  579. { rule_any = {type = { "normal", "dialog" }
  580. }, properties = { titlebars_enabled = false }
  581. },
  582.  
  583. -- Set Firefox to always map on the tag named "2" on screen 1.
  584. { rule = { class = "Firefox" },
  585. properties = { screen = 1, tag = "2" } },
  586. }
  587. -- }}}
  588.  
  589. -- {{{ Signals
  590. -- Signal function to execute when a new client appears.
  591. client.connect_signal("manage", function (c)
  592. -- Set the windows at the slave,
  593. -- i.e. put it at the end of others instead of setting it master.
  594. -- if not awesome.startup then awful.client.setslave(c) end
  595.  
  596. if awesome.startup
  597. and not c.size_hints.user_position
  598. and not c.size_hints.program_position then
  599. -- Prevent clients from being unreachable after screen count changes.
  600. awful.placement.no_offscreen(c)
  601. end
  602. end)
  603.  
  604. -- Add a titlebar if titlebars_enabled is set to true in the rules.
  605. client.connect_signal("request::titlebars", function(c)
  606. -- buttons for the titlebar
  607. local buttons = gears.table.join(
  608. awful.button({ }, 1, function()
  609. c:emit_signal("request::activate", "titlebar", {raise = true})
  610. awful.mouse.client.move(c)
  611. end),
  612. awful.button({ }, 3, function()
  613. c:emit_signal("request::activate", "titlebar", {raise = true})
  614. awful.mouse.client.resize(c)
  615. end)
  616. )
  617.  
  618. awful.titlebar(c) : setup {
  619. { -- Left
  620. awful.titlebar.widget.iconwidget(c),
  621. buttons = buttons,
  622. layout = wibox.layout.fixed.horizontal
  623. },
  624. { -- Middle
  625. { -- Title
  626. align = "center",
  627. widget = awful.titlebar.widget.titlewidget(c)
  628. },
  629. buttons = buttons,
  630. layout = wibox.layout.flex.horizontal
  631. },
  632. { -- Right
  633. awful.titlebar.widget.floatingbutton (c),
  634. awful.titlebar.widget.maximizedbutton(c),
  635. awful.titlebar.widget.stickybutton (c),
  636. awful.titlebar.widget.ontopbutton (c),
  637. awful.titlebar.widget.closebutton (c),
  638. layout = wibox.layout.fixed.horizontal()
  639.  
  640.  
  641. },
  642. layout = wibox.layout.align.horizontal
  643. }
  644. end)
  645.  
  646. -- Enable sloppy focus, so that focus follows mouse.
  647. client.connect_signal("mouse::enter", function(c)
  648. c:emit_signal("request::activate", "mouse_enter", {raise = false})
  649. end)
  650.  
  651. client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  652. client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  653.  
  654. --------------------Gaps---------------------------
  655. beautiful.useless_gap = 5
  656.  
  657. -----------------autostart------------------
  658. awful.spawn.with_shell("pgrep qlipper || qlipper")
  659. awful.spawn.with_shell("pgrep lxpolkit || lxpolkit")
  660. awful.spawn.with_shell("pgrep picom || picom")
  661. awful.spawn.with_shell("pgrep nm-applet || nm-applet")
  662.  
  663. -----------------Autoswitch------------------
  664.  
  665. client.connect_signal("manage", function (c)
  666.  
  667. if not awesome.startup then
  668. awful.client.setslave(c)
  669. c:jump_to()
  670. end
  671.  
  672. end)
  673. -- }}}
  674.  
  675.  
  676.  
Add Comment
Please, Sign In to add comment