Skip to content

Instantly share code, notes, and snippets.

@fjolnir
Last active December 26, 2015 07:09
Show Gist options
  • Save fjolnir/7113362 to your computer and use it in GitHub Desktop.
Save fjolnir/7113362 to your computer and use it in GitHub Desktop.
Hides the menubar shadow (Screenshot: http://d.asgeirsson.is/yWUi)
#!/usr/local/tranquil/bin/tranquil
import "AppKit"
\ Hides the menubar shadow
\ I used Platypus to wrap this script in an app bundle and then added that to my login items
nsapp = NSApplication sharedApplication
@OverlayView < NSView {
accessor: #background
- drawRect: dirtyRect {
bounds = self bounds
screenBounds = self window screen frame
screenBounds[0] = [0, -screenBounds[1][1] + bounds[1][1]]
@background drawInRect: screenBounds fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1
}
}
windows = nil
update = {
windows = {}
NSScreen screens each: { screen |
imageURL = NSWorkspace sharedWorkspace desktopImageURLForScreen:screen
view = OverlayView new
setBackground: (NSImage alloc initByReferencingURL: imageURL);
self
frame = screen frame
windows[screen] = (NSWindow alloc initWithContentRect: [[frame[0][0], frame[0][1] + frame[1][1] - 35], [frame[1][0], 35]]
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreBuffered
defer: no)
setContentView: view;
setLevel: -1;
setCollectionBehavior: NSWindowCollectionBehaviorCanJoinAllSpaces;
orderFront: nil;
self
}
}
NSNotificationCenter defaultCenter addObserver: update selector: #call
name: NSApplicationDidChangeScreenParametersNotification
object: nil
update()
nsapp run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment