Guest User

rc.lua

a guest
Jan 13th, 2024
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.45 KB | None | 0 0
  1. local gears = require("gears")
  2. local awful = require("awful")
  3. local scratch = require("scratch")
  4. local bindings = require("bindings")
  5. local wibox = require("wibox")
  6. local beautiful = require("beautiful")
  7. local logout_menu_widget = require("logout_menu")
  8. local menubar = require("menubar")
  9. require("awful.autofocus")
  10. require("awful.hotkeys_popup.keys")
  11.  
  12. screen_width = awful.screen.focused().geometry.width
  13. screen_height = awful.screen.focused().geometry.height
  14. terminal = "kitty"
  15. editor = "nano"
  16. editor_cmd = terminal .. " -e " .. editor
  17. root.keys(bindings.keyboard.global)
  18. mytextclock = wibox.widget.textclock()
  19. mykeyboardlayout = awful.widget.keyboardlayout()
  20. menubar.utils.terminal = terminal
  21. beautiful.init("/home/haissam/.config/awesome/theme.lua")
  22. awful.layout.layouts = { awful.layout.suit.spiral }
  23.  
  24.  
  25. local tasklist_buttons = gears.table.join(
  26. awful.button({ }, 1, function (c)
  27. if c == client.focus then
  28. c.minimized = true
  29. else
  30. c:emit_signal(
  31. "request::activate",
  32. "tasklist",
  33. {raise = true}
  34. )
  35. end
  36. end),
  37. awful.button({ }, 3, function()
  38. awful.menu.client_list({ theme = { width = 250 } })
  39. end),
  40. awful.button({ }, 4, function ()
  41. awful.client.focus.byidx(1)
  42. end),
  43. awful.button({ }, 5, function ()
  44. awful.client.focus.byidx(-1)
  45. end))
  46.  
  47. awful.screen.connect_for_each_screen(function(s)
  48. awful.tag({ "  ", "  ", "  ", "  ", "  ", " 󰊴 ", " 󰄘 "}, s, awful.layout.layouts[1])
  49.  
  50. apps = awful.popup {
  51. widget = awful.widget.tasklist {
  52. screen = screen[1],
  53. filter = awful.widget.tasklist.filter.allscreen,
  54. buttons = tasklist_buttons,
  55. style = {
  56. shape = gears.shape.partially_rounded_rect,
  57. },
  58. widget_template = {
  59. {
  60. {
  61. id = 'clienticon',
  62. widget = awful.widget.clienticon,
  63. },
  64. margins = 5,
  65. widget = wibox.container.margin,
  66. },
  67. id = 'background_role',
  68. forced_width = 48,
  69. forced_height = 48,
  70. widget = wibox.container.background,
  71. create_callback = function(self, c)
  72. self:get_children_by_id('clienticon')[1].client = c
  73. end,
  74.  
  75. },
  76. },
  77. border_width = 0,
  78. visible = false,
  79. ontop = true,
  80. placement = awful.placement.centered,
  81. shape = gears.shape.partially_rounded_rect
  82.  
  83. }
  84. ---------------------------------------------------------- BAR ---------------------------------------------------------
  85.  
  86. s.mywibox = awful.wibar({ position = "top", screen = s, opacity = 0.65, fg = beautiful.white, height = 25})
  87.  
  88. s.mytaglist = awful.widget.taglist {
  89. screen = s,
  90. filter = awful.widget.taglist.filter.all,
  91. style = {
  92. shape = gears.shape.powerline
  93. },
  94. layout = {
  95. spacing = -12,
  96. spacing_widget = {
  97. color = beautiful.white,
  98. shape = gears.shape.powerline,
  99. widget = wibox.widget.separator,
  100. },
  101. layout = wibox.layout.fixed.horizontal
  102. },
  103. widget_template = {
  104. {
  105. {
  106. {
  107. id = 'text_role',
  108. widget = wibox.widget.textbox,
  109. },
  110. layout = wibox.layout.fixed.horizontal,
  111. },
  112. left = 30,
  113. right = 36,
  114. widget = wibox.container.margin
  115. },
  116. id = 'background_role',
  117. widget = wibox.container.background,
  118. },
  119. }
  120.  
  121. s.mywibox:setup {
  122. layout = wibox.layout.align.horizontal,
  123. {
  124. layout = wibox.layout.fixed.horizontal,
  125. s.mytaglist,
  126. },
  127. s.mytasklist, -- Middle widget / only here for gap
  128. {
  129. layout = wibox.layout.fixed.horizontal,
  130. spacing = 5,
  131. mytextclock,
  132. logout_menu_widget(),
  133. },
  134. }
  135. end)
  136. month_calendar = require("calendar")
  137. month_calendar:attach(mytextclock, "tr")
  138.  
  139. ------------------------------------------------- DEFAULT CLIENTS RULES ------------------------------------------------
  140.  
  141. awful.rules.rules = {
  142. { rule = {},
  143. properties = { border_width = beautiful.border_width,
  144. border_color = beautiful.border_normal,
  145. focus = awful.client.focus.filter,
  146. raise = true,
  147. keys = bindings.keyboard.client,
  148. buttons = bindings.clientbuttons,
  149. screen = awful.screen.preferred,
  150. placement = awful.placement.no_overlap+awful.placement.no_offscreen,
  151. }
  152. },
  153.  
  154. --------------------------------------------------- SCRATCHPAD RULES ---------------------------------------------------
  155.  
  156. { rule_any = {class = {"discord", "kitty"}},
  157. instance = { "scratch" },
  158. properties = { skip_taskbar = true, titlebars_enabled = false, floating = true, ontop = true, minimized = true,
  159. sticky = true, width = screen_width * 0.65, height = screen_height * 0.65
  160. },
  161. callback = function (c)
  162. awful.placement.centered(c,{honor_padding = true, honor_workarea=true})
  163. gears.timer.delayed_call(function()
  164. c.urgent = false
  165. c.border_width = 1
  166. end)
  167. end
  168. },
  169.  
  170. ------------------------------------------------------ TAGS RULES ------------------------------------------------------
  171.  
  172. {rule_any = {class = {"Termite"}},
  173. properties = {tag = "  ", skip_taskbar = true, titlebars_enabled = false, urgent = false },
  174. },
  175.  
  176. {rule_any = {class = {"jetbrains-clion", "Code", "jetbrains-pycharm", "jetbrains-idea", "jetbrains-datagrip"}},
  177. properties = { tag = "  ", switchtotag = true },
  178. },
  179.  
  180. {rule_any = {class = {"Google-chrome"}},
  181. properties = { tag = "  ", switchtotag = true },
  182. },
  183.  
  184. {rule_any = {class = {"Anydesk", "anydesk"}},
  185. properties = { tag = " 󰄘 " , switchtotag = false, floating = false},
  186. },
  187.  
  188. {rule_any = {class = {"Font-manager", "Thunar"}},
  189. properties = { tag = "  " , switchtotag = false, floating = false},
  190. },
  191.  
  192. {rule_any = {class = {"VirtualBox Manager", "VirtualBox Machine"}},
  193. properties = { tag = "  " , switchtotag = true, floating = false, fullscreen = true},
  194. },
  195.  
  196. {rule_any = {class = {"steam", "steam_app_1449850"}},
  197. properties = { tag = " 󰊴 " , switchtotag = true},
  198. },
  199. }
  200.  
  201.  
  202. ------------------------------------------------- DEFAULT CLIENTS RULES ------------------------------------------------
  203.  
  204. awful.rules.rules = {
  205. { rule = {},
  206. properties = { border_width = beautiful.border_width,
  207. border_color = beautiful.border_normal,
  208. focus = awful.client.focus.filter,
  209. raise = true,
  210. keys = bindings.keyboard.client,
  211. buttons = bindings.clientbuttons,
  212. screen = awful.screen.preferred,
  213. placement = awful.placement.no_overlap+awful.placement.no_offscreen,
  214. }
  215. },
  216.  
  217. --------------------------------------------------- SCRATCHPAD RULES ---------------------------------------------------
  218.  
  219. { rule_any = {class = {"discord", "kitty"}},
  220. instance = { "scratch" },
  221. properties = { skip_taskbar = true, titlebars_enabled = false, floating = true, ontop = true, minimized = true,
  222. sticky = true, width = screen_width * 0.65, height = screen_height * 0.65
  223. },
  224. callback = function (c)
  225. awful.placement.centered(c,{honor_padding = true, honor_workarea=true})
  226. gears.timer.delayed_call(function()
  227. c.urgent = false
  228. c.border_width = 1
  229. end)
  230. end
  231. },
  232.  
  233. ------------------------------------------------------ TAGS RULES ------------------------------------------------------
  234.  
  235. {rule_any = {class = {"Termite"}},
  236. properties = {tag = "  ", skip_taskbar = true, titlebars_enabled = false, urgent = false },
  237. },
  238.  
  239. {rule_any = {class = {"jetbrains-clion", "Code", "jetbrains-pycharm", "jetbrains-idea", "jetbrains-datagrip"}},
  240. properties = { tag = "  ", switchtotag = true },
  241. },
  242.  
  243. {rule_any = {class = {"Google-chrome"}},
  244. properties = { tag = "  ", switchtotag = true },
  245. },
  246.  
  247. {rule_any = {class = {"Anydesk", "anydesk"}},
  248. properties = { tag = " 󰄘 " , switchtotag = false, floating = false},
  249. },
  250.  
  251. {rule_any = {class = {"Font-manager", "Thunar"}},
  252. properties = { tag = "  " , switchtotag = false, floating = false},
  253. },
  254.  
  255. {rule_any = {class = {"VirtualBox Manager", "VirtualBox Machine"}},
  256. properties = { tag = "  " , switchtotag = true, floating = false, fullscreen = true},
  257. },
  258.  
  259. {rule_any = {class = {"steam", "steam_app_1449850"}},
  260. properties = { tag = " 󰊴 " , switchtotag = true},
  261. },
  262. }
  263.  
  264. ------------------------------------------------------------------------------------------------------------------------
  265.  
  266. client.connect_signal("manage", function (c)
  267. if awesome.startup
  268. and not c.size_hints.user_position
  269. and not c.size_hints.program_position then
  270. awful.placement.no_offscreen(c)
  271. end
  272. end)
  273. client.connect_signal("mouse::enter", function(c)
  274. c:emit_signal("request::activate", "mouse_enter", {raise = false})
  275. end)
  276. client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  277. client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  278. client.connect_signal("property::floating", function(c)
  279. if c.floating then
  280. beautiful.border_width = 0
  281. end
  282. end)
  283.  
  284. --------------------------------------------------- LAUNCH AT STARTUP --------------------------------------------------
  285.  
  286. awful.spawn.single_instance(terminal,{{class = "kitty"}, instance = { "scratch" }, hidden = true, raise = false})
  287. awful.spawn.once("discord",{{class = "discord"}, instance = { "scratch" }, hidden = true, raise = false})
  288. awful.spawn.single_instance("picom")
  289. awful.spawn.single_instance("nitrogen --random --set-tiled")
  290. awful.spawn.with_shell
  291. ("termite -e 'cmatrix -b' & sleep 1 && termite --config /etc/xdg/termite/config -e btop & sleep 1 && termite --config /etc/xdg/termite/config -e lf")
  292. awful.spawn.once("anydesk", {hidden = true})
  293.  
Add Comment
Please, Sign In to add comment