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

[FancyZones] Quicky switch between layouts with the scroll wheel while dragging a window #4969

Open
Miodec opened this issue Jul 13, 2020 · 9 comments
Labels
FancyZones-Dragging&UI FancyZone dragging / interaction issue Idea-Enhancement New feature or request on an existing product Product-FancyZones Refers to the FancyZones PowerToy

Comments

@Miodec
Copy link

Miodec commented Jul 13, 2020

I sometimes like to keep my windows in a 3 columns, sometimes 2, sometimes 2 that are not equal width.

It would be awesome to be able to quickly switch between layouts. Im thinking while dragging a window and holding shift to see the zones, using the scroll wheel would cycle through the layouts created on that monitor.

Thanks!

@ghost ghost added the Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams label Jul 13, 2020
@Miodec Miodec changed the title Quicky switch between layouts with the scrollwhell when holding shift Quicky switch between layouts with the scroll wheel when holding shift Jul 13, 2020
@enricogior enricogior added FancyZones-Dragging&UI FancyZone dragging / interaction issue Idea-Enhancement New feature or request on an existing product Product-FancyZones Refers to the FancyZones PowerToy and removed Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Jul 14, 2020
@enricogior enricogior changed the title Quicky switch between layouts with the scroll wheel when holding shift [FancyZones] Quicky switch between layouts with the scroll wheel when holding shift Jul 30, 2020
@enricogior
Copy link
Contributor

Reference: #1411

@rztaylor
Copy link

rztaylor commented Sep 9, 2020

Switching between layout options whilst dragging a window would be awesome, but from a UI point of view I think we also need to consider:

  • We'd need some way of marking layouts that should be cycled - such as marking layouts as favorites/starred
  • The scrollwheel isn't a comfortable option, I would propose the following:
    1. If "Hold shift key to activate zones whilst dragging" is checked, then tapping SPACE or ALT whilst holding down SHIFT and dragging a window would cycle the selected layouts
    2. If "Use a non-primary mouse button to toggle zone activation" is checked, then each press of the non-primary mouse button would cycle the selected layouts.

I'd suggest chaning the ticket title to "[FancyZones] Quicky switch between layouts whilst dragging a window"

@gczark
Copy link

gczark commented Sep 9, 2020

PowerToys has this functionality before, but I don't know why it was removed. Before while snapping a window to a zone (zones are present), I can switch layouts by pressing number keys which corrensponds to the number of zones that you have used since the installation.

@enricogior
Copy link
Contributor

@gczark
that feature had issues:

  • a layout may have not been designed for the current screen resolution and still it was allowing to apply it to the current screen.
  • accessibility problem: it required to start dragging a window and press ctrl + number at the same time
  • the ctrl + number shortcut is already used by Windows for a different feature

#1411 will try to address all those problems

@enricogior enricogior changed the title [FancyZones] Quicky switch between layouts with the scroll wheel when holding shift [FancyZones] Quicky switch between layouts with the scroll wheel while dragging a window Sep 24, 2020
@enricogior enricogior reopened this Apr 19, 2021
@Imold
Copy link

Imold commented Jul 12, 2023

For any one else who wants this, here's an autohotkey script for it.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force
CoordMode, Mouse, Screen

;CONFIG
;Assign FancyZones Layouts shortcuts in order from 0 to 9
;Scrolling down will cycle through layouts numerically from 0 to 9
;Scrolling up will cycle through layouts in the reverse order

;Set to highest number layout shortcut
NoLo := 2
;End of Config

Lo := 0
*~LButton::
    MouseGetPos, x, y, hwnd
    SendMessage, 0x84, 0, (x&0xFFFF) | (y&0xFFFF) << 16,, ahk_id %hwnd%
    RegExMatch("ERROR TRANSPARENT NOWHERE CLIENT CAPTION SYSMENU SIZE MENU HSCROLL VSCROLL MINBUTTON MAXBUTTON LEFT RIGHT TOP TOPLEFT TOPRIGHT BOTTOM BOTTOMLEFT BOTTOMRIGHT BORDER OBJECT CLOSE HELP", "(?:\w+\s+){" . ErrorLevel+2&0xFFFFFFFF . "}(?<AREA>\w+\b)", HT)
	 if htarea!=CAPTION
		if OutputVarControl!=TITLE_BAR_SCAFFOLDING_WINDOW_CLASS1
			if OutputVarControl!=DRAG_BAR_WINDOW_CLASS1
				Return
	 MouseGetPos,_x,_y
	 While GetKeyState("LButton","P") && x=_x && y=_y ;Wait until user begins dragging
		MouseGetPos,_x,_y
    While GetKeyState("LButton","P") ;while dragging
		dragging := 1
	dragging := 0
Return
#If (dragging = 1)
	WheelUp::
		Lo --
		if (Lo < 0)
			Lo:=NoLo
		Send %Lo%
		Return
	WheelDown::
		Lo ++
		if (Lo > NoLo)
			Lo:=0
		Send %Lo%
		Return
		

@harvastum
Copy link
Contributor

Hey, I was just about to create another issue but found my old (#13387) issue regarding this and I'd like to put emphasis on one thing: the controls of zone switching must be configurable and it has to allow to assign mouse buttons (especially MB4 and MB5).

Is there chance for any action on this issue in the foreseeable future? It's been here a while and there are plenty of duplicates being created.

Also, I think FancyZones-Settings and FancyZones-Hotkeys labels could be added to this.

@Imold
Copy link

Imold commented Mar 14, 2024

@harvastum Here's a modified version of my autohotkey script that uses the back and forward buttons (MB4 and MB5), instead of scrolling while dragging a window.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force

;5th Mouse Button (aka: the "Forward" button) will cycle through layouts numerically from 0 to 9
;4th Mouse Button (aka: the "Back" button) will cycle through layouts in the reverse order

;CONFIG
;Assign FancyZones Layouts shortcuts in order from 0 to 9

;Set to highest number layout shortcut
NoLo := 2
;End of Config

Lo := 0
XButton1::
	Lo --
	if (Lo < 0)
		Lo:=NoLo
	Send #^!%Lo%
	Return
XButton2::
	Lo ++
	if (Lo > NoLo)
		Lo:=0
	Send #^!%Lo%
	Return

@tylertylerday
Copy link

@harvastum Here's a modified version of my autohotkey script that uses the back and forward buttons (MB4 and MB5), instead of scrolling while dragging a window.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force

;5th Mouse Button (aka: the "Forward" button) will cycle through layouts numerically from 0 to 9
;4th Mouse Button (aka: the "Back" button) will cycle through layouts in the reverse order

;CONFIG
;Assign FancyZones Layouts shortcuts in order from 0 to 9

;Set to highest number layout shortcut
NoLo := 2
;End of Config

Lo := 0
XButton1::
	Lo --
	if (Lo < 0)
		Lo:=NoLo
	Send #^!%Lo%
	Return
XButton2::
	Lo ++
	if (Lo > NoLo)
		Lo:=0
	Send #^!%Lo%
	Return

Amazing just what I've been looking for! Do you know why it doesn't work when I'm dragging a window though? It works when I press the mouse buttons, now I can't use those buttons for Back/Forward in the browser because it keeps changing the layout.

@Imold
Copy link

Imold commented Jan 28, 2025

Amazing just what I've been looking for! Do you know why it doesn't work when I'm dragging a window though? It works when I press the mouse buttons,

Not Sure, my best guess is something to do with them being mouse buttons turns it off.

now I can't use those buttons for Back/Forward in the browser because it keeps changing the layout.

That's to be expected, it's just globally remapping the buttons. If you still want to use them for Back/Forward you'd need a modifier for changing layouts. You could also try the original scroll while dragging version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FancyZones-Dragging&UI FancyZone dragging / interaction issue Idea-Enhancement New feature or request on an existing product Product-FancyZones Refers to the FancyZones PowerToy
Projects
None yet
Development

No branches or pull requests

7 participants