and the thing of interest there is the Main.overview.toggle();.
So maybe I just need to know what the JavaScript API for going to next and previous workspace is. Where are the API docs for this? Google isn’t doing a good job leading me there.
Apuf…this is very difficult, because of the lack of documentation…So the best way to learn is to see the source code (Yes, the best way…the only way!).
EDIT: I don’t see anything if I search for “overview” in https://gjs-docs.gnome.org. I was hoping to find info on, for example, Main.overview. Is that supposed to be documented there?
EDIT: I see! I need to explicitly “enable” APIs in order to be able to search for them there.
Which API contains workspace switching stuff? I have a feeling it is in the “Shell” API. Mind giving a hint?
EDIT: Ok, I see global.workspace_manager, but I’m not sure what to do with it yet. It says the type is Meta.WorkspaceManager, but I don’t see any docs for Meta.WorkspaceManager.
But this at least helps me know that I can try global.workspace_manager in lookingglas and see what it has, although I don’t see any method to go to next or previous workspace.
EDIT: Ooooooh, I need to enable the “Meta” APIs in DevDocs. I see Meta 3, Meta 4, and Meta 5. Now I need to figure out which one I need to look at.
I hope I’m not spoiling the fun of figuring it out yourself
There are no methods to go to the next or previous workspace. That’s mainly because the underlying API supports arbitrary grid layouts, so “next” or “previous” are ambitious: This fun comment has an overview.
Note that get_neighbor() will return the workspace itself if there is no other workspace in the specified direction, so the above works on the top- and bottom-most workspace as well.
I’m curious, is it possible to make it also show the workspace list (the mini layout that highlights the workspace that I’m switching to), like when I use the keyboard?
I’m thinking I could just use xdotool instead, which wouuld be easier, but seems like the improper way to do it, because changing the key shortcuts would break the Gesture scripts.