%
% anyremote configuration file for smplayer management. (Server-mode)
% (tested with v0.2.37)
% 

% STATUS stable
% XTEST yes
% SOUND app
% ENV no
% FBROWSER v.3i
% DEF_VIDEO_PLAYER   
% ALL_IN_ONE 
% MEDIACENTER video

GuiAppName=Smplayer
GuiAppBinary=smplayer
GuiAppRun=A=`ps -ef|grep smplayer|grep -v grep`; if [ "x$A" = "x" ]; then echo NOK; else echo OK; fi
GuiAppIcon=smplayer.png
GuiAppType=Application
GuiAppProtocols=Server
GuiAppDesc=SMPlayer intends to be a complete front-end for MPlayer

[Protocol]=Server

(Init)=\
	Include($(CfgDir)/Utils/aliases-server.cfg);\
        Include($(CfgDir)/Utils/aliases-server-fbrowser-v3i.cfg);\
	Macro(FBROWSER_IC_INIT);\
	Include($(CfgDir)/Utils/aliases-server-video-player.cfg);\
	Make(var,app_name,by_value,Smplayer);\
	Make(var,open_file,by_value,);\
	Make(var,do_app_init,by_value,1);\
	Make(var,smplayer_layout,\
	     V=`$(CfgDir)/Utils/registry.sh $(TmpDir) get smplayer_layout`;\
	     if [ "x$V" = "x" ]; then echo "3x4"; else echo $V; fi);\
	Make(var,app_manage_mode,by_value,smplayer_$(smplayer_layout));

(Exit)=\
	Macro(FBROWSER_IC_EXIT);\
	Exec($(CfgDir)/Utils/registry.sh $(TmpDir) set smplayer_layout $(smplayer_layout));

(Connect)=\
	Make(mode,smplayer_init);

[Mode]=smplayer_init : default_video_player_init

APP_IS_RUN=\
	Make(var,app_run,\
	     ID=`id -u`;A=`pgrep -u $ID smplayer`;\
	     if [ "x$A" = "x" ]; then echo 0; else echo 1; fi);

[ModeEnd]

[Mode]=smplayer_general

APP_START_IF=\
	Set(title,$(open_file));\
	Exec(ID=`id -u`;P=`pgrep -u $ID smplayer`;\
	     if [ "x$P" = "x" ]; then cd "$(fbrowser_dir)";smplayer $(open_file) 2> /dev/null & fi);

% Application window should be present in output of "wmctrl -l"
APP_RAISE=\
	Exec($(CfgDir)/Utils/run-or-switch-to.sh -switch smplayer);

APP_QUIT=\
	Emulate(keydown,Control_L,key,x,keyup,Control_L);\
	Exec(pkill -u `id -u` smplayer);

APP_FULLSCREEN=\
	Emulate(key,f)

PLAY=Emulate(key,Space)
RWD=Emulate(key,Left)
FF=Emulate(key,Right)
STOP=Emulate(key,Space)
PAUSE=Emulate(key,Space)

Layout 3x4=\
	Make(mode,smplayer_3x4);

Layout 5x1=\
	Make(mode,smplayer_5x1);

[ModeEnd]

[Mode]=smplayer_3x4 : smplayer_general,default_video_player

% (EnterMode) by Utils/aliases-server-video-player.cfg

% Override
1=Emulate(key,9)
2=Emulate(key,m)
3=Emulate(key,0)

APP_POST_SETUP=\
	Make(var,smplayer_layout,by_value,3x4);\
	Make(var,app_manage_mode,by_value,smplayer_$(smplayer_layout));

APP_MENU=\
	Set(menu,replace,Layout 5x1,PowerMgmt);\
	Macro(ALLIN1MENU);\
	Macro(MEDIACENTER_MENU);

[ModeEnd]

[Mode]=smplayer_5x1 : smplayer_general,default_video_player_5x1 

APP_POST_SETUP=\
	Make(var,smplayer_layout,by_value,5x1);\
	Make(var,app_manage_mode,by_value,smplayer_$(smplayer_layout));

APP_MENU=\
	Set(menu,replace,Help,Mute,Quit,Files,Layout 3x4,IMDB,PowerMgmt);\
	Macro(ALLIN1MENU);\
	Macro(MEDIACENTER_MENU);

% Override
VOL-=\
	Emulate(key,9);

Mute=\
	Emulate(key,m);

VOL+=\
	Emulate(key,0);

[ModeEnd]

[End]
