Unable to dock Duplicati from shell

Asked by Dahudi on 2015-01-28

Hey there,
after searching a while and trying a lot of different stuff my question didn't vanish, so here it is:

::System::
Linux Mint 17 with Cinnamon 2.2.16

::Aim::
I want to start the program Duplicati on system startup and want it to be automatically minimized to system tray.

::What is working::
If I just start Duplicati, then start Kdocker and klick on Duplicati it works perfectly fine.
Also for example the command
kdocker gedit
works perfectly fine.

::The Problem::
I want to do that by shell command, so that I can create a autostart rule.
But the command
kdocker duplicati
gives an error in the gui:
Could not find a matching window for duplicati in the specified time: 5 seconds.

::What I tried so far::
So I "searchmachined" that error and tried out the following:
kdocker -d 20 duplicati
kdocker -d 20 -n "Duplicati" duplicati
kdocker -d 10 -n Duplicati duplicati
kdocker -d 10 -n "Status" duplicati
kdocker -d 10 -n "Duplicati 1.3.4 - Status" duplicati
kdocker -d 10 -n "Duplicati 1.3.4" duplicati
All resulting in the same error.

::xwininfo tells me::
xwininfo: Window id: 0x2c00021 "Duplicati 1.3.4 - Status"

  Absolute upper-left X: 424
  Absolute upper-left Y: 209
  Relative upper-left X: 10
  Relative upper-left Y: 32
  Width: 426
  Height: 404
  Depth: 24
  Visual: 0x20
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x22 (installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners: +424+209 -430+209 -430-187 +424-187
  -geometry 426x404+414+177

::Additional Info::
* Duplicati runs on mono (whatever that means...?)
* Wenn I installed it there was something about a .exe - file (donnu if that plays a role)
* The developper(s) of duplicati is calling the gui not stable yet
http://code.google.com/p/duplicati/

::Bringing the Question to a more general level::
Obviously kdocker can handle duplicati, since it's working when using the gui and klicking on it.
(Reading some forums a similar issue seemed to appear for various other programs as thunderbird,...)
So is there a way to find out wich "parameters" (window-name) kdocker takes/uses when i klick on the duplicati-window(or any other).
I mean, if it would be possible to monitor / see that, than one doesn't need xwininfo or whatever other program.

Appriciate your help,
Dahudi

PS:I'm not a linux-crack so I'll try my best to understand your answer ;)

Question information

Language:
English Edit question
Status:
Solved
For:
Inactive kdocker (moved to https://github.com/user-none/KDocker) Edit question
Assignee:
No assignee Edit question
Solved by:
Dahudi
Solved:
2015-02-02
Last query:
2015-02-02
Last reply:
2015-01-30
John Schember (user-none) said : #1

There really isn't much of an answer to give...

You need to examine the window using the xutils and get the window name. Then use the -n option to match against the name. Also use the delay to ensure it's fully up...

Mono may do some type of wrapping where what it launches is a wrapper.

John

Dahudi (robert-wiesen) said : #2

Hi John,
thanks for your quick answer.
But I was not able to solve the problem this way.
I'm not shure what program/options of xutils I exactly should use to get the window name.

I used xwininfo as I wrote.
xwininfo: Window id: 0x4600021 "Duplicati 1.3.4 - Status"
but
kdocker -d 30 -n "Duplicati 1.3.4 - Status" duplicati
gives the error message. (Various altered tries see above)

I used xprop, but coudn't get a clue.

So what's the exact procedure to find the correct Window name?

regards,
Dahudi

PS:To be honest, I didn't understand if mono plays now a role in this or not. But I guess not?

Dahudi (robert-wiesen) said : #3

Oh,When I tell kdocker the id of the duplicati windows it works perfectly fine:
 kdocker -w ...
but gives this error-message in the shell:
"sni-qt/12292" WARN 12:04:26.404 void StatusNotifierItemFactory::connectToSnw() Invalid interface to SNW_SERVICE

but I guess the windows id is nothing constant, so I wouldn't be able to use it on auto start....

John Schember (user-none) said : #4

> but I guess the windows id is nothing constant, so I wouldn't be able to use it on auto start....

It is not.

Have you tried using the -e option and setting the window title to use a regular expression? This was added in 4.8 (the current release) for this very situation. See https://launchpad.net/kdocker/+announcement/10393 This way you could do something like: ".* duplicati.*" So anything like version numbers or other things in the window title will be ignored. There are other pattern syntaxes supported by -e. It's actually using a QRegExp instead of trying to match a QString, so you have a lot of ways to do matching. Look at http://qt-project.org/doc/qt-4.8/qregexp.html .

Dahudi (robert-wiesen) said : #5

I tried kdocker 4.8.
(It took me 2 hours to learn how to compile it :) Would be nice, to know the dependencies on other packages, beforehand....)
But it didn't work using the -e option.
For me as a newbie it was very hard to find the pattern syntaxes supported by the -e option, reading the link you provided.
So I'm not sure if I used it right...
Nevertheless it seems to be a very nice option.

I spend another two hours to learn what is a bash-script :)
and found a workaround which is at least working for my case, but could maybe be adopted to others, just by
1.replacing "duplicati" with the program which should go to the system-tray.
2.And replacing "Duplicati 1.3.4 - Status" with the window-title of that program.

---------------------------------------------------------------------------
#!/bin/bash

#Start duplicati
#***************
duplicati & #start duplicati in background, so the script continues

sleep 4 #give the duplicati some time to start (in seconds).Adjust if it takes longer for your given program.

#Use xwininfo to gather infos about the window
#*********************************************
var1=`xwininfo -name "Duplicati 1.3.4 - Status"` #write all the infos gathered by "xwininfo -name "Duplicati 1.3.4 - Status"" in var1
#echo "$var1" #uncomment this line to read the content of var1

#Now we cut out only the windows-id from all that information
#************************************************************
var2=${var1##*Window id: } #everything left of the id will be thrown away
#echo "$var2" #uncomment this line to read the content of var2

var3=${var2%%\ \"Duplicati 1.3.4 - Status\"*} #everything right of the id will be thrown away
#echo "$var3" #uncomment this line to read the content of var3

#when this is done

#Start kdocker an tell it the id
#*******************************
kdocker -w $var3

-----------------------------------------------------------------------------------------------------------------------

You can see that the script could be written a lot more compact, but this way it's easier to understand what's happening.
So after all, I learned a lot and got a solution to my problem.
Thanks for all help.
Dahudi