Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to display the switcher in the center of the screen #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add an option to display the switcher in the center of the screen
ad044 committed May 17, 2022
commit 385c5c5c333748c42d355a0b9e47da36d3c908b5
21 changes: 16 additions & 5 deletions init.lua
Original file line number Diff line number Diff line change
@@ -52,6 +52,9 @@ cyclefocus = {
-- but can be disabled if you do not use sloppy focus.
move_mouse_pointer = true,

-- Display the switcher in the center of the screen (right-aligned by default).
centered = false,

-- How many entries should get displayed before and after the current one?
display_next_count = 3,
display_prev_count = 3,
@@ -1057,11 +1060,19 @@ cyclefocus.cycle = function(startdirection_or_args, args)
wbox_screen = initial_screen
local wa = screen[wbox_screen].workarea
local w = math.ceil(wa.width * 0.618)
wbox:geometry({
-- right-align.
x = math.ceil(wa.x + wa.width - w),
width = w,
})
if args.centered then
wbox:geometry({
-- position in center.
x = wa.x + floor(wa.width/2 - w/2),
width = w,
})
else
wbox:geometry({
-- right-align.
x = math.ceil(wa.x + wa.width - w),
width = w,
})
end
end
local wbox_height = 0