PanelSwitcher

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Native2904
Posts: 164
Joined: 23 Apr 2025 18:48
Location: Aachen

PanelSwitcher

Post by Native2904 »

Hi everyone,

As they say, it's better to give than to receive ^^, so I wanted to share a tiny little command I put together for my small laptop.

What I wanted to achieve was this: whenever I switch from 2-pane mode to 1-pane mode (#800), XYplorer should automatically reduce its width by half as well, since I find Windows' Snap feature more annoying than useful.

After posting my question here, it occurred to me the following day that Windows already has a built-in solution for this: WIN + ← / →.
I also found something in the scripting help, but as far as I could figure out, there is no SendKeys command for the Windows key.

So I decided to use NirCmd.exe instead...

Code: Select all

#800;
 focus "XY";
  if (get("#800") == 0) {
    run "nircmd.exe sendkeypress lwin+left";
  } else {
    run "nircmd.exe win max foreground";
  }
NirCmd Command Reference - sendkey
NirCmd Command Reference - win

If there's a smarter way to achieve this using XYplorer's built-in commands, I'm all ears!
Lts. 64-bit XY-Port. ƒ JetBrainsMono @ Windows 11 Pro 24H2 ▣ 1920x1080 ⇵ 115%
xytags4tc

admin
Site Admin
Posts: 67227
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: PanelSwitcher

Post by admin »

Thanks for WIN + ←, I did not know about it :)

Native2904
Posts: 164
Joined: 23 Apr 2025 18:48
Location: Aachen

Re: PanelSwitcher

Post by Native2904 »

I can hardly believe a coding guru like yourself hasn't run into this yet!
Good thing we're well past the days of shooting the messenger. :whistle: :biggrin:
Lts. 64-bit XY-Port. ƒ JetBrainsMono @ Windows 11 Pro 24H2 ▣ 1920x1080 ⇵ 115%
xytags4tc

admin
Site Admin
Posts: 67227
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: PanelSwitcher

Post by admin »

coding guru ... that's why! Coding all the time. No time to play with Windows.

Post Reply