Skip to content

Instantly share code, notes, and snippets.

@chockenberry
chockenberry / finder_icons.sh
Last active October 22, 2020 19:25
A simple shell script to turn the Finders desktop icons on and off
View finder_icons.sh
#!/bin/sh
defaults read com.apple.finder CreateDesktop > /dev/null 2>&1
enabled=$?
if [ "$1" = "off" ]; then
if [ $enabled -eq 1 ]; then
defaults write com.apple.finder CreateDesktop false
osascript -e 'tell application "Finder" to quit'
open -a Finder
@Kapeli
Kapeli / NSCrapField.m
Last active March 9, 2020 18:57
Yosemite NSSearchField Fixes
View NSCrapField.m
// 1. Disable centered look & animation:
// 1.1. Subclass NSSearchFieldCell and add:
- (BOOL)isCenteredLook
{
return NO;
}
// 1.2. Subclass NSSearchField and add:
@franciscoadasme
franciscoadasme / gist:1008620
Created June 5, 2011 03:40
How to show a custom title bar icon in NSWindow
View gist:1008620
// Force to show a titlebar icon
[window setRepresentedURL:[NSURL URLWithString:@"WindowTitle"]];
// Set our custom icon
[[window standardWindowButton:NSWindowDocumentIconButton] setImage:[NSImage imageNamed:@"imagename"]];
...
// Implement window delegate method to prevent to popup document (which do not exist) path menu when cmd+clicked
- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu
{