-
Notifications
You must be signed in to change notification settings - Fork 4
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
Feat: Cycle through widths #57
Comments
It sounds like a nice feature, but I don't want there to be too many ways to do the same thing in Karousel, so maybe it should actually replace the existing options. Or maybe it could be implemented as its own Kwin script. Cycling through preset sizes sounds useful even outside Karousel. Tiled windows in Karousel should already react and work correctly with another script changing window sizes. |
Came here to request this very feature. I tried niri, and while it's fantastic, I missed all the niceties a DE brings to the table, so I came back to plamsa+karousel. What I miss the most from niri is hitting Meta+R and resizing a window to 33, 50, 66 and 100% of the display's available horizontal space. |
As soon as I got the notification for this commit, I built and upgraded karousel. I love it! There's just one difference between how karousel and niri handle this feature; karousel resizes windows from the largest set value to the smallest, whereas niri does it the other way around. I'd love it if this behaviour were inverted, or at least if there was an option to invert the behaviour. I played around with setting the preset widths to "33.3333%, 50%, 66.6667%, 100%" instead of "100%, 66.6667%, 50%, 33.3333%", but doesn't seem to have made a difference. |
I've managed to achieve what I wanted, but since I'm a complete noob when it comes to typescript and tests, I had to delete the two preset widths tests to get it to build. Here's what I changed: ────────────────────────────────────────────────────────────────────
modified: src/lib/behavior/PresetWidths.ts
────────────────────────────────────────────────────────────────────
@ src/lib/behavior/PresetWidths.ts:7 @ class PresetWidths {
public get(minWidth: number, maxWidth: number) {
const widths = this.presets.map(f => clamp(f(maxWidth), minWidth, maxWidth));
+ widths.sort((a, b) => b - a);
- widths.sort((a, b) => a - b);
return uniq(widths);
}
────────────────────────────────────────────────────────────────────
modified: src/lib/keyBindings/Actions.ts
────────────────────────────────────────────────────────────────────
@ src/lib/keyBindings/Actions.ts:190 @ class Actions {
}
const widths = this.config.presetWidths.get(column.getMinWidth(), column.getMaxWidth());
const currentWidth = column.getWidth();
- const nextIndex = widths.findIndex(width => width < currentWidth);
- const nextWidth = nextIndex >= 0 ? widths[nextIndex] : widths[0];
+ const nextIndex = widths.findIndex(width => width > currentWidth);
+ const nextWidth = nextIndex !== -1 ? widths[nextIndex] : widths[0];
column.setWidth(nextWidth, true);
} |
For some unknown reason it made more sense to me to go from large to small, but now that I know that Niri goes from small to large, I'll do the same. Thanks for the feedback! |
Inspired from paperWM over on the GNOME side, the option to cycle through widths with a keybind, preferably configurable widths (e.g percentages) would be nice.
In PaperWM, hitting Meta+R by default will cycle through 3 sizes set by default or by the user in the settings. This allows there to be one keybind for what is currently exclusively two keybinds in Karousel: Decrease and Increase Width
This should not replace the existing options, and would probably be unmapped by default (it clashes with Spectacle: Record Rectangular Region by default)
Thoughts?
The text was updated successfully, but these errors were encountered: