Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@c10b10

This comment has been minimized.

Copy link

@c10b10 c10b10 commented Feb 8, 2013

Should this work with Skype 6?

@pwc3

This comment has been minimized.

Copy link
Owner Author

@pwc3 pwc3 commented Mar 6, 2013

I have used it with Skype 6 and it worked. It's just copying the dock icon's badge label (which is the number of unread conversations) to the menu bar. So long as Skype continues to use the badge label, this should work.

@BAndonovski

This comment has been minimized.

Copy link

@BAndonovski BAndonovski commented Sep 19, 2013

Tried to get this working with Skype 6 on OS X 10.8.5, but with no success. Have you tried that, hopefully, with any good results?

@briangershon

This comment has been minimized.

Copy link

@briangershon briangershon commented Mar 11, 2014

F-Script not supported on OSX 10.6 and above -- saw note on http://sabi.net/nriley/software/

@DenimTornado

This comment has been minimized.

Copy link

@DenimTornado DenimTornado commented Mar 13, 2014

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

@onemanstartup

This comment has been minimized.

Copy link

@onemanstartup onemanstartup commented Oct 27, 2014

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

This comment has been minimized.

Copy link

@MacL3an 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