Modification of our launchers needed #2

Closed
opened 2018-04-21 07:19:04 +00:00 by philm · 10 comments
philm commented 2018-04-21 07:19:04 +00:00 (Migrated from gitlab2.manjaro.org)

Created by: philmmanjaro

When I start the launcher from the shared folder I've a working result:

phil@development ~/dev/git/manjaro/basic/ms-office-online-launcher $ /usr/share/ms-office/office/ms-office-online
Identifying User Agent as - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Safari/605.1.15

However, if I launch it as a symlink from '/usr/bin' it fails:

phil@development ~/dev/git/manjaro/basic/ms-office-online-launcher $ ms-office
Identifying User Agent as - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Safari/605.1.15
Traceback (most recent call last):
  File "/usr/bin/ms-office", line 53, in <module>
    applicationWindow()
  File "/usr/bin/ms-office", line 49, in __init__
    self.webview.load_uri(settings("app", "route"))
TypeError: Argument 1 does not allow None as a value

Therefore we have to rethink the concept of the launcher a little.

*Created by: philmmanjaro* When I start the launcher from the shared folder I've a working result: ``` phil@development ~/dev/git/manjaro/basic/ms-office-online-launcher $ /usr/share/ms-office/office/ms-office-online Identifying User Agent as - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Safari/605.1.15 ``` However, if I launch it as a symlink from '/usr/bin' it fails: ``` phil@development ~/dev/git/manjaro/basic/ms-office-online-launcher $ ms-office Identifying User Agent as - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Safari/605.1.15 Traceback (most recent call last): File "/usr/bin/ms-office", line 53, in <module> applicationWindow() File "/usr/bin/ms-office", line 49, in __init__ self.webview.load_uri(settings("app", "route")) TypeError: Argument 1 does not allow None as a value ``` Therefore we have to rethink the concept of the launcher a little.
philm commented 2018-04-21 07:43:02 +00:00 (Migrated from gitlab2.manjaro.org)

Created by: philmmanjaro

Current PKGBUILD

# Maintainer: Philip Müller <philm@manjaro.org>
# Contributor: Vitor Lopes <vmnlop@gmail.com>

pkgname=('ms-office-online')
pkgver=18.04.1
pkgrel=5
_commit=284865d
pkgdesc="Microsoft Office Suite Online for Manjaro Linux"
url="https://www.office.com/"
depends=('python-jade-application-kit>=0.36')
license=('GPL3' 'custom')
arch=('any')
provides=('microsoft-office-online' 'microsoft-office')
source=("${pkgname}-${pkgver}-${pkgrel}.tar.gz::https://github.com/manjaro/${pkgname}-launcher/archive/${pkgver}.tar.gz"
        "${pkgname}-${pkgver}-${pkgrel}.patch::https://github.com/manjaro/ms-office-online-launcher/compare/${pkgver}...${_commit}.patch")
sha256sums=('f7bc899379fa4999ed2b2d74b0a6db375018f42c625cb557b9885a20a5f61e8a'
            '301ba649471ed288767b2b4c8cd97d10222e591b7373e65ffabe0ca8ee7f8dc2')

prepare() {
    cd "${pkgname}-launcher-${pkgver}"
    patch -p1 -i "${srcdir}/${pkgname}-${pkgver}-${pkgrel}.patch"
}

package() {
    cd "${pkgname}-launcher-${pkgver}"
    make PREFIX="/usr" DESTDIR="${pkgdir}" install

    # Workaround till issue #2 is fixed
    rm "${pkgdir}"/usr/bin/*

    # Create binaries
    declare -a arr=(ms-office ms-powerpoint ms-excel ms-word ms-outlook ms-onenote ms-skype)
    for i in ${arr[@]}; do
        echo "#!/bin/sh" > "${pkgdir}/usr/bin/$i"
        echo "cd /usr/share/ms-office/${i//ms-/}" >> "${pkgdir}/usr/bin/$i"
        echo "./ms-office-online" >> "${pkgdir}/usr/bin/$i"
    done
    chmod a+x "${pkgdir}"/usr/bin/*
}
*Created by: philmmanjaro* Current PKGBUILD ``` # Maintainer: Philip Müller <philm@manjaro.org> # Contributor: Vitor Lopes <vmnlop@gmail.com> pkgname=('ms-office-online') pkgver=18.04.1 pkgrel=5 _commit=284865d pkgdesc="Microsoft Office Suite Online for Manjaro Linux" url="https://www.office.com/" depends=('python-jade-application-kit>=0.36') license=('GPL3' 'custom') arch=('any') provides=('microsoft-office-online' 'microsoft-office') source=("${pkgname}-${pkgver}-${pkgrel}.tar.gz::https://github.com/manjaro/${pkgname}-launcher/archive/${pkgver}.tar.gz" "${pkgname}-${pkgver}-${pkgrel}.patch::https://github.com/manjaro/ms-office-online-launcher/compare/${pkgver}...${_commit}.patch") sha256sums=('f7bc899379fa4999ed2b2d74b0a6db375018f42c625cb557b9885a20a5f61e8a' '301ba649471ed288767b2b4c8cd97d10222e591b7373e65ffabe0ca8ee7f8dc2') prepare() { cd "${pkgname}-launcher-${pkgver}" patch -p1 -i "${srcdir}/${pkgname}-${pkgver}-${pkgrel}.patch" } package() { cd "${pkgname}-launcher-${pkgver}" make PREFIX="/usr" DESTDIR="${pkgdir}" install # Workaround till issue #2 is fixed rm "${pkgdir}"/usr/bin/* # Create binaries declare -a arr=(ms-office ms-powerpoint ms-excel ms-word ms-outlook ms-onenote ms-skype) for i in ${arr[@]}; do echo "#!/bin/sh" > "${pkgdir}/usr/bin/$i" echo "cd /usr/share/ms-office/${i//ms-/}" >> "${pkgdir}/usr/bin/$i" echo "./ms-office-online" >> "${pkgdir}/usr/bin/$i" done chmod a+x "${pkgdir}"/usr/bin/* } ```
philm commented 2018-04-21 07:46:21 +00:00 (Migrated from gitlab2.manjaro.org)

Created by: philmmanjaro

Current package layout:

phil@development ~ $ pacman -Ql ms-office-online
ms-office-online /usr/
ms-office-online /usr/bin/
ms-office-online /usr/bin/ms-excel
ms-office-online /usr/bin/ms-office
ms-office-online /usr/bin/ms-onenote
ms-office-online /usr/bin/ms-outlook
ms-office-online /usr/bin/ms-powerpoint
ms-office-online /usr/bin/ms-skype
ms-office-online /usr/bin/ms-word
ms-office-online /usr/share/
ms-office-online /usr/share/applications/
ms-office-online /usr/share/applications/ms-excel.desktop
ms-office-online /usr/share/applications/ms-office.desktop
ms-office-online /usr/share/applications/ms-onenote.desktop
ms-office-online /usr/share/applications/ms-outlook.desktop
ms-office-online /usr/share/applications/ms-powerpoint.desktop
ms-office-online /usr/share/applications/ms-skype.desktop
ms-office-online /usr/share/applications/ms-word.desktop
ms-office-online /usr/share/icons/
ms-office-online /usr/share/icons/hicolor/
ms-office-online /usr/share/icons/hicolor/1024x1024/
ms-office-online /usr/share/icons/hicolor/1024x1024/apps/
ms-office-online /usr/share/icons/hicolor/1024x1024/apps/ms-excel.png
ms-office-online /usr/share/icons/hicolor/1024x1024/apps/ms-office.png
ms-office-online /usr/share/icons/hicolor/1024x1024/apps/ms-onenote.png
ms-office-online /usr/share/icons/hicolor/1024x1024/apps/ms-outlook.png
ms-office-online /usr/share/icons/hicolor/1024x1024/apps/ms-powerpoint.png
ms-office-online /usr/share/icons/hicolor/1024x1024/apps/ms-skype.png
ms-office-online /usr/share/icons/hicolor/1024x1024/apps/ms-word.png
ms-office-online /usr/share/ms-office/
ms-office-online /usr/share/ms-office/excel/
ms-office-online /usr/share/ms-office/excel/ms-office-online
ms-office-online /usr/share/ms-office/excel/settings.json
ms-office-online /usr/share/ms-office/office/
ms-office-online /usr/share/ms-office/office/ms-office-online
ms-office-online /usr/share/ms-office/office/settings.json
ms-office-online /usr/share/ms-office/onenote/
ms-office-online /usr/share/ms-office/onenote/ms-office-online
ms-office-online /usr/share/ms-office/onenote/settings.json
ms-office-online /usr/share/ms-office/outlook/
ms-office-online /usr/share/ms-office/outlook/ms-office-online
ms-office-online /usr/share/ms-office/outlook/settings.json
ms-office-online /usr/share/ms-office/powerpoint/
ms-office-online /usr/share/ms-office/powerpoint/ms-office-online
ms-office-online /usr/share/ms-office/powerpoint/settings.json
ms-office-online /usr/share/ms-office/skype/
ms-office-online /usr/share/ms-office/skype/ms-office-online
ms-office-online /usr/share/ms-office/skype/settings.json
ms-office-online /usr/share/ms-office/word/
ms-office-online /usr/share/ms-office/word/ms-office-online
ms-office-online /usr/share/ms-office/word/settings.json
*Created by: philmmanjaro* Current package layout: ``` phil@development ~ $ pacman -Ql ms-office-online ms-office-online /usr/ ms-office-online /usr/bin/ ms-office-online /usr/bin/ms-excel ms-office-online /usr/bin/ms-office ms-office-online /usr/bin/ms-onenote ms-office-online /usr/bin/ms-outlook ms-office-online /usr/bin/ms-powerpoint ms-office-online /usr/bin/ms-skype ms-office-online /usr/bin/ms-word ms-office-online /usr/share/ ms-office-online /usr/share/applications/ ms-office-online /usr/share/applications/ms-excel.desktop ms-office-online /usr/share/applications/ms-office.desktop ms-office-online /usr/share/applications/ms-onenote.desktop ms-office-online /usr/share/applications/ms-outlook.desktop ms-office-online /usr/share/applications/ms-powerpoint.desktop ms-office-online /usr/share/applications/ms-skype.desktop ms-office-online /usr/share/applications/ms-word.desktop ms-office-online /usr/share/icons/ ms-office-online /usr/share/icons/hicolor/ ms-office-online /usr/share/icons/hicolor/1024x1024/ ms-office-online /usr/share/icons/hicolor/1024x1024/apps/ ms-office-online /usr/share/icons/hicolor/1024x1024/apps/ms-excel.png ms-office-online /usr/share/icons/hicolor/1024x1024/apps/ms-office.png ms-office-online /usr/share/icons/hicolor/1024x1024/apps/ms-onenote.png ms-office-online /usr/share/icons/hicolor/1024x1024/apps/ms-outlook.png ms-office-online /usr/share/icons/hicolor/1024x1024/apps/ms-powerpoint.png ms-office-online /usr/share/icons/hicolor/1024x1024/apps/ms-skype.png ms-office-online /usr/share/icons/hicolor/1024x1024/apps/ms-word.png ms-office-online /usr/share/ms-office/ ms-office-online /usr/share/ms-office/excel/ ms-office-online /usr/share/ms-office/excel/ms-office-online ms-office-online /usr/share/ms-office/excel/settings.json ms-office-online /usr/share/ms-office/office/ ms-office-online /usr/share/ms-office/office/ms-office-online ms-office-online /usr/share/ms-office/office/settings.json ms-office-online /usr/share/ms-office/onenote/ ms-office-online /usr/share/ms-office/onenote/ms-office-online ms-office-online /usr/share/ms-office/onenote/settings.json ms-office-online /usr/share/ms-office/outlook/ ms-office-online /usr/share/ms-office/outlook/ms-office-online ms-office-online /usr/share/ms-office/outlook/settings.json ms-office-online /usr/share/ms-office/powerpoint/ ms-office-online /usr/share/ms-office/powerpoint/ms-office-online ms-office-online /usr/share/ms-office/powerpoint/settings.json ms-office-online /usr/share/ms-office/skype/ ms-office-online /usr/share/ms-office/skype/ms-office-online ms-office-online /usr/share/ms-office/skype/settings.json ms-office-online /usr/share/ms-office/word/ ms-office-online /usr/share/ms-office/word/ms-office-online ms-office-online /usr/share/ms-office/word/settings.json ```
philm commented 2018-04-21 11:01:07 +00:00 (Migrated from gitlab2.manjaro.org)

Created by: codesardine

This is related with JAK as it uses the launcher path to search for the settings file.

JAK line 27 - options.route = os.path.dirname(os.path.abspath(sys.argv[0]))
At the moment i don't have a better way of doing this.
workaround:
create a shell script in bin /usr/share/ms-office/office/ms-office-online

*Created by: codesardine* This is related with JAK as it uses the launcher path to search for the settings file. JAK line 27 - options.route = os.path.dirname(os.path.abspath(sys.argv[0])) At the moment i don't have a better way of doing this. workaround: create a shell script in bin /usr/share/ms-office/office/ms-office-online
philm commented 2018-04-21 11:46:13 +00:00 (Migrated from gitlab2.manjaro.org)

Created by: philmmanjaro

Well, if this is the case we have to modifiy our launcher, which calls JAK. For now you do this in line 12 of the launcher: os.chdir(os.path.dirname(os.path.realpath(__file__))). This will logically change to /usr/bin, as this is the location of the file we called. Then we have another section which is never used (line 38 - 42):

                else:
                    # use existing office settings.json
                    os.chdir("/usr/share/ms-office/msoffice/")
                    # open url in a new window
                    subprocess.call(["jak", url])

With the new way we install to /usr/share/ms-office/office. office may also be word or skype and so on. So, the hardcoded path might not work anyway.

To resolve it, it would be good to have an option to tell JAK where the settings file is located at. For now I'm using a workaround already by using a bash script in /usr/bin calling the python-app in /usr/share/ms-office/<app>.

*Created by: philmmanjaro* Well, if this is the case we have to modifiy our launcher, which calls JAK. For now you do this in line 12 of the launcher: `os.chdir(os.path.dirname(os.path.realpath(__file__)))`. This will logically change to `/usr/bin`, as this is the location of the file we called. Then we have another section which is never used (line 38 - 42): ``` else: # use existing office settings.json os.chdir("/usr/share/ms-office/msoffice/") # open url in a new window subprocess.call(["jak", url]) ``` With the new way we install to `/usr/share/ms-office/office`. `office` may also be `word` or `skype` and so on. So, the hardcoded path might not work anyway. To resolve it, it would be good to have an option to tell JAK where the settings file is located at. For now I'm using a workaround already by using a bash script in `/usr/bin` calling the python-app in `/usr/share/ms-office/<app>`.
philm commented 2018-04-21 11:56:58 +00:00 (Migrated from gitlab2.manjaro.org)

Created by: codesardine

for example if you remove www.skype.com from "same_frame" skype will open in a separate application window as i think it should since is a separate application, any clicked link if it is not in same_frame will open in a separate window, some users mention that links were not working so I implemented this.

*Created by: codesardine* for example if you remove www.skype.com from "same_frame" skype will open in a separate application window as i think it should since is a separate application, any clicked link if it is not in same_frame will open in a separate window, some users mention that links were not working so I implemented this.
philm commented 2018-04-21 23:53:39 +00:00 (Migrated from gitlab2.manjaro.org)
*Created by: codesardine* fixed https://github.com/codesardine/Jade-Application-Kit/commit/f6838f00c8ada41c548effbff1b89bf341e5f97c
philm commented 2018-04-22 05:54:54 +00:00 (Migrated from gitlab2.manjaro.org)

Created by: philmmanjaro

@codesardine Seems this still doesn't work:

ms-office-online/usr/bin $ ls -l .
insgesamt 0
lrwxrwxrwx 1 phil phil 43 22. Apr 07:47 ms-excel -> /usr/share/ms-office/excel/ms-office-online
lrwxrwxrwx 1 phil phil 44 22. Apr 07:47 ms-office -> /usr/share/ms-office/office/ms-office-online
lrwxrwxrwx 1 phil phil 45 22. Apr 07:47 ms-onenote -> /usr/share/ms-office/onenote/ms-office-online
lrwxrwxrwx 1 phil phil 45 22. Apr 07:47 ms-outlook -> /usr/share/ms-office/outlook/ms-office-online
lrwxrwxrwx 1 phil phil 48 22. Apr 07:47 ms-powerpoint -> /usr/share/ms-office/powerpoint/ms-office-online
lrwxrwxrwx 1 phil phil 43 22. Apr 07:47 ms-skype -> /usr/share/ms-office/skype/ms-office-online
lrwxrwxrwx 1 phil phil 42 22. Apr 07:47 ms-word -> /usr/share/ms-office/word/ms-office-online
$ ms-office
Identifying User Agent as - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Safari/605.1.15
Traceback (most recent call last):
  File "/usr/bin/ms-office", line 53, in <module>
    applicationWindow()
  File "/usr/bin/ms-office", line 49, in __init__
    self.webview.load_uri(settings("app", "route"))
TypeError: Argument 1 does not allow None as a value
phil@development ~/dev/git/manjaro/repositories/stable-repos/community/ms-office-online $ pacman -Q python-jade-application-kit
python-jade-application-kit 1.3.3-1

I assume the laucher script needs still to be modified ...

*Created by: philmmanjaro* @codesardine Seems this still doesn't work: ``` ms-office-online/usr/bin $ ls -l . insgesamt 0 lrwxrwxrwx 1 phil phil 43 22. Apr 07:47 ms-excel -> /usr/share/ms-office/excel/ms-office-online lrwxrwxrwx 1 phil phil 44 22. Apr 07:47 ms-office -> /usr/share/ms-office/office/ms-office-online lrwxrwxrwx 1 phil phil 45 22. Apr 07:47 ms-onenote -> /usr/share/ms-office/onenote/ms-office-online lrwxrwxrwx 1 phil phil 45 22. Apr 07:47 ms-outlook -> /usr/share/ms-office/outlook/ms-office-online lrwxrwxrwx 1 phil phil 48 22. Apr 07:47 ms-powerpoint -> /usr/share/ms-office/powerpoint/ms-office-online lrwxrwxrwx 1 phil phil 43 22. Apr 07:47 ms-skype -> /usr/share/ms-office/skype/ms-office-online lrwxrwxrwx 1 phil phil 42 22. Apr 07:47 ms-word -> /usr/share/ms-office/word/ms-office-online ``` ``` $ ms-office Identifying User Agent as - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Safari/605.1.15 Traceback (most recent call last): File "/usr/bin/ms-office", line 53, in <module> applicationWindow() File "/usr/bin/ms-office", line 49, in __init__ self.webview.load_uri(settings("app", "route")) TypeError: Argument 1 does not allow None as a value phil@development ~/dev/git/manjaro/repositories/stable-repos/community/ms-office-online $ pacman -Q python-jade-application-kit python-jade-application-kit 1.3.3-1 ``` I assume the laucher script needs still to be modified ...
philm commented 2018-04-23 05:15:43 +00:00 (Migrated from gitlab2.manjaro.org)

Created by: codesardine

Update - Makefile

Outlook:
New user agent needed to force display of new UI

"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14",
"same_frame": ["https://people.live.com", "https://calendar.live.com"]

Office, Word, Excel, Powerpoint

"same_frame": ["https://office.live.com", "https://www.office.com"]

Something like this in Makefile

sed -i "s|@frame@|"https://office.live.com", "https://www.office.com"|" $(BUILDDIR)/ms-office/settings.json

sed -i "s|@user_agent@|Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14|" $(BUILDDIR)/outlook/settings.json

*Created by: codesardine* Update - Makefile Outlook: New user agent needed to force display of new UI ``` "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14", "same_frame": ["https://people.live.com", "https://calendar.live.com"] ``` Office, Word, Excel, Powerpoint ``` "same_frame": ["https://office.live.com", "https://www.office.com"] ``` Something like this in Makefile sed -i "s|@frame@|"https://office.live.com", "https://www.office.com"|" $(BUILDDIR)/ms-office/settings.json sed -i "s|@user_agent@|Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14|" $(BUILDDIR)/outlook/settings.json
philm commented 2018-04-27 19:01:19 +00:00 (Migrated from gitlab2.manjaro.org)

Created by: codesardine

I think we can close this one, everything is working on my end, unless you want to add something? @philmmanjaro

*Created by: codesardine* I think we can close this one, everything is working on my end, unless you want to add something? @philmmanjaro
philm commented 2018-04-29 20:15:03 +00:00 (Migrated from gitlab2.manjaro.org)

Created by: codesardine

Closing this one if anything else is needed open a new issue @philmmanjaro

*Created by: codesardine* Closing this one if anything else is needed open a new issue @philmmanjaro
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
applications/ms-office-online-launcher#2
No description provided.