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

Feature Request: Import FancyZones Layouts and Enhanced Layout Management in AltSnap #601

Open
shodanx2 opened this issue Mar 16, 2025 · 5 comments

Comments

@shodanx2
Copy link

This feature request proposes the ability for AltSnap to:

Import FancyZones layouts directly from its configuration file.
Define AltSnap layout regions using percentage-based values relative to the monitor size.
Enable per-monitor layouts, ensuring that different layouts are assigned based on the connected display.
Bind layouts to a specific monitor's serial number, so that layouts persist correctly even when switching between multiple displays.

These enhancements would significantly improve AltSnap’s layout management, making it more flexible and compatible with FancyZones, allowing users to seamlessly switch between the two utilities.
Proposed Enhancements

1. Import Layouts from FancyZones Configuration

AltSnap should be able to read and import layout configurations from FancyZones' JSON configuration file.
🔧 Implementation Notes:

Detect and parse the FancyZones config file (custom-layouts section).
Extract information such as:
    UUID (Unique identifier for the layout).
    Layout name (e.g., "COMM", "Left4K", etc.).
    Layout type (canvas or grid).
    Zones (position and size of each snap region).
Automatically convert the FancyZones layout data into AltSnap’s layout format.

🔹 Benefit: Allows users to instantly transfer their FancyZones layouts to AltSnap, eliminating the need for manual recreation.

2. Define AltSnap Layout Regions by Percentage of Monitor Size

Currently, AltSnap defines layout zones using absolute pixel values, which do not scale well across different monitor resolutions. Instead, layout definitions should support percentage-based values, allowing zones to adapt dynamically to different display sizes.
🔧 Implementation Notes:

Convert absolute pixel values (X, Y, width, height) into relative percentages based on monitor dimensions.
Example conversion:
    If a zone’s width is 960px on a 1920px wide screen → Convert it to 50%.
    If a zone starts at X=480px on a 1440px wide screen → Convert it to 33.3%.

🔹 Benefit: Ensures scalability across different resolutions, making layouts more universal and portable.

3. Enable Per-Monitor Layouts

Currently, AltSnap layouts apply globally, which may cause issues when using multiple monitors with different resolutions. This feature would allow users to assign different layouts to different monitors.

🔧 Implementation Notes:

Store layouts per monitor, instead of a single global layout.
Allow users to configure different layouts for each connected display.
When a window is moved between monitors, AltSnap should automatically apply the correct layout based on the monitor.

🔹 Benefit: Improves multi-monitor workflow, ensuring correct layout behavior across different screens.

4. Bind Layouts to Monitor Serial Number

Monitor configurations change frequently—users may dock/undock laptops, switch monitors, or use multiple displays with the same resolution. To prevent layout mismatches, layouts should be bound to each monitor’s serial number, ensuring that the correct layout is always restored.
🔧 Implementation Notes:

Retrieve the monitor's unique serial number via EDID (Extended Display Identification Data).
Store and apply layouts based on the detected serial number, rather than relying solely on resolution.

🔹 Benefit: Prevents layout misalignment when switching between identical monitor models or when reconnecting displays.

FancyZones Configuration File: Format Explanation

##(Please note this understanding was AI generated and could be wrong)

FancyZones stores its layout configuration in a JSON file. Below is an explanation of its format:

{
  "custom-layouts": [
    {
      "uuid": "{6B825628-56A7-4F41-9496-693197956B43}",
      "name": "COMM",
      "type": "canvas",
      "info": {
        "ref-width": 1920,
        "ref-height": 1040,
        "zones": [
          {
            "X": 0,
            "Y": 0,
            "width": 523,
            "height": 580
          },
          {
            "X": 523,
            "Y": 0,
            "width": 1131,
            "height": 462
          }
        ],
        "sensitivity-radius": 20
      }
    }
  ]
}

Key Elements in FancyZones Config:

custom-layouts: An array containing multiple saved layout configurations.
Each layout has the following properties:
    uuid: Unique identifier for the layout.
    name: The user-defined name of the layout.
    type:
        "canvas" → Freeform zones defined by specific pixel coordinates.
        "grid" → Divides the screen into a uniform grid.
    info: Layout configuration details.
    ref-width / ref-height: The reference resolution for which the layout was created.
    zones: An array of objects defining each zone’s X, Y, width, and height.
    sensitivity-radius: The snapping sensitivity around each zone’s edges.

Comparison with AltSnap Layout Configuration

FancyZones Layout Example (JSON Format)

"zones": [
  {
    "X": 0,
    "Y": 0,
    "width": 523,
    "height": 580
  },
  {
    "X": 523,
    "Y": 0,
    "width": 1131,
    "height": 462
  }
]

