visual-studio-codeterminalwindow

How can I force the VS Code panel to be certain height on startup?


I think the title and image sum up the problem (this has been going on for years).

Any way to force the terminal window to have a fixed height (or percentage, e.g. 15%) when launching/restarting VSCode?

enter image description here


Solution

  • VS Code stores the workbench panel size memory in globalStorage/state.vscdb under the same directory as user settings. You can open the database file with sqlite3 and then run UPDATE ItemTable SET value = 123 WHERE key = 'workbench.panel.size';. If you're interested in the primary sidebar or the secondary/auxiliary sidebar, see also the workbench.sidebar.size and workbench.auxiliarybar.size keys.

    Then you could write a shell script that does that modification and then runs code and passes the rest of the script arguments to code. Ex. in Bash (you need to do some singlequote dances), the command to do the DB modification would be (using 100 as an example value): sqlite3 ~/.config/Code/User/globalStorage/state.vscdb 'UPDATE ItemTable SET value = 100 WHERE key = '"'"'workbench.panel.size'"'"';'

    See also How can I configure the sidebar and panel's default sizes in VS Code?.

    Other keys related to the panel include workbench.panel.wasLastMaximized, workbench.panel.position, workbench.panel.hidden, workbench.panelpart.activepanelid, and others.