Always Launch FileBot Centered on Desktop

All your suggestions, requests and ideas for future development
Post Reply
dokuro
Posts: 40
Joined: 01 Sep 2023, 18:45

Always Launch FileBot Centered on Desktop

Post by dokuro »

My environment is Fedora Linux 41 (Workstation Edition) x86_64 running GNOME 47.4 but I've seen this happen on windows and ubuntu also.

This is somewhat of a minor issue but is one which has been an annoyance so in the hope that something can be done to fix this I'm going to create this thread.

Steps to reproduce:
  • Start FileBot and resize the application to the size you want, centred on the desktop (not full screen screen)
  • Now close FileBot and open it again - the application will move down from the top of the screen by a few lines and is no longer centred
  • Now close FileBot again and open it again - the application will again move down some additional lines
  • If you keep opening and closing FileBot and the application will eventually move all the way down to the bottom of the desktop

Is there anything that could be done to help fix this issue? It almost appears that FileBot tried to centre the application based on the last time it was opened and then moves it down a few lines. BTW, this is the ONLY application that exhibits this behaviour. It also happens under X11 and Wayland.
User avatar
rednoah
The Source
Posts: 23915
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Always Launch FileBot Centered on Desktop

Post by rednoah »

The FileBot window will save its location / size on close and restore with those values. There's probably something funky going on with the window manager, either reporting the wrong numbers when saving the window bounds or not respecting the window bounds that FileBot wants to set. Either way, no idea. No one else seems to have reported anything like that.


:idea: You can check filebot -script fn:preferences to see the stored window location / size.
:idea: Please read the FAQ and How to Request Help.
dokuro
Posts: 40
Joined: 01 Sep 2023, 18:45

Re: Always Launch FileBot Centered on Desktop

Post by dokuro »

Thank you for your response. Below is the output from the FileNet preferences (I removed some file & folder paths).

Console Output: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE preferences SYSTEM "http://java.sun.com/dtd/preferences.dtd">
<preferences EXTERNAL_XML_VERSION="1.0">
  <root type="user">
    <map/>
    <node name="net">
      <map/>
      <node name="filebot">
        <map>
          <entry key="dialog.open.file" value=""/>
          <entry key="dialog.open.folder" value=""/>
          <entry key="getting.started" value="1"/>
        </map>
        <node name="login">
          <map/>
        </node>
        <node name="ui">
          <map>
            <entry key="dialog.open.file" value=""/>
            <entry key="dialog.open.folder" value=""/>
            <entry key="getting.started" value="1"/>
            <entry key="panel.selected" value="0"/>
            <entry key="window.position" value="{&quot;@type&quot;:&quot;Rectangle&quot;,&quot;x&quot;:1976,&quot;y&quot;:86,&quot;width&quot;:1808,&quot;height&quot;:906}"/>
            <entry key="window.state" value="0"/>
          </map>
          <node name="episodelist">
            <map>
              <entry key="engine.selected" value="0"/>
            </map>
            <node name="language.favorites">
              <map/>
            </node>
          </node>
          <node name="filter">
            <map/>
          </node>
          <node name="list">
            <map/>
          </node>
          <node name="rename">
            <map>
              <entry key="rename.episode.order" value="Airdate"/>
              <entry key="rename.format.episode" value="{n} ({y}) {&quot;{tmdb-$id}&quot;}/{regular ? 'Season ' + s.pad(2) : 'Specials'}/{n} - {s00e00} - {t}{subt}"/>
              <entry key="rename.format.mode" value="Episode"/>
              <entry key="rename.format.movie" value="{n}{&quot; {tmdb-$id}&quot;}/{n}{&quot; [$vf $vcf]&quot;}{subt}"/>
              <entry key="rename.language" value="en"/>
              <entry key="rename.match.mode" value="Opportunistic"/>
            </map>
            <node name="dialog.select.movie">
              <map>
                <entry key="window.position" value="{&quot;@type&quot;:&quot;Rectangle&quot;,&quot;x&quot;:2698,&quot;y&quot;:424,&quot;width&quot;:440,&quot;height&quot;:624}"/>
              </map>
            </node>
            <node name="dialog.select.series">
              <map>
                <entry key="window.position" value="{&quot;@type&quot;:&quot;Rectangle&quot;,&quot;x&quot;:2693,&quot;y&quot;:246,&quot;width&quot;:440,&quot;height&quot;:624}"/>
              </map>
            </node>
            <node name="format.recent.episode">
              <map>
                <entry key="0" value="{n} ({y}) {&quot;{tmdb-$id}&quot;}/{regular ? 'Season ' + s.pad(2) : 'Specials'}/{n} - {s00e00} - {t}{subt}"/>
                <entry key="1" value="{drive}/{n} ({y}) {&quot;{tmdb-$id}&quot;}/{regular ? 'Season ' + s.pad(2) : 'Specials'}/{n} - {s00e00} - {t}{subt}"/>
                <entry key="2" value="{n} ({y}) {&quot;{tvdb-$id}&quot;}/{regular ? 'Season ' + s.pad(2) : 'Specials'}/{n} - {s00e00} - {t}{subt}"/>
              </map>
            </node>
            <node name="format.recent.movie">
              <map>
                <entry key="0" value="{n}{&quot; {tmdb-$id}&quot;}/{n}{&quot; [$vf $vcf]&quot;}{subt}"/>
                <entry key="1" value="{drive}/{n}{&quot; {tmdb-$id}&quot;}/{n}{&quot; [$vf $vcf]&quot;}{subt}"/>
              </map>
            </node>
            <node name="presets">
              <map/>
            </node>
            <node name="rename.action.apply.scripts">
              <map/>
            </node>
            <node name="scripts">
              <map/>
            </node>
          </node>
          <node name="subtitle">
            <map/>
            <node name="language.favorites">
              <map/>
            </node>
          </node>
        </node>
      </node>
    </node>
  </root>