Equivalent AltSnap Layout Example (INI Format)

Zone0=0,0,523,580
Zone1=523,0,1131,462

Differences:

FancyZones uses JSON, whereas AltSnap uses INI-style settings.
FancyZones supports both "canvas" and "grid" layouts, while AltSnap primarily supports grid-based configurations.
AltSnap zones are listed as direct pixel values, whereas FancyZones zones are tied to a reference resolution.

Why This is Useful

✅ Seamless Integration with FancyZones – Users can instantly import their layouts without manual recreation.
✅ Better Layout Scalability – Percentage-based layouts adapt dynamically to different resolutions.
✅ Per-Monitor Layouts – Ensures correct layouts are used across multi-monitor setups.
✅ Persistent Layouts – Binding layouts to monitor serial numbers prevents misalignment when switching displays.

Final Thoughts

These enhancements would significantly improve layout management in AltSnap, making it more versatile and user-friendly. The ability to import FancyZones layouts, use percentage-based scaling, and bind layouts to specific monitors would make AltSnap a more powerful window management tool.

@shodanx2
Copy link
Author

For example here are my custom-layouts.json and AltSnap.ini files

custom-layouts.json

AltSnap.ini.txt

@RamonUnch
Copy link
Owner

You are mixing a lot of things here.

Please do not use AI here to write anything, it is useless I can look up the information myself. IA generated stuff will not help me because even if it were to be right I would have to check it anyway.

AltSnap has a very simple and straigh-forward layout system, this is the reason I am not importing FancyZones layout, Most people will not use both anyway because FancyZones is almost useless if you use AltSnap Layouts.

I do not want to depend on a json parser or to have to write one just to import random stuff from other program that do not even give warranty that it will stay the same in the future.

I could add a percentage-based layout option and an option to name the layouts.

@RamonUnch
Copy link
Owner

Also I am hear to read what humans have to say I do not want to loose any time trying to understand what an AI said.

@shodanx2
Copy link
Author

Hi,

"Most people will not use both anyway because FancyZones is almost useless if you use AltSnap Layouts."

Actually I use both at the same time, and for the simple reason that blacklisted processed can't be made to snap into altsnap layout.

So for instance I have moonlight in the altsnap blacklist, because that windows opens on another computer also running altsnap. So to be able to do hotclick action into that computer remotely, I have the moonlight client blacklisted. And I snap it with fancyzone.

But also, I have a friend who uses fancyzone and altsnap, and I keep telling him he should try altsnap layout snapping feature, but he never bothers to set it up. So that's mostly for him that I would like the feature to import layouts from fancyzone.

Also, anyone in the situation of using both, would probably want to have an easy way to keep both zone layouts in sync rather than have to make every change in both.

But that import function doesn't really have to be inside altsnap, it could just as easily be an external application. It's not really hard to read from a json file and output it in an .ini file.

One way to parse json without relying on an external json parser is just to use powershell since it has one built in

example
Get-Content data.json

In fact, I can probably make a powershell oneliner, that dumps fancyzone coordinates into the altsnap format, the only catch is that fancyzone defined monitor layouts, so all coordinates are relative to the monitor's origin. While altsnap uses coordinates relative to ?? main monitor origin the absolute 0,0 of the desktop I think. So it would need an offset and to know, which layout apply to what monitor as well. That is probably also in that json file, the per monitor layout assignment.

As for this message being AI.

I am sorry you feel this way, you are not the first making this complaint.
But I get the impression you were only triggered because I added a disclosure that I used the AI to format and spellcheck my message into a nicer format.

By dismissing my message wholesale for AI use will lead me to cease disclosing AI use entirely. In fact, at this point that's probably what I'm going to do because I'm tired of having that particular discussion every single time.

I included the particular disclaimer because I am like, only 99% the description was correct. It probably did correctly guess the, rather simple, structure of that json file.

BTW I also used AI to format #599 and #600

@RamonUnch
Copy link
Owner

You did not get my point.

  1. you are asking many things in a single issue which is not a way to structure the work.

  2. It is annoying to have to read through dozens of lines where you explain how to do things when you actually want me to implement them. bt if you know how to do it why dont you just implement it?

I do not think it is beneficial to import FancyZones layout directly fromAltSnap. If it is so trivial, just make a powershell script and I will add it to the AltSnap directory. But I have little time and things with Higher priority to work on.

I am annoyed indeed that you use AI to help you write your Issue, not because I have a problem with AI by itself but because it is combined with a high volume of verbosity that I would rather avoid.

An Issue has to be straight to the point and simple, not like an essay, but maybe this is your natural style.

I dismissed partially the Issue because of all of this reasons, not because you used AI. and because it was already asked and I said no but this is not your fault I cannot find in the closed Issues either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants