module Smartdict::Gui

Constants

LEFT_BOX_BUTTON_HEIGHT
VERSION

Public Instance Methods

root_dir() click to toggle source
# File lib/smartdict/gui.rb, line 43
def root_dir
  File.join(File.dirname(__FILE__), '../..')
end
run() click to toggle source
# File lib/smartdict/gui.rb, line 29
def run
  if running?
    puts "smartdict-gtk is already running. PID=#{running_pid}"
    Process.kill("USR1", running_pid)
  else
    File.write(pid_file, Process.pid.to_s)
    controller = Smartdict::Gui::Controller.new
    Signal.trap("USR1") do
      controller.show_visibility
    end
    controller.run
  end
end

Private Instance Methods

pid_file() click to toggle source
# File lib/smartdict/gui.rb, line 63
def pid_file
  File.join(Smartdict.user_dir, 'smartdict-gtk.pid')
end
running?() click to toggle source
# File lib/smartdict/gui.rb, line 59
def running?
  !!running_pid
end
running_pid() click to toggle source
# File lib/smartdict/gui.rb, line 51
def running_pid
  pid = File.read(pid_file).strip.to_i
  Process.getpgid(pid)
  pid
rescue Errno::ENOENT, Errno::ESRCH
  nil
end