Where can I find/access the horizontal scroll property value for the TOPBAR menu-and-tabs, or the active workspace tab position ? I'd like to see which tab label is active but it is often off to the right of my hardware's desktop/display space.

Workspace tabs don't become visible when I do Ctrl+PgUp or Ctrl+PgDn to select them, so I'd like to write a bit of code that finds out where the tab is and scrolls it horizontally into the middle of the tab bar.

I'd like to be able to do this because it will mean being about to work a little more conveniently than by moving the mouse to the menu to set the horizontal menu scrollwheel context, even after the workspace tab already changed. It is trivial but also distracting.

Is it somewhere in bpy.data.window_managers['WinMan'].windows[0] or bpy.context.window_manager['WinMan'].windows[0] ?


This code can find where I want the workspace tab to be put, and move the mouse there, but I don't know how to situate the tab menu scroll line via bpy. I don't want to have to try achieving it withpyautogui, so I'd be grateful for your help.

import bpy
import pyautogui
step_time = 1.4
original_x, original_y = pyautogui.position().x, pyautogui.position().y
window_x_center = bpy.data.window_managers["WinMan"].windows[0].width/2
pyautogui.moveTo(window_x_center, 10, step_time, pyautogui.easeOutQuint)
pyautogui.moveTo(original_x, original_y, step_time, pyautogui.easeOutQuint)


>>> for d in bpy.context.window.screen.bl_rna.properties.items(): print (d)
('rna_type', <bpy_struct, PointerProperty("rna_type") at 0xe96dfa0>)
('areas', <bpy_struct, CollectionProperty("areas") at 0xec54600>)
>>> bpy.context.window.screen.bl_rna.properties['areas']
<bpy_struct, CollectionProperty("areas") at 0xec54600>

>>> bpy.context.window.screen.bl_rna.properties['areas'].
  • $\begingroup$ Somewhat related. blender.stackexchange.com/questions/146815/… $\endgroup$
    – batFINGER
    Aug 18, 2021 at 14:20
  • $\begingroup$ That is true, and a good one, but even beside ≡, my workspace tabs still hide over behind, far to the right of everything. $\endgroup$
    – Rob Moore
    Aug 18, 2021 at 16:21
  • $\begingroup$ In my start up file I reduced workspaces down to .. well General and Scripting. basically a set of those I use most often. Any others I can grab from + add workspace. If I load in a blend and forget to uncheck load UI, I run the issue you are talking about.... .. do have a move most often used workspace left script, will try and hunt it down. $\endgroup$
    – batFINGER
    Aug 18, 2021 at 16:35
  • $\begingroup$ I generally start Blender from a shell script that runs a few other things first, like pycco. That lets me browse Blender/Python scripts with most comments pulled out, to the side of the code. If there are particular kinds of mistake in the Python scripts that it would otherwise to show as HTML, pycco often makes that quite clear by failing to show the code from the point of such errors. $\endgroup$
    – Rob Moore
    Aug 19, 2021 at 10:41
  • $\begingroup$ The bash script that runs Blender has parameters --python-use-system-env and --python ./setup.py to give easy access to the modules associated with the system's Python and to set up things like Workspaces (tabs). These are based on the Scripting workspace template and include a User Preferences workspace. Blender 3.0.0a seems to crash before take-off if setup.py tries to take the Layout. $\endgroup$
    – Rob Moore
    Aug 19, 2021 at 10:43


You must log in to answer this question.

Browse other questions tagged .