Skip to content

Conversation

@lei9444
Copy link
Contributor

@lei9444 lei9444 commented Dec 4, 2025

Summary of the Pull Request

Adds a new command-line interface (CLI) tool for FancyZones, enabling users and automation scripts to manage window layouts without the GUI.

Commands:

Command Aliases Description
open-editor editor, e Launch FancyZones layout editor
get-monitors monitors, m List all monitors and their properties
get-layouts layouts, ls List all available layouts with ASCII art preview
get-active-layout active, a Show currently active layout
set-layout <uuid> set, s Apply layout by UUID or template name
open-settings settings Open FancyZones settings page
get-hotkeys hotkeys, hk List all layout hotkeys
set-hotkey <key> <uuid> shk Assign hotkey (0-9) to custom layout
remove-hotkey <key> rhk Remove hotkey assignment

Key Capabilities:

  • ASCII art visualization of layouts (grid, focus, priority-grid, canvas)
  • Support for both template layouts and custom layouts
  • Monitor-specific layout targeting (--monitor N or --all)
  • Real-time notification to FancyZones via Windows messages
  • Native AOT compilation support for fast startup

Example Usage

# List all layouts with visual previews
FancyZonesCLI.exe ls

# Apply "columns" template to all monitors
FancyZonesCLI.exe s columns --all

# Set custom layout on monitor 2
FancyZonesCLI.exe s {uuid} --monitor 2

# Assign hotkey Win+Ctrl+Alt+3 to a layout
FancyZonesCLI.exe shk 3 {uuid}
output6.mp4

PR Checklist

  • Closes: #xxx
  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

@lei9444 lei9444 requested a review from a team as a code owner December 4, 2025 13:11
}
else
{
// > 11 zones: fallback to grid layout

Check failure

Code scanning / check-spelling

Forbidden Pattern

[fallback](#security-tab) matches a line_forbidden.patterns entry: "\\\bfallback\(?= to\)\\\b". \(forbidden-pattern\)
"set-layout" or "set" or "s" => args.Length >= 2 ? SetLayout(args.Skip(1).ToArray()) : PrintErrorAndReturn("Error: set-layout requires a UUID parameter"),
"open-settings" or "settings" => OpenSettings(),
"get-hotkeys" or "hotkeys" or "hk" => GetHotkeys(),
"set-hotkey" or "shk" => args.Length >= 3 ? SetHotkey(int.Parse(args[1], CultureInfo.InvariantCulture), args[2]) : PrintErrorAndReturn("Error: set-hotkey requires <key> <uuid>"),

Check failure

Code scanning / check-spelling

Unrecognized Spelling

[shk](#security-tab) is not a recognized word. \(unrecognized-spelling\)
"open-settings" or "settings" => OpenSettings(),
"get-hotkeys" or "hotkeys" or "hk" => GetHotkeys(),
"set-hotkey" or "shk" => args.Length >= 3 ? SetHotkey(int.Parse(args[1], CultureInfo.InvariantCulture), args[2]) : PrintErrorAndReturn("Error: set-hotkey requires <key> <uuid>"),
"remove-hotkey" or "rhk" => args.Length >= 2 ? RemoveHotkey(int.Parse(args[1], CultureInfo.InvariantCulture)) : PrintErrorAndReturn("Error: remove-hotkey requires <key>"),

Check failure

Code scanning / check-spelling

Unrecognized Spelling

[rhk](#security-tab) is not a recognized word. \(unrecognized-spelling\)
Console.WriteLine(" --all Apply to all monitors");
Console.WriteLine(" open-settings (settings) Open FancyZones settings page");
Console.WriteLine(" get-hotkeys (hotkeys, hk) List all layout hotkeys");
Console.WriteLine(" set-hotkey (shk) <key> <uuid> Assign hotkey (0-9) to CUSTOM layout");

Check failure

Code scanning / check-spelling

Unrecognized Spelling

[shk](#security-tab) is not a recognized word. \(unrecognized-spelling\)
Console.WriteLine(" get-hotkeys (hotkeys, hk) List all layout hotkeys");
Console.WriteLine(" set-hotkey (shk) <key> <uuid> Assign hotkey (0-9) to CUSTOM layout");
Console.WriteLine(" Note: Only custom layouts work with hotkeys");
Console.WriteLine(" remove-hotkey (rhk) <key> Remove hotkey assignment");

Check failure

Code scanning / check-spelling

Unrecognized Spelling

[rhk](#security-tab) is not a recognized word. \(unrecognized-spelling\)
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

Successfully merging this pull request may close these issues.

2 participants