-------------------------------------------
-- @author https://github.com/Kasper24
-- @copyright 2021-2025 Kasper24
-------------------------------------------
local awful = require("awful")
local screenshot_app = require("ui.apps.screenshot")
local main_menu = require("ui.popups.main_menu")
local power_popup = require("ui.screens.power")
local app_launcher = require("ui.popups.app_launcher")
local hotkeys_popup = require("ui.popups.hotkeys")
local window_switcher = require("ui.popups.window_switcher")
local layout_switcher = require("ui.popups.layout_switcher")
local playerctl_daemon = require("daemons.system.playerctl")
local audio_daemon = require("daemons.hardware.audio")
local brightness_daemon = require("daemons.hardware.brightness")
local rgb_daemon = require("daemons.hardware.rgb")
local ui_daemon = require("daemons.system.ui")
local screenshot_daemon = require("daemons.system.screenshot")
local record_daemon = require("daemons.system.record")
local keyboard_layout_daemon = require("daemons.hardware.keyboard_layout")

local library = require("library")
local bling = require("external.bling")
local machi = require("external.layout-machi")
local treetile = require("external.awesome-treetile")

local capi = {
	awesome = awesome,
	client = client,
}
local keys = {
	mod = "Mod4",
	ctrl = "Control",
	shift = "Shift",
	alt = "Mod1",
}

-- =============================================================================
--  Awesome
-- =============================================================================
awful.keyboard.append_global_keybindings({
	-- restart awesomewm
	awful.key({
		modifiers = { keys.mod },
		key = "r",
		group = "awesome",
		description = "reload",
		on_press = capi.awesome.restart,
	}),
	-- quit awesomewm
	awful.key({
		modifiers = { keys.mod, keys.shift },
		key = "q",
		group = "awesome",
		description = "quit",
		on_press = capi.awesome.quit,
	}),

	-- cycle keyboard layout
	awful.key({
		modifiers = { keys.alt },
		key = "Shift_L",
		group = "awesome",
		description = "cycle keyboard layout",
		on_press = function()
			keyboard_layout_daemon:cycle_layout()
		end,
	}),
})

-- =============================================================================
--  Screen
-- =============================================================================
awful.keyboard.append_global_keybindings({
	-- Focus the next screen
	awful.key({
		modifiers = { keys.mod, keys.ctrl },
		key = "j",
		group = "screen",
		description = "focus the next screen",
		on_press = function(c)
			awful.screen.focus_relative(1)
		end,
	}),
	-- Focus the previous screen
	awful.key({
		modifiers = { keys.mod, keys.ctrl },
		key = "k",
		group = "screen",
		description = "focus the previous screen",
		on_press = function(c)
			awful.screen.focus_relative(-1)
		end,
	}),
})

-- =============================================================================
--  Client
-- =============================================================================
capi.client.connect_signal("request::default_mousebindings", function()
	awful.mouse.append_client_mousebindings({
		-- Focus a client
		awful.button({
			modifiers = {},
			button = 1,
			on_press = function(c)
				if c.can_focus ~= false then
					c:activate({
						context = "mouse_click",
					})
				end
			end,
		}),
		-- Make a client floating and move it
		awful.button({
			modifiers = { keys.mod },
			button = 1,
			on_press = function(c)
				if c.can_move ~= false then
					c.floating = true
					c.maximized = false
					c.fullscreen = false
					c:activate({
						context = "mouse_click",
						action = "mouse_move",
					})
				end
			end,
		}),
		-- Make a client floating and resize it
		awful.button({
			modifiers = { keys.mod },
			button = 3,
			on_press = function(c)
				if c.can_resize ~= false then
					c.maximized = false
					c.fullscreen = false
					c:activate({
						context = "mouse_click",
						action = "mouse_resize",
					})
				end
			end,
		}),
	})
end)

capi.client.connect_signal("request::default_keybindings", function()
	awful.keyboard.append_client_keybindings({
		-- Close client
		awful.key({
			modifiers = { keys.mod },
			key = "c",
			group = "client",
			description = "close",
			on_press = function(c)
				if c.can_kill ~= false then
					c:kill()
				end
			end,
		}),
		-- Toggle titlebar
		awful.key({
			modifiers = { keys.mod },
			key = "t",
			group = "client",
			description = "toggle titlebar",
			on_press = function(c)
				if c.custom_titlebar ~= true then
					if c.titlebar == nil then
						c.titlebar = true
					else
						c.titlebar = not c.titlebar
					end
					awful.titlebar.toggle(c)
				end
			end,
		}),
		-- Toggle floating
		awful.key({
			modifiers = { keys.mod },
			key = "space",
			group = "client",
			description = "toggle floating",
			on_press = function(c)
				if c.floating == true and c.can_tile == false then
					return
				end
				awful.client.floating.toggle()
			end,
		}),
		-- Toggle fullscreen
		awful.key({
			modifiers = { keys.mod },
			key = "f",
			group = "client",
			description = "toggle fullscreen",
			on_press = function(c)
				c.fullscreen = not c.fullscreen
				c:raise()
			end,
		}),
		-- Toggle maximize client
		awful.key({
			modifiers = { keys.mod },
			key = "m",
			group = "client",
			description = "toggle maximize client",
			on_press = function(c)
				c.maximized = not c.maximized
				c:raise()
			end,
		}),
		-- Toggle maximize client vertically
		awful.key({
			modifiers = { keys.mod, keys.ctrl },
			key = "m",
			group = "client",
			description = "toggle maximize client vertically",
			on_press = function(c)
				c.maximized_vertical = not c.maximized_vertical
				c:raise()
			end,
		}),
		-- Toggle maximize client horizontally
		awful.key({
			modifiers = { keys.mod, keys.shift },
			key = "m",
			group = "client",
			description = "toggle maximize client horizontally",
			on_press = function(c)
				c.maximized_horizontal = not c.maximized_horizontal
				c:raise()
			end,
		}),
		-- Minimize client
		awful.key({
			modifiers = { keys.mod },
			key = "n",
			group = "client",
			description = "minimize",
			on_press = function(c)
				c.minimized = true
			end,
		}),
		-- Restore minimized clients
		awful.key({
			modifiers = { keys.mod, keys.shift },
			key = "n",
			group = "client",
			description = "restore minimized",
			on_press = function()
				local c = awful.client.restore()
				if c then
					c:activate({
						raise = true,
						context = "key.unminimize",
					})
				end
			end,
		}),
		-- Make tiny float and keep on top
		awful.key({
			modifiers = { keys.mod, keys.shift },
			key = "b",
			group = "client",
			description = "make tiny float and keep on top",
			on_press = function(c)
				c.floating = not c.floating
				c.width = 400
				c.height = 200
				awful.placement.bottom_right(c)
				c.sticky = not c.sticky
			end,
		}),
		-- Move and resize to center
		awful.key({
			modifiers = { keys.mod, keys.shift },
			key = "c",
			group = "client",
			description = "move and resize to center",
			on_press = function(c)
				library.client.float_and_resize(
					c,
					awful.screen.focused().geometry.width * 0.9,
					awful.screen.focused().geometry.height * 0.9
				)
			end,
		}),
		-- Move up
		awful.key({
			modifiers = { keys.mod, keys.shift },
			key = "Up",
			group = "client",
			description = "move up",
			on_press = function(c)
				library.client.move(c, "up")
			end,
		}),
		-- Move down
		awful.key({
			modifiers = { keys.mod, keys.shift },
			key = "Down",
			group = "client",
			description = "move down",
			on_press = function(c)
				library.client.move(c, "down")
			end,
		}),
		-- Move left
		awful.key({
			modifiers = { keys.mod, keys.shift },
			key = "Left",
			group = "client",
			description = "move left",
			on_press = function(c)
				library.client.move(c, "left")
			end,
		}),
		-- Move right
		awful.key({
			modifiers = { keys.mod, keys.shift },
			key = "Right",
			group = "client",
			description = "move right",
			on_press = function(c)
				library.client.move(c, "right")
			end,
		}),
		-- Resize up
		awful.key({
			modifiers = { keys.mod, keys.ctrl },
			key = "Up",
			group = "client",
			description = "resize up",
			on_press = function(c)
				if c.can_resize ~= false then
					if awful.layout.get(c.screen).name ~= "treetile" then
						library.client.resize(c, "up")
					else
						treetile.resize_client(-0.1)
					end
				end
			end,
		}),
		-- Resize down
		awful.key({
			modifiers = { keys.mod, keys.ctrl },
			key = "Down",
			group = "client",
			description = "resize down",
			on_press = function(c)
				if c.can_resize ~= false then
					if awful.layout.get(c.screen).name ~= "treetile" then
						library.client.resize(c, "down")
					else
						treetile.resize_client(0.1)
					end
				end
			end,
		}),
		-- Resize left
		awful.key({
			modifiers = { keys.mod, keys.ctrl },
			key = "Left",
			group = "client",
			description = "resize left",
			on_press = function(c)
				if c.can_resize ~= false then
					if awful.layout.get(c.screen).name ~= "treetile" then
						library.client.resize(c, "left")
					else
						treetile.resize_client(-0.1)
					end
				end
			end,
		}),
		-- Resize right
		awful.key({
			modifiers = { keys.mod, keys.ctrl },
			key = "Right",
			group = "client",
			description = "resize right",
			on_press = function(c)
				if c.can_resize ~= false then
					if awful.layout.get(c.screen).name ~= "treetile" then
						library.client.resize(c, "right")
					else
						treetile.resize_client(0.1)
					end
				end
			end,
		}),
		-- Focus up
		awful.key({
			modifiers = { keys.mod },
			key = "Up",
			group = "client",
			description = "focus up",
			on_press = function(c)
				awful.client.focus.bydirection("up")
			end,
		}),
		-- Focus down
		awful.key({
			modifiers = { keys.mod },
			key = "Down",
			group = "client",
			description = "focus down",
			on_press = function(c)
				awful.client.focus.bydirection("down")
			end,
		}),
		-- Focus left
		awful.key({
			modifiers = { keys.mod },
			key = "Left",
			group = "client",
			description = "focus left",
			on_press = function(c)
				awful.client.focus.bydirection("left")
			end,
		}),
		-- Focus right
		awful.key({
			modifiers = { keys.mod },
			key = "Right",
			group = "client",
			description = "focus right",
			on_press = function(c)
				awful.client.focus.bydirection("right")
			end,
		}),
		-- Focus next
		awful.key({
			modifiers = { keys.mod },
			key = "j",
			group = "client",
			description = "focus next",
			on_press = function()
				awful.client.focus.byidx(1)
			end,
		}),
		-- Focus previous
		awful.key({
			modifiers = { keys.mod },
			key = "k",
			group = "client",
			description = "focus previous",
			on_press = function()
				awful.client.focus.byidx(-1)
			end,
		}),
		-- Swap with next
		awful.key({
			modifiers = { keys.mod, keys.shift },
			key = "k",
			group = "client",
			description = "swap with next",
			on_press = function()
				awful.client.swap.byidx(1)
			end,
		}),
		-- Swap with previous
		awful.key({
			modifiers = { keys.mod, keys.shift },
			key = "j",
			group = "client",
			description = "swap with previous",
			on_press = function()
				awful.client.swap.byidx(-1)
			end,
		}),
		-- Swap focused client with master
		awful.key({
			modifiers = { keys.mod, keys.shift },
			key = "Return",
			group = "client",
			description = "swap with master",
			on_press = function(c)
				c:swap(awful.client.getmaster())
			end,
		}),
		-- Go back in history
		awful.key({
			modifiers = { keys.mod },
			key = "Tab",
			group = "client",
			description = "go back in history",
			on_press = function(c)
				awful.client.focus.history.previous()
				c:raise()
			end,
		}),
		-- Jump to urgent
		awful.key({
			modifiers = { keys.mod, keys.shift },
			key = "u",
			group = "client",
			description = "jump to urgent",
			on_press = awful.client.urgent.jumpto,
		}),
		-- Bling-tabbed - pick client to add to tab group
		awful.key({
			modifiers = { keys.alt },
			key = "a",
			group = "client",
			description = "pick client to add to tab group",
			on_press = function(c)
				bling.module.tabbed.pick()
			end,
		}),
		-- Bling-tabbed - iterate through tabbing group
		awful.key({
			modifiers = { keys.alt },
			key = "s",
			group = "client",
			description = "iterate through tabbing group",
			on_press = function(c)
				bling.module.tabbed.iter()
			end,
		}),
		-- Bling-tabbed - remove focused client from tabbing group
		awful.key({
			modifiers = { keys.alt },
			key = "d",
			group = "client",
			description = "remove focused client from tabbing group",
			on_press = function(c)
				bling.module.tabbed.pop()
			end,
		}),
	})
end)

-- =============================================================================
--  Layout
-- =============================================================================
awful.keyboard.append_global_keybindings({
	-- Add padding
	awful.key({
		modifiers = { keys.mod, keys.shift },
		key = "=",
		group = "layout",
		description = "increase padding",
		on_press = function()
			local current_client_gap = ui_daemon:get_client_gap()
			ui_daemon:set_client_gap(current_client_gap + 5)
		end,
	}),
	-- Subtract padding
	awful.key({
		modifiers = { keys.mod, keys.shift },
		key = "-",
		group = "layout",
		description = "decrease padding",
		on_press = function()
			local current_client_gap = ui_daemon:get_client_gap()
			ui_daemon:set_client_gap(current_client_gap - 5)
		end,
	}),

	-- Increase useless gaps
	awful.key({
		modifiers = { keys.mod },
		key = "=",
		group = "layout",
		description = "increase useless gaps",
		on_press = function()
			local current_useless_gap = ui_daemon:get_useless_gap()
			ui_daemon:set_useless_gap(current_useless_gap + 5)
		end,
	}),
	-- Decrease useless gaps
	awful.key({
		modifiers = { keys.mod },
		key = "-",
		group = "layout",
		description = "decrease useless gaps",
		on_press = function()
			local current_useless_gap = ui_daemon:get_useless_gap()
			ui_daemon:set_useless_gap(current_useless_gap - 5)
		end,
	}),

	-- Decrase number of master clients
	awful.key({
		modifiers = { keys.mod, keys.shift },
		key = "h",
		group = "layout",
		description = "decrease number of master clients",
		on_press = function()
			awful.tag.incnmaster(-1, nil, true)
		end,
	}),
	-- Increase number of master clients
	awful.key({
		modifiers = { keys.mod, keys.shift },
		key = "l",
		group = "layout",
		description = "increase number of master clients",
		on_press = function()
			awful.tag.incnmaster(1, nil, true)
		end,
	}),

	-- Increase number of columns
	awful.key({
		modifiers = { keys.mod, keys.ctrl },
		key = "h",
		group = "layout",
		description = "increase number of columns",
		on_press = function()
			awful.tag.incncol(1, nil, true)
		end,
	}),
	-- Decrease number of columns
	awful.key({
		modifiers = { keys.mod, keys.ctrl },
		key = "l",
		group = "layout",
		description = "decrease number of columns",
		on_press = function()
			awful.tag.incncol(-1, nil, true)
		end,
	}),

	-- Make next treetile split horizontal
	awful.key({
		modifiers = { keys.mod },
		key = "h",
		group = "layout",
		description = "make next treetile split horizontal",
		on_press = function()
			treetile.horizontal()
		end,
	}),
	-- Make next treetile split vertical
	awful.key({
		modifiers = { keys.mod },
		key = "v",
		group = "layout",
		description = "make next treetile split vertical",
		on_press = function()
			treetile.vertical()
		end,
	}),

	-- layout-machi - Edit the current layout if it is a machi layout
	awful.key({
		modifiers = { keys.mod },
		key = ".",
		group = "layout",
		description = "edit the current layout if it is a machi layout",
		on_press = function()
			machi.default_editor.start_interactive()
		end,
	}),
	-- layout-machi - Switch between windows for a machi layout
	awful.key({
		modifiers = { keys.mod },
		key = "/",
		group = "layout",
		description = "switch between windows for a machi layout",
		on_press = function()
			machi.switcher.start(capi.client.focus)
		end,
	}),
})

-- =============================================================================
--  Tag
-- =============================================================================
awful.keyboard.append_global_keybindings({
	-- View desktop
	awful.key({
		modifiers = { keys.mod },
		key = "s",
		group = "tag",
		description = "view none",
		on_press = function()
			awful.tag.viewnone()
		end,
	}),
	-- View a tag
	awful.key({
		modifiers = { keys.mod },
		keygroup = "numrow",
		description = "view tag",
		group = "tag",
		on_press = function(index)
			-- needed for the last tag
			if index == 0 then
				index = 10
			end
			library.misc.tag_back_and_forth(index)
		end,
	}),
	-- Toggle tag
	awful.key({
		modifiers = { keys.mod, keys.alt },
		keygroup = "numrow",
		description = "toggle tag",
		group = "tag",
		on_press = function(index)
			-- needed for the last tag
			if index == 0 then
				index = 10
			end
			local tag = awful.screen.focused().tags[index]
			if tag then
				awful.tag.viewtoggle(tag)
			end
		end,
	}),
	-- Move focused client to tag
	awful.key({
		modifiers = { keys.mod, keys.shift },
		keygroup = "numrow",
		description = "move focused client to tag",
		group = "tag",
		on_press = function(index)
			-- needed for the last tag
			if index == 0 then
				index = 10
			end
			local focused_client = capi.client.focus
			if focused_client then
				local tag = awful.screen.focused().tags[index]
				if tag then
					focused_client:move_to_tag(tag)
				end
			end
		end,
	}),
	-- Move focused client and switch to tag
	awful.key({
		modifiers = { keys.mod, keys.ctrl },
		keygroup = "numrow",
		description = "move focused client and switch to tag",
		group = "tag",
		on_press = function(index)
			-- needed for the last tag
			if index == 0 then
				index = 10
			end
			local focused_client = capi.client.focus
			if focused_client then
				local tag = awful.screen.focused().tags[index]
				if tag then
					focused_client:move_to_tag(tag)
					tag:view_only()
				end
			end
		end,
	}),
})

