How to toggle workspace by hotkey in Blender 2.8?

Hi! Is theree the way to toggle workspace by hotkeys? For example UVEediting workspce is one hotkey, Sculpt workspace is another hotkey and so on? For now we can toggle workspaces by ctrl+pageup and pagedown but it’s not handy at all…

Would like that, too. But checking the code for available operators, I’m rather sure the answer is no. It would be easy to do that via an add-on, though.

On the python console, it can be done like this:

C.window.workspace = bpy.data.workspaces[“Material”]

Just needs someone to put it into an addon :wink:

1 Like

First of all, you can change workspace cycle hotkeys to something closer, Ctrl + Right \ Left Arrows are pretty good.

If you just want hotkeys to switch into specific workspace, here how you do it:

1 Add new hotkey entries to Screen / Screen (Global)
2 In Identifier field you should put wm.context_set_id
3 For Context Attribute you should use window.workspace
4 Use names of your workspace tabs in Value field

In my example I can switch into Fullscreen workspace with Ctrl + Up Arrow and into Materials workspace with Ctrl + Down Arrow.

4 Likes

Ha, learned something new. A generic operator to set stuff to specific values. Nice. Thanks.

Thanx a lot!!! thats exactly what I need

This seems to be broken in Blender 3.3. The context attribute field changes to window.workspace[‘category_indices’] and is red.

Anyone know if there’s an updated command that works to toggle workspace by specific hotkey?

1 Like

For those who are still interested in an answer, the following script adds a hotkey (the ‘6’ key) to switch to a specific workspace (in this example, ‘Sculpting’):

import bpy

keyconfig = bpy.context.window_manager.keyconfigs.user
keymap = keyconfig.keymaps.get("Screen")

if keymap:
    kmi = keymap.keymap_items.new(idname='wm.context_set_id', type='SIX', value='PRESS')
    kmi.properties.data_path = 'window.workspace'
    kmi.properties.value = 'Sculpting'