zakkak / workspace-grid

https://extensions.gnome.org/extension/484/workspace-grid/
GNU General Public License v3.0
289 stars 40 forks source link

Add a fullscreen workspace switcher #61

Open spacekookie opened 6 years ago

spacekookie commented 6 years ago

I'm still actively using Unity on my desktop computer and I love the way that Ctrl + S works, moving the view out so that all workspaces are visible in their actual configuration (aka the way that windows are displayed), without activating "exposé".

This quickly allows to drag windows between workspaces, get a broad overview of what workspaces exist and what is open, etc (regularly having 6 or 8 workspaces, this would be an awesome feature for me!)

Not knowing what options GNOME gives to extention developers, I'm not sure this is even possible. But I'd love to hear what you think about this. It's essentially developing a full-screen workspace switcher that's decoupled from the meta-overview. If it turns out to be something that is possible and wanted I'd also love to help out with development in any way I can :)

Example of Unity workspace switcher

spacekookie commented 6 years ago

A conversation I had on the GNOME IRC about this:

<spacekookie> Looking at the docs I'm not sure where exactly I would start with that
<mlundblad> spacekookie: dunno exactly how the default workspace "dock" is implemented, but it shows thumbnails of the workspaces, so maybe it's possible to do something similar in an extension
<mlundblad> or is that implemented in C (accessing lower-level mutter stuff)?
<exalm[m]> It's certainly possible, the question is how much work it is
<exalm[m]> You would need to hide the main UI and show the one you want instead. Of course, you'll have to implement the switcher yourself, but there is default thumbnail class, used in workspace switcher dock. The thumbnail are not pixel-perfect, but that'd be enough here
<exalm[m]> And also call Meta.disable_unredirect_for_screen(global.screen) when showing the switcher and Meta.enable_unredirect_for_screen(global.screen) when ending
<exalm[m]> Otherwise it won't work with fullscreen apps that disable compositing
<exalm[m]> s/ending/hiding/
<spacekookie> exalm[m]: mlundblad: Oh cool! Thanks. I've only been playing with the idea in my head so far but it's something I'd love to see in combination with the workspace grid extention actually :P
<spacekookie> That's like the one workflow feature I really miss from Unity. But I'm completely new to gnome extentions
<exalm[m]> Well, you need to implement the switcher actor class
<exalm[m]> Then when needed, you hide the UI (e.g. Main.layoutManager.uiGroup.hide();), disable unredirect and show your actor
<exalm[m]> s/show/create even
<exalm[m]> Then when the user selects the desktop, you remove your actor and show the usual UI back. And enable unredirect
<exalm[m]> The main pain point here is debugging. If you do even a mistake, such as accessing an invalid variable, after you've hidden the UI, then the shell will remain in this state and you'd have to restart it from a tty
<exalm[m]> Or maybe you can instead only hide desktop and windows, but not the panel, and not switch Main.actionMode, in that case you'd be able to do Alt+F2, r on X11
<exalm[m]> But you'd need to disable overview somehow, to ensure that user doesn't open it and break everything
<spacekookie> Yea and that wouldn't allow any "zooming out" animation style either, right? It would just switch (fade at most)
<exalm[m]> It would, if you implement the animation
<exalm[m]> You can e.g. start the animation that transforms the desktop and at the same time fades it out, and at the same time have the animation in the switcher actor that would  transform the needed thumbnail from the entire screen to the small size
<exalm[m]> Then it would zoom and crossfade nicely
<exalm[m]> (crossfade is needed, because thumbnails aren't pixel-perfect sadly
<spacekookie> Hm alright.
<spacekookie> I'm gonna write all this down in my wiki for now and revisit the idea later this weekend when I have some more time :P
<exalm[m]> Animations are done with Tweener, look inside the gnome-shell source for examples
<spacekookie> Thanks <3
<exalm[m]> animation that transforms the desktop from full screen to the position/size matching the thumbnail, I mean
<spacekookie> And while the project doesn't exist yet...PRs always welcome xD
<exalm[m]> And don't forget to reset the desktop size/position back after the animation. Otherwise it'd be still small after you exit :)
<spacekookie> Alright :D
zakkak commented 6 years ago

Nice, thanks for the input @spacekookie.

Unfortunately I can't work on this. Please fill free to open a PR anytime you have something (or you need help with something).

spacekookie commented 6 years ago

@zakkak I'm trying to look into it :) I've never written a GNOME extension before but I want to learn it. Are you on IRC or gitter maybe for questions?

zakkak commented 6 years ago

No, I don't use any of these platforms anymore, nor can I think of any non-personal medium as an alternative.

TBH I am also not very familiar with GNOME extensions (and JS in general), I just adopted this extension and try to keep it functional.