Skip to content

macOS: Recommended settings for wide activity-bar with integrated traffic lights #16

Description

@lehni

First of all, thank you for making this great extension! I'm the author of the original vscode-titlebar-less-macos, which I discontinued when the great Customize UI by @iocave came long, which eventually was broken by VSCode changes and replaced by the equally great Apc Customize UI++ by @drcika. Now it seems that Custom UI Style continues to carry the torch, and thus I tried to achieve the wide activity-bar look that the previous extensions supported through some JS trickery.

I managed to actually make it work by solely using CSS settings, and so I decided to share them here. Perhaps they could be abstracted behind a more convenient setting switch in the extension?

My current settings are:

{
  "window.titleBarStyle": "native",
  "window.customTitleBarVisibility": "never",
  "custom-ui-style.electron": {
    "titleBarStyle": "hiddenInset"
  },
  "custom-ui-style.stylesheet": {
    ".monaco-workbench": {
      "--activitybar-width": "77px",
      "--titlebar-height": "37px",

      // Titlebar
      ".part.sidebar.left .composite.title": {
        "&, .title-actions, .global-actions, .monaco-toolbar": {
          "height": "var(--titlebar-height)"
        },

        ".title-label": {
          "line-height": "var(--titlebar-height)"
        }
      },
  
      // Tabs
      ".title.tabs": {
        "--editor-group-tab-height": "var(--titlebar-height) !important",
      },

      // Wide activity bar
      ".split-view-view:has(> .part.activitybar.left)": {
        "&, .part.activitybar.left, .content": {          
          "min-width": "var(--activitybar-width)",
        },

        // Make the split-view after the wide activity bar smaller.
        // Also handle the situation where the sidebar is hidden,
        // in which case the editor itself needs to shrink / auto-size.
        "& + .split-view-view.visible, & + .split-view-view:not(.visible) + .split-view-view.visible": {
          "--offset": "calc(var(--activitybar-width) - 48px)",
          "margin-left": "var(--offset)",

          "> *:first-child": {
            "width": "auto",
            "margin-right": "var(--offset)",

            // Auto-size the editor when the sidebar is hidden.
            ".content": {
              "&, .split-view-view": {
                "&, .monaco-editor": {
                  "&, .overflow-guard, .overlayWidgets" : {
                    "&, .monaco-scrollable-element, .sticky-widget": {
                      "width": "unset !important",
                      "left": "0",
                      "right": "0"
                    },

                    ".sticky-widget": {
                      "right": "14px !important"
                    }
                  }
                }
              }
            }
          },
        }
      },

      // Search-Widget
      ".search-view .search-widget": {
        ".replace-container": {
          "width": "calc(100% - 18px)",

          ".replace-input": {
            "&, .monaco-findInput": {
              "width": "100% !important"
            }
          }
        }			
      },

      ".monaco-sash.vertical.minimum": {
        // TODO: Improve collapsing of the sidebar.
        "left": "calc(var(--activitybar-width) - var(--vscode-sash-size) / 2) !important"
      },

      ".part.activitybar.left": {
        ".monaco-action-bar": {
          ".action-label": {
            "width": "var(--activitybar-width)"
          }
        }
      },

      "&:not(.fullscreen)": {
        // Make room for traffic lights.
        ".part.activitybar.left > .content": {
          "padding-top": "var(--titlebar-height)"
        },

        // Move editor title when side-bar is hidden, when side-bar is on the
        // right or when activity-bar is hidden and side-bar is not on the right
        "&:has(.sidebar.right)": {
          ".monaco-split-view2.horizontal .split-view-view:not(.visible) + .split-view-view.visible .editor .title .tabs-and-actions-container": {
            "padding-left": "var(--activitybar-width)"
          },

          ".auxiliarybar.left .composite.title": {
            "padding-left": "var(--activitybar-width)"
          }
        },

         // Allow dragging on the activity-bar, status-bar, tabs-container, side-bar title...
        ".activitybar, .statusbar, .tabs-container, .sidebar .composite.title": {
          "-webkit-app-region": "drag",

          // ...but still allow to click actions and items without dragging.
          ".content .monaco-action-bar, .statusbar-item, .tab, .title .title-actions .action-label": {
            "-webkit-app-region": "no-drag"
          }
        }
      },

      ".statusbar": {
        // Don't indent the statusbar items.
        "> .items-container > .statusbar-item.left.first-visible-item": {
          "padding-left": "0"
        },

        // Show the host button again, and make it as wide as the .activitybar.
        "#status\\.host": {
          "&": {
            "display": "block !important",
            "width": "calc(var(--activitybar-width) - 1px)"
          },
          ".codicon": {
            "margin": "0 auto"
          }
        }
      }
    },

    // Make line numbers a bit smaller.
    ".editor .margin-view-overlays .line-numbers": {
      "font-size": "85%"
    },

    // Show search inputs and results in monospaced font.
    ".search-widget textarea, .find-widget textarea, .search-view .results .match": {
      "font-family": "var(--cus-monospace-font) !important"
    }
  }
}
Screenshot 2024-12-27 at 14 09 26

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions