How to snap a window to top/bottom half of screen - windows-10

One of my favorite features in Windows is the ability to snap windows. [1]
With Windows 10 they can now be snapped to quarter-screen, as well as the left- and right-half screen available in previous Windows releases.
Is it possible to snap a window to top and bottom half?
In other words, snap a window to span the width of the monitor, but only half the height? It could be snapped to either the top or bottom of the screen.
https://support.microsoft.com/en-us/help/4027324/windows-10-snap-your-windows

Unfortunately no, not natively. See e.g.: https://answers.microsoft.com/en-us/windows/forum/windows_10-desktop-winpc/snap-assist-to-top-and-bottom-in-portrait-mode/3ecdd25e-8886-4ef1-a7db-0d2e168ce381.
There are third-party solutions, such as https://www.displayfusion.com/Discussions/View/portrait-mode-and-windows-snapping/?ID=8e0ff0b8-5988-43d9-bd54-4567d7869f48 and https://www.nurgo-software.com/products/aquasnap

This is now natively supported in Windows 11. Press Windows+Z, then you can select where you want your window to be. There are several other portrait-only layouts too (the spot that is dark blue is the one my mouse is hovering over):

Not in the way that you snap windows to the left and right; if you try to snap a window to the top by dragging it to the top of your screen it will just maximize that window...and dragging to the bottom won't work at all.
One way that I can think of that will work is minimize 2 windows that you want to split and resize them both so that they span the width of the screen and approximately half the height of the screen. Then drag each window to the desired portion of the screen. To make things easier, you might want to have the window that you want on the bottom of the screen open over the one that you want on top of the screen before you start minimizing windows.

Related

Designing for full screen

Summary: I'm having a big problem with layout design in my project... I want to set it up in fullscreen mode, but I can only set it in a specify resolution, because of that, when I click to maximize my program, it goes like image #2... I tried to anchor buttons in "Top,Left,Bottom,Right" but the mess is bigger (image #3).
What I need: I want to make a single layout for a fullscreen mode in any screen resolution...
Image 1 below
Image 2 below
Image 3 below
When I use fill mode...
If I understand right and you want everything to stretch when you resize your form then you should dock your tablelayoutpanel (fill) and the same with your buttons.

how to widen the Visual Studio Code's Terminal window from left end of screen to right end of screen?

In Visual Studio Code, Terminal window is some inconvenient because of the width.
I want to widen the width from the end of screen to the end of screen.
Is it possible?
enter image description here
As far as I'm aware, no, this isn't possible to some extent, but perhaps there are some extensions you could search around to see if they can do something similar.
Remember that using your PC's command terminal is also an option.
However, I've found that minimizing the left sidebar by dragging it to the left is an option, which increases the terminal width to the entire screen if this is what you're looking for:
Note doing that disables you from accessing that entire sidebar unless you drag it out again.

Missing pixels from upper left of window placed at origin

I have an application that uses a non-decorated window (no title bar and so on, it's eventually intended to be a full-screen application). It also has one-pixel-wide line images around the outside to form a natural border with the outside world.
When I run this application and the Window gets its default position (i.e., not at the (0,0) origin), the borders are clearly visible.
However, when I perform a this.Move(0, 0) in the constructor of the main window to make sure the window is positioned correctly, the upper-right pixels seem to disappear thus:
Ignore the Act text in that capture, it's actually the Activities menu under Gnome desktop. The actual upper-left pixel of the window is where those two red lines would meet.
Does anyone know what could be causing this issue? Is it possibly something to do with the Gnome Shell extensions taking control of that area?
The missing pixels are an artifact of the way gnome-shell does rounded rectangles for its windows.
If you really want to change it, you can edit the file /usr/share/gnome-shell/theme/gnome-shell.css. Look for the CSS selector .panel-corner and set -panel-corner-radius to 0px. This will cause the windows to have square corners rather than rounded ones. You will probably need to restart gnome-shell after making the change by pressing Alt-F2 and enter the r command.
Whether that edit will survive a gnome-shell (or even a theme) update is unsure, you may have to put into place something that keeps it at the value you want (or install an extension to do that for you).
That is how gnome-shell renders the top corners of the main monitor, it's a rounded corner, just not very visible with black on black. Changing this rendering is not something an application should do.
If your application is supposed to be full screen instead of just positioned at the corner, you could request gnome-shell to do that with Window.fullscreen(). Do not rely on always being full screen though: the window manager can decide otherwise.

X11: frameless resizeable windows

Can I have a frameless but resizeable window in X?
Setting just MWM_DECOR_RESIZEH without the other flags doesn't make it resizeable.
I can resize it myself manually but then I need to scrape for themed mouse cursors which are non-standardized and are also different for each corner and side.
There are exactly two ways to resize windows:
Leave it to the window manager and be happy. This is recommended way for X. If someone don't like it, he can install another WM that will make it better.
Make it by yourself - draw border around window, track the mouse cursor and when the user drags the edges - resize the window in a way you like. In this case you must set the override-redirect flag of the window and WM will not mess with it.

How to detect fullscreen?

Currently, I check if the window manager supports _NET_WM_STATE_FULLSCREEN. If it does then I use XGetWindowProperty to get array of atom's of _NET_WM_STATE. If it is the atom of _NET_WM_STATE_FULLSCREEN is found then i know it is fullscreen.
However on many windows, like the Desktop WM_NAME window, it doesn't have this atom. In fact doing doing _NET_WM_STATE fetch wit XGetWindowProperty fails, this i think is because the _NET_WM_STATE is removed when the window doesn't have focus? THe docs say its removed when window is unmapped.
I did test Desktops width and height using XGetWindowRect and I compared it to the screen width and height by using macros of WidthOfScreen and HeightOfScreen and desktop does match full screen width and height. What's up with the atom missing? Any sure fire way to detect full screen?
Thanks

Resources