Category Archives: Productivity

Muting/unmuting Skype for lazy people

With my current employer, we decided telecommuting was worth a try.

Our office is distributed between Barcelona and Bologna, with occasional incursions by traveler colleagues who happen to be in some random coffee house around the world.

One of the key elements for this setup to be practical and effective is Skype, which I don’t particularly like but I have to admit works pretty well in this scenario. In our headquarters in Bologna there’s an USB microphone/speaker, which my colleagues connect in shifts to their laptops, or to a spare Android tablet. On my side, I use the Macbook Pro internal mic and headphones.

The Skype audio chat is always on, meaning that it’s almost like being there: I only miss lunch and coffee breaks.

Actually, it seems it’s even more vivid than the real thing. It’s not unusual some of them shout “MUTE!” in my direction: the internal microphone on my parts takes in too much consideration the tik-ke-ti-tak of the keyboard, which in Bologna becomes an unsolicited, thunderous and rather unpleasant proof I’m really at my desk.

Of course I could use the handy HUD window with all the Skype controls, but that requires 1) finding its position on the screen, 2) moving my hands from keyboard to trackpad, 3) click the mute button. I’m lazy, and I wanted something less cumbersome. Something like a keyboard trigger to toggle the mute status of the current Skype call. Triggers? Quicksilver to the rescue.

I knew Quicksilver permits to assign arbitrary actions to hotkeys, and those actions can be anything you can do with Quicksilver: for example, running an Applescript program. Unfortunately, a quick inspection in the Skype’s Applescript dictionary revealed there was no direct and simple access to the Mute toggle. Here the first program I wrote to solve the problem:

on run argv
    set front_app to (path to frontmost application as Unicode text)
    tell application "Skype" to activate
    menu_click({"Skype", "Conversations", (item 1 of argv) & " Microphone"})
    tell application front_app to activate
end run


-- http://hints.macworld.com/article.php?story=20060921045743404
-- `menu_click`, by Jacob Rus, September 2006
--
-- Accepts a list of form: `{"Finder", "View", "Arrange By", "Date"}`
-- Execute the specified menu item. In this case, assuming the Finder
-- is the active application, arranging the frontmost folder by date.

on menu_click(mList)
    local appName, topMenu, r

    -- Validate our input
    if mList's length < 3 then error "Menu list is not long enough"

    -- Set these variables for clarity and brevity later on
    set {appName, topMenu} to (items 1 through 2 of mList)
    set r to (items 3 through (mList's length) of mList)

    -- This overly-long line calls the menu_recurse function with
    -- two arguments: r, and a reference to the top-level menu
    tell app "System Events" to my menu_click_recurse(r, ((process appName)'s ¬
        (menu bar 1)'s (menu bar item topMenu)'s (menu topMenu)))
end menu_click

on menu_click_recurse(mList, parentObject)
    local f, r

    -- `f` = first item, `r` = rest of items
    set f to item 1 of mList
    if mList's length > 1 then set r to (items 2 through (mList's length) of mList)

    -- either actually click the menu item, or recurse again
    tell app "System Events"
        if mList's length is 1 then
            click parentObject's menu item f
        else
            my menu_click_recurse(r, (parentObject's (menu item f)'s (menu f)))
        end if
    end tell
end menu_click_recurse

This is largely based on a piece of code by Jacob Rus I found in a hold post on Macworld. It accepts a single parameters (“Mute” or “Unmute“) and it will work only if you use the English Skype localization. I don’t think there’s something particularly interesting in this program, except the useful code I borrowed from Jacob, the trick with frontmost application to re-activate the application which had the focus before switching to Skype and, yes!, the fact is remarkably long to perform such a simple task. Also, I’m not set with only this script: I’d need to create two different hotkeys for muting and un-muting, and assign them to two different ways of calling the script itself.

There must be a shorter path.

To a closer inspection (silly me!), I noticed the menu item I’m using keeps the same hotkey (I mean hotkey from Skype’s standpoint): no matter what the current mic status is, it’s always ⇧⌘M. Let’s try to shorten the program.

set front_app to (path to frontmost application as Unicode text)
tell application "System Events"
    tell application "Skype" to activate
    keystroke "M" using {command down, shift down}
end tell
tell application front_app to activate

No need to differentiate the mechanism, and there is so much less code!

Maintenance programming

$ history|awk '{a[$2]++} END{for(i in a){printf "%5d\t%s \n",a[i],i}}'|sort -rn|head
215 cd
121 ls
97 vim
41 grep
4 find
3 vimdiff
3 touch
2 tail
2 perl
2 less

Things


In questi giorni sto usando parecchio Things, un’applicazione per Macintosh per il task management al momento in beta. Secondo me è molto indovinata, per un po’ di motivi:

  • L’interfaccia è pensata bene, e benchè manchino ancora alcune cose comode, si raggiunge ogni cosa rapidamente.
  • Gli attributi legati a ciascun task sono sufficienti per organizzare il lavoro tipico (almeno, a me non vanno stretti): si possono organizzare i task per progetto, task e progetti si possono a loro volta organizzare per area di responsabilità. Ad ogni task sono associabili dei tag, e l’interfaccia consente di usarli per scremare rapidamente la lista delle cose da fare. Il punto quando si usano programmi di questo genere è la concentrazione sul singolo punto, senza essere soverchiati da troppe informazioni, e al tempo stesso senza perdere la possibilità di passare rapidamente alla vista generale.
  • In qualunque momento, e con il focus su qualunque altra applicazione, è possibile richiamare una finestra dalla quale aggiungere un task alla propria lista. È veloce, non è intrusivo, e si infila perfettamente nel flusso di lavoro di tutti i giorni, per il quale tipicamente si usano tanti programmi contemporaneamente. Bravi.
  • I dati vengono memorizzati in formato XML. Oltre all’ovvio vantaggio di non perdere nulla se un domani si decide di cambiare programma, mi aspetto che questa caratteristica porti ad un proliferare di utility di terze parti per fare qualcosa di ancora più utile con i dati prodotti con questo software. Ad esempio sto pensando ad uno script che trasformi l’XML in una pagina web da mostrare ai propri colleghi e collaboratori: una pagina che dica “ho fatto questo, manca quest’altro”.
  • Si integra con l’address book, e permette di memorizzare un task assegnandolo ad uno dei propri contatti. Non esiste una vera e propria funzionalità di comunicazione, ma è comunque utile per mantenere aggiornata la propria visione di “chi deve fare cosa”.

Tra le cose che mi piacerebbero per le future versioni, la possibilità di organizzare i task gerarchicamente (cosa fattibile tutto sommato con i progetti, ma fatta questa considerazione sono al punto di prima, e sento il desiderio di organizzare gerarchicamente i progetti).

Zero inbox?

I need to rationalize my inbox.