-
Notifications
You must be signed in to change notification settings - Fork 24
implement new setting: fallback output mode #449
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
base: master
Are you sure you want to change the base?
Conversation
jay-config/src/input.rs
Outdated
| /// Defines where relative actions are performed by default. | ||
| #[derive(Serialize, Deserialize, Copy, Clone, Debug, Hash, Eq, PartialEq)] | ||
| pub enum RelativeBehaviorMode { | ||
| /// New windows, workspaces, etc. will be created on the display the cursor is on. | ||
| Cursor, | ||
| /// New windows, workspaces, etc. will be created on the display the focus is on (which window is highlighted). | ||
| Focus, | ||
| } |
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 find this a bit hard to understand. I'd prefer to have specialized settings that do one thing only. For example
pub enum WindowOpenLocation {
Cursor,
Keyboard,
}
/// Where to focus when closing a window.
pub enum FocusFallback {
CursorOutput,
KeyboardOutput,
}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.
Hmm, I don't agree:
The setting here is for every place the codebase calls WlSeatGlobal.get_output. That would mean a setting for:
- Where the new workspace is put when set_workspace is called on a new workspace
- Where the new workspace is put when show_workspace is called on a new workspace
- Which workspace is used for
Seat.move_to_output - Which window is focused when closing a window
- Which workspace a new window is opened on
- Which workspace new floating windows are opened on
- I honestly don't 100% understand
ZwlrLayerShellV1.get_layer_surface's use of get_output, and would need a bit of help coming up with a name/description for a setting for that.
Granted, a couple of those could be merged, but that's still a lot of separate settings. In my opinion it's highly unlikely that a user will want to configure different behavior for each one individually, and will set them all to the same value. Additionally, any new uses of WlSeatGlobal.get_output will need to create a new setting, and then users will have to add that new setting to their configuration file for every update that includes a new use of get_output.
It seems better to have one global setting for whether Jay tends to follow mouse-centric behavior or keyboard-centric behavior.
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.
Makes sense.
I'd still want this setting to be renamed to something like FallbackOutputMode and be a setting on a it already is.Seat
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.
Lovely, thanks! And yes, "relative behavior mode" is a terrible name I just guessed at, FallbackOutputMode is much better, thanks, haha.
I think the solution is to not use the keyboard node at all in
|
I ran into some complications while implementing this:
I'm totally fine with doing those, I just wanted to run them past you to see how you feel about those vs. adding support for having a WorkspaceNode and/or an OutputNode be the keyboard_node (either would work fine). (Looking through the code, it looks like adding support for focusing WorkspaceNodes would be easiest, as they're only destroyed in one place in code right now AFAIK - |
f89ff22 to
2ba2184
Compare
|
I was busy with #451 but I'll look at this next week. |
|
Thanks! No rush. (And to be clear, I haven't implemented either of |
|
How about this? |
I don't have an answer to this yet. Maybe setting prev_keyboard_node_output to the output of the workspace would work. |
Mmm! Setting it to the old keyboard_node's output (not the new keyboard_node being set) is very subtle and took me a while to see, that's pretty clever. But yeah, I'm not sure how to handle focusing an empty workspace with this way of handling it... unfortunately I'm extremely fried from coding at my day job right now :P |
|
I'm also fine with merging this as is without solving the empty workspace issue. |
efe49bb to
640c1cb
Compare
|
Sorry for disappearing for almost a year. The difficulty in implementing this kind of demotivated me and I ended up using Sway for a while instead.
I've rebased this PR and removed the prev_keyboard_node_output/etc. attempts to solve the empty workspace issue, and am thinking of trying to work on it in a future PR. There's three options I see as reasonable:
In my opinion, the first option is the cleanest, and it's also how other compositors solve the same issue, but may not be possible with how Jay is set up. If I can't get it to work, I'll try the second, and otherwise, I guess I'll wait for the third! In any case, if you still feel this PR is mergeable as-is, feel free to do so. |
|
Update: The one place workspaces are destroyed ( So, implementing focusing empty workspaces is a matter of two lines of code. I've added that as a commit in this PR, feel free to force-push-remove it and we can continue in another PR. |
f0b1feb to
22633f8
Compare
|
This all looks good in principle. I have pushed another commit that contains a few more changes I would make to integrate this better with other functionality. |
22633f8 to
95e5e08
Compare
src/tree/workspace.rs
Outdated
| .rev_iter() | ||
| .find_map(|node| (*node).clone().node_into_float()) | ||
| { | ||
| if let Some(child) = float.child.get() { |
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.
Can float.child be None? I could refactor this to properly fall back to focusing the workspace if it's None, but from a few moments of testing I can't figure out a way for it to be 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.
I don't think it can be None. But you can replace this by && let Some(child) = ... if you want.
15d9d5e to
6a44bf5
Compare
|
I've pushed another version with the workspace-focus highlighting. I don't quite remember if I had any other concerns. I'll have to do another review. But this looks fine conceptually. Please rebase your branch to integrate my |
6a44bf5 to
3ed5d11
Compare
Cleaned up the commits, and added handling for
When testing this, I ran into two things:
|
Just FYI, I have done so here. No idea if folks will be receptive to it or if it'll be accepted! |
Partially fixes #448. I have no idea what a good name for this is, I just guessed "relative behavior mode".
This PR gets most of the way there, but has a glaring hole: as discussed in #446, Jay doesn't really have support for setting keyboard_node to an OutputNode or a WorkspaceNode. This means that for workspaces with no windows, the focus gets "lost": for example,
seat.show_workspacedoes nothing when passed a workspace with no windows, which breaks my expected functionality - if I callseat.show_workspace, then open a window, I expect the window to be opened on that workspace.So, I intend to implement that missing functionality in a follow-up PR, as I'm guessing you'd like such a tangly PR (implementing defocusing selected OutputNodes when the output is disconnected, etc.) to be separated from this option/feature PR. Let me know if you'd instead like that to be in this PR as well, though!
(Thanks for taking the time to review my PRs and look at my issues! I really appreciate it, I'm really enjoying using Jay, it's great)