kiwix-desktop icon indicating copy to clipboard operation
kiwix-desktop copied to clipboard

Window size and position should be remembered

Open TheQuickFox opened this issue 2 years ago • 18 comments

Is it possible for Kiwix to remember my last used Window size and position? If yes, how do I achieve this? I'm using a portable installation.

TheQuickFox avatar Apr 23 '22 20:04 TheQuickFox

@TheQuickFox What is your version of Windows?

kelson42 avatar May 01 '22 13:05 kelson42

It seems to be quite forward to do https://doc.qt.io/qt-5/restoring-geometry.html

kelson42 avatar May 01 '22 13:05 kelson42

@TheQuickFox What is your version of Windows?

Windows 11 x64 [Version 10.0.22000.613] But as it is portable I also may use it on Windows 7 and Windows 10 computers.

TheQuickFox avatar May 01 '22 19:05 TheQuickFox

@TheQuickFox It seems Windows11 has a feature to do that, see https://gearupwindows.com/how-to-enable-or-disable-remember-window-locations-on-multiple-displays-in-windows-11/. For the right we might implement something.

@mgautierfr Do you have an opinion on this. To me it looks good, but I wonder to which extend we step on the foots of the window manager?

kelson42 avatar May 02 '22 05:05 kelson42

What about a .ini file in the Kiwix program folder that saves the window size and positions (for portable installations) or in the users appdata folder for permanent installs?

TheQuickFox avatar May 05 '22 23:05 TheQuickFox

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] avatar Aug 14 '22 01:08 stale[bot]

There is a way to set the windows size and position as parameters in the kiwix-desktop command. The command looks something like kiwix-desktop --qwindowgeometry 1400x930+120+60. For more detail, the command kiwix-desktop --help can be typed. It shows a graphical help message. The command kiwix-desktop just starts the desktop application with the default size and position (same as double-clicking to kiwix-desktop.exe). The command can be wrapped in a desktop shortcut. Honestly, I prefer to remember the size and position (preferably in users appdata). It's a small usability thing that makes kiwix-desktop more attractive to windows users. Especially, because the command trick is very unintuitive. The desktop shortcut wrapping is more for expert users.

FractalU avatar Aug 01 '23 21:08 FractalU

On Linux there is the same problem. I tested the appimage of kiwix-desktop 2.3.1 on my Pop!_OS 20.04 LTS. Actually, the size and position can be specified there as well as on Windows. The command ./kiwix-desktop_x86_64_2.3.1-2.appimage --qwindowgeometry 1400x930+120+60 does work on Linux. One this I noticed there however is that the --qwindowgeometry argument is not specified in the help message.

Here the help message on Linux.

Usage: ./kiwix-desktop_x86_64_2.3.1-2.appimage [options] zimfile
The Kiwix Desktop is a viewer/manager of ZIM files for GNU/Linux and Microsoft Windows OSes.

Options:
  -h, --help     Displays this help.
  -v, --version  Displays version information.

Arguments:
  zimfile        The zim file

I guess the --qwindowgeometry argument works because kiwix-desktop is a Qt based application. Also, there is no --help-all argument as opposed to on Windows to show the missing command line flags.

Here the help message on Windows for comparision.

Kiwix-Desktop-Help-Message

FractalU avatar Aug 06 '23 21:08 FractalU

Do you have an opinion on this. To me it looks good, but I wonder to which extend we step on the foots of the window manager

With wayland, it is impossible. It is considered that it is not the responsibility to the application to place its window(s) in the screen(s). Window Manager are better for that.

On Window, it should be possible. But I would say that the same objection about responsibility separation is valid, even on Windows. @FractalU Can you test with the option describe here : https://winaero.com/windows-11-enable-or-disable-remember-window-locations/

mgautierfr avatar Aug 07 '23 15:08 mgautierfr

@FractalU Can you test with the option describe here : https://winaero.com/windows-11-enable-or-disable-remember-window-locations/

@FractalU Any feedback here?

kelson42 avatar Aug 12 '23 08:08 kelson42

@kelson42 I'm still trying to set up windows 11 in a vm. Also, I'm testing kiwix-desktop on a linux distro using wayland to see how the remembering of window size and position works there.

FractalU avatar Aug 12 '23 09:08 FractalU

Do you have an opinion on this. To me it looks good, but I wonder to which extend we step on the foots of the window manager

With wayland, it is impossible. It is considered that it is not the responsibility to the application to place its window(s) in the screen(s). Window Manager are better for that.

On Window, it should be possible. But I would say that the same objection about responsibility separation is valid, even on Windows. @FractalU Can you test with the option describe here : https://winaero.com/windows-11-enable-or-disable-remember-window-locations/

IMO you should not rely on Windows to remember the application window sizes and positions. In Windows, this is usually the responsibility of the application. (I don't know about other operating systems because I'm a Windows user)

@FractalU Can you test with the option describe here : https://winaero.com/windows-11-enable-or-disable-remember-window-locations/

@FractalU Any feedback here?

That does not work. I got that setting on my default. Here you see me open Kiwix Desktop. Resize and move the window. Close it. Reopening it and it comes back in the default size and position.

In comparison I open the old Encarta encyclopedia. And it remembers it's window size and positions flawlessly.

Video recording: https://www.youtube.com/watch?v=SS2DhhfGvWw

TheQuickFox avatar Aug 12 '23 12:08 TheQuickFox

I finally got windows 11 up and running (was a total pain to set up). I confirm that Enable or Disable Remember Window Locations doesn't affect the size and position of kiwix-desktop. It has the same behavior on windows 11 as on 10 or 7. In short, it doesn't work.

Regarding wayland, I tried pureos because I know it uses wayland by default. It has the same behavior there as on pop_!os or windows.

I also tested kiwix-desktop on windows, pop_!os, pureos with --qwindowgeometry argument. It actually works on all those systems except that on pureos starting kiwix-desktop maximizes the window on certain values of the --qwindowgeometry argument and prints Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway. on the terminal.

If the --qwindowgeometry argument works then why not just do it automatically by remembering the size and position in a config file and getting those values from that file at application launch?

FractalU avatar Aug 15 '23 23:08 FractalU

How it behaves on linux when you set the env variable QT_QPA_PLATFORM=wayland ?

mgautierfr avatar Aug 21 '23 12:08 mgautierfr

I set QT_QPA_PLATFORM=wayland on pureos (the distro that uses wayland by default) and the kiwix-desktop couldn't start.

When running ./kiwix-desktop_x86_64_2.3.1-2.appimage --qwindowgeometry 1400x930+120+60, here is the error message in the terminal.

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

Aborted

With wayland, it is impossible. It is considered that it is not the responsibility to the application to place its window(s) in the screen(s). Window Manager are better for that.

@mgautierfr maybe you're right about wayland. It really might be impossible. I still don't know why --qwindowgeometry argument worked on pureos without QT_QPA_PLATFORM=wayland.

FractalU avatar Aug 21 '23 17:08 FractalU

I think it is not related. Does kiwix-desktop work with QT_QPA_PLATFORM=wayland and without --qwindowgeometry ?

It seems that your installed qt is without wayland support.

mgautierfr avatar Aug 21 '23 21:08 mgautierfr

It doesn't work either. The error message is exactly the same.

FractalU avatar Aug 21 '23 21:08 FractalU

Is going ahead and making a solution that uses the --qwindowgeometry logic with parameters for the position and dimensions, saved in a .ini file, a good solution or am I missing something that block that alternative?

sgourdas avatar Mar 20 '24 22:03 sgourdas