user-none / KDocker

Dock most applications to the system tray
GNU General Public License v2.0
311 stars 22 forks source link

Cannot start flatpak application Evolution with KDocker #42

Closed Etamuk closed 5 years ago

Etamuk commented 6 years ago

I am using the flatpak-version of Evolution. To get it minimized on system start i installed KDocker. But when i start evolution with kdocker with kdocker flatpak run org.gnome.Evolution a error message appears. There is also no kdocker icon in tray.

Can anybody help me?

bildschirmfoto vom 2018-10-25 19-30-36

I think it's no problem of Evolution because it is reproducible with any flathub apps.

I am using LinuxMint 19 with Cinnamon 3.8.9

xdenyer commented 6 years ago

Does KDocker work on the window otherwise? eg If you bind "kdocker -f -q" to a keyboard shortcut, does it manage to tray Evolution?

Could try something like;

sh -c 'pavucontrol &' && sleep 2 && kdocker -w $(xdotool search --name 'Volume Control' | tail -n 1)

Substituting in parameters to run Evolution, i.e. run it then search for its window after a couple of seconds.

(I'm fairly new to bash, that's probably horrible syntax).

Etamuk commented 6 years ago

Does KDocker work on the window otherwise? eg If you bind "kdocker -f -q" to a keyboard shortcut, does it manage to tray Evolution?

Yes, that's working. I tried it in terminal with sleep 2 && kdocker -f -q

It's also working with the window ID. In this case i set kdocker to start with a delay of 7 seconds. But the window ID is changing after some time. SO Kdocker cannot find the window anymore.

I changed the command in your post to: sh -c 'flatpak run org.gnome.Evolution &' && sleep 2 && kdocker -w $(xdotool search --name 'Evolution' | tail -n 1) This only starts Evolution. But it does not minimize it. You have to know i don't know anything about scripting :-)

xdenyer commented 6 years ago

I can't get Xubuntu to install any flatpaks at the moment (errors about metadata objects) or I'd try Evolution that way. But I don't think finding the window ID is a problem unique to flatpaks -- when I do xdotool search --name 'Evolution' it lists six window IDs.

The | tail -n 1 bit is very crude error handling in the eventuality that there's more than one matching window, which as Evolution is creating so many windows means that the wrong one is likely to be selected.

xdotool search --name 'Mail — Evolution' (the title of the window with no account set up) lists only one window ID, so replacing that with the exact title your Evolution window has when it starts up might be the way to go.

Etamuk commented 6 years ago

I tested all the IDs given by xdotool search --name 'Evolution' It gives me five IDs. One of them docks a window with the description "alarm-notify", the other creates a tray icon with "vivaldi-stable" (? don't know why, also my system freezes for some seconds) and the other three didn't work. With the command xdotool search --name 'Mail — Evolution' nothing happens.

Daxx commented 6 years ago

The Evolution window is not owned by flatpak, so kdocker has no way to find it without help. Try something like: kdocker -d 10 -n ' — Evolution' flatpak run org.gnome.Evolution ... and reduce or remove the 10 sec delay, later, if possible.

(Untested. I don't have Evolution, flatpak or Mint 19)

For your xdotool search, add '--onlyvisible' to filter out the unneeded windows. xdotool search --onlyvisible --name ' — Evolution'

Etamuk commented 6 years ago

The window ID is always changing.

When i run kdocker -d 10 -n ' — Evolution' flatpak run org.gnome.Evolution this following error window appears.

As i was using Evolution from the Mint repo there were no problems. But there is an older version of Evolution in their repo. So i want to use the flatpak version because it runs better. In the older version of Evolution i had some problems (because of bugs).

bildschirmfoto vom 2018-10-30 18-17-36

xdenyer commented 6 years ago

@Daxx -- good spot, I've only used xdotool for a few things before.

If we put those things together, does this work?

sh -c 'flatpak run org.gnome.Evolution &' && sleep 10 && kdocker -w $(xdotool search --onlyvisible --name ' — Evolution')

(Note the dash in the name matching string is an mdash).

Etamuk commented 6 years ago

Hello, i rwas running the terminal with sh -c 'flatpak run org.gnome.Evolution &' && sleep 10 && kdocker -w $(xdotool search --onlyvisible --name ' — Evolution') and got this message:

(evolution.bin:49): evolution-calendar-CRITICAL **: 21:22:36.146: etdp_merge_with_root_paths: assertion 'new_root_paths != NULL' failed qt5ct: using qt5ct plugin kdocker: Diese Option benötigt ein Argument -- »w« Usage: kdocker [options] command Try `kdocker -h' for more information

Evolution was opening, but not minimized to tray. Also no icon in tray.

xdenyer commented 6 years ago

What's the full title of your main Evolution window, the one you're trying to tray?

Etamuk commented 6 years ago

I think it's Eingang – Evolution

bildschirmfoto vom 2018-10-30 21-38-19

So i tried sh -c 'flatpak run org.gnome.Evolution &' && sleep 10 && kdocker -w $(xdotool search --onlyvisible --name 'Eingang — Evolution') But no change to my last post.

xdenyer commented 6 years ago

If you run Evolution manually first, what output/result do you get from each of these?

xdotool search --name 'Eingang — Evolution'

kdocker -n 'Eingang — Evolution'

kdocker -w $(xdotool search --name 'Eingang — Evolution')

xdenyer commented 6 years ago

I've gotten Flatpak working by telling the PPA to use bionic rather than cosmic, gotten Evolution installed, and this (exact title match) works for me;

sh -c 'flatpak run org.gnome.Evolution &' && sleep 5 && kdocker -w $(xdotool search --onlyvisible --name 'Mail — Evolution')

Using an exact title match the --onlyvisible isn't strictly necessary. The kdocker -n option doesn't work for me either with a partial or full title.

xdenyer commented 6 years ago

A touch bizarrely, the first of these doesn't work but the other two do;

sh -c 'flatpak run org.gnome.Evolution &' && sleep 5 && kdocker -w $(xdotool search --onlyvisible --name 'Evolution')

sh -c 'flatpak run org.gnome.Evolution &' && sleep 5 && kdocker -w $(xdotool search --onlyvisible --name ' — Evolution')

sh -c 'flatpak run org.gnome.Evolution &' && sleep 5 && kdocker -w $(xdotool search --onlyvisible --name ' — ')

Because even though there's only one Evolution window open and visible, $(xdotool search --onlyvisible --name 'Evolution') returns two window IDs. It must be doing something "interesting" with its window management.

Etamuk commented 6 years ago

Hmm. For me none of this worked.

sh -c 'flatpak run org.gnome.Evolution &' && sleep 5 && kdocker -w $(xdotool search --onlyvisible --name 'Mail — Evolution')

brings: ** Message: 11:14:37.547: received an invalid or unencryptable secret

(evolution.bin:50): evolution-calendar-CRITICAL **: 11:14:37.826: etdp_merge_with_root_paths: assertion 'new_root_paths != NULL' failed qt5ct: using qt5ct plugin kdocker: Diese Option benötigt ein Argument -- »w« Usage: kdocker [options] command Try `kdocker -h' for more information


sh -c 'flatpak run org.gnome.Evolution &' && sleep 5 && kdocker -w $(xdotool search --onlyvisible --name 'Evolution')

brings: (evolution.bin:48): evolution-calendar-CRITICAL **: 11:13:38.184: etdp_merge_with_root_paths: assertion 'new_root_paths != NULL' failed qt5ct: using qt5ct plugin


sh -c 'flatpak run org.gnome.Evolution &' && sleep 5 && kdocker -w $(xdotool search --onlyvisible --name ' — Evolution')

brings: (evolution.bin:50): evolution-calendar-CRITICAL **: 11:12:54.105: etdp_merge_with_root_paths: assertion 'new_root_paths != NULL' failed qt5ct: using qt5ct plugin kdocker: Diese Option benötigt ein Argument -- »w« Usage: kdocker [options] command Try `kdocker -h' for more information

with this window

bildschirmfoto vom 2018-10-31 11-14-03


and

sh -c 'flatpak run org.gnome.Evolution &' && sleep 5 && kdocker -w $(xdotool search --onlyvisible --name ' — ')

brings:

(evolution.bin:47): evolution-calendar-CRITICAL **: 11:12:14.413: etdp_merge_with_root_paths: assertion 'new_root_paths != NULL' failed qt5ct: using qt5ct plugin kdocker: Diese Option benötigt ein Argument -- »w« Usage: kdocker [options] command Try `kdocker -h' for more information


If you run Evolution manually first, what output/result do you get from each of these?

xdotool search --name 'Eingang — Evolution'

kdocker -n 'Eingang — Evolution'

kdocker -w $(xdotool search --name 'Eingang — Evolution')

When i run xdotool search --name 'Eingang — Evolution' in terminal, nothing happens.


kdocker -n 'Eingang — Evolution'

shows this window: bildschirmfoto vom 2018-10-31 11-25-12


and kdocker -w $(xdotool search --name 'Eingang — Evolution')

brings: qt5ct: using qt5ct plugin kdocker: Diese Option benötigt ein Argument -- »w« Usage: kdocker [options] command Try `kdocker -h' for more information

Daxx commented 6 years ago

After starting Evolution manually, what's the output from: xprop WM_NAME (click on the Evolution window to select it, after the crosshairs cursor appears)

Then: kdocker -n 'copy/paste (partial) title from xprop to here'


Does ps -ejH | grep [Ee]volution produce anything? I assume it has its own process ID. If so, try kdocker -x $(pidof -s evolution) (using whatever its process name is)


xwininfo is useful if you have it (it used to be in 'x11-utils' package) https://manpages.debian.org/jessie/x11-utils/xwininfo.1.en.html e.g.: xwininfo -root -children | grep Evolution

Etamuk commented 6 years ago

xprop WM_NAME

WM_NAME(COMPOUND_TEXT) = "Eingang – Evolution"

Then i put this in terminal (after starting Evolution manualy): kdocker -n 'Eingang – Evolution'

This window appears after some seconds: bildschirmfoto vom 2018-10-31 12-38-01


xwininfo -root -children | grep Evolution

gives:

0x6200001 "evolution-alarm-notify": ("evolution-alarm-notify" "Evolution-alarm-notify") 20x20+20+20 +20+20 0x6000001 "evolution.bin": ("evolution.bin" "Evolution.bin") 20x20+20+20 +20+20 0x5a00001 "Cannot start flatpak application Evolution with KDocker · Issue #42 · user-none/KDocker - Vivaldi": ("vivaldi-stable" "Vivaldi-stable") 3084x2106+756+54 +756+54

Daxx commented 6 years ago

I've been editing; can you try the ps -ejH part of my post to dock using its PID.

Does xwininfo -root -children | grep Eingang find your main Evo window?

I'm increasingly suspicious about possible unicode characters: xprop WM_NAME | hexdump -C -OR- xprop WM_NAME | xxd (again, click on Evo window to select it) ... Also curious to know if wmctrl -lpx has a line showing your Evo window

Etamuk commented 6 years ago

Does xwininfo -root -children | grep Eingang find your main Evo window?

I think no. When i triy this i terminal nothing happens.


xprop WM_NAME | hexdump -C

00000000 57 4d 5f 4e 41 4d 45 28 43 4f 4d 50 4f 55 4e 44 |WM_NAME(COMPOUND| 00000010 5f 54 45 58 54 29 20 3d 20 22 45 69 6e 67 61 6e |_TEXT) = "Eingan| 00000020 67 20 e2 80 93 20 45 76 6f 6c 75 74 69 6f 6e 22 |g ... Evolution"| 00000030 0a |.| 00000031


xprop WM_NAME | xxd

00000000: 574d 5f4e 414d 4528 434f 4d50 4f55 4e44 WM_NAME(COMPOUND 00000010: 5f54 4558 5429 203d 2022 4569 6e67 616e _TEXT) = "Eingan 00000020: 6720 e280 9320 4576 6f6c 7574 696f 6e22 g ... Evolution" 00000030: 0a


wmctrl -lpx

0x03c00003 -1 1529 nemo-desktop.Nemo-desktop selfmade Schreibtisch 0x05a00001 0 5603 vivaldi-stable.Vivaldi-stable selfmade Cannot start flatpak application Evolution with KDocker · Issue #42 · user-none/KDocker - Vivaldi 0x06000033 0 50 evolution.bin.Evolution.bin selfmade Eingang – Evolution 0x04200013 -1 1532 tilda.Tilda selfmade tilda


I don't know anything about this lines. But perhaps you can use it.

Daxx commented 6 years ago

(Note the dash in the name matching string is an mdash).

... It's an EN DASH, @xdenyer, which is probably messing up a lot of our tests: https://www.fileformat.info/info/unicode/char/2013/index.htm (seen in the hexdump from @Etamuk)

Daxx commented 6 years ago

With Evo running ... WID="$(wmctrl -lx | grep [Ee]volution.bin)"; kdocker -w "${WID%% *}"


Explanation: wmctrl -lx lists windows being managed by the window manager with their IDs. Assign the result to the WID variable. grep is on WM_CLASS of the Evolution window (should be unique - avoids matching titles)

${string%%substring} Deletes the longest match of $substring from the back of $string.

(In this case, delete from the first space to the end of the line, leaving just the window ID in $WID)

Hopefully, if that works, you can add the flatpak startup && sleep to the front of that.

Daxx commented 6 years ago

REPEAT of something I edited into a previous post (assumes Evo running): Does ps -ejH | grep [Ee]volution produce anything? If so, kdocker -x $(pidof -s evolution) (using whatever its process name is) might be less clunky than the wmctrl attempt, above.

EDIT: Once you know the process name to use with pidof, you won't need the ps command every time.

Etamuk commented 6 years ago

When Evolution is running and run WID="$(wmctrl -lx | grep [Ee]volution.bin)"; kdocker -w "${WID%% *}" in terminal, the window moves to the tray and shown an icon (mail icon). That's fine :-) I added -q to the command to get this: WID="$(wmctrl -lx | grep [Ee]volution.bin)"; kdocker -q -w "${WID%% *}"

I have to say it works very stable.

But i have to run this command manual after Evolution starts. When i run /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=evolution --file-forwarding org.gnome.Evolution @@u %U @@ && sleep 5 && WID="$(wmctrl -lx | grep [Ee]volution.bin)"; kdocker -q -w "${WID%% *}"

Evolution starts, but it's not minimized to tray.

xdenyer commented 6 years ago

@Daxx -- Yay for inconsistent localisation, I've got

xprop WM_NAME | hexdump -C

00000000  57 4d 5f 4e 41 4d 45 28  43 4f 4d 50 4f 55 4e 44  |WM_NAME(COMPOUND|
00000010  5f 54 45 58 54 29 20 3d  20 22 4d 61 69 6c 20 e2  |_TEXT) = "Mail .|
00000020  80 94 20 45 76 6f 6c 75  74 69 6f 6e 22 0a        |.. Evolution".|
0000002e

This one works here, using wmctrl

sh -c 'flatpak run org.gnome.Evolution &' && sleep 5 && WID="$(wmctrl -lx | grep [Ee]volution.bin)"; kdocker -qw "${WID%% *}"

Etamuk commented 6 years ago

I think we are getting closer to the solution. But when you close Evolution with the Calendar-View and the reopen it with sh -c 'flatpak run org.gnome.Evolution &' && sleep 5 && WID="$(wmctrl -lx | grep [Ee]volution.bin)"; kdocker -qw "${WID%% *}" you will get a calendar icon in tray.

So i added a path to a mail icon:

sh -c 'flatpak run org.gnome.Evolution &' && sleep 5 && WID="$(wmctrl -lx | grep [Ee]volution.bin)"; kdocker -qw "${WID%% *}" -i /usr/share/icons/Mint-Y/apps/32/email.png

xdenyer commented 6 years ago

Yeah, kdocker makes a best guess when first run (and doesn't seem to like Chromium/Chrome/Opera unfortunately, whereas alltray finds an icon) -- overriding is definitely the best option if you're starting on a different view where the window has an icon you don't want.

Etamuk commented 6 years ago

So this sh -c 'flatpak run org.gnome.Evolution &' && sleep 5 && WID="$(wmctrl -lx | grep [Ee]volution.bin)"; kdocker -qw "${WID%% *}" -i /usr/share/icons/Mint-Y/apps/32/email.png works very stable for me. By the way i get this message in terminal:

(evolution.bin:45): evolution-calendar-CRITICAL **: 20:57:43.763: etdp_merge_with_root_paths: assertion 'new_root_paths != NULL' failed
qt5ct: using qt5ct plugin
qt5ct: D-Bus system tray: no

But Evolution works and there seems to be no problem.

The only problem is, i have to type this in terminal after login to get the command working.

When i try to create a starter on desktop or (better) in Autostart it's not working. It only opens Evolution.

xdenyer commented 6 years ago

Assuming Cinnamon is anything like Xfce, put it into a script (eg, 'start_evolution.sh') like so

#!/bin/bash
sh -c 'flatpak run org.gnome.Evolution &' && sleep 5 && WID="$(wmctrl -lx | grep [Ee]volution.bin)"; kdocker -qw "${WID%% *}" -i /usr/share/icons/Mint-Y/apps/32/email.png

Save it somewhere the file won't move, mark it as executable if necessary (in Nemo right-click it, choose Properties, Permissions, "Allow executing file as program") and target that script with Autostart.

I get far more warning messages launching Gnome style GUI software from the Terminal, not least due to using gtk3-nocsd. It's generally nothing to worry about.

xdenyer commented 6 years ago

eg, For me the autostart command would be

sh /home/admech/.myscripts/start_evolution.sh

Etamuk commented 6 years ago

Now i was able to login for a couple of times and have to say: it's working. I created a script as you proposed and put it into Cinnamons Autostart.

Thank you both for taking the time helping me with this problem. As you could see i have no big experience with terminal commands or other similar stuff. And also my english is not the best. But at the end everything is working now. Again, thank you for your persistent help!!! You both did a very good job :-)

xdenyer commented 6 years ago

No worries, it was more Daxx. I'm just glad the project's still being supported for those of us who like a traditional desktop (and finding out just now that 5.2 allows saving custom icons per application was a nice bonus).

Daxx commented 6 years ago

Glad you're getting closer to a workaround and thanks to @xdenyer for valuable input. Still no feedback on https://github.com/user-none/KDocker/issues/42#issuecomment-434770774 ... which I think would make a tidier solution than setting $WID?

Safe for @user-none to close this as it isn't, strictly, a KDocker issue (more a limiting effect of flatpak).

Etamuk commented 6 years ago

ps -ejH | grep [Ee]volution shows

1552 1164 1164 ? 00:00:00 evolution 1557 1164 1164 ? 00:00:00 evolution-dbus- 1615 1164 1164 ? 00:00:00 evolution-wrapp 1662 1164 1164 ? 00:00:00 evolution-sourc 1682 1164 1164 ? 00:00:00 evolution-addre 1683 1164 1164 ? 00:00:00 evolution-calen 1715 1164 1164 ? 00:00:03 evolution.bin 1730 1164 1164 ? 00:00:01 evolution-alarm


And

kdocker -x $(pidof -s evolution)

shows

qt5ct: using qt5ct plugin kdocker: Diese Option benötigt ein Argument -- »x« Usage: kdocker [options] command Try `kdocker -h' for more information

Daxx commented 6 years ago

Looks like pidof -s evolution is coming up empty? Should have yielded 1552 from your example (if it was still running). I wonder if it's not installed ... whereis pidof

Manually, I'd have expected kdocker -x 1552 to work.

Etamuk commented 6 years ago

Looks like pidof -s evolution is coming up empty?

Yes, but Synaptic says it is installed in paket sysvinit-utils

... whereis pidof

gives pidof: /bin/pidof /usr/share/man/man8/pidof.8.gz

The command kdocker -x 1552 doesn't work. It only shows qt5ct: using qt5ct plugin

Daxx commented 6 years ago

pid (1552) changes on each run, of course.

Does this give anything while Evo is running? pidof -s evolution

Etamuk commented 6 years ago

pidof -s evolution

no, nothing.

Daxx commented 6 years ago

Bizarre! Here's what I expected using a similar example:

ps -ejH | grep [Tt]hunderbird 3675 2729 2729 ? 00:02:43 thunderbird pidof -s thunderbird 3675

Etamuk commented 6 years ago

Yes, that works:

ps -ejH | grep [Tt]hunderbird

5953 1164 1164 ? 00:00:02 thunderbird

pidof -s thunderbird

5953

Thunderbird was installed on my system via the "normal" repo. Evolution as flatpak app.

Perhaps this is the difference.

qwertychouskie commented 6 years ago

@Etamuk What version of KDocker are you using? I keep seeing in your output the various flags are not recognized.

Etamuk commented 6 years ago

Hello,

i am using the Kdocker version installed from the Linux Mint Repo. It's version 5.0-1.

xdenyer commented 6 years ago

@Etamuk What version of KDocker are you using? I keep seeing in your output the various flags are not recognized.

Do you mean the "Diese Option benötigt ein Argument"? If so, it's because the argument passed is blank rather than because kdocker doesn't recognise the option.

xdenyer commented 6 years ago

pid (1552) changes on each run, of course.

Does this give anything while Evo is running? pidof -s evolution

If you do xprop _NET_WM_PID and click on the Evolution window, the process ID it identifies has no obvious connection to Evolution (although kdocker -x when passed the process ID trays it).

This seems to be peculiar to flatpak. Evolution installed normally behaves as expected.

edit: Personally the process ID seems to consistently be either 'netns' or 'oom_reaper' (both low-numbered processes). It's not ever in an OOM situation, there's gigabytes of free RAM.

edit2: Same behaviour with 'gLabels' installed via flatpak, its process is 'kthreadd' (process ID 2). In short, I don't think using process IDs with flatpak applications and kdocker is practical due to whatever it's doing with the wrappers, and window IDs are probably the way to go.

promeneur commented 5 years ago

Hello

i tested your tremendous solution. thank you very much i solved my problem: docking Android Messages in kde environment.

i just wrote a script dock_messages.sh

!/bin/bash

# /opt/google/chrome/google-chrome --app= https://messages.android.com && sleep 5 && WID="$(wmctrl -lx | grep Messages)"; kdocker -qw "${WID%% *}"

a slight difference: i used kcron to start the script during kde session login

we have a solution to dock all web apps as android messages , whatsapp etc. using chrome, kdocker and your work.

just a little problem when minimizing the app then the app stays in the task bar.

promeneur commented 5 years ago

i found a work around about task bar problem.

i checked "skip task bar"

promeneur commented 5 years ago

finally my solution here https://forums.opensuse.org/showthread.php/533989-kde-docking-an-app-in-systray

xdenyer commented 5 years ago

Try the -t option, which is equivalent to "skip task bar". i.e. in what you've got kdocker -tqw instead of kdocker -qw

edit: To be clearer, remaining in the taskbar when visible isn't necessarily a bug in kdocker. It's up to the desktop environment (in this case KDE) to handle the request.

edit2: Works as expected in Xfce, Cinnamon & Gnome. Elementary has removed support for traditional indicators. Will try some other DEs if I get time.

edit3: Works as expected in LXDE and Mate. It seems to work as expected in KDE too. I installed kubuntu-desktop on top of Ubuntu 18.04 (Plasma 5.12.6) and executed kdocker -f in a terminal window, which removed it from the task manager panel widget when not visible and allowed it to be toggled via the system tray icon. Minimising the window also removed the entry from the task manager panel widget and trayed it as expected.

promeneur commented 5 years ago

i want to minimize in systray 3 web apps with Chrome: hangouts , messages , skype.

i wrote 3 scripts.

i launch each script when opening a kde session.

hangouts script includes the statement "sleep 1m 30s" messages script includes the statement "sleep 1m 45s" skype script includes the statement "sleep 2m"

when opening a kde session then i got "invalid window id ..." from kdocker for hangouts and messages.

if in a console i run each script there is no problem.

example of script

!/bin/bash

# sleep 1m 30s bash -c '/opt/google/chrome/google-chrome --app=https://hangouts.google.com &' && sleep 5s && WID="$(wmctrl -lx | grep "Hangouts")"; kdocker -qtw "${WID%% *}" -i ~/.local/share/icons/hicolor/32x32/apps/chrome-odadmohlkalmmfdgjdlbjdpoekbijhcc-Default.png

xdenyer commented 5 years ago

It's probably taking longer than 5 seconds to start Chrome due to more things needing to be loaded into memory just after boot. Try increasing that value.

Alternatively try a simple script that waits for the window to be available (the reply to this post);

https://stackoverflow.com/questions/50873375/show-program-only-in-system-tray-kdocker

promeneur commented 5 years ago

@xdenyer thanks

yes, delay for launching chrome or a new tab is randomly short or long (connection delay ?) we must tune the two delays. i changed "sleep 5s" by "sleep 10s" in the 3 scripts to avoid a problem. i keep 15s between two script launches.

xdenyer commented 5 years ago

I'm not somewhere I can test it now, but something similar to what's referred to in the link should work, breaking the process down into 1) run app, 2) wait until ready, 3) tray it;

#!/bin/bash
bash -c '/opt/google/chrome/google-chrome --app=https://hangouts.google.com &'
while [ true ]
do
   sleep 5
   status=$(wmctrl -l | grep "Hangouts")
   if [ "$status" != "" ] ; then
      break
   fi
done
WID="$(wmctrl -lx | grep "Hangouts")"; kdocker -qtw "${WID%% *}" -i ~/.local/share/icons/hicolor/32x32/apps/chrome-odadmohlkalmmfdgjdlbjdpoekbijhcc-Default.png