OSX Maverick: wintermute

From wikinotes
Revision as of 05:08, 17 February 2020 by Will (talk | contribs) (→‎Xmonad)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Install

Adding Chimera bootloader to Grub2

This information is no longer accurate. See Wintermute Archlinux documentation under UEFI. The following article explains how I originally got OSX booting with grub-bios.


#### /etc/grub.d/40_custom

# append:
menuentry "OSX Mountain Lion" {
    set root='(hd1)'
    chainloader +1
}

NOTE:

we're chainloading the chimera bootloader, you don't need to specify the partition.

# update grub in linux
sudo update-grub

Core Setup

programs

brew
macports
xquartz
urxvt
xcode
brew install caskroom/cask/brew-cask

brew install \
  zsh \
  git \
  tmux \
  bash \
  gcc \
  coreutils \
  findutils \
  w3m \
  vifm \
  ghc \
  cabal-install \
  homebrew/x11/dmenu \
  vim \
  macvim \
  Caskroom/cask/sublime-text \
  Caskroom/cask/osxfuse \
  grep \
  gawk \
  imagemagick \
  ffmpeg \
  pyside

sudo port install feh

Hostname

sudo scutil --set HostName wintermute  # set hostname

Shell

Add to /etc/shells

/usr/local/bin/zsh
chsh -s /usr/local/bin/zsh

Basics

System Preferences > Sharing > Remote Login  # enable sshd
System Preferences > Audio > Alert Volume    # (slide to 0% so terminal audio bells are disabled)
System Preferences > Security & Privacy > Allow Apps Downloaded from (anywhere)

Hotkeys

Note
The below system should work with standard keyboards, my matias keyboard however needs a special fix. In the KeyboardMenu, set 'Capslock','Control' to 'No Action', then run the program seil, binding CapsLock to keycode 59, Control to keycode 55. Reboot. (capslock confirmed, uncertain about ctrl key to command key)


Swap Command/Ctrl, Capslock/Ctrl
After logout/re-login, this works both within OSX, and also for XQuartz (X11) applications without any xmodmap hackery.

Keyboard Menu

System Preferences > Keyboard
## (will make vim scroll more bearable)
## Key Repeat(fastest)
## Delay Until Repeat (fastest)
## Requires re-login

System Preferences > Keyboard > Modifier Keys
## CapsLock: Control
## Control: Command

#### Logout and log back in for MODIFIER-KEY changes to take effect.


Terminal

defaults write com.apple.finder NSUserKeyEquivalents '{"Move to Trash"="\U007F";}'		## Bind 'Delete' to delete files in Finder


Home/End/Page/SelectWord/ShiftInsert

I haven't actually had success with this one yet, I currently have it disabled so that the above Ctrl/Capslock swap works correctly.

mkdir ~/Library/KeyBindings

#### ~/Library/KeyBindings/DefaultKeyBinding.dict
/*
This file remaps the key bindings of a single user on Mac OS X 10.5 to more closely 
match default behavior on Windows systems.  This particular mapping assumes 
that you have also switched the Control and Command keys already. 
 
This key mapping is more appropriate after switching Ctrl for Command in this menu: 
Apple->System Preferences->Keyboard & Mouse->Keyboard->Modifier Keys...-> 
Change Control Key to Command 
Change Command key to Control 
This applies to OS X 10.5 and possibly other versions. 
 
Here is a rough cheatsheet for syntax. 
Key Modifiers 
^ : Ctrl 
$ : Shift 
~ : Option (Alt) 
@ : Command (Apple) 
# : Numeric Keypad 
 
Non-Printable Key Codes 
 
Up Arrow:     \UF700        Backspace:    \U0008        F1:           \UF704 
Down Arrow:   \UF701        Tab:          \U0009        F2:           \UF705 
Left Arrow:   \UF702        Escape:       \U001B        F3:           \UF706 
Right Arrow:  \UF703        Enter:        \U000A        ... 
Insert:       \UF727        Page Up:      \UF72C 
Delete:       \UF728        Page Down:    \UF72D 
Home:         \UF729        Print Screen: \UF72E 
End:          \UF72B        Scroll Lock:  \UF72F 
Break:        \UF732        Pause:        \UF730 
SysReq:       \UF731        Menu:         \UF735 
Help:         \UF746 
 
NOTE: typically the Windows 'Insert' key is mapped to what Macs call 'Help'.   
Regular Mac keyboards don't even have the Insert key, but provide 'Fn' instead,  
which is completely different. 
*/  

{
"\UF729"   = "moveToBeginningOfLine:";                       /* Home                      */  
"@\UF729"  = "moveToBeginningOfDocument:";                   /* Cmd  + Home               */  
"$\UF729"  = "moveToBeginningOfLineAndModifySelection:";     /* Shift + Home              */  
"@$\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; /* Shift + Cmd  + Home       */  
"\UF72B"   = "moveToEndOfLine:";                             /* End                       */  
"@\UF72B"  = "moveToEndOfDocument:";                         /* Cmd  + End                */  
"$\UF72B"  = "moveToEndOfLineAndModifySelection:";           /* Shift + End               */  
"@$\UF72B" = "moveToEndOfDocumentAndModifySelection:";       /* Shift + Cmd  + End        */  
"\UF72C"   = "pageUp:";                                      /* PageUp                    */  
"\UF72D"   = "pageDown:";                                    /* PageDown                  */  
"$\UF728"  = "cut:";                                         /* Shift + Del               */  
"$\UF727"  = "paste:";                                       /* Shift + Ins               */  
"@\UF727"  = "copy:";                                        /* Cmd  + Ins                */  
"$\UF746"  = "paste:";                                       /* Shift + Help              */  
"@\UF746"  = "copy:";                                        /* Cmd  + Help (Ins)         */  
"@\UF702"  = "moveWordBackward:";                            /* Cmd  + LeftArrow          */  
"@\UF703"  = "moveWordForward:";                             /* Cmd  + RightArrow         */  
"@$\UF702" = "moveWordBackwardAndModifySelection:";          /* Shift + Cmd  + Leftarrow  */  
"@$\UF703" = "moveWordForwardAndModifySelection:";           /* Shift + Cmd  + Rightarrow */  
}
####


Window Management

Amethyst is pretty awesome, but I don't always want to manage windows via hotkeys when writing GUIs. Afloat gives you X11-like window resizing:

http://nulana.com/flexiglass/						## 15$, but works like a charm. Worth it to me.

https://github.com/conformal/spectrwm/wiki	## This also looks very promising, possibly alternative to amethyst
http://onethingwell.org/post/5609933530/scrotwm-osx


Autostart Programs

OSX has both a crontab, and a graphical autostart option. I'm backing up the crontab, so it doesn't require documentation here, but here is where/what I have autostarting on login:


#### Preparation
## You cannot autostart programs that are in the 'Utilities' folder, however
## if you Rclick > Make Alias, then copy that alias to your Applications Folder
## you can Autostart it. Here are some of the preparations I had to make:

/Applications/Ulitites/X11 > Make Alias
Copy/Paste to /Applications/


#### Preferences > Users & Groups > will > LoginItems (tab)
* Applications/FinderPath
* Applications/X11 (Alias)

Terminal

Terminal.App

See terminal.app

iterm2

iterm2 is the go-to OSX terminal. I'd rather use urxvt, or better still, suckless-st but this can be my crutch until I get sorted. https://www.iterm2.com/

mkdir /Users/will/.iterm2

iTerm > Preferences > General > (Check Load Preferences from custom folder or URL) > Save Settings to Folder
/Users/will/.iterm2
## Save Settings To Folder


rxvt-unicode

## Install XQuartz
## http://xquartz.macosforge.org/landing/

sudo port install rxvt-unicode


suckless st

suckless st, can be compiled on a mac, it just needs a patch:
https://gist.github.com/tmsh/8df44a9fcd0180e15906

NOTE I haven't been able to get this to compile yet

### Install
#
cd /home/src
#curl -O# https://aur.archlinux.org/packages/st/st/st.tar.gz  	## no longer using arch repo, want specific version
																					## for patches
 
curl -O#  http://dl.suckless.org/st/st-0.4.tar.gz					## get st-0.4.1
curl -O# http://st.suckless.org/patches/st-0.4.1-argbbg.diff	## get transparency patch
curl -O# https://gist.github.com/8df44a9fcd0180e15906.git      ## get OSX patch
git apply -v st-0.4*															## within dir with st
git apply -R st-0.4*															## to remove
 
cp -R /home/src/st-repo/src/st-0.4.1 /home/src/st					## copied to universal location for easy config synching
																					## between computers (and so doesn't get overwritten when trying new)
 
 
 
 
## From now on, to compile a new version:
cd /home/src/st
sudo make install


enable root

On old versions of OSX, you need to enable the root account if you wanted to use sudo/visudo.

## I haven't had to do this since MountainLion
dsenableroot



Finder Address Bar

How the bloody hell are you supposed to navigate osx without a goddamned address bar?!!!
Install FinderPath: http://bahoom.com/finderpath/

DoubleClick on the finder titlebar to get access to a path bar.


Fonts

http://www.fontsquirrel.com/fonts/droid-sans-mono


Xmonad

Xmonad compiles and runs, but only manages X11 windows.

#### ~/.xinitrc.d/90-xmonad.hs
#! /bin/sh
USERWM=$HOME/Library/Haskell/bin/xmonad
####


chmod +x ~/.xinitrc.d/90-xmonad.sh



sudo port install xft2
cabal update
LIBRARY_PATH=/opt/X11/lib:$LIBRARY_PATH cabal install X11			## install X11
cabal install xmonad
cabal install xmonad-contrib --flags="-use_xft"
## By Default, cabal-install installs programs to
## ~/.cabal/vin



cp /private/etc/X11/xinit/xinitrc ~/.xinitrc
chmod +w ~/.xinitrc
#### ~/.xinitrc 
#comment out the line 'exec quartz-wm' and add PATH-TO-XMONAD/xmonad after it.
/Users/will/.cabal/bin/xmonad
quartz-wm --only-proxy & 					## sync X11/OSX clipboards
####



Amethyst

Config
~/.amethyst Amethyst config file (json)

Amethyst is a native OSX window manager that is (heavily) inspired by Xmonad. It is a real life saver.


#git clone https://github.com/ianyh/Amethyst.git
brew install caskroom/cask/brew-cask
brew cask install amethyst

cd /opt/homebrew-cask/Caskroom/amethyst
## Copy Package to Applications

OSX Hotkey Modifications

#### System Preferences > Keyboard >
## Spotlight
	- cmd + p

## Launchpad and Dock
	- cmd + o


Config

cp /opt/homebrew-cask/Caskroom/amethyst/0.9.4/Amethyst.app/Contents/Resources/default.amethyst ~/.amethyst

## Reading/Writing the config file is very simple


Quirks

#### Firefox
Firefox must be opened BEFORE amethyst is launched for it to be managed properly

ntfs

https://osxfuse.github.io/ ## install osxfuse http://macntfs-3g.blogspot.com/2010/10/ntfs-3g-for-mac-os-x-2010102.html ## install ntfs3g