-
-
Notifications
You must be signed in to change notification settings - Fork 178
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
base: main
Are you sure you want to change the base?
Conversation
resources/default-config.kdl
Outdated
// 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; } | ||
} | ||
|
There was a problem hiding this comment.
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.
// 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; } | |
} |
There was a problem hiding this comment.
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.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// (This example rule is commented out with a "/-" in front.) |
src/layout/floating.rs
Outdated
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 | ||
} |
There was a problem hiding this comment.
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 -
.
wiki/Configuration:-Window-Rules.md
Outdated
@@ -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`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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`. |
wiki/Configuration:-Window-Rules.md
Outdated
|
||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
@YaLTeR : thank you for the review. Updated with your suggestions! |
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