The Hidden Blog

As it turns out, I do have a hostname.

Overwriting Textual's shortcuts

Published on March 9, 2014

If you are anything like me, you are connected to a large number of IRC networks and the accompanying channels. As it happens, I’m also developing for the web at the same time which usually involves reloading your browser window from time to time. (Shortcut: cmd + R)

Coincidentally, that’s also a shortcut used by Textual to rearrange the channels alphabetically, which is usually not what you want.

The likelihood of hitting cmd + R which Textual still being the active window and not the browser/inspector is very high and that’s why we are going to reassign the shortcut to something less disastrous. (Yes, the correct order of IRC channels is serious business)

Restoring your old channel order:

s/o to the people with working backups!

Luckily Textual stores the way the channels are sorted in the application’s plist file so we are going to grab the old one from our TimeMachine backup and replace the new one.

Open your terminal and navigate to path where the correct plist file is stored. The path usually looks a bit like this:

cd /Volumes/MobileBackup/Backups.backupdb/monki/2014-03-07-125854/Macintosh\ HD/Users/dewey/Library/Containers/com.codeux.irc.textual/Data/Library/Preferences

There are two files directly related to Textual in there. Use ls | grep textual to list them:

Preferences|⇒ ls | grep textual
com.codeux.irc.textual.LSSharedFileList.plist
com.codeux.irc.textual.plist

We only need to restore the second one.

Make sure you quit Textual at this point and then use cp to copy/overwrite the “new” (wrong channel order) with the old plist file containing the correct order:

cp com.codeux.irc.textual.plist ~/Library/Containers/com.codeux.irc.textual/Data/Library/Preferences/com.codeux.irc.textual.plist

Now we are done here, but due to Mavericks caching plist files and the inner workings on how to flush the cache manually not being known you’ll have to reboot your computer to update the cache.

Prevent this from happening in the future:

It’s great that we are able to restore these old settings but how can we prevent this from happening in the future? Easy, we’ll just reassign the Textual shortcut like mentioned earlier.

Open “System Preferences / Keyboard / Shortcuts” and reassign cmd + R to Main Window

Note: If you really need the rearrange shortcut it’s possible to do it the other way round and just assign some obscure shortcut so you don’t hit it accidentally. To do that just use “Sort Channel List” instead of “Main Window” and a shortcut of your choice.

There’s also a neat way to list all your custom shortcuts we could use to verify that our new shortcut is in place. Just run defaults find NSUserKeyEquivalents and you’ll get something like this:

~|⇒ defaults find NSUserKeyEquivalents
Found 1 keys in domain 'com.codeux.irc.textual': {
    NSUserKeyEquivalents =     {
        "Main Window" = "@r";
        "Next Unread Channel" = "@7";
    };
}

As you can see everything worked as expected. Happy reloading!

The End.