[LyX/master] Put the LyX window frontmost automatically on Mac on successful reverse search

Stephan Witt st.witt at gmx.net
Fri Feb 14 06:39:34 UTC 2020


Am 13.02.2020 um 18:24 schrieb Jean-Marc Lasgouttes <lasgouttes at lyx.org>:
> 
> Le 13/02/2020 à 16:21, Stephan Witt a écrit :
>> commit 983da7d6dea0af6658debac3cf338c4c6a3c810e
>> Author: Stephan Witt <switt at lyx.org>
>> Date:   Thu Feb 13 16:38:37 2020 +0100
>>     Put the LyX window frontmost automatically on Mac on successful reverse search
> 
>>  	while read line ; do
>>  		echo LyX said: $line
>>  	done < "${LYXPIPE}".out || { echo "Cannot read from lyxpipe." ; exit 2 ; }
>> +	test -x /usr/bin/osascript && /usr/bin/osascript -e 'tell application "LyX" to activate'
> 
> I guess the name will not be right if the user decided to rename it. Isn't there an internal name like org.lyx.xxx that would be more robust to any LyX instance?

I don’t think the name of the bundle in file system is used here.

$ plutil -p lyx-build/LyX-2.4.0dev.app/Contents/Info.plist|grep CFBundle
  "CFBundleExecutable" => "lyx"
  "CFBundleGetInfoString" => "LyX/Mac 2.4.0dev"
  "CFBundleIconFile" => "LyXapp.icns"
  "CFBundleIdentifier" => "org.lyx.lyx"
  "CFBundleName" => "LyX"
  "CFBundlePackageType" => "APPL"
  "CFBundleShortVersionString" => "2.4.0dev"
$ open lyx-build/LyX-2.4.0dev.app
$ /usr/bin/osascript -e 'tell application "LyX" to activate'

works.

You have a point if we start localizing the LyX application name. 
Then one has to use the identifier. So to be safe the alternate solution is:

$ /usr/bin/osascript -e 'tell application id "org.lyx.lyx" to activate'

Thank you for the hint.

Stephan



More information about the lyx-devel mailing list