Add scratchpad-sized untile binding
This commit is contained in:
@@ -242,6 +242,7 @@ function M.setup(ctx)
|
||||
bind(main_mod .. " + F", toggle_active_window_real_fullscreen, desc("Toggle active window real fullscreen"))
|
||||
bind(main_mod .. " + SHIFT + F", toggle_active_window_gaming_mode, desc("Toggle active window gaming fullscreen"))
|
||||
bind(main_mod .. " + T", hl.dsp.window.float({ action = "disable" }), desc("Tile active window"))
|
||||
bind(main_mod .. " + SHIFT + T", float_active_window_to_default_scratchpad_geometry, desc("Float active window to scratchpad size"))
|
||||
bind(main_mod .. " + O", toggle_pinned_active_window, desc("Toggle pinned active window"))
|
||||
bind(main_mod .. " + M", minimize_active_window, desc("Minimize active window"))
|
||||
bind(main_mod .. " + SHIFT + M", restore_last_minimized, desc("Restore last minimized window"))
|
||||
|
||||
@@ -247,6 +247,24 @@ function M.setup(ctx)
|
||||
return windows
|
||||
end
|
||||
|
||||
local function default_scratchpad_geometry(target_monitor)
|
||||
local monitor = target_monitor or hl.get_active_monitor()
|
||||
if not monitor then
|
||||
return
|
||||
end
|
||||
|
||||
local workarea = monitor_workarea(monitor)
|
||||
local width = math.floor(workarea.width * scratchpad_size_ratio)
|
||||
local height = math.floor(workarea.height * scratchpad_size_ratio)
|
||||
|
||||
return {
|
||||
width = width,
|
||||
height = height,
|
||||
x = workarea.x + math.floor((workarea.width - width) / 2),
|
||||
y = workarea.y + math.floor((workarea.height - height) / 2),
|
||||
}
|
||||
end
|
||||
|
||||
local function scratchpad_geometry(name, target_monitor, position)
|
||||
local def = scratchpads[name]
|
||||
local monitor = target_monitor or hl.get_active_monitor()
|
||||
@@ -270,10 +288,7 @@ function M.setup(ctx)
|
||||
y = position
|
||||
end
|
||||
else
|
||||
width = math.floor(workarea.width * scratchpad_size_ratio)
|
||||
height = math.floor(workarea.height * scratchpad_size_ratio)
|
||||
x = workarea.x + math.floor((workarea.width - width) / 2)
|
||||
y = workarea.y + math.floor((workarea.height - height) / 2)
|
||||
return default_scratchpad_geometry(monitor)
|
||||
end
|
||||
|
||||
return {
|
||||
@@ -510,6 +525,7 @@ function M.setup(ctx)
|
||||
ctx.should_apply_scratchpad_geometry = should_apply_scratchpad_geometry
|
||||
ctx.refreshed_window = refreshed_window
|
||||
ctx.matching_scratchpad_windows = matching_scratchpad_windows
|
||||
ctx.default_scratchpad_geometry = default_scratchpad_geometry
|
||||
ctx.apply_scratchpad_geometry = apply_scratchpad_geometry
|
||||
ctx.schedule_scratchpad_geometry = schedule_scratchpad_geometry
|
||||
ctx.dropdown_spring_progress = dropdown_spring_progress
|
||||
|
||||
@@ -122,6 +122,29 @@ function M.setup(ctx)
|
||||
dispatch(hl.dsp.window.resize())
|
||||
end
|
||||
|
||||
local function float_active_window_to_default_scratchpad_geometry()
|
||||
local window = hl.get_active_window()
|
||||
local selector = window_selector(window)
|
||||
if not selector then
|
||||
return
|
||||
end
|
||||
|
||||
local geometry = default_scratchpad_geometry(hl.get_active_monitor())
|
||||
if not geometry then
|
||||
return
|
||||
end
|
||||
|
||||
dispatch(hl.dsp.window.fullscreen_state({
|
||||
internal = 0,
|
||||
client = 0,
|
||||
action = "set",
|
||||
window = selector,
|
||||
}))
|
||||
dispatch(hl.dsp.window.float({ action = "enable", window = selector }))
|
||||
dispatch(hl.dsp.window.resize({ x = geometry.width, y = geometry.height, relative = false, window = selector }))
|
||||
dispatch(hl.dsp.window.move({ x = geometry.x, y = geometry.y, relative = false, window = selector }))
|
||||
end
|
||||
|
||||
local function toggle_pinned_active_window()
|
||||
local window = hl.get_active_window()
|
||||
local selector = window_selector(window)
|
||||
@@ -583,6 +606,7 @@ function M.setup(ctx)
|
||||
ctx.float_active_window_preserving_tiled_geometry = float_active_window_preserving_tiled_geometry
|
||||
ctx.float_and_drag_active_window = float_and_drag_active_window
|
||||
ctx.float_and_resize_active_window = float_and_resize_active_window
|
||||
ctx.float_active_window_to_default_scratchpad_geometry = float_active_window_to_default_scratchpad_geometry
|
||||
ctx.toggle_pinned_active_window = toggle_pinned_active_window
|
||||
ctx.current_minimized_windows = current_minimized_windows
|
||||
ctx.restore_minimized_window = restore_minimized_window
|
||||
|
||||
Reference in New Issue
Block a user