</preferences>
Done ヾ(@⌒ー⌒@)ノ
I can see windows position is being saved. Is there a way to tell FileBot not to save those values and just let the OS handle it ? Might be worth a try if its possible.
User avatar
rednoah
The Source
Posts: 23915
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Always Launch FileBot Centered on Desktop

Post by rednoah »

FileBot will restore the window at this location and this size:

Code: Select all

x: 1976
y: 86
width: 1808
height: 906

:?: Are these values correct? Does FileBot not restore at this size / location?


:idea: Unfortunately, there is no way to tell FileBot not not save / restore its window location. The current behaviour is known to work on Windows / Mac / Linux KDE / Linux Gnome / etc, at least on all the configurations I have tested with, so we're not inclined to make changes here. I don't know why it doesn't work for you in your specific configuration.


:idea: You could have a custom script rewrite the preferences after each filebot call to clear the saved size / location information.
:idea: Please read the FAQ and How to Request Help.
dokuro
Posts: 40
Joined: 01 Sep 2023, 18:45

Re: Always Launch FileBot Centered on Desktop

Post by dokuro »

Thanks, the custom script will likely work, I'll probably just do that or just live with this oddity.

BTW... I ran three tests, opening FileBot, closing and taking note of the window size/position and here are the results:

Console Output: Select all

<entry key="window.position" value="{&quot;@type&quot;:&quot;Rectangle&quot;,&quot;x&quot;:2097,&quot;y&quot;:247,&quot;width&quot;:1585,&quot;height&quot;:654}"/>
<entry key="window.position" value="{&quot;@type&quot;:&quot;Rectangle&quot;,&quot;x&quot;:2097,&quot;y&quot;:277,&quot;width&quot;:1585,&quot;height&quot;:654}"/>
<entry key="window.position" value="{&quot;@type&quot;:&quot;Rectangle&quot;,&quot;x&quot;:2097,&quot;y&quot;:307,&quot;width&quot;:1585,&quot;height&quot;:654}"/>
As you can see the Y position is the one that keeps changing (30 points), the others are kept. Again, no idea why this is happening and also why its only happening for FileBot. My environment is linux/gnome but maybe some extension is having an effect, I'll look into that and update here if I find something.

Anyhow, thanks for your comment and insights.
User avatar
rednoah
The Source
Posts: 23915
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Always Launch FileBot Centered on Desktop

Post by rednoah »

Thanks for running tests. That is peculiar indeed. FileBot definitely doesn't adjust the location. It'll simply set the window bounds on startup to what it says in the configuration file. Some something else downstream must then override those values, perhaps in the Java AWT layer, perhaps in the window manager layer, perhaps elsewhere, no clue. The 30px value sounds a bit like something might be adjusting window locations for the top menu bar.



:idea: You can use this command to clear that specific setting before / after running FileBot:

Shell: Select all

filebot -script 'g:UserData.main().remove("window.position")'
:idea: Please read the FAQ and How to Request Help.
dokuro
Posts: 40
Joined: 01 Sep 2023, 18:45

Re: Always Launch FileBot Centered on Desktop

Post by dokuro »

Additional Info:

I have installed vanilla fedora 41 in a VM, done a dnf upgrade after install, rebooted and then did nothing else but install FileBot. This shows the exact same behaviour I outlined above. I suspect this bug has been around for a long time (if not forever) as its always happened for me since I purchased FileBot many years ago. I guess its so minor no one either noticed it or bothered to report it.

Anyhow, as a workaround I done as you suggested and created a backup of prefs.xml with the settings I want to keep and I've added a restore of this backup to my workflow so that FileBot now always starts in the position I want.

I understand this is minor and as I'm the only one who reported it, I'm not expecting or requesting you open up this code to debug. However, if you ever feel you want to then please feel free to reach out to me and I'd be happy to debug and test if you ever want to. Thanks.
User avatar
rednoah
The Source
Posts: 23915
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Always Launch FileBot Centered on Desktop

Post by rednoah »

The problem is that we can't fix it for you without potentially breaking things for others. We either set the location or we do not set the location. We cannot just disable the "remember location" feature for all Linux users just to see what happens after the next update for all the Linux users on all the different desktop environments. We could certainly add an internal setting but you'd be the only one using it.



EDIT:

You could check if Gnome has any logs that would tell us what location FileBot requests. If FileBot requests the wrong location, we'll look into it. If FileBot requests the correct location but Gnome does something else instead, then it's a Gnome issue.
:idea: Please read the FAQ and How to Request Help.
dokuro
Posts: 40
Joined: 01 Sep 2023, 18:45

Re: Always Launch FileBot Centered on Desktop

Post by dokuro »

Let me share what I found. BTW... I'm a NOT developer but do have some good linux skills.

So, using xwininfo I can get the window information from an application. Within the FileBot config I've set ...

Code: Select all

<entry key="window.position" value="{&quot;@type&quot;:&quot;Rectangle&quot;,&quot;x&quot;:2005,&quot;y&quot;:110,&quot;width&quot;:1750,&quot;height&quot;:640}"/>
... which should set FileBot to using X: 2005 and Y: 110. Then using...

Code: Select all

xwininfo -id $(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')
and selecting the FileBot active window I get this information reported back on the window information ...

Console Output: Select all

xwininfo: Window id: 0x2c00007 "FileBot"
  Absolute upper-left X:  2005
  Absolute upper-left Y:  140
  Relative upper-left X:  30
  Relative upper-left Y:  54
  Width: 1750
  Height: 640
  Depth: 24
  Visual: 0x46
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x45 (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:  +2005+140  -2005+140  -2005-300  +2005-300
  -geometry 1750x640+1975+86
You can see that X=2005, however Y=140 (not 110) which corresponds to the +30px.

My guess then is that when FileBot exits, it then detects Y=140 and saves that. Then when it starts again for some reason FileBot starts with an additional 30px to Y which is why it keeps moving down on the Y axis. I'm not sure if FileBot is adding this somehow or Mutter (gnome windows manager). Is this at all helpful ?
User avatar
rednoah
The Source
Posts: 23915
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Always Launch FileBot Centered on Desktop

Post by rednoah »

FileBot is definitely calling setLocation() with 110 in this case. The Java AWT layer could possibly modify the value, however unlikely. The Window Manager layer could modify the value.


:?: Does the 30px happen to match some kind of 30px menu on the top of the screen? You could try different screen resolutions, different scale factors, different menu bar settings, etc, just to see if that makes a difference. That might give us a clue.


:idea: If xwininfo reports Y=140 then I would assume that FileBot is getting the same number when it stores the window location on exit. So it's definitely the setLocation() on startup that doesn't work.
:idea: Please read the FAQ and How to Request Help.
dokuro
Posts: 40
Joined: 01 Sep 2023, 18:45

Re: Always Launch FileBot Centered on Desktop

Post by dokuro »

Regarding the top menu, I had considered that but I tested using the extension dash-to-panel which removes the top menu altogether and it made no different. I hadn't considered different resolutions, I'll try that tomorrow as I need to step away from my PC this evening and let you know if it has any difference. Thanks again.
Post Reply