ubuntu12.04にAir Video Serverをインストールする。

ターミナルで以下の3つを実行するだけ。

add-apt-repository ppa:rubiojr/airvideo

apt-get update

apt-get install airvideo-server

重要なのがインストール時に作成されたショートカットを使わずに/opt/airvideo-server内にtrayという名前のファイルを作成して以下のように記述し、パーミッションを0755に設定し、このファイルをショートカットで起動して使います。

ショートカットを作成してjava -jar /opt/airvideo-server/AirVideoServerLinux.jar /opt/airvideo-server/AirVideoServerLinux.propertiesを実行しても動作しますがサーバーの起動・停止ができないのでtrayを作成した方がいいと思います。(2014/1/13追加)

#!/usr/bin/env ruby
require 'Qt4'

class Tray < Qt::SystemTrayIcon
    
    slots :startStopAction, :quit

    def initialize(parent = nil)
        super(parent)
        @serverThread = nil
    
        @serverRunning = false
        @startStopAction = Qt::Action.new(tr("&Start Server"), self)
        connect(@startStopAction, SIGNAL(:triggered), self, SLOT(:startStopAction))
    
        @quitAction = Qt::Action.new(tr("&Quit"), self)
        connect(@quitAction, SIGNAL(:triggered), self, SLOT(:quit))
        @trayIconMenu = Qt::Menu.new(nil) do |t|
            t.addAction(@startStopAction)
            t.addSeparator()
            t.addAction(@quitAction)
        end
        self.contextMenu = @trayIconMenu
        self.icon = Qt::Icon.new("#{File.dirname(__FILE__)}/airvideo-tray-off.png")
        self.toolTip = 'AirVideo Server'
    end

    def quit
      if @serverThread
        Process.kill(9, @serverThread)
      end
      $qApp.quit
    end

    def startStopAction
      if @serverRunning
        @startStopAction.text = 'Start Server'
        @serverRunning = false
        if @serverThread
          Process.kill(9, @serverThread)
        end
        self.icon = Qt::Icon.new("#{File.dirname(__FILE__)}/airvideo-tray-off.png")
      else
        @startStopAction.text = 'Stop Server'
        @serverRunning = true
        cmd = 'java -jar /opt/airvideo-server/AirVideoServerLinux.jar /opt/airvideo-server/AirVideoServerLinux.properties'
        @serverThread = fork { exec cmd }
        self.icon = Qt::Icon.new("#{File.dirname(__FILE__)}/airvideo-tray.png")
      end
    end
    
    def createTrayIcon()
    end
end

app = Qt::Application.new(ARGV)

if !Qt::SystemTrayIcon.isSystemTrayAvailable
    Qt::MessageBox.critical(nil, Qt::Object.tr("Systray"),
                              Qt::Object.tr("I couldn't detect any system tray " \
                                          "on this system."))
    exit 1
end

tray = Tray.new
tray.show
app.exec