Skip to content

Instantly share code, notes, and snippets.

@tuomassalo
Last active February 8, 2023 07:49
Show Gist options
  • Save tuomassalo/7e703001f28bcdeb9cc09a28604ea587 to your computer and use it in GitHub Desktop.
Save tuomassalo/7e703001f28bcdeb9cc09a28604ea587 to your computer and use it in GitHub Desktop.
add numbers to vscode tabs
#!/bin/bash
# This script adds tab numbering and some other CSS tweaks to VSCode.
# NB:
# - The script needs to be re-run after each VSCode upgrade.
# - The script will cause VSCode to say "Installation appears to be corrupt". Just "Don't show again" it.
# - Since macos 13.2 (?) the terminal app needs the `App Management` permission under `Privacy & Security`.
# Allowing a blanket permission is far from optimal, but I haven't found workarounds.
# This gist lives at: https://gist.github.com/tuomassalo/7e703001f28bcdeb9cc09a28604ea587
File='/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.css'
if grep -q 'TS_CSSTWEAKS' "$File"; then
# already patched
exit 0
fi
echo '
/* TS_CSSTWEAKS */
/* Make tabs a bit smaller; emphasize tab borders */
.tabs-container .tab {
border-right: 1px solid #888 !important;
padding-left: 0 !important;
}
/* Tab numbers */
.tabs-container .tab::before {
position:absolute;
left:12px;
top:0px;
padding:0px 3px;
border-radius:7px;
opacity:.7;
color: black;
background:#ff0c;
font-weight:bold;
font-size:70%;
line-height:150%;
}
.tabs-container .tab:nth-child(1)::before{content:"1"}
.tabs-container .tab:nth-child(2)::before{content:"2"}
.tabs-container .tab:nth-child(3)::before{content:"3"}
.tabs-container .tab:nth-child(4)::before{content:"4"}
.tabs-container .tab:nth-child(5)::before{content:"5"}
.tabs-container .tab:nth-child(6)::before{content:"6"}
.tabs-container .tab:nth-child(7)::before{content:"7"}
.tabs-container .tab:nth-child(8)::before{content:"8"}
' >> "$File"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment