Author Topic: USBDM default window width in Linux  (Read 731 times)

0 Members and 1 Guest are viewing this topic.

Offline CirclotronTopic starter

  • Super Contributor
  • ***
  • Posts: 3180
  • Country: au
USBDM default window width in Linux
« on: September 25, 2022, 07:08:27 am »
When I use the stand alone programmer software for USBDM I have five instances of the software running, each with a different binary file loaded. Five instances takes up a lot of screen width so I have to manually resize the windows.

Is there an easy way in Linux to change the default width of these windows? Some file that holds all the startup parameters?
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3785
  • Country: de
Re: USBDM default window width in Linux
« Reply #1 on: September 25, 2022, 08:16:45 am »
No idea about USBDM software - that may have a setting somewhere in its config file specifying the window geometry. I doubt it, though - it would have likely been in the preferences already.

Concerning Linux - depends? There is no "the Linux" and you haven't said what you are using. Especially the window manager matters - that is where these things happen. So it is not possible to give you a more specific advice.

E.g. in KDE Plasma you can right click on the title bar, More Actions->Configure Special Window settings or More Actions->Configure Special Application settings and there you can set things such as forcing the size of the specific application/window. A well written application will work with that. Plasma will remember the setting and apply it every time it sees a window that matches whatever selector you have configured there (window ID, window title, application, etc.).

Other window managers often have similar features. Usually either accessible through the window title bar or sometime (usually with the various "lite" WMs) through configuration files.
 

Offline CirclotronTopic starter

  • Super Contributor
  • ***
  • Posts: 3180
  • Country: au
Re: USBDM default window width in Linux
« Reply #2 on: September 25, 2022, 08:19:27 am »
Okay. I'm using Mint Mate FWIW.
Right clicking the title bar doesn't provide a suitable option.
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3785
  • Country: de
Re: USBDM default window width in Linux
« Reply #3 on: September 25, 2022, 09:08:45 am »
Yeah, then you may be out of luck. Gnome (MATE is fork of Gnome 2) is not known for exactly providing features that the authors deem "unnecessary" for the users. You may want to try a different desktop environment, not sure what Mint ships with.

Another option is using something like wmctrl:

https://stackoverflow.com/questions/288512/resizing-a-window-to-a-set-size-in-linux#

That command may be available for installation using the package manager.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6260
  • Country: fi
    • My home page and email address
Re: USBDM default window width in Linux
« Reply #4 on: September 25, 2022, 09:54:14 am »
Is there an easy way in Linux to change the default width of these windows? Some file that holds all the startup parameters?
Usually the widget toolkit (Gtk, WxWidgets, Qt) supports command-line arguments to set the location and/or width and/or height of the window.
When they do not, you can write a launcher script that uses wmctrl to force the window dimensions and/or location.  You then modify menu entry for the application to run the launcher script instead of the application directly.
(In Cinnamon, the menu editor is accessible by right-clicking the application menu icon, and picking Configure.., and then on the Menu tab, clicking Open the menu editor.  Not sure about Mate.)

Even easier is to write a keyboard shortcut that resizes the currently active window.  In Cinnamon, the keyboard shortcuts are in Preferences > Keyboard, in the Shortcut tab.  Add a custom shortcut, giving it a descriptive name like "Resize to 512x384", with the command being
    wmctrl -r :ACTIVE: -e 0,-1,-1,512,384
Then, add a binding to it by double-clicking in the Keyboard bindings section, and pressing the desired key combination, for example Shift+F11.  It works immediately.

If the USBDM windows are the only ones with USBDM in their title (in upper or lower case), then
    wmctrl -r usbdm -e 0,-1,-1,512,-1
will resize each of them to 512 pixels wide (unless they are maximized).

The argument to wmctrl -e is gravity,left,top,width,height in desktop coordinates.

In a launch script, I usually use LANG=C LC_ALL=C wmctrl -lGp, so I can use the process ID in the third column (and find /proc/process ID/exe -maxdepth 0 -printf '%l' to identify the executable that created that window), and a temporary child process that waits until the parent process creates the new window, then resizes/moves it, and exits.  There is very little overhead, basically no latency, and no extra processes left over.
If anyone wants (and shows the wmctrl -lGp line identifying the target windows, with the related find /proc/third-column/exe -maxdepth 0 -printf '%l\n' output), I can easily write an example one you can easily edit yourself further.
 
The following users thanked this post: Ed.Kloonk, paf

Offline pgo

  • Regular Contributor
  • *
  • Posts: 69
  • Country: au
Re: USBDM default window width in Linux
« Reply #5 on: September 25, 2022, 01:57:19 pm »
The initial window size is is hard-coded.  There is no option to change this.
The dialogue is created using wxFormBuilder.  As a short-cut it is actually based on a dialog window so has some issues with resizing etc  i.e. it's not a standard  window.
You could change the values used by modifying the values in shared/src/UsbdmDialgueSkeleton.h @line 202.

If you routinely have 5 instances open and always program the same files? I would suggest you try another approach.  For example a shell script with a simple menu could run the programmer in console mode with different parameters and check the error code.  Launching the programmer in this way has little effect on the programming time.

bye
« Last Edit: September 25, 2022, 02:02:32 pm by pgo »
 
The following users thanked this post: Circlotron


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf