Note to self: base16 color themes

Use base16-builder-python to build the base16 themes.

Clone the repo, create a virtual environment and install the undocumented requrements:

$ pip install pystache pyyaml aiofiles

Then download the current base16 colorschemes and output templates:

$ ./pybase16.py update

Now you can build all the application specific themes using

$ ./pybase16.py build

Delete color themes from iTerm2

Quitting iTerm, opening ~/Library/Preferences/com.googlecode.iterm2.plist in Xcode. Color themes can be found under the key Custom Color Presets. Delete any you do not want.

iTerm2 color theme variants

Use the *-256.itermcolors files. They conserve compatibility with the standard ANSI color palette.

Install alot from cloned repo on Mac OS X

Just a short note on how to install alot from a cloned repository. This might be incomplete since its from memory and I am writing this down since I had to to a reinstall and I had to figure it out again.

You can install alot from homebrew using brew install alot, but I needed to modify the code so the tag autocompletion search the whole tag name for the substring (e.g. typing “cur” would not autocomplete to “@/Current” without changing a default parameter in the code).

So I install notmuch via homebrew:

$ brew install notmuch

then clone pazz/alot:

$ cd parent-dir-to-where-you-want-the-alot-repo
$ git clone https://github.com/pazz/alot.git

I am using pyenv together with pyenv-virtualenv to manage my python versions. These are installed via homebrew as well:

$ brew install pyenv pyenv-virtualenv

If you are just installing pyenv and pyenv-virtualenv now, you’ll need make a change to your .profile and install at least one version of python2 before installing alot from the cloned repository.

Add the following to your .profile and restart your shell (or source ~/.profile it):

# pyenv
# bonus export below that is not needed for alot, but needed
# if you want to use python with e.g. nvim
export PYTHON_CONFIGURE_OPTS="--enable-framework"
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi

# pyenv-virtualenv
# another bonus export, not strictly needed, but gets rid of a
# prompt when switching virtual environments
export PYENV_VIRTUALENV_DISABLE_PROMPT=1
if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi

Now install e.g. python 2.7.12 via pyenv:

$ pyenv install 2.7.12

Then create a virtualenv for alot an activate it:

$ pyenv virtualenv alot
$ pyenv activate alot

Finally, before you can install, you need to add the python packages installed by homebrew to your virtual environment:

echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> $PYENV_VIRTUAL_ENV/lib/python2.7/site-packages/homebrew.pth

This adds the file homebrew.pth to your virtualenv site-packages directory which contains a reference to the site-packages directory used by homebrew. Now you can finally install alot from your cloned repository:

$ cd path-to-alot-repo
$ pip install -e ./

pip should see that the notmuch library is avaliable and will not install its own (which I couldn’t get to access the notmuch bindings installed by homebrew). You should now be able to run alot if the correct virtualenv is activated.

# activate the alot virtualenv if you havnt
$ pyenv activate alot

# run alot
$ alot

If you get an error about python not being able to find the shared notmuch library, try pip uninstall notmuch in case pip installed it anyway. Also make sure that you have installed notmuch via brew and that there is a directory named notmuch in /usr/local/lib/python2.7/site-packages (where homebrew installs its python packages).

Three displays: two stacked, two mirrored

At the moment my display setup consists of two 24″ monitors stacked vertically. Today I had a visitor and wanted to show stuff across my office desk and found the following gem regarding multiple display setups (from the Display Settings Help):

If more than two displays are connected to your Mac, you can specify that some are mirrored displays and others show the extended desktop. For example, if you have three displays, you can have two displays showing the same information and the third display showing the extended desktop.

  1. Set up all the displays as an extended desktop.
  2. Option-drag a display icon onto another display icon to mirror those two displays.

So now I could continue with my regular setup, but flip open the lid of my Macbook and use it show stuff to my visitor!

Three displays, two stacked, two mirrored
Three displays: two stacked external displays with the lower external display mirrored to the built in display of my Macbook 15″

Using multiple spaces with multiple displays

I use TotalSpaces2 to manage how I use spaces on my MacBook Pro running El Capitan. During a day, I move from a 3 display setup, to a 2 display setup, to a single display setup. This being the case, I have observed different ways of using spaces and multiple displays.

Using a single display with multiple spaces
When using multiple spaces on a single display, everybody basically use “spaces as folders”, i.e. each space contain apps for one activity. When adding additional displays into the setup, there are two (generally speaking) choices.

Using multiple displays with multiple spaces
From reading the TotalSpaces forum, there seem to be two main ways of using spaces with multiple displays:

  1. One activity spread across multiple displays (e.g. video editing) → linked spaces between displays
  2. One activity per display → independent spaces

In the first category, additional displays add screen real-estate and the user has more space to use for each activity. The user is mainly performing one activity at the time. Lets call category 1 users “single activity users”.

For the second use category, additional displays add screen real-estate, and the user uses that space to house additional activities. Instead of additional displays providing more space per activity, additional displays provide space for more activities. Lets call category 2 users “multiple activity users”.

Linking a space to a display vs spaces that exist independently of available displays
I fall into the second category. Basically I am using spaces as containers for activities, but only one display is needed per activity. During a day, I move from a 3 display setup, to a 2 display setup, to a 1 display setup. For me, I do not see a space as linked to a specific display, but rather that applications are linked to a space and the space can be on different displays.

The current behavior when disconnecting a display does not work for me as a multiple activity user. Example of current behavior:

3 display setup
Display 1: Display1 space, Development space, Presentation space
Display 2: Display 2 space, Browsing space
Display 3: Display 3 space, Email/Calendar, Reading space

Disconnecting a display: If I just disconnect a display, the apps move from the space on the disconnected display, but the spaces do not.

Current workaround
I use the following workaround:

  1. One dedicated space per display.
  2. Spaces with names according to activity with different applications assigned to each space.
  3. When going from my 3 display setup to a smaller one, I use Mission Control to move any activity spaces from that display to one of the ones that still will be in use.

Ideal behavior for spaces-as-folders-users
– Spaces exist independently of displays.
– If a display is removed, spaces move to existing displays.
– If the removed display is attached, spaces that lived on that display are moved to that display.

Different philosophy
I realize that this is different from how TotalSpaces2 has envisioned space management. In TotalSpaces2, the number of spaces of a display is important. Each display is configured to have a specific number of spaces. When an activity is not spread across displays one does not need to focus both on how many spaces exist and which displays they exist on, only how many spaces exist.

In other words, rather than thinking of each display having its own pool of spaces, one can think of all displays sharing a common pool of spaces, so just like moving applications between displays, one can move spaces between displays.

Now, El Capitan lets you move spaces between displays, but El Capitan treats spaces as something ephemeral, rather than permanent fixtures. Why this conclusion? Well spaces can not be named, they have names such as Desktop 1, Desktop 2 etc. The numbering also changes depending on the position of the space. If I move Desktop 3 between Desktop 2, the previous Desktop 2 is renamed to Desktop 3, and the previous Desktop 3 is renamed to Desktop 2. Creating and deleting spaces is also very easy which promotes a behavior where you create and delete spaces as you need them.

Anyway, writing this has been interesting for me, as it has helped me explore how a linear increase of the degrees of freedom in an interface does not entail a linear increase in UI and interaction complexity, but rather a exponential increase in UI and interaction complexity.

A “simple” thing like adding desktop space functionality combined with another “simple” thing like adding an additional display can have the result of creating non-trivial interaction and usability issues.

Mini review: Choice of the Deathless for iOS

Choice of the Deathless for iOS by Choice of Games is an interesting interactive book. Not the type where you roll dice, but the kind where you shape and make real choices for the main character. Not “Do you go up the stairs or to the next room first?” choices, but rather choices between alternatives like “Be silent and nod, even though you disagree”, or “Proclaim your honest and enthusiastic support”.

The story is set in a parallel universe where you play the role of a Crafts/man/woman/person, i.e. a sorcerer of sorts, working at a medium sized firm, dealing with demons and gods – a line of work which seems to be more similar to working as a lawyer than being Gandalf.

I am not a fan of “Choose your own adventure” type books, but this I like. Choice of the Deathless uses the strengths of written fiction, rather than trying to emulate a computer game. Choices are not easily categorized into “good” or “evil/bad”. They represent choosing one alternative and discarding others. And there is no looking back… unless you read the book again 🙂

I have not finished the book but am a few chapters in, but I do not think my opinion regrding the experience will change, at least not for the worse I hope.

Use Choosy.app to interactively choose which app to use to open any file

I have been using Choosy for a very long time (a quick search through my email revealed that I started using the beta in 2008 and bought my license in 2009).

Today I discovered a way of using Choosy to pop up a selector for any file type.

Select between opening a PDF file in Preview.app or Skim.app

Some time ago I added a rule to Choosy that gave me the option to edit a local .html file using Sublime Text in addition to selecting a web browser to open it in.

Rule for adding Sublime Text to browser selection when opening a local HTML file

Here is how to do it:

  1. Create an alias of ~/Library/PreferencePanes/Choosy.prefPane/Contents/Resources/Choosy.app (if you have installed Choosy all users remove the initial ~) and put it in your Applications folder.
  2. Create a rule in Choosy in the advanced tab
  3. Set the rule trigger to require that all the following conditions are true:
    • Web address begins with file://
    • Web address ends with <file extension> (replace <file extension> with the file extension of your choosing, e.g. pdf).
  4. Set the action to be “Promt to select from these browsers…”
  5. Select the applications you want to be able to choose from (they need not be browsers).
  6. In Finder right click a file that has the extension you just created a rule for, choose Get Info and change the Open with application to the Choosy.app alias you added to your Applications folder.
  7. Click “Change All...” so that all files with that extension are affected.

Thats it! Now when you click a file with that extension, it will open in Choosy, which in turn will show you the app selection popup. Below is a screenshot of my PDF rule:

Rule for opening a PDF file in Preview.app or Skim.app

My Firefox add-ons after a Firefox Refresh

So I had this problem that Firefox did not remember my toolbar customizations. I created a new profile and re-synced that, but it did not seem to help. Today I discovered that Firefox has a “Refresh Firefox” feature that clears everything and starts fresh, so I tried that and it seems to work. Since all my add-ons were removed, I the chance to only install those that I really need. The list is not very minimal, but I spend a lot of time in my browser, and making being able to do stuff faster saves a lot of time, but most of all, reduces frustration.

Blocking unwanted things

Then there are the add-ons that take care of usability issues (that should not exist to begin with):

  • Customizable Shortcuts: CMD-Left Arrow is mapped to “Navigate Back” and in all other applications on OS X, it is mapped to “go to the beginning of the line”. You can see how this becomes a problem when editing text in a text field.
  • Lazarus: Form Recovery – Have you ever by accident navigated away from a page and had to fill in all the form fields again? Lazarus saves everything you type in to form fields. It even has multiple versions of the stuff. Also, if you use a web interface for adminsitrative stuff and have to fill in the same stuff lots of times, Lazarus can help you there.
  • warn-before-quit: Sometimes I hit Cmd-Q instead of Cmd-W when I want to close a window and end up quitting Firefox.

I like Firefox, especially now that I refreshed it and it got faster. Panorama an automatic unloading of unused tabs are fantastic. But sometimes I need to use other browsers and when I do, I want to have access to my bookmarks and passwords, so I need cross browser sync for that:

  • 1Password: Your passwords and other credentials everywhere.
  • Xmarks: Xmarks almost died, but got saved by a crowd funding campaign.

The browser is great for browsing, not so much for saving, so I have add-ons to get stuff out from the browser. In many cases a simple bookmarklet is enough, but as in Evernote’s case, the add-on is more than just the bookmarklet functionality.

Finally I use Zotero for my academic reference management:

  • Zotero: A reference manager that adds references and their associated PDFs directly from the page you found them on. Zotero is also unaffiliated with any publishing house. Mendeley got sold to Elsevier, Papers got bought by Springer Nature.
  • Zotero Better Bib(La)Tex: for generating .bib files. Better Bib(La)Tex allows for setting your own cite keys and can automatically update a .bib file that you have exported (e.g. a bib file of a subset of you collection)
  • Zotero Storage Scanner Plugin:
  • ZoteroQuickLook: enables QuickLook in Zotero.
  • ZotFile: Better attachment renaming rules, and the possibility of moving PDFs out from the Zotero store to e.g. a Dropbox folder.

Fortunately for me however Tab Mix Plus and Session Manager can export and import settings. Zotero and its add-ons however, I had to re-configure manually (I took screenshots of the preferences before the refresh).

Stuff not on the list

  • Tab Mix Plus is not on this list because I think it was responsible for the toolbar issue in the first place. Otherwise it is great: multiple rows of tabs, visual feedback on tabs with regard to whether they are unloaded, unread + progressbar for each tab.

Left handed mouse pointer

  • Are you left-handed?
  • Do you use your left hand to controll your mouse with the buttons reversed?
  • Do you use a Mac (Yosemite)?
  • Has the right-handedness of the mouse pointer irritated you at some point?

Here is the solution. Download Mousecape (check the releases page, the latest release at the time of writing is 0.0.5 which is the second download on the page).

After downloading, installing both the app and the helper app, do the following:

  1. Go to the Mousecape preferences and choose “I am left handed”.
  2. Dump the system cursors into a cape from the menu: “Capes” → “Dump Cursors”
  3. Apply the Cursor Dump cape (right click → apply)
  4. Done!

Synching, or rather sharing contacts between Gmail accounts

Started using more than one gmail account now (without forwarding because I need separate inboxes) but send email so common addresses, so I wanted to sync my contacts. The solution I settled with was using Shared Groups that can (surprise) share a contact group across accounts. The least problematic approach (to avoid duplicates) seems to be to create a new group, share that, and put any contacts that need to be shared into that group.

Migrate all email from IMAP server to Gmail using OfflineIMAP

OfflineIMAP (github, website) – a great way to migrate email (docs here. Just moved my email from my webhost IMAP-server to a gmail account.

I had some problems connecting to gmail until I enabled “less secure apps” to access my account at https://www.google.com/settings/security/lesssecureapps. Also, Gmail automatically blocked my first access, so I recieved an email that I had to respond to (click a link and verify that it actually was me that tried to access my email – good feature).

Also, OfflineIMAP might complain about unknown certificate fingerprints and print them out. I just added them to the servers that needed them and hoped nobody had manipulated them.

Here is a template for migrating for future reference.

# Offlineimap sample configuration file

[general]
metadata = ~/.offlineimap
accounts = migration
ui = TTYUI

[Account migration]
localrepository = gmail-trg
remoterepository = imap-src

# use sqlite backend rather than plain text
status_backend = sqlite

[Repository imap-src]
type = IMAP
remotehost = imap.yourdomain.com
ssl = yes
remoteport = 993
remoteuser = imap.username
remotepass = imap.password
usecompression = no
maxconnections = 1

# don't write any changes to the imap server
readonly = True

# you might need to fill this in if you use SSL
#cert_fingerprint = 

[Repository gmail-trg]
# You can use Gmail as type, by I had some problems connecting.
type = IMAP
remotehost = imap.gmail.com
ssl = yes
remoteport = 993
remoteuser = gmail.username
remotepass = gmail.password
usecompression = no
maxconnections = 1
readonly = False

# Set cert_fingerprint to whatever you need
#cert_fingerprint = 

# Do not sync [Gmail]/All mail etc folders
folderfilter = lambda foldername: not re.search('^\[Gmail\]', foldername)