-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
Reverse switch-preset-column-width
#1367
base: main
Are you sure you want to change the base?
Conversation
Can specify number of steps and whether to wraparound
@YaLTeR I have added some methods to support this feature, but I'm now unclear as to how to implement this in the IPC interface. Help appreciated thanks. |
SwitchPresetColumnWidthNext, | ||
SwitchPresetColumnWidthPrev, |
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.
As we discussed, instead of two new commands it should be just SwitchPresetColumnWidthBack
, and both of them should have a #[knuffel(property)] bool
cycle argument.
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.
And on the ipc/lib.rs it would be --cycle false
. See the recent --focus false
on MoveWindowToMonitor
self.preset_width_idx = Some(preset_idx); | ||
} | ||
|
||
fn cycle_width(&mut self, steps: i32, tile_idx: Option<usize>, wraparound: bool) { |
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.
Why did you make this generic by steps? This overcomplicates the logic below quite a bit. Just pass another back: bool
or something
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 will make an attempt to cleanup logic. Wasn't able to immediately find contributing guidelines. Do you want me to fix via squashing or keep everything as new commits?
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 prefer a clean commit history with self-contained changes. In practice most PRs don't do that, so I use squash-and-merge. So do as you prefer
@@ -4379,7 +4401,14 @@ impl<W: LayoutElement> Column<W> { | |||
true | |||
} | |||
|
|||
fn toggle_width(&mut self, tile_idx: Option<usize>) { | |||
fn select_width(&mut self, preset_idx: usize, tile_idx: Option<usize>) { |
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.
Why extract this?
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.
While not scoped for this PR, I think it might be useful to specify an exact preset width. For example, the user could bind a shortcut to immediately make the window half size (vs. cycling through all preset widths). This would behave similarly to what is possible right now with full width.
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.
It's already possible. set-column-width 50%
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.
Yes, but is there some advantage that the column retains knowledge that it is at a preset width? And not just an arbitrary width value
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.
Not really. Switch preset will already start with the closest next (or previous) width.
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.
Is it possible there may be rounding issues? For example, the first Mod+R
press (imperceptibly) applies a very similar preset width, and the user must then hit Mod+R
again to actually increment the window width. I've had this exact experience coming from hyprscroller (or maybe it was PaperWM)
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.
Not really, no. Window sizes are quantized to logical integers on Wayland which makes this sort of stuff less likely
@@ -1068,6 +1068,22 @@ impl<W: LayoutElement> Workspace<W> { | |||
} | |||
} | |||
|
|||
pub fn increment_width(&mut self) { | |||
if self.floating_is_active.get() { | |||
self.floating.toggle_window_width(None); |
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.
Should be implemented for floating too
Don't forget to add the new action to src/layout/tests.rs Op enum |
Support
switch-preset-column-width
in reverse order as well as switching presets without wraparound. Implements #1000