Skip to content

Hiding titlebar #42

Closed
Closed

Description

@oschrenk

I'm trying to create a minimal MacVim experience by removing the titlebar from the application. I was inspired by https://tuananh.org/2015/01/11/a-minimal-iterm2-setup/ which was actually being picked up by the development team as an option.

Basically I did

diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m
index b87079b..ecea307 100644
--- a/src/MacVim/MMWindowController.m
+++ b/src/MacVim/MMWindowController.m
@@ -126,7 +126,7 @@

 - (id)initWithVimController:(MMVimController *)controller
 {
-    unsigned styleMask = NSTitledWindowMask | NSClosableWindowMask
+    unsigned styleMask = NSClosableWindowMask
             | NSMiniaturizableWindowMask | NSResizableWindowMask
             | NSUnifiedTitleAndToolbarWindowMask;

Everything compiles and it actually removes the titlebar as intended BUT the window doesn't accept any keyboard input (I just hear the bell).

As an unfortunate side effect this removes the ability for amethyst window manager to move the window. Maybe that is even the issue for MacVim.

Unfortunately my knowledge about Objective-C is limited, so my experiment stopped. But maybe somebody else knows how to move this forward?

Activity

  1. jpetrie commented on Jun 4, 2015

    @jpetrie
    Contributor

    By removing NSTitledWindowMask (0x1), you've essentially set NSBorderlessWindowMask (0x0); none of the other values you are still OR'ing into the style masks set the low bit of the value to 1.

    A window with NSBorderlessWindowMask can't become key or main, and thus can't get keyboard input (that's why you hear the bells when you type). The NSWindow needs to return YES from canBecomeMainWindow and/or canBecomeKeyWindow to change this behavior.

    Fortunately MacVim already has a window subclass (MMWindow), so you should be able to fix this by adding one or both of:

    -(BOOL) canBecomeMainWindow {
        return YES;
    }
    
    -(BOOL) canBecomeMainWindow {
        return YES;
    }
    

    to MMWindow.m. I think (I haven't tested it).

    I'm not sure whether or not supporting this is something MacVim would want (and if so, how to expose the preference), that's probably for @douglasdrumond to decide.

  2. splhack commented on Nov 5, 2015

    @splhack
    Contributor

    Hmm, no-title-bar window is not fancy for me, but you can try the pull request #111

  3. added
    Feature RequestNew features request. Not an existing issue or bug.
    on Nov 7, 2015
  4. splhack commented on Dec 8, 2015

    @splhack
    Contributor

    #111 is ready to merge. @oschrenk could you test it?

  5. splhack commented on Dec 9, 2015

    @splhack
    Contributor

    #111 merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature RequestNew features request. Not an existing issue or bug.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions