public
Description: Watches the ether for the handy *jour scripts.
Homepage:
Clone URL: git://github.com/lachie/starjour.git
Click here to lend your support to: starjour and make a donation at www.pledgie.com !
starjour / PasteJour.rb
100644 31 lines (24 sloc) 0.534 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#
# PasteJour.rb
# starjour
#
# Created by Lachie Cox on 21/06/08.
# Copyright (c) 2008 __MyCompanyName__. All rights reserved.
#
 
require 'osx/cocoa'
require 'Jour'
 
class PasteJour < OSX::NSObject
  include Jour
  service_name 'paste'
  nib_name 'PasteJour'
  
  kvc_accessor :pasted
 
  def setup
    (from, to) = *@service.name.split('-')
  
    @text = "from #{from}"
    @text << " to #{to}" if to
  end
  
  def paste(sender)
    # self.pasted = ` '#{@service.name}'`
    system("/usr/bin/env pastejour | pbcopy")
  end
end