WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Resizer extension submitted  (Read 4926 times)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11703
Resizer extension submitted
« on: July 08, 2021, 05:27:29 PM »
I recently read about a forum member who wanted to wanted to control an applications
size while running under X without a window manager (emphasis mine):
... But there is a strange problem, the applications don't start in full screen and I can't enlarge them because there is only X (no control over windows). If I press f11 as in the case of firefox the application does not expand to occupy the whole screen, but I can wander with the mouse in all regions of the screen.
Would anyone know how to do this? ...

It seemed like an interesting problem which probably also has an existing solution, but I decided to see what I could
come up with anyway.

Resizer.tcz is 4K (64 bit is 8K) in size. Its only dependency is libX11 which likely is already installed if you are
running X. This is the built in usage message:
Code: [Select]
tc@box:~$ ./Resizer

Resizer version 0.10 Jul  8 2021 10:24:33
Copyright Richard A. Rost July 2,2021

Resizer starts a program and then resizes and moves its
window based on the options passed in.

Usage: Resizer -p "program args" [-x N] [-y N] [-w N] [-h N] [-d N] [-b]

        -p program plus arguments in quotes.
        -x X position.
        -y Y position.
        -w Width.
        -h Height.
        -d Delay N seconds, then move/resize window.
        -b No window manager present.

        Notes
        Use -d when:
                A program puts up a splash dialog before its window.
                A program displays its window and later moves it.

        Your screen size is 1920 x 1080.

tc@box:~$

The .info file has more details. Please read it if you want to try Resizer:
http://tinycorelinux.net/12.x/x86/tcz/Resizer.tcz.info

I'm currently using Resizer to setup the desktop on one of my machines when it starts up. It launches apps and
places them where I want them using the attached script. It takes literally 2 seconds from claws-mail to geany
to load and place everything.

If someone wants to test It (I'm looking at you vinnie ;D), it should work without a window manager by including
the -b option.

It is currently in the TC 12 repo (32 and 64 bit) but should work under all versions of Tinycore.

Offline vinnie

  • Hero Member
  • *****
  • Posts: 1187
  • HandMace informatic works
Re: Resizer extension submitted
« Reply #1 on: July 08, 2021, 08:02:57 PM »
Beautiful, Thanks Rich, in these days I'll see to try it.
The attached InitDesktop file is an example of script to run (or insert in xsession?) to have a kind of tilling only with xorg?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11703
Re: Resizer extension submitted
« Reply #2 on: July 08, 2021, 08:17:04 PM »
Hi vinnie
I have a file called  ~/.X.d/Desktop  that contains the line  InitDesktop &.  ~/.X.d/Desktop  gets run at the end of .xsession
as do all files in  ~/.X.d.  I have  InitDesktop  in  ~/.local/bin.  And yes, it is an example of how Resizer can be used.

Offline vinnie

  • Hero Member
  • *****
  • Posts: 1187
  • HandMace informatic works
Re: Resizer extension submitted
« Reply #3 on: July 08, 2021, 08:39:15 PM »
Ok thanks for the further explanation. Now i'm a bit tired but in the next days I will try. I get ready to spare the 5mb of ratpoison too  ;D lol

« Last Edit: July 08, 2021, 08:47:28 PM by vinnie »

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: Resizer extension submitted
« Reply #4 on: July 09, 2021, 01:54:02 AM »
Hi Rich

Thank You, very interesting and surprising approach to window management design. Sorry for my 2 cents, maybe I am wrong, but I think it will be more convenient for TinyCore users if You will add "window manager wm" tags to the .info file.

Best regards!

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11703
Re: Resizer extension submitted
« Reply #5 on: July 09, 2021, 09:24:11 AM »
Hi jazzbiker
I wasn't certain whether it would be appropriate to include window manager tags since this isn't a window manager in
the traditional sense. I'd be interested in hearing other opinions on this.

Since I only tested this under flwm_topside, testing by anyone running other window managers would be welcome.
Since window managers don't like to load applications on top of each other, a simple test would be to use the same
command to load an application twice, something like this:
Code: [Select]
tce-load -wi Resizer
Resizer -p "editor" -x 200 -y 100 -w 800 -h 600
Resizer -p "editor" -x 200 -y 100 -w 800 -h 600
You should get 2 identically sized copies of editor, one exactly on top of the other.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11703
Re: Resizer extension submitted
« Reply #6 on: July 11, 2021, 01:50:38 AM »
I realized I left out 2 important options:
1. The original issue vinnie was interested in was forcing a program to start fullscreen.  -f  option added.
2. Since Resizer takes position/size arguments, retrieving that data from windows would be useful.  -D  option added.

The  -D  option displays its data on a single line that is continuously updated.
As you move the mouse across the desktop, it displays and updates the the XY coordinates of the pointer:
Code: [Select]
Mouse:X=1073  Y=705   When the pointer is over a window, that windows ID and geometry are also displayed:
Code: [Select]
Mouse:X=1414  Y=727   Window: ID=0040000c  X=1254  Y=631   W=667   H=420   Ctrl-C exits display mode.

The built in usage message has been re-factored to better fit on one screen in a terminal:
Code: [Select]
Resizer version 0.20 Jul 11 2021 00:52:22
Copyright Richard A. Rost July 2,2021

Resizer starts a program and then resizes and moves its
window based on the options passed in.

Usage:

  Resizer -p "program args" [-x N] [-y N] [-w N] [-h N] [-f] [-d N] [-b] [-D]

        -p program plus arguments in quotes
        -x X position  -y Y position  -w Width  -h Height
        -f Fullscreen
        -d Delay N seconds, then move/resize window
        -b No window manager present
        -D Display ID and geometry of window under mouse, ^C exits

        Use -d when a program:
                Puts up a splash dialog before its window
                Displays its window and later moves it

        Your screen size is 1920 x 1080

tc@E310:~/C_Programs/Resizer$

TC12 x86 and x86_64 repos updated with version 0.20 of Resizer.

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: Resizer extension submitted
« Reply #7 on: July 11, 2021, 02:37:38 PM »
Hi Rich,

Didn't You tried to build Resizer with "-fno-asynchronous-unwind-tables"?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11703
Re: Resizer extension submitted
« Reply #8 on: July 11, 2021, 04:38:52 PM »
Hi jazzbiker
Neither  -fno-asynchronous-unwind-tables  and/or  -fno-unwind-tables  make any difference.

That is probably because I wrote my program in C and this note from the GCC site:
Quote
-fexceptions
    Enable exception handling. Generates extra code needed to propagate exceptions. For some targets, this implies GCC will generate frame unwind information for all functions, which can produce significant data size overhead, although it does not affect execution. If you do not specify this option, GCC will enable it by default for languages like C++ which normally require exception handling, and disable it for languages like C that do not normally require it. However, you may need to enable this option when compiling C code that needs to interoperate properly with exception handlers written in C++. You may also wish to disable this option if you are compiling older C++ programs that don't use exception handling.

Although the  .info  file does not show it,  CXXFLAGS  also gets set in my compile scripts:
Quote
CXXFLAGS=-flto -fuse-linker-plugin -march=i486 -mtune=i686 -Os -g -pipe -Wall -Wextra -fno-exceptions -fno-rtti

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: Resizer extension submitted
« Reply #9 on: July 11, 2021, 05:22:57 PM »
Hi Rich,

Today when I found that new incredible TC12 rootfs crafted by Juanito is working well on my ancient laptop, I compiled some pure C programs on it. And found them grown compared to themselves under TC10. Then I recompiled them with "-fno-asynchronous-unwind-tables" and they shrank obviously, one of them from 19K to 16K. Now I tried "-fno-exceptions" instead of "-fno-asynchronous-unwind-tables" but programs grew back. If You remember when You proposed this option I was testing vis editor, which is pure C too. Maybe gcc linker (I guess it is linker who implants this unwind tables?) behavior is influenced by dependencies? Both vis and my little program has ncursesw as the dependency. Maybe ncurses are written in C++?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11703
Re: Resizer extension submitted
« Reply #10 on: July 11, 2021, 11:24:19 PM »
Hi jazzbiker
Code: [Select]
CFLAGS=-flto -fuse-linker-plugin -march=i486 -mtune=i686 -Os -g  -pipe -Wall -Wextra -fno-plt
LDFLAGS=-Wl,-T/usr/local/lib/ldscripts/elf_i386.xbn
The linker script also makes a difference, as I wrote about here:
http://forum.tinycorelinux.net/index.php/topic,23623.0.html

Then compile like this:
Code: [Select]
gcc $CFLAGS Program.c -o Program $LDFLAGSor for  ncursesw  like this:
Code: [Select]
gcc $CFLAGS -c Program.c
gcc $LDFLAGS -I. -L. Program.o -o Program -lncursesw

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: Resizer extension submitted
« Reply #11 on: July 12, 2021, 01:33:23 AM »
Hi Rich,

Yes I tried to compile exactly with all the options You describe in Resizer.tcz.info. And appending "-fno-asynchronous-unwind-tables" to CFLAGS still significantly reduces binary size. By the way, these unwind tables are provided during compilation, I tried to link binary with tcc, and their presence or absence still affect the binary size.
Thank You for advices, as "-fno-...-tables" option doesn't affect Resizer then my question is answered.