Skip to content

Instantly share code, notes, and snippets.

@pwc3
Created May 18, 2012 23:42
Show Gist options
  • Save pwc3/2728176 to your computer and use it in GitHub Desktop.
Save pwc3/2728176 to your computer and use it in GitHub Desktop.
Shows the number of unread Skype conversations in the menu bar
#!/usr/bin/env ruby
FSCRIPT_PATH = "/Library/Frameworks/FScript.framework"
GDB = IO.popen("gdb", "w")
def gdb(cmd)
GDB.puts cmd
GDB.flush
end
updaterScript = <<END_OF_FSCRIPT
SkypeMenuUpdater : NSObject
{
statusBarItem
timer
- init
{
self := super init.
self ~~ nil ifTrue:
[
statusBarItem := NSStatusBar systemStatusBar statusItemWithLength:20.
timer := NSTimer scheduledTimerWithTimeInterval:1
target:[self updateMenu]
selector:#value
userInfo:nil
repeats:YES.
].
^ self
}
- updateMenu
{
statusBarItem setTitle:NSApplication sharedApplication dockTile badgeLabel.
}
}.
updater := (SkypeMenuUpdater alloc) init.
END_OF_FSCRIPT
updaterScript.gsub!("\n", "\\n")
gdb "attach Skype"
gdb "p (char)[[NSBundle bundleWithPath:@\"#{FSCRIPT_PATH}\"] load]"
gdb "p (void)[[FSInterpreter interpreter] execute:@\"#{updaterScript}\"]"
gdb "detach"
gdb "quit"
GDB.close
@DenimTornado
Copy link

I there the way to do it without GDB? I do't want to install it on Mavericks.

@onemanstartup
Copy link

It's working just needs updated with lldb and use last version Kentzo/F-Script#12 see my fork https://gist.github.com/onemanstartup/a240051b05d4858593d7

@MacL3an
Copy link

MacL3an commented Feb 27, 2015

Please excuse my ignorance, but I feel a bit lost here. I've downloaded and installed F-script (moved the files to Applications- and appropriate Library-folder?), installed Xcode and downloaded onemanstartup's version of SkypeMenuUpdater.rb. I then ran the ruby script in a Terminal window by writing "ruby SkypeMenuUpdater.rb". Nothing appeared in the terminal and I don't get any updates on the icon. I'm running Yosemite and the latest version of Skype. Is there anything I'm doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment