-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Add initial support for horizontal / vertical tiling #16
Conversation
For my understanding, what should the shortcut exactly do, tile three windows like in the image? What is exactly the issue? Other question: are you aware of Window Shuffler on Ubuntu Budgie? Seems the work is all done already and features like this are available from either a shortcut a hotcorner or whatever you prefer. |
No, it can tile any arbitrary number of windows that are on the current workspace. Press Super+T This also solves solus-project/budgie-desktop#2183 |
Ah, it does a lot more today, but deliberately not like i3wm and such. So the issue is you run into minsize issues? I also see a slightly off-position code- window. You need any help with that? |
Well, it's not that the window is off-position. It's that the terminal window on top is not the size i've given it, because Mutter's Meta.Window#move_resize_frame function does respect size hints. The gap is not big enough to fit another row of characters, so the terminal window keeps it smaller. I need help with that, yeah, but I'm not sure how to do it or if it is even possible with Mutter's API in the first place. |
Personally, I use Wnck to position windows, which works pretty much exactly. Occasionally, a window only accepts resize steps in e.g. 2px or something. |
Probably the _NET_FRAME_EXTENTS thing can be done in the next PR, but I'm still not sure what you mean on that. There isn't any y-extent in _NET_FRAME_EXTENTS, just top/bottom/left/right. |
Ah, sorry, should have been clearer, it's the top extent. |
I see. I don't really have dedication to maintain a fork or separate plugin because I don't use Budgie too often, so I guess I'll just close this PR. |
I would like to emphasize that @Jacob-Vlijm does not speak on behalf of the project and shouldn't have discouraged you from continuing this work. |
Fair, if there is a possibility that it could still be accepted in the future then I'm happy to keep working on it. |
In terms of accepting the work, I'd really like to see an option for automatic Tile Vertically to compliment the Tile Horizontally. I think this could be easily accomplished by having a dialog pop up in the center on pressing Is this work you are willing to get involved in? |
Sure, that's a good idea. My original plan was to just have Super+T cycle through the available layouts but that seems like a better option, although it will need me to learn a bit about Gtk. |
@codic12 Well I would like to stress that there is no rush for landing this. You're not on some sort of timeline and I'm always happy to keep this PR open and you contribute more commits as the work evolves. Having Super+T cycle through is a good idea, however I'm just trying to make it more interactive and straight-forward for folks. Having Super+T instantly tile would probably freak the user out at first, whereas it prompting them with an opportunity to tile or simply cancel the operation (cancel button or pressing Esc) would probably feel more intuitive. Just my two cents of course. |
Right now I'm working on vertical tiling, but after that I'm thinking of how to implement the popup dialog. The tile_windows function is in src/wm/wm.vala, however we would probably have to put the popup in another file. Since the wm code seems to be independent of other code, how would that access tile_windows()? Or can we just create a GTK window in wm.vala inside the on_layout_toggle function? |
We don't need it to access tile_windows, we can have a popup in a separate file, construct / destroy when needed (or just have it always exist but hide it when we don't need it to reduce the delay) and have the button clicks call signals we set up in the window, which are handled (with |
Thanks. I'm still not sure how to go around that but I'll look at the other dialogs when I get there. |
@JoshStrobl For the record, I never suggested I spoke on behalf of the project, nor do I believe @codic12 did think. At the same time, I can't believe you would implement a popos-ish procedure into Budgie, but apparently I was wrong. Just wanted to be helpful here, since there was no one to react on it. |
It doesn't yet play well with the panel, but otherwise I've pretty much finished vertical tiling.
why not, though? it is just a fork which can be merged at any time with the click of a button. |
I'll leave the speech to @JoshStrobl , but certainly a PR can be polished. Not the place for development though, but Josh might have another opinion. |
It's fine here, in Budgie and in a separate branch + PR process. Stop it please. |
i've finished vertical tiling. Now Super+T will cycle through the list: [Floating, Horizontal Tiling, Vertical Tiling]. also here is a video of how it looks. the overlap of the terminal and chromium in the end is because chromium has a minimum size and it doesn't allow going lower than it, and that minimum size is reached in this small Xephyr screen. simplescreenrecorder-2022-01-05_11.09.00.mp4 |
This is a different style of working that some folks are used to - collaborative working sometimes is difficult on text only github style comments. Lets not use that as an excuse to prevent innovation. I think Jacob and Codic can craft something great here that will be useful to the wider community.
The phrase "Stop it" though does not contribute to discussion however misunderstood things are. A formal code of conduct will need to be introduced for the organisation and contributors need to fully understand it and abide by it. No specific person should talk down or be perceived talking down to anyone. That is bordering on the unacceptable. Lets not fall into this sort of way of talking to each other in the future. |
I agree, which is why I was disappointed to see the focus being on not submitting it until it's more mature and the development happening in an environment that doesn't encourage an immediate feedback loop, which is what this was intended for. I understand that folks are coming from a wide background and all have different experiences and expectations on development practices, so cultivating an understanding of that going forward is ideal. A focus on a future CoC (similar to the one I had originally proposed for Solus to evolve its community engagement) will be engaging in constructive discussions and I will be creating a framework that establishes ideal feedback loops and processes for development, including but not limited to: RFCs, discussions, corresponding issues, preference of any branches and reducing the number of forks if possible, PRs and discussions around that. I believe that should offer clarify and reduce frustrations. My intent here was to eliminate any cause for concern by the submitter and dissuade any language of otherwise, having experience circumstances where some may continue to assert their way of doing things (not claiming that was being done here, but avoiding it is paramount). I recognize it may not have been the intent of Jacob to dissuade anyone and I could have done better in communicating my request and clarity that this specific method for developing is acceptable (so I do apologize to @Jacob-Vlijm for that), that was simply the impression given and the end result was the closure of the PR, so clearer communication going forward is always ideal on all parts. In regards to everyone getting engaged in finding a workable solution, as well as @codic12's ask for guidance, I certainly believe that can be provided in the current framework of this pull request. Onto the topic of the PR itself and technicalities around implementation of the switch, @codic12 I would highly encourage you to take a look at the alt+tab switcher code available in
And so forth. I believe a couple GtkButtons in the switcher, both with icons (Gtk.Image) that communicate vertical v.s. horizontal options, would likely be sufficient. If you want, you can also use a Gtk.Box set to vertical orientation, have the flowbox pushed to that, and have a dedicated "Cancel" button below it (or an explicit "close" icon above the flowbox), which can be handled with pack_end or pack_start respective on the box. If @Jacob-Vlijm, @fossfreedom , @serebit, etc. have other ideas on how this switcher can be overlaid and presentable, certainly this is the place for this discussion. |
Thanks, I appreciate your points.
This is the one point I don't get even after reading src/daemon/tabswitcher.vala. My only guess would be that it's communicating via DBus? Also, for the initial implementation, would simply textual buttons saying "Vertical", "Horizontal", "Floating" etc do? With images we'd need to create assets (ideally scalable SVGs) first. |
If the WM didn't have a reference to it then yea, the best way of accomplishing it would be over D-Bus. In that file, there are various consts, like:
and
In the TabSwitcherWindow, we set up various functions, such as
This is, in my opinion, one of the better ways of passing information in a non-blocking way, to that window. To get info, we would create a couple signals, such as:
We would connect in the wm.vala code to the closed signal so we are informed on closure (not an absolute necessity to do, we don't for TabSwitcher, but doesn't hurt to at least add the signal even if there are no consumers). Similarly in the wm.vala code, we would have a function that connects to the layout_selected signal (via By having that layout in the window manager, we may even be able to extend it to grid, or provide more functionality, possibly something that Budgie Shuffler can hook into down the line. |
@codic12 @JoshStrobl would this be fit for the buttons? Made those myself so feel free to use them if they fit. SVG are here: https://drive.google.com/drive/folders/1odvRuHOkxx0haFaGR1Wh2Nj6C7ezkO8V?usp=sharing |
@JoshStrobl thanks for the information, I think I have an idea of where to start now.
Indeed, it's already an enum:
|
@guillotjulien those buttons look great! would be happy to use them. Maybe make either all the windows filled or all of them empty, though; right now only the floating one doesn't have filled windows so it looks a bit inconsistent. |
That looks perfect. |
With regard to the icons, what about light theme users? |
They could be recolored to be black. Idk how we'd detect if the current theme is light or dark though. |
Just thinking out loud, but the whole procedure could be hooked up to the automatic layouts as done by shuffler applet: Each layout is defined in its own string in gsettings, but could as well (in any layout arrangement) be stored in an array of layouts. Then, on new-window or window-closed signal (shuffler has a set-action option on both), windows would be rearranged into the next/previous layout. The advantage of this would be that you have full control, and a choice to either rearrange (only) vertically, horizontally or in any complex "next" order. So indeed: one window -> full size, two windows -> 1/2 + 1/2? or 1/3 + 2/3 or 1/5 + 4/5? Whatever you like. My personal opinion is that you shouldn't put this sort of stuff into the windowmanager, but play with from outside. It' s very interesting, but quite different from standard q/h tiling, and something probably only a selective group of users will appreciate (popos- ish). |
I'm having a lot of trouble trying to create a gtk popup, always running into issues - if someone else wants to do the basics of that, I'd be very welcome, otherwise I'll just let it be for the time being and look into it later.
I'm also a fan of modularity. I would happily put this in an applet, a much more appealing choice, but I don't think this is possible. The thing is we need to intercept MapRequest and DestroyNotify events (which mutter does and we override functions |
Would like to emphasize that this is something I do want baked into Budgie and exposed through the suggested UI and not just part of an applet. Having more advanced functionality in an applet I'm open to (even merging in Budgie Shuffler itself), but not having that as the sole solution. |
I am afraid I am misunderstood. |
@codic12 I agree, doesn't really make sense for only one icon to not be filled. Here is another version more consistent with the other two icons (floating_fill.svg). @EbonJaeger I believe SVG can be recolored on the fly by themes. Not sure how it plays out with existing themes, maybe we'll have to set a special class? I'll have to check to be sure but it's definitely a valid concern. |
Description
This PR adds basic support for horizontal tiling to Budgie. It looks like this:
We add a new option to the dconf schema com.solus-project.budgie.wm.gschema.xml: toggle-layout, which is the keybinding to toggle layout. Currently the default is
<Super>T
.In the future support will be added for vertical tiling in a follow-up PR if this one gets accepted.
The only downside here is that size hints are respected, which is great for a floating WM but not so great for a tiling one (obviously not what Mutter developers had in mind). If anyone knows any way to override size hints beyond using manual X11 calls or simply removing the size hints, please let me know. For now I've just used move_resize_frame, which respects hints, but it's not that horrible.
I'm new to Mutter, Budgie, and Vala, so please tell me if there's any improvements I can make! Code reviews and some testing would be much appreciated.
Also as for multi-monitor support, in the future this needs to be more discussed. Right now it uses the primary monitor reported by gdk, whatever that is, and tiles all windows on just that monitor.
Submitter Checklist
git rebase -i
(if needed)