-- =============================================================================
--  Media
-- =============================================================================
awful.keyboard.append_global_keybindings({
	-- Toogle media
	awful.key({
		modifiers = {},
		key = "XF86AudioPlay",
		group = "media",
		description = "toggle media",
		on_press = function()
			playerctl_daemon:play_pause()
		end,
	}),
	-- Previous media
	awful.key({
		modifiers = {},
		key = "XF86AudioPrev",
		group = "media",
		description = "previous media",
		on_press = function()
			playerctl_daemon:previous()
		end,
	}),
	-- Next media
	awful.key({
		modifiers = {},
		key = "XF86AudioNext",
		group = "media",
		description = "next media",
		on_press = function()
			playerctl_daemon:next()
		end,
	}),

	-- Raise volume
	awful.key({
		modifiers = {},
		key = "XF86AudioRaiseVolume",
		group = "media",
		description = "increase volume",
		on_press = function()
			audio_daemon:default_sink_volume_up(5)
		end,
	}),
	-- Lower volume
	awful.key({
		modifiers = {},
		key = "XF86AudioLowerVolume",
		group = "media",
		description = "decrease volume",
		on_press = function()
			audio_daemon:default_sink_volume_down(5)
		end,
	}),
	-- Mute volume
	awful.key({
		modifiers = {},
		key = "XF86AudioMute",
		group = "media",
		description = "mute volume",
		on_press = function()
			audio_daemon:default_sink_toggle_mute()
		end,
	}),

	-- Increase brightness
	awful.key({
		modifiers = {},
		key = "XF86MonBrightnessUp",
		group = "media",
		description = "increase brightness",
		on_press = function()
			brightness_daemon:increase_brightness(5)
		end,
	}),
	-- Decrease brightness
	awful.key({
		modifiers = {},
		key = "XF86MonBrightnessDown",
		group = "media",
		description = "decrease brightness",
		on_press = function()
			brightness_daemon:decrease_brightness(5)
		end,
	}),

	-- Toggle Screenshot app
	awful.key({
		modifiers = {},
		key = "Print",
		group = "media",
		description = "toggle screenshot app",
		on_press = function()
			screenshot_app:show()
		end,
	}),
	-- Take a screenshot
	awful.key({
		modifiers = { keys.mod },
		key = "Print",
		group = "media",
		description = "take a screenshot",
		on_press = function()
			screenshot_daemon:screenshot()
		end,
	}),

	-- Pick a coilor
	awful.key({
		modifiers = { keys.alt },
		key = "Print",
		group = "media",
		description = "color picker",
		on_press = function()
			screenshot_daemon:pick_color()
		end,
	}),

	-- Start recording
	awful.key({
		modifiers = { keys.mod },
		key = "F5",
		group = "media",
		description = "start recording",
		on_press = function()
			record_daemon:start_video()
		end,
	}),
	-- Stop recording
	awful.key({
		modifiers = { keys.mod },
		key = "F6",
		group = "media",
		description = "stop recording",
		on_press = function()
			record_daemon:stop_video()
		end,
	}),

	-- sync rgb colors with theme
	awful.key({
		modifiers = { keys.mod, keys.ctrl },
		key = "w",
		group = "media",
		description = "sync rgb colors with theme",
		on_press = function()
			rgb_daemon:update_colors()
		end,
	}),

	-- turn off all rgb leds
	awful.key({
		modifiers = { keys.mod, keys.alt },
		key = "w",
		group = "media",
		description = "turn off all rgb leds",
		on_press = function()
			rgb_daemon:turn_off()
		end,
	}),
})

-- =============================================================================
--  UI
-- =============================================================================
capi.awesome.connect_signal("root::pressed", function(button)
	if button == 3 then
		main_menu:toggle()
	end
end)

capi.client.connect_signal("button::press", function(client, x, y, button)
	if client.fake_root == true then
		capi.awesome.emit_signal("root::pressed", button)
	end
end)

awful.mouse.append_global_mousebindings({
	awful.button({ "Any" }, 1, function()
		capi.awesome.emit_signal("root::pressed", 1)
	end),
	awful.button({ "Any" }, 3, function()
		capi.awesome.emit_signal("root::pressed", 3)
	end),
})

awful.keyboard.append_global_keybindings({
	-- Toggle app launcher
	awful.key({
		modifiers = { keys.mod },
		key = "d",
		group = "ui",
		description = "toggle app launcher",
		on_press = function()
			app_launcher:show()
		end,
	}),
	-- Toggle exit screen
	awful.key({
		modifiers = { keys.mod },
		key = "Escape",
		group = "ui",
		description = "toggle exit screen",
		on_press = function()
			power_popup:toggle()
		end,
	}),
	-- Toggle hotkeys
	awful.key({
		modifiers = {},
		key = "F1",
		group = "ui",
		description = "toggle hotkeys",
		on_press = hotkeys_popup.show_help,
	}),
})

awful.keygrabber({
	keybindings = {
		awful.key({
			modifiers = { keys.alt },
			key = "Escape",
			on_press = function()
				window_switcher:hide()
			end,
		}),
		awful.key({
			modifiers = { keys.alt },
			key = "n",
			on_press = function()
				if capi.client.focus then
					capi.client.focus.minimized = true
				end
			end,
		}),
		awful.key({
			modifiers = { keys.alt },
			key = "N",
			on_press = function()
				if awful.client.restore() then
					capi.client.focus = awful.client.restore()
				end
			end,
		}),
		awful.key({
			modifiers = { keys.alt },
			key = "q",
			on_press = function()
				if capi.client.focus then
					capi.client.focus:kill()
				end
			end,
		}),
		awful.key({
			modifiers = { keys.alt },
			key = "Tab",
			on_press = function()
				window_switcher:cycle_clients(true)
			end,
		}),
		awful.key({
			modifiers = { keys.alt },
			key = "Left",
			on_press = function()
				window_switcher:cycle_clients(false)
			end,
		}),
		awful.key({
			modifiers = { keys.alt },
			key = "Right",
			on_press = function()
				window_switcher:cycle_clients(true)
			end,
		}),
		awful.key({
			modifiers = { keys.alt },
			key = "h",
			on_press = function()
				window_switcher:cycle_clients(false)
			end,
		}),
		awful.key({
			modifiers = { keys.alt },
			key = "l",
			on_press = function()
				window_switcher:cycle_clients(true)
			end,
		}),
	},
	root_keybindings = {
		awful.key({
			modifiers = { keys.alt },
			key = "Tab",
			on_press = function() end,
		}),
	},
	stop_key = keys.alt,
	stop_event = "release",
	start_callback = function()
		window_switcher:show()
	end,
	stop_callback = function()
		window_switcher:hide()
	end,
})

awful.keygrabber({
	keybindings = {
		awful.key({
			modifiers = { keys.alt },
			key = "z",
			on_press = function()
				layout_switcher:cycle_layouts(false)
			end,
		}),
		awful.key({
			modifiers = { keys.alt },
			key = "x",
			on_press = function()
				layout_switcher:cycle_layouts(true)
			end,
		}),
	},
	root_keybindings = {
		awful.key({
			modifiers = { keys.alt },
			key = "z",
			on_press = function() end,
		}),
		awful.key({
			modifiers = { keys.alt },
			key = "x",
			on_press = function() end,
		}),
	},
	stop_key = keys.alt,
	stop_event = "release",
	start_callback = function()
		layout_switcher:show()
	end,
	stop_callback = function()
		layout_switcher:hide()
	end,
})
