Way for Bash to position apps. & bring to top?

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

Way for Bash to position apps. & bring to top?

#1 Post by sunburnt »

A GUI util. I wrote pops up ROX & an xmessage dialog with instructions, xmessage tends to cover up ROX,
Can I move ROX or the xmessage dialog with Bash to place it on the screen, or can their calls position them?

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#2 Post by MU »

Install this Dotpup, it has only 1 file:
/usr/local/bin/PB-movewindow

http://dotpups.de/dotpups/System_Utilit ... window.pup

Usage:
PB-movewindow -getpos "WindowTitle"
or
PB-movewindow -exactpos "WindowTitle"
or
PB-movewindow -move x y "WindowTitle"
or
PB-movewindow -moveactivate x y "WindowTitle"

Difference -getpos and -exactpos:
-getpos gets the position ignoring the window-decoration (Border and titleheight).
So I added -exactpos, which moves the window slightly to calculate the correct position, what causes a short slight "flickering".

Difference -move and -moveactivate:
-move just moves the window, but does not make it active.
-moveactivate moves it, iconifies it, restores it. So it becomes the active, focussed window.

Usage in shellscripts:

Code: Select all

#!/bin/sh

rxvt -title "abc" &

pos=`PB-movewindow -getpos "abc"`
echo $pos
Mark

User avatar
Nathan F
Posts: 1764
Joined: Wed 08 Jun 2005, 14:45
Location: Wadsworth, OH (occasionally home)
Contact:

#3 Post by Nathan F »

Ooohh, this is nice Mark. I was working on a way to do just this in a couple scripts, thank you.

Nathan
Bring on the locusts ...

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#4 Post by MU »

Puppybasic includes several such commands from Xlib.
If you look at the script in the Dotpup, you can for example replace xwin_move(...) with win_resize(...) to resize windows.

Like this you simply can create other tools to manipulate windows.
The implemented available commands are listed here:
http://noforum.de/wxBasicscript-documen ... t/xwin.htm

If you need something not listed there, I could add a new command to Puppybasic if you tell me, what you need.
A full set of Xlib-functions is listed here for example:
http://moonbase.wwc.edu/~davija/XLIB/top.html

Almost every attribute listed there could be added as a new function to Puppybasic similar to the existing ones.

Mark

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#5 Post by sunburnt »

Thanks MU... gee, I just knew it'd be you providing an answer to this post.

Wow... that makes PuppyBasic very extensible in the relm of GUI manipulation.
I'll have to take another more serious look at it to see what the capabilities could be.
If it can be made to mimic VB's "(command).(property) = $value" syntax, it'd open up it's usability for GUI apps.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#6 Post by MU »

If it can be made to mimic VB's "(command).(property) = $value" syntax, it'd open up it's usability for GUI apps.
No, it won't.
Puppybasic is not object-oriented concerning Guis, as it just provides wrappers to other C-libraries.

The full wxBasic supports more visual-basic style syntax, but I did not compile the latest version yet.
http://wxbasic.sourceforge.net/phpBB2/v ... .php?t=969
But this just applies to the C++ based wxWidgets-bindings (a wrapper to Gtk in Linux, to the win32-Api in Windows, to Carbon in MacOSX), that were removed in Puppybasic to reduce the size from 6 MB to 150 kb.

Puppybasic just can handle additional commands via functions passing parameters:

returncodelist = functionxyz( option1 , option2)
example:

Code: Select all

values = xwin_screensize()
sizex = values[0]
sizey = values[1]
This syntax is based on the way, how Puppybasic handles variables.
It internally does not use C-like *char or int, instead it uses it's own datatype wxVariant.
To be able to integrate external C-functions like xlib, I added some commands to convert these types.

This conversion was kind of complicated to achieve, the easiest way to add new functions I finally found out was this scheme of a function returning a list.

Using element.property.value = ... would need a much more complex construction, making it less easy to add a wrapper for other C based libraries.

Mark

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#7 Post by sunburnt »

MU; I think I understand what your saying about trying to build a syntax that would do OOP for wxBasic.

Using the VB syntax for controlling data or control (GUI) properties doesn't have to mean an OOP approach.
Really it's just nothing more than a synatical expression, a rearrangement of the command words.
An interpereter interface (a converter) is all that should be needed to change the syntax of any language.
Rearranging the syntax isn't going to make it do anything more than what it already does now.

I had a type of basic a while back that converted to C code that then used a std. C compiler.
This is somewhat different than what I'm talking about, but in the same vein.

Thanks again MU, I'm trying to finish all the LanPup GUI utils., & all of this sure helps!

Post Reply