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

Added top, left, bottom and right floating windows alignement #1169

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Mandarancio
Copy link

As discussed in #1168 instead of adding the relative position I added 4 new options for the alignment of floating windows to the side of the screen.

recording.b.mp4

Comment on lines 318 to 328
// Example: drop down terminal from the bottom of the screen
// (This example rule is commented out with a "/-" in front.)
/-window-rule {
match app-id="dropdown"
open-focused true
open-floating true
default-floating-position x=0 y=0 relative-to="bottom"
default-window-height { proportion 0.500; }
default-column-width { proportion 0.8; }
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, let's leave this to the wiki, doesn't need to be in the default config.

Suggested change
// Example: drop down terminal from the bottom of the screen
// (This example rule is commented out with a "/-" in front.)
/-window-rule {
match app-id="dropdown"
open-focused true
open-floating true
default-floating-position x=0 y=0 relative-to="bottom"
default-window-height { proportion 0.500; }
default-column-width { proportion 0.8; }
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put it as a second example in the wiki section. Also probably if it's "drop down" then it should come from the top.


binds {
// Keys consist of modifiers separated by + signs, followed by an XKB key name
// in the end. To find an XKB name for a particular key, you may use a program
// (This example rule is commented out with a "/-" in front.)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// (This example rule is commented out with a "/-" in front.)

Comment on lines 1221 to 1226
if relative_to == RelativeTo::Top || relative_to == RelativeTo::Bottom {
pos.x = area.size.w / 2.0 - size.w / 2.0 - pos.x
}
if relative_to == RelativeTo::Left || relative_to == RelativeTo::Right {
pos.y = area.size.h / 2.0 - size.h / 2.0 - pos.y
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say these should have + pos.x and + pos.y respectively, rather than -.

@@ -609,10 +609,11 @@ Afterward, the window will remember its last floating position.
By default, new floating windows open at the center of the screen, and windows from the tiling layout open close to their visual screen position.

The position uses logical coordinates relative to the working area.
By default, they are relative to the top-left corner of the working area, but you can change this by setting `relative-to` to one of these values: `top-left`, `top-right`, `bottom-left`, `bottom-right`.
By default, they are relative to the top-left corner of the working area, but you can change this by setting `relative-to` to one of these values: `top-left`, `top-right`, `bottom-left`, `bottom-right`, `top`, `bottom`, `left` or `right`.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
By default, they are relative to the top-left corner of the working area, but you can change this by setting `relative-to` to one of these values: `top-left`, `top-right`, `bottom-left`, `bottom-right`, `top`, `bottom`, `left` or `right`.
By default, they are relative to the top-left corner of the working area, but you can change this by setting `relative-to` to one of these values: `top-left`, `top-right`, `bottom-left`, `bottom-right`, `top`, `bottom`, `left`, or `right`.


For example, if you have a bar at the top, then `x=0 y=0` will put the top-left corner of the window directly below the bar.
If instead you write `x=0 y=0 relative-to="top-right"`, then the top-right corner of the window will align with the top-right corner of the workspace, also directly below the bar.
When only one side is secified (e.g. top) the window will allign to the center of that side.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When only one side is secified (e.g. top) the window will allign to the center of that side.
When only one side is specified (e.g. top) the window will align to the center of that side.

@Mandarancio
Copy link
Author

@YaLTeR : thank you for the review. Updated with your suggestions!

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