Posted
Comments None

I’ve been using my MacBook Pro under OS X 10.8 for a while now. There are still things that I find perplexing. For example, why is there no function lock key? Sure, I like to be able to adjust my screen brightness, but I also want to set bookmarks in Sublime Text and select all my units in StarCraft.

For those in the same boat, here is how I got a keyboard shortcut for toggling Function Lock.

My first attempt was to take an Applescript and and alias it as a command line tool. I found a script and set it up, but I was unsatisfied. I really wanted to be able to toggle functionality from the keyboard. This lead me to the following: setting up a service, and then creating a keyboard shortcut.

Set up a service

All flavors of Mac come with Automator. Because I use Alfred, it is simple to bring up. When Automator starts, choose to create a Service. In the search bar, search for “applescript” and choose “Run Applescript”. Paste the following and save the service with a useful name like “Function Toggle” (script source: rezecib on http://forums.macrumors.com/showthread.php?t=383969)

tell application "System Preferences"
    set current pane to pane "com.apple.preference.keyboard"
end tell
tell application "System Events"
    if UI elements enabled then
        tell tab group 1 of window "Keyboard" of process "System Preferences"
            -- replaced next line because it stopped working the next day. WAT?
            --click checkbox "Use all F1, F2, etc. keys as standard function keys"
            click checkbox 1
        end tell
    else
        tell application "System Preferences"
            set current pane ¬
                to pane "com.apple.preference.universalaccess"
            display dialog ¬
                "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
        end tell
    end if
end tell
tell application "System Preferences"
    quit
end tell

Set up the Keyboard Shortcut to Toggle Function Lock

Open up your keyboard settings (again, Alfred is helpful). Go to the Keyboard Shortcuts tab and select Services on the left. Scroll to the bottom and you should see General > Function Toggle. I set my shortcut to ⌘+`.

I find it too bad that I have to go through such rigmarole to get a standard Ubuntu feature back (or standard keyboard feature, rather). But I feel that I am better for having had to figure it out.

Author

Posted
Comments None

At work, we are trying to push towards a homogenous grouping of developer environments (beyond the common VMs) and all developers are encouraged to go the Mac route on the dev’s next upgrade. My System76’s screen cracked (Nooooooooo!) and I started working on the slick XPS13 Developer Ed. The poor little machine could not keep up with a simple VM. So, Mac it was.

My first impressions are that (in no particular order):

  • The `control` button is in the wrong place.
  • Switching workspaces is a pain. I cannot take my currently focused window with me to a different workspace just using the keyboard. This breaks my entire workflow. Using Dexpot for Windows, I can at least simulate my workflow, though, I’d rather stay clear of that OS (mostly for lack a decent, native CLI).
  • Alfred is not a replacement for the `super` key in Unity.
  • The red close button does not quit an application always. In two important cases (Chrome and Sublime Text 3), it closes the window but leaves the application running, thus losing my tabs and workspace.
  • I can’t figure out (I haven’t googled it yet) how to dim my ThunderBolt display.
  • A model window popped up and I could not hit `tab` to cycle through and select `OK` or whatever the button was. I had to use the mouse.
  • `ls` requires parameters to be useful (`ls -GF`).
  • `sudo` while installing is the enemy.
  • Right-click is painfully missing and getting used to control+click is a nuisance (two hands?!).
  • I can no longer ctrl+enter while in the address bar to auto-append `.com`.

That said, many things seemed well polished, especially the dual monitor support. Ubuntu has come so far with monitor support lately, but they are really playing catch-up with Mac. I like gestures for moving to other workspaces. I’m still out on iTerm2. I really liked Terminator, but I am sure I’ll get used to this new terminal shortly. I feel that I could work around everything if I could just get workspaces to flow right (as in, be able to take the window in focus with me with something similar to alt+shift+ctrl+arrow and no mouse).

Author

Posted
Comments None

Somehow my laptop screen got a crack in it. Totally suxorz. I have… er… had a System76 Serval Professional. Awesome machine. While that rig is being sent out for repairs, I’ve installed Ubuntu on a spare laptop and pulled in my Github repo with my settings backup. Presto, chango — my terminal in all its bashy goodness is back to the exact way I like it. Couple that with a Dropbox full of standard background images set up with Wallch and it is like I never changed computers.

Author

Posted
Comments None

Working through some Perl code today (shudder). I came across the slash slash equals operator, two forwards slashes and an equals sign (//=). No, it is not a comment. It is very similar to pipe pipe equals (||=), but is restricted to undef values. Google needs to work on a way to better search for programming operators.

Author

Posted
Comments None

Settings Backup and Restoration with GitHub

A new Ubuntu version is coming out and the last thing I want to do is manually copy over my myriad of different config and settings files. I have my PS1 function set the way I like it, my Terminator terminal all set up with my keybindings and colors, some handy aliases, and some other rc_goodies. Thanks to the awesome power of GitHub, I fret of this aspect of upgrading no longer. I set up a repo that has a script that pulls in all my latest and greatest changes and can push those changes back out to my system.

The Backup/Restore Process

I have a python script that has a list of file names. For each file, it shutil.copyfile()’s the file to my current working directory under files/filename. There is one caveat. I change the filename from /path/to/file to slash__path__slash__to__slash__file. Upon restoration, I run the same script with a different flag for restoration. It changes those __slash tokens back to a good ol’ forward-slash and copies the file back into the place it belongs. Prior to restoring the file, the script checks to see if the file already exists, and if it does, replace it with filename.BAK.

On a New System

All I have to do is git clone my repo, and run ‘grab_settings.py restore’. Vim works the way I like. Terminator works the way I like. My aliases are all present. Done and done.

Author
Categories

← Older Newer →