3 Awesome WM configuration template
8 -- {{{ Required libraries
9 local awesome, client, mouse, screen, tag = awesome, client, mouse, screen, tag
10 local ipairs, string, os, table, tostring, tonumber, type = ipairs, string, os, table, tostring, tonumber, type
12 local screenshot = require("screenshot")
14 local gears = require("gears")
15 local awful = require("awful")
16 require("awful.autofocus")
17 local wibox = require("wibox")
18 local beautiful = require("beautiful")
19 local naughty = require("naughty")
20 local lain = require("lain")
21 --local menubar = require("menubar")
22 local freedesktop = require("freedesktop")
23 local hotkeys_popup = require("awful.hotkeys_popup").widget
24 require("awful.hotkeys_popup.keys")
25 local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
26 local dpi = require("beautiful.xresources").apply_dpi
30 -- Check if awesome encountered an error during startup and fell back to
31 -- another config (This code will only ever execute for the fallback config)
32 if awesome.startup_errors then
33 naughty.notify({ preset = naughty.config.presets.critical,
34 title = "Oops, there were errors during startup!",
35 text = awesome.startup_errors })
38 -- Handle runtime errors after startup
40 local in_error = false
41 awesome.connect_signal("debug::error", function (err)
42 if in_error then return end
45 naughty.notify({ preset = naughty.config.presets.critical,
46 title = "Oops, an error happened!",
47 text = tostring(err) })
53 -- {{{ Autostart windowless processes
55 -- This function will run once every time Awesome is started
56 local function run_once(cmd_arr)
57 for _, cmd in ipairs(cmd_arr) do
58 awful.spawn.with_shell(string.format("pgrep -u $USER -fx '%s' > /dev/null || (%s)", cmd, cmd))
62 --run_once({ "urxvtd", "unclutter -root" }) -- entries must be separated by commas
64 -- This function implements the XDG autostart specification
66 awful.spawn.with_shell(
67 'if (xrdb -query | grep -q "^awesome\\.started:\\s*true$"); then exit; fi;' ..
68 'xrdb -merge <<< "awesome.started:true";' ..
69 -- list each of your autostart commands, followed by ; inside single quotes, followed by ..
70 'dex --environment Awesome --autostart --search-paths "$XDG_CONFIG_DIRS/autostart:$XDG_CONFIG_HOME/autostart"' -- https://github.com/jceb/dex
76 -- {{{ Variable definitions
85 "powerarrow-dark", -- 7
91 local chosen_theme = themes[5]
94 local terminal = "alacritty"
95 local vi_focus = false -- vi-like client focus - https://github.com/lcpz/awesome-copycats/issues/275
96 local cycle_prev = true -- cycle trough all previous client or just the first -- https://github.com/lcpz/awesome-copycats/issues/274
97 local editor = os.getenv("EDITOR") or "nvim"
98 local gui_editor = os.getenv("GUI_EDITOR") or "gvim"
99 local browser = os.getenv("BROWSER") or "firefox"
100 local scrlocker = "slock systemctl suspend" --This is in order to lock and suspend in one command
102 awful.util.terminal = terminal
103 awful.util.tagnames = { "1", "2", "3", "4", "5" }
104 awful.layout.layouts = {
105 awful.layout.suit.floating,
106 awful.layout.suit.tile,
107 awful.layout.suit.tile.left,
108 awful.layout.suit.tile.bottom,
109 awful.layout.suit.tile.top,
110 awful.layout.suit.fair,
111 --awful.layout.suit.fair.horizontal,
112 --awful.layout.suit.spiral,
113 --awful.layout.suit.spiral.dwindle,
114 --awful.layout.suit.max,
115 --awful.layout.suit.max.fullscreen,
116 awful.layout.suit.magnifier,
117 --awful.layout.suit.corner.nw,
118 --awful.layout.suit.corner.ne,
119 --awful.layout.suit.corner.sw,
120 --awful.layout.suit.corner.se,
121 --lain.layout.cascade,
122 --lain.layout.cascade.tile,
123 lain.layout.centerwork,
124 --lain.layout.centerwork.horizontal,
125 --lain.layout.termfair,
126 --lain.layout.termfair.center,
129 awful.util.taglist_buttons = my_table.join(
130 awful.button({ }, 1, function(t) t:view_only() end),
131 awful.button({ modkey }, 1, function(t)
133 client.focus:move_to_tag(t)
136 awful.button({ }, 3, awful.tag.viewtoggle),
137 awful.button({ modkey }, 3, function(t)
139 client.focus:toggle_tag(t)
142 awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
143 awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
146 awful.util.tasklist_buttons = my_table.join(
147 awful.button({ }, 1, function (c)
148 if c == client.focus then
151 --c:emit_signal("request::activate", "tasklist", {raise = true})<Paste>
153 -- Without this, the following
154 -- :isvisible() makes no sense
156 if not c:isvisible() and c.first_tag then
157 c.first_tag:view_only()
159 -- This will also un-minimize
160 -- the client, if needed
165 awful.button({ }, 2, function (c) c:kill() end),
166 awful.button({ }, 3, function ()
170 if instance and instance.wibox.visible then
174 instance = awful.menu.clients({theme = {width = dpi(250)}})
178 awful.button({ }, 4, function () awful.client.focus.byidx(1) end),
179 awful.button({ }, 5, function () awful.client.focus.byidx(-1) end)
182 lain.layout.termfair.nmaster = 3
183 lain.layout.termfair.ncol = 1
184 lain.layout.termfair.center.nmaster = 3
185 lain.layout.termfair.center.ncol = 1
186 lain.layout.cascade.tile.offset_x = dpi(2)
187 lain.layout.cascade.tile.offset_y = dpi(32)
188 lain.layout.cascade.tile.extra_padding = dpi(5)
189 lain.layout.cascade.tile.nmaster = 5
190 lain.layout.cascade.tile.ncol = 2
192 beautiful.init(string.format("%s/.config/awesome/themes/%s/theme.lua", os.getenv("HOME"), chosen_theme))
196 local myawesomemenu = {
197 { "hotkeys", function() return false, hotkeys_popup.show_help end },
198 { "manual", terminal .. " -e man awesome" },
199 { "edit config", string.format("%s -e %s %s", terminal, editor, awesome.conffile) },
200 { "restart", awesome.restart },
201 { "quit", function() awesome.quit() end }
203 awful.util.mymainmenu = freedesktop.menu.build({
204 icon_size = beautiful.menu_height or dpi(16),
206 { "Awesome", myawesomemenu, beautiful.awesome_icon },
207 -- other triads can be put here
210 { "Open terminal", terminal },
211 -- other triads can be put here
214 -- hide menu when mouse leaves it
215 --awful.util.mymainmenu.wibox:connect_signal("mouse::leave", function() awful.util.mymainmenu:hide() end)
217 --menubar.utils.terminal = terminal -- Set the Menubar terminal for applications that require it
221 -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
222 screen.connect_signal("property::geometry", function(s)
224 if beautiful.wallpaper then
225 local wallpaper = beautiful.wallpaper
226 -- If wallpaper is a function, call it with the screen
227 if type(wallpaper) == "function" then
228 wallpaper = wallpaper(s)
230 gears.wallpaper.maximized(wallpaper, s, true)
234 -- No borders when rearranging only 1 non-floating or maximized client
235 screen.connect_signal("arrange", function (s)
236 local only_one = #s.tiled_clients == 1
237 for _, c in pairs(s.clients) do
238 if only_one and not c.floating or c.maximized then
241 c.border_width = beautiful.border_width
245 -- Create a wibox for each screen and add it
246 awful.screen.connect_for_each_screen(function(s) beautiful.at_screen_connect(s) end)
249 -- {{{ Mouse bindings
250 root.buttons(my_table.join(
251 awful.button({ }, 3, function () awful.util.mymainmenu:toggle() end),
252 awful.button({ }, 4, awful.tag.viewnext),
253 awful.button({ }, 5, awful.tag.viewprev)
258 globalkeys = my_table.join(
260 awful.key({ altkey }, "p", scrot_full,
261 {description = "take a screenshot", group = "hotkeys"}),
262 awful.key({ }, "Print", scrot_full,
263 {description = "Take a screenshot of entire screen", group = "screenshot"}),
264 awful.key({ modkey, }, "Print", scrot_selection,
265 {description = "Take a screenshot of selection", group = "screenshot"}),
266 awful.key({ "Shift" }, "Print", scrot_window,
267 {description = "Take a screenshot of focused window", group = "screenshot"}),
268 awful.key({ "Ctrl" }, "Print", scrot_delay,
269 {description = "Take a screenshot of delay", group = "screenshot"}),
271 awful.key({ altkey, "Control" }, "l", function () os.execute(scrlocker) end,
272 {description = "lock screen", group = "hotkeys"}),
275 awful.key({ modkey, }, "s", hotkeys_popup.show_help,
276 {description = "show help", group="awesome"}),
278 awful.key({ modkey, }, "Left", awful.tag.viewprev,
279 {description = "view previous", group = "tag"}),
280 awful.key({ modkey, }, "Right", awful.tag.viewnext,
281 {description = "view next", group = "tag"}),
282 awful.key({ modkey, }, "Escape", awful.tag.history.restore,
283 {description = "go back", group = "tag"}),
285 -- Non-empty tag browsing
286 awful.key({ altkey }, "Left", function () lain.util.tag_view_nonempty(-1) end,
287 {description = "view previous nonempty", group = "tag"}),
288 awful.key({ altkey }, "Right", function () lain.util.tag_view_nonempty(1) end,
289 {description = "view previous nonempty", group = "tag"}),
291 -- Default client focus
292 awful.key({ altkey, }, "j",
294 awful.client.focus.byidx( 1)
296 {description = "focus next by index", group = "client"}
298 awful.key({ altkey, }, "k",
300 awful.client.focus.byidx(-1)
302 {description = "focus previous by index", group = "client"}
305 -- By direction client focus
306 awful.key({ modkey }, "j",
308 awful.client.focus.global_bydirection("down")
309 if client.focus then client.focus:raise() end
311 {description = "focus down", group = "client"}),
312 awful.key({ modkey }, "k",
314 awful.client.focus.global_bydirection("up")
315 if client.focus then client.focus:raise() end
317 {description = "focus up", group = "client"}),
318 awful.key({ modkey }, "h",
320 awful.client.focus.global_bydirection("left")
321 if client.focus then client.focus:raise() end
323 {description = "focus left", group = "client"}),
324 awful.key({ modkey }, "l",
326 awful.client.focus.global_bydirection("right")
327 if client.focus then client.focus:raise() end
329 {description = "focus right", group = "client"}),
330 awful.key({ modkey, }, "w", function () awful.util.mymainmenu:show() end,
331 {description = "show main menu", group = "awesome"}),
333 -- Layout manipulation
334 awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
335 {description = "swap with next client by index", group = "client"}),
336 awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
337 {description = "swap with previous client by index", group = "client"}),
338 awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
339 {description = "focus the next screen", group = "screen"}),
340 awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
341 {description = "focus the previous screen", group = "screen"}),
342 awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
343 {description = "jump to urgent client", group = "client"}),
344 awful.key({ modkey, }, "Tab",
347 awful.client.focus.history.previous()
349 awful.client.focus.byidx(-1)
355 {description = "cycle with previous/go back", group = "client"}),
356 awful.key({ modkey, "Shift" }, "Tab",
359 awful.client.focus.byidx(1)
365 {description = "go forth", group = "client"}),
368 awful.key({ modkey }, "b", function ()
370 s.mywibox.visible = not s.mywibox.visible
371 if s.mybottomwibox then
372 s.mybottomwibox.visible = not s.mybottomwibox.visible
376 {description = "toggle wibox", group = "awesome"}),
378 -- On the fly useless gaps change
379 awful.key({ altkey, "Control" }, "=", function () lain.util.useless_gaps_resize(1) end,
380 {description = "increment useless gaps", group = "tag"}),
381 awful.key({ altkey, "Control" }, "-", function () lain.util.useless_gaps_resize(-1) end,
382 {description = "decrement useless gaps", group = "tag"}),
385 awful.key({ modkey, "Shift" }, "n", function () lain.util.add_tag() end,
386 {description = "add new tag", group = "tag"}),
387 awful.key({ modkey, "Shift" }, "r", function () lain.util.rename_tag() end,
388 {description = "rename tag", group = "tag"}),
389 awful.key({ modkey, "Shift" }, "Left", function () lain.util.move_tag(-1) end,
390 {description = "move tag to the left", group = "tag"}),
391 awful.key({ modkey, "Shift" }, "Right", function () lain.util.move_tag(1) end,
392 {description = "move tag to the right", group = "tag"}),
393 awful.key({ modkey, "Shift" }, "d", function () lain.util.delete_tag() end,
394 {description = "delete tag", group = "tag"}),
397 awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
398 {description = "open a terminal", group = "launcher"}),
399 awful.key({ modkey, "Control" }, "r", awesome.restart,
400 {description = "reload awesome", group = "awesome"}),
401 awful.key({ modkey, "Shift" }, "q", awesome.quit,
402 {description = "quit awesome", group = "awesome"}),
404 awful.key({ altkey, "Shift" }, "l", function () awful.tag.incmwfact( 0.05) end,
405 {description = "increase master width factor", group = "layout"}),
406 awful.key({ altkey, "Shift" }, "h", function () awful.tag.incmwfact(-0.05) end,
407 {description = "decrease master width factor", group = "layout"}),
408 awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
409 {description = "increase the number of master clients", group = "layout"}),
410 awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
411 {description = "decrease the number of master clients", group = "layout"}),
412 awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
413 {description = "increase the number of columns", group = "layout"}),
414 awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
415 {description = "decrease the number of columns", group = "layout"}),
416 awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end,
417 {description = "select next", group = "layout"}),
418 awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
419 {description = "select previous", group = "layout"}),
421 awful.key({ modkey, "Control" }, "n",
423 local c = awful.client.restore()
424 -- Focus restored client
430 {description = "restore minimized", group = "client"}),
432 -- Dropdown application
433 awful.key({ modkey, }, "z", function () awful.screen.focused().quake:toggle() end,
434 {description = "dropdown application", group = "launcher"}),
437 awful.key({ altkey, }, "c", function () if beautiful.cal then beautiful.cal.show(7) end end,
438 {description = "show calendar", group = "widgets"}),
439 awful.key({ altkey, }, "h", function () if beautiful.fs then beautiful.fs.show(7) end end,
440 {description = "show filesystem", group = "widgets"}),
441 awful.key({ altkey, }, "w", function () if beautiful.weather then beautiful.weather.show(7) end end,
442 {description = "show weather", group = "widgets"}),
445 awful.key({ }, "XF86MonBrightnessUp", function () os.execute("xbacklight -inc 10") end,
446 {description = "+10%", group = "hotkeys"}),
447 awful.key({ }, "XF86MonBrightnessDown", function () os.execute("xbacklight -dec 10") end,
448 {description = "-10%", group = "hotkeys"}),
450 -- ALSA volume control
451 awful.key({ altkey }, "Up",
453 os.execute(string.format("amixer -q set %s 1%%+", beautiful.volume.channel))
454 beautiful.volume.update()
456 {description = "volume up", group = "hotkeys"}),
457 awful.key({ altkey }, "Down",
459 os.execute(string.format("amixer -q set %s 1%%-", beautiful.volume.channel))
460 beautiful.volume.update()
462 {description = "volume down", group = "hotkeys"}),
463 awful.key({ altkey }, "m",
465 os.execute(string.format("amixer -q set %s toggle", beautiful.volume.togglechannel or beautiful.volume.channel))
466 beautiful.volume.update()
468 {description = "toggle mute", group = "hotkeys"}),
469 awful.key({ altkey, "Control" }, "m",
471 os.execute(string.format("amixer -q set %s 100%%", beautiful.volume.channel))
472 beautiful.volume.update()
474 {description = "volume 100%", group = "hotkeys"}),
475 awful.key({ altkey, "Control" }, "0",
477 os.execute(string.format("amixer -q set %s 0%%", beautiful.volume.channel))
478 beautiful.volume.update()
480 {description = "volume 0%", group = "hotkeys"}),
483 awful.key({ altkey, "Control" }, "Up",
485 os.execute("mpc toggle")
486 beautiful.mpd.update()
488 {description = "mpc toggle", group = "widgets"}),
489 awful.key({ altkey, "Control" }, "Down",
491 os.execute("mpc stop")
492 beautiful.mpd.update()
494 {description = "mpc stop", group = "widgets"}),
495 awful.key({ altkey, "Control" }, "Left",
497 os.execute("mpc prev")
498 beautiful.mpd.update()
500 {description = "mpc prev", group = "widgets"}),
501 awful.key({ altkey, "Control" }, "Right",
503 os.execute("mpc next")
504 beautiful.mpd.update()
506 {description = "mpc next", group = "widgets"}),
507 awful.key({ altkey }, "0",
509 local common = { text = "MPD widget ", position = "top_middle", timeout = 2 }
510 if beautiful.mpd.timer.started then
511 beautiful.mpd.timer:stop()
512 common.text = common.text .. lain.util.markup.bold("OFF")
514 beautiful.mpd.timer:start()
515 common.text = common.text .. lain.util.markup.bold("ON")
517 naughty.notify(common)
519 {description = "mpc on/off", group = "widgets"}),
521 -- Copy primary to clipboard (terminals to gtk)
522 awful.key({ modkey }, "c", function () awful.spawn.with_shell("xsel | xsel -i -b") end,
523 {description = "copy terminal to gtk", group = "hotkeys"}),
524 -- Copy clipboard to primary (gtk to terminals)
525 awful.key({ modkey }, "v", function () awful.spawn.with_shell("xsel -b | xsel") end,
526 {description = "copy gtk to terminal", group = "hotkeys"}),
529 awful.key({ modkey }, "q", function () awful.spawn(browser) end,
530 {description = "run browser", group = "launcher"}),
531 awful.key({ modkey }, "a", function () awful.spawn(gui_editor) end,
532 {description = "run gui editor", group = "launcher"}),
536 awful.key({ modkey }, "p", function() menubar.show() end,
537 {description = "show the menubar", group = "launcher"})
541 awful.key({ modkey }, "x", function ()
542 os.execute(string.format("dmenu_run -i -fn 'Monospace' -nb '%s' -nf '%s' -sb '%s' -sf '%s'",
543 beautiful.bg_normal, beautiful.fg_normal, beautiful.bg_focus, beautiful.fg_focus))
545 {description = "show dmenu", group = "launcher"}),
546 -- alternatively use rofi, a dmenu-like application with more features
547 -- check https://github.com/DaveDavenport/rofi for more details
549 awful.key({ modkey }, "x", function ()
550 os.execute(string.format("rofi -show %s -theme %s",
553 {description = "show rofi", group = "launcher"}),
556 awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
557 {description = "run prompt", group = "launcher"})
559 awful.key({ modkey }, "x",
562 prompt = "Run Lua code: ",
563 textbox = awful.screen.focused().mypromptbox.widget,
564 exe_callback = awful.util.eval,
565 history_path = awful.util.get_cache_dir() .. "/history_eval"
568 {description = "lua execute prompt", group = "awesome"})
572 clientkeys = my_table.join(
573 awful.key({ altkey, "Shift" }, "m", lain.util.magnify_client,
574 {description = "magnify client", group = "client"}),
575 awful.key({ modkey, }, "f",
577 c.fullscreen = not c.fullscreen
580 {description = "toggle fullscreen", group = "client"}),
581 awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end,
582 {description = "close", group = "client"}),
583 awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
584 {description = "toggle floating", group = "client"}),
585 awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
586 {description = "move to master", group = "client"}),
587 awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
588 {description = "move to screen", group = "client"}),
589 awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
590 {description = "toggle keep on top", group = "client"}),
591 awful.key({ modkey, }, "n",
593 -- The client currently has the input focus, so it cannot be
594 -- minimized, since minimized clients can't have the focus.
597 {description = "minimize", group = "client"}),
598 awful.key({ modkey, }, "m",
600 c.maximized = not c.maximized
603 {description = "maximize", group = "client"})
606 -- Bind all key numbers to tags.
607 -- Be careful: we use keycodes to make it works on any keyboard layout.
608 -- This should map on the top row of your keyboard, usually 1 to 9.
610 -- Hack to only show tags 1 and 9 in the shortcut window (mod+s)
611 local descr_view, descr_toggle, descr_move, descr_toggle_focus
612 if i == 1 or i == 9 then
613 descr_view = {description = "view tag #", group = "tag"}
614 descr_toggle = {description = "toggle tag #", group = "tag"}
615 descr_move = {description = "move focused client to tag #", group = "tag"}
616 descr_toggle_focus = {description = "toggle focused client on tag #", group = "tag"}
618 globalkeys = my_table.join(globalkeys,
620 awful.key({ modkey }, "#" .. i + 9,
622 local screen = awful.screen.focused()
623 local tag = screen.tags[i]
629 -- Toggle tag display.
630 awful.key({ modkey, "Control" }, "#" .. i + 9,
632 local screen = awful.screen.focused()
633 local tag = screen.tags[i]
635 awful.tag.viewtoggle(tag)
639 -- Move client to tag.
640 awful.key({ modkey, "Shift" }, "#" .. i + 9,
643 local tag = client.focus.screen.tags[i]
645 client.focus:move_to_tag(tag)
650 -- Toggle tag on focused client.
651 awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
654 local tag = client.focus.screen.tags[i]
656 client.focus:toggle_tag(tag)
664 clientbuttons = gears.table.join(
665 awful.button({ }, 1, function (c)
666 c:emit_signal("request::activate", "mouse_click", {raise = true})
668 awful.button({ modkey }, 1, function (c)
669 c:emit_signal("request::activate", "mouse_click", {raise = true})
670 awful.mouse.client.move(c)
672 awful.button({ modkey }, 3, function (c)
673 c:emit_signal("request::activate", "mouse_click", {raise = true})
674 awful.mouse.client.resize(c)
679 root.keys(globalkeys)
683 -- Rules to apply to new clients (through the "manage" signal).
684 awful.rules.rules = {
685 -- All clients will match this rule.
687 properties = { border_width = beautiful.border_width,
688 border_color = beautiful.border_normal,
689 focus = awful.client.focus.filter,
692 buttons = clientbuttons,
693 screen = awful.screen.preferred,
694 placement = awful.placement.no_overlap+awful.placement.no_offscreen,
695 size_hints_honor = false
700 { rule_any = { type = { "dialog", "normal" } },
701 properties = { titlebars_enabled = false } },
703 -- Set Firefox to always map on the first tag on screen 1.
704 { rule = { class = "Firefox" },
705 properties = { screen = 1, tag = awful.util.tagnames[1] } },
707 { rule = { class = "Gimp", role = "gimp-image-window" },
708 properties = { maximized = true } },
713 -- Signal function to execute when a new client appears.
714 client.connect_signal("manage", function (c)
715 -- Set the windows at the slave,
716 -- i.e. put it at the end of others instead of setting it master.
717 -- if not awesome.startup then awful.client.setslave(c) end
719 if awesome.startup and
720 not c.size_hints.user_position
721 and not c.size_hints.program_position then
722 -- Prevent clients from being unreachable after screen count changes.
723 awful.placement.no_offscreen(c)
727 -- Add a titlebar if titlebars_enabled is set to true in the rules.
728 client.connect_signal("request::titlebars", function(c)
730 if beautiful.titlebar_fun then
731 beautiful.titlebar_fun(c)
736 -- buttons for the titlebar
737 local buttons = my_table.join(
738 awful.button({ }, 1, function()
739 c:emit_signal("request::activate", "titlebar", {raise = true})
740 awful.mouse.client.move(c)
742 awful.button({ }, 2, function() c:kill() end),
743 awful.button({ }, 3, function()
744 c:emit_signal("request::activate", "titlebar", {raise = true})
745 awful.mouse.client.resize(c)
749 awful.titlebar(c, {size = dpi(16)}) : setup {
751 awful.titlebar.widget.iconwidget(c),
753 layout = wibox.layout.fixed.horizontal
758 widget = awful.titlebar.widget.titlewidget(c)
761 layout = wibox.layout.flex.horizontal
764 awful.titlebar.widget.floatingbutton (c),
765 awful.titlebar.widget.maximizedbutton(c),
766 awful.titlebar.widget.stickybutton (c),
767 awful.titlebar.widget.ontopbutton (c),
768 awful.titlebar.widget.closebutton (c),
769 layout = wibox.layout.fixed.horizontal()
771 layout = wibox.layout.align.horizontal
775 -- Enable sloppy focus, so that focus follows mouse.
776 client.connect_signal("mouse::enter", function(c)
777 c:emit_signal("request::activate", "mouse_enter", {raise = vi_focus})
780 client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
781 client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
783 -- possible workaround for tag preservation when switching back to default screen:
784 -- https://github.com/lcpz/awesome-copycats/issues/251
788 --awful.spawn.with_shell("/home/josuer08/.screenlayout/ontop.sh")
789 --awful.spawn.with_shell("/home/josuer08/.local/bin/beautify")
790 awful.spawn.with_shell("feh --randomize --bg-fill /home/josuer08/Pictures/backgrounds/*")
791 awful.spawn.with_shell("compton")