-
Notifications
You must be signed in to change notification settings - Fork 130
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
Any way to set per wmclass preferences for default size #304
Comments
Not at the moment, but yeah, it's something we'd like to do, and should be fairly easy implement. Due to how wayland handles resizing (starting several at the same time doesn't work) the resizing will probably need to be handled by the layout code. Eg. by adding a |
As a rough hack, I added the below to tiling.js and it seems to work. First I tried setting these values in
|
Right, the winprop is looked up when new windows are created: Lines 2426 to 2438 in b33f2d8
So you'll probably want something like this: @@ -2441,6 +2450,8 @@ function insertWindow(metaWindow, {existing}) {
if (winprop.focus) {
Main.activateWindow(metaWindow);
}
+ metaWindow.preferredWidth = winprop.preferredWidth;
+ metaWindow.preferredHeight = winprop.preferredHeight;
}
if (addToScratch) { And then apply the preferredWidth in eg. layoutColumnSimple: @@ -319,6 +319,15 @@ class Space extends Array {
let resizable = !mw.fullscreen &&
mw.get_maximized() !== Meta.MaximizeFlags.BOTH;
+ if (mw.preferredWidth) {
+ targetWidth = mw.preferredWidth;
+ delete mw.preferredWidth
+ }
+ if (mw.preferredHeight) {
+ targetHeight = mw.preferredHeight;
+ delete mw.preferredHeight
+ }
+
if (resizable) {
const hasNewTarget = mw._targetWidth !== targetWidth || mw._targetHeight !== targetHeight;
const targetReached = f.width === targetWidth && f.height === targetHeight; To correctly handle vertical tiling, getting the preferred width might be better done here (you'll still want to delete the preferredWidth property so its only applied once though): @@ -413,9 +422,9 @@ class Space extends Array {
let targetWidth;
if (i === selectedIndex) {
- targetWidth = selectedInColumn.get_frame_rect().width;
+ targetWidth = w.preferredWidth || selectedInColumn.get_frame_rect().width;
} else {
- targetWidth = Math.max(...column.map(w => w.get_frame_rect().width));
+ targetWidth = Math.max(...column.map(w => w.preferredWidth || w.get_frame_rect().width));
}
targetWidth = Math.min(targetWidth, workArea.width - 2*minimumMargin()); While heights might need some more handling if we want the whole column to take up all the available height (there's a use-case to freely resize the height though: #189). |
Thanks, this is working well for width. Height is a more complicated problem though... ideally we'd perhaps want the window to be created full height, but the its preferredHeight to be consulted when it is first pulled into a column. There seems to be a lot going on in |
It would be great to be able to set desired widths for new windows based on wmclass. I tried this in
user.js
but it had no effect.Heights too, in case the window is vertically tiled after creation, if this is possible.
The text was updated successfully, but these errors were encountered: