Git Product home page Git Product logo

vscode-titlebar-less-macos's Introduction

Deprecation Notice

This extension does not work on VSCode 1.40 or newer, and has therefore been deprecated.

You may use Apc Customize UI++ instead, which you can configure to achieve the same UI style by adding these settings in your settings.json file, see #52:

{
  "window.titleBarStyle": "native",
  "apc.electron": {
    "titleBarStyle": "hiddenInset",
  },
  "apc.header": {
    "height": 37
  },
  "apc.sidebar.titlebar": {
    "height": 37
  },
  "apc.activityBar": {
    "size": 77,
    "itemSize": 48,
    "itemMargin": 0
  },
  "apc.stylesheet": {
    // Don't indent the sidebar title.
    ".custom-sidebar-titlebar .sidebar .composite.title": "padding-left: 0;",
    // Don't indent the statusbar items.
    ".monaco-workbench .part.statusbar>.items-container>.statusbar-item.left.first-visible-item": "padding-left: 0;",
    // Show the host button, and make it as wide as the .activitybar.
    ".statusbar #status\\.host": "display: block !important; width: calc(var(--activity-bar-action-size) - 1px); background: #555 !important;",
    ".statusbar #status\\.host .codicon": "margin: 0 auto;",
  }
}

Before Apc Customize UI++, Customize UI was recommended as a replacement, which you could configure to achieve the same UI style by adding these settings in your settings.json file:

{
  "window.titleBarStyle": "native",
  "customizeUI.titleBar": "inline",
  "customizeUI.activityBar": "wide",
  "customizeUI.stylesheet": {
    // Center action items in .activitybar.
    ".monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item .action-label": "margin: 0 auto;",
    // Show the host button, and make it as wide as the .activitybar.
    ".statusbar #status\\.host": "width: 76px; background: #555 !important;",
    ".statusbar #status\\.host .codicon": "margin: 0 auto;"
  }
}

Titlebar-less VSCode for macOS

Preview

An extension to hide the titlebar on VSCode for macOS, and inline the traffic lights (= window controls).

Installation

Follow the instructions in the Marketplace, or run the following in the command palette:

ext install lehni.vscode-titlebar-less-macos

Alternatively, you can run this command in the command line:

code --install-extension lehni.vscode-titlebar-less-macos

Usage

The extension adds 2 new commands to the command palette:

Titlebar-Less: Enable // Enable titlebar-less mode on macOS (patches core files)
Titlebar-Less: Disable // Disable titlebar-less mode on macOS (restores core files)

After executing either of these commands, you need to fully restart VSCode in order to see the extension's effect. Simply reloading the window is not enough.

If VSCode complains about it being corrupted after the restart, you have two options:

  1. Install the vscode-fix-checksums extension and adjust the internal checksums to prevent this error from being displayed. This will also solve the display of [Unsupported] in titles and menus.

  2. Choose Don't Show Again:

    Don't Show Again

See Disclaimer / A Word of Caution for details.

See Required User Settings, if the title bar doesn't look right after the restart.

Required User Settings

This extension only works with the following User Settings. In order to change them, choose Code > Preferences > Settings in the menu, and add / change these lines:

"window.titleBarStyle": "custom",
"window.nativeTabs": false,

Applying the Patches as Root

Due to security restrictions on some systems, VSCode may need to run as root in order to be able to apply the patches. To do so, open the Terminal.app and run:

sudo "/Applications/Visual Studio Code.app/Contents/MacOS/Electron"

Or this if you're using VSCode Insiders:

sudo "/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron"

Once you ave applied the patches by executing Titlebar-Less: Enable as root, quit VSCode and start it normally without root privileges again.

Disclaimer / A Word of Caution

This extension modifies files that are part of the core of VSCode, so use it at your own risk.

This extension creates backup files before modifying the core files, and these can be restored at any time using the Titlebar-Less: Disable command.

If anything goes wrong, you can always reinstall VSCode from code.visualstudio.com without loosing any settings or installed extensions.

Updating VSCode / Titlebar-Less

When either VSCode or this extension is updated to a newer version, you can reapply the extension's modifications of the core files simply by running this command again, followed by a restart of the full application:

Titlebar-Less: Enable

Before / After

Before/After

Inspiration

microsoft/vscode#12377

In particular, @orta's work on a similar fork.

License

MIT Β© JΓΌrg Lehni, 2018

vscode-titlebar-less-macos's People

Contributors

dpren avatar lehni avatar smockle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vscode-titlebar-less-macos's Issues

Window Resizing

on macOS you can click the title bar to have the window automatically resize to the available screen size. With this extension enabled you there is nowhere to click to make this happen.

Double click to zoom

First of all, thank you for this extension. It is a game changer. There is one tiny thing that bugs me a bit. Doubleclicking on draggable areas should maximize (zoom) the window. Would this be possible to implement?

Option to hide traffic light buttons

Since I use keyboard shortcuts, I have no use for the traffic light buttons. Could we add an option to hide them entirely?

I'd submit a PR if you're open to it.

I appreciate your effort on this extension.

Unable to use window.nativeFullScreen as false

Hi there,

Just found out about this extension recently and I absolutely love it, thank you so much for having done this! You are awesome. πŸ‘

I noticed that before this extension I would have window.nativeFullScreen = false to prevent Code from creating a new space when triggering the fullscreen, however that needs to be set as true for the extension to work properly

Only adding this here because the README only mentions window.nativeTabs but not that one

Code Version 1.34.0 (1.34.0)
macOS Mojave Version 10.14.5

PS: I wouldn't bother trying to make this work, if anything this is a cue for me to finally learn how to use Spectacle shortcuts properly instead of relying on application settings for that, thank you again!!!!

Not able to click certain areas of tabs.

With this extension enable, I'm not able to click on certain tab areas and the behavior is inconsistent. It seems like a similar problem as #27 but I'm not sure.

Also, clicking on the "x" to close a tab will not work unless I click directly on the "x" glyph.

Awesome extension btw, thanks!

Fullscreen support

First of all thank you for this extension!

When VSC is fullscreened some space is still reserved for the traffic lights, even though the traffic lights get rendered in a separate titlebar.

Better way of handling tab dragging

Currently, every tab has -webkit-app-region: no-drag set, which causes problem when there is a lot of tabs and they get scrolled beneath panel title (the "EXPLORER" part). Despite overflow:hidden, chrome still considers the area covered by tabs no-drag, and thus panel title becomes not draggable.

This could be solved by some monkey-patching magic. I.e. this seems to work fine

    _override = function (where, name, cb) {
        (function (original) {
            where.prototype[name] = function () {
                let t = this;
                let a = arguments;
                let res = cb.apply(this,
                    [() => original.apply(t, a)]
                );
                return res;
            }
        })(where.prototype[name]);
    }

   require.define("my", [
        "vs/workbench/services/window/electron-browser/windowService",
        "vs/workbench/browser/parts/editor/tabsTitleControl",
        "vs/workbench/browser/parts/editor/editorPart"
    ], function(ws, ttt, egs) {

             let replacement = function (original) {
                // remove draggin area element
                if (this.tabsContainer.lastChild) {
                    this.tabsContainer.removeChild(this.tabsContainer.lastChild);
                }

                // call original handler to create / delete tab nodes
                let res = original();

                // append dragging area
                let node = document.createElement("div");
                let container = this.tabsContainer;
                node.addEventListener("mousedown", (e) => e.preventDefault());

                // forward drag and drop
                let forward = function (oldEvent) {
                    let e = new oldEvent.constructor(oldEvent.type, oldEvent);
                    oldEvent.cancelBubble = true;
                    oldEvent.preventDefault();
                    e.target = container;
                    return container.dispatchEvent(e);
                }
                node.addEventListener("dragenter", forward);
                node.addEventListener("dragleave", forward);
                node.addEventListener("dragover", forward);
                node.addEventListener("dragend", forward);
                node.addEventListener("drop", forward);

                // doubleclick to zoom
                let windowService = this.instantiationService.createInstance(ws.WindowService);
                node.addEventListener("dblclick", () => windowService.onWindowTitleDoubleClick());

                this.tabsContainer.appendChild(node);

                let service = this.accessor;
                let group = this.group;

                // when this function is invoked during restore, there is no
                // grid widget present just yet
                window.setTimeout(function () {
                    if (document.body.contains(node)) { // still in document
                        // check if this is topmost group
                        groupAbove = service.findGroup({ direction: 0 }, group);
                        if (!groupAbove) {
                            node.className = "dragging-area-top";
                        }
                    }
                }, 0);

                return res;
            }

            _override(ttt.TabsTitleControl, "openEditor", replacement);
            _override(ttt.TabsTitleControl, "handleClosedEditors", replacement);
    }

and a bit of css

div.dragging-area-top {
    flex-grow: 1.0;
    -webkit-app-region: drag;
}

The way this works is that it creates div that fills area after last tab, which itself is draggable (so the drag/no-drag properties of tablist and tab can be removed). It also checks if tab is on top, so the logic from extension.js (process.nextTick()...) could be removed

Support "Extension Development Host" windows

For some reasons the window.titleBarStyle setting is ignored in the window that gets opened when debugging extensions, I think this extension should support that, basically detecting when it's running in such window and doing nothing, similarly to when the window is fullscreened.

screen shot 2018-08-31 at 16 10 01

Stuck after upgrade to version 1.31.0

Stuck after upgrade to version 1.31.0
After applying TitlebarLess: enable and restart Vscode shows an empty screen and I see no way to roll back except to download a new app and replace VScode in Applications folder.

It's also doesn't allow to open Developer Tools

Unable applying in 1.32.0-insider

While running the enable command, I'm running into an unknown error of unable to apply patch (2/4), even when using sudo.

VSCode Version: Insiders

Unable to apply all patches (0/4)

Hey there!

Awesome plugin, this is just what I wanted.

I added the options

{
    "window.nativeTabs": false,
    "window.titleBarStyle": "custom",
}

and ran

>Titlebar-Less: Enable

But then I got an error saying

Unable to apply all patches (0/4)

Do you have any clue from this what could have gone wrong?

Remove titlebar icons

Hello,

First, great extension ! πŸ˜„
Would it be possible/relevant to remove the left colored mac icons with an option or something ?

image

I wanna have a minimal vscode ui

  • no tabs
  • no activity bar
  • no title bar (at all)

to get something similar with hyper-mimal

image

I tried Vscode-essence but

  1. The vscode version is old
  2. Lots of extensions not working on it
  3. Some errors
  4. UI is to light (don't have filename, scrollbar, line amounts)

I think it could interest some people and extension like this one is a better option than forking

Not working on 1.38

It seems that the last update broke some of the patches that this extension applies. I've checked the console output and it seems because some files don't exist anymore, in this case they seem to have been renamed

[Extension Host] Error: ENOENT: no such file or directory, open '/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js'    at Object.openSync (fs.js:436:3)    at Object.module.(anonymous function) [as openSync] (ELECTRON_ASAR.js:160:31)    at Object.readFileSync (fs.js:341:35)    at Object.exports.wrapFsWithAsar.fs.readFileSync (ELECTRON_ASAR.js:580:40)    at applyPatches (/Users/alex/.vscode/extensions/lehni.vscode-titlebar-less-macos-1.9.1/extension.js:164:26)
[Extension Host] Error: ENOENT: no such file or directory, open '/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.css'    at Object.openSync (fs.js:436:3)    at Object.module.(anonymous function) [as openSync] (ELECTRON_ASAR.js:160:31)    at Object.readFileSync (fs.js:341:35)    at Object.exports.wrapFsWithAsar.fs.readFileSync (ELECTRON_ASAR.js:580:40)    at applyPatches (/Users/alex/.vscode/extensions/lehni.vscode-titlebar-less-macos-1.9.1/extension.js:164:26)

It seems that the new files are called workbench.desktop.main.js and workbench.desktop.main.css respectively

Only dragging the topmost tab bars should drag the whole window

Currently all tab bars can be dragged on in order to move the entire window, but I think only the top-most tab bars should behave like that. It feels weird that I can drag the whole window from its center, and this way I can't move any editors groups around.

screen shot 2018-08-12 at 17 04 27

Not working on 1.30.0

Having trouble getting it to work on 1.30.0

After enabling it, the usual message "Your Code installation appears to be corrupt. Please reinstall." appears, but no effect.

Maintenance help?

I notice you haven't been maintaining this as actively lately. I understand it's a lot of work to keep up with all the VSCode updates. I'd love to help. Would you be open to adding me as a co-maintainer so we can keep things working if you're busy?

Incompatible with some settings

This extension does not have any effect when "window.titleBarStyle" is set to "native" or when "window.nativeTabs" is set to true.

As a workaround, set "window.titleBarStyle" to "custom" and "window.nativeTabs" to false.

This isn’t really a bug IMO, but it might be worth noting in the README.

Sidebar layout broken in latests Insiders release

Titlebar-less version: 1.0.9
VS Code version: 1.26.0-insider (90fc7e66e2e10f643871b42f9c0f1f989d0ed221)

Not sure if you want to support the Insiders release but in the latest VS Code - Insiders release, the sidebar layout is pretty badly broken:

screenshot 2018-07-23 13 29 53

It works just fine using my exact same settings in the non-Insiders release version 1.25.1

Upper half of debug toolbar buttons not clickable

  1. Install vscode-titlebar-less-macos (version 1.9.1) and enable titlebar-less, restart VSCode.
  2. Start some debug configuration so that debug toolbar appears.
  3. Try clicking on any of the debug toolbar buttons (e.g. Stop).

You can successfully click on a button if clicking the lower half of the button. Nothing happens if you click on the upper half. No such problems with titlebar-less disabled.

[FEAT. REQ.] Vertical traffic light option possibility?

Hello! This is a groovy extension for Mac VSCode users and I would like to request the addition of the ability to choose between horizontal and vertical traffic lights if possible, like in the Atom mod screenshot on this comment in @Microsoft/vscode#12377. What would be the difficulty in adding this feature?

The other screenshot in that comment (the Xcode-style titlebar) is potentially a trivial change with the Custom CSS & JS extension augmenting the current version of this extension, so I'm not nearly as concerned for that one at the moment.

ZoomLevel

When "window.zoomlevel" is set to anything but 0 the traffic light buttons aren't aligned correctly. -1 causes the explorer to overlap them slightly

Top of explorer sidebar becomes undraggable

Top of explorer sidebar becomes un-draggable after the window is open for some time. I'm not sure exactly what causes this to happen but it seems to consistently happen to me. Re-opening the window fixes it.
Screen Shot 2019-03-31 at 2 28 28 PM

Sidebar width when on the right

Love the extension!
Being one of these weirdos who put the side bar on the right (View/Appearance/Move sidebar right), I was thinking that there's no real point in this case for the sidebar to match the width of the traffic lights. It could use the standard 50px width, right?

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.