Resizing - revisited

Erm… I know there are quite a few ways to resize a window, but the one I’m after doesn’t involve a rodent. Also, I wouldn’t like any “interactivity”, I would just like to see it happend.
So, after some manualpage reading, I came up with:

AddToFunc FvwmResizeHorizontallyRight
+ I PipeRead "echo Resize $(($[desk.width] - $[w.width] + 3))p keep"
Key Right A M FvwmResizeHorizontallyRight

But I’d like to know if I’m trying to accomplish something Really Stupid ™ mathematically-wise?

No, that looks OK. What did you think you were over-complicating?

– Thomas Adam

Well, my goal was to largen the window in 3 pixel steps, but now it just largens a bit, and with next keypresses, it return to the size it was before the first press (and the counting of size is all wrong, I just realized ).
Don’t tell me there’s easier way? :open_mouth:

Ok, I don’t get it…

AddToFunc FvwmResizeHorizontallyLeft
+ I PipeRead "echo Resize $(($[w.width] - 3))p keep"

works, whereas

AddToFunc FvwmResizeHorizontallyRight
+ I PipeRead "echo Resize $(($[w.width] + 3))p keep"

doesn’t. A bug? In my head?

Got it working.

[code]AddToFunc FvwmResizeHorizontallyLeft

  • I PipeRead “echo Resize $(($[cw.width] - 15))p keep”

AddToFunc FvwmResizeHorizontallyRight

  • I PipeRead “echo Resize $(($[cw.width] + 15))p keep”

AddToFunc FvwmResizeVerticallyUp

  • I PipeRead “echo Resize keep $(($[cw.height] - 15))p”

AddToFunc FvwmResizeVerticallyDown

  • I PipeRead “echo Resize keep $(($[cw.height] + 15))p”
    [/code]
    I tried with $[w.height/width] … didn’t work. Also if ±15 is changed to 5, it doesn’t work. I really, really don’t understand this.
    :imp:

And here is the final version:

AddToFunc KeyboardResize
+ I PipeRead "case $0 in \
	Left) echo \"Resize $(($[cw.width] - \$1))p keep\" ;;\
	Right) echo \"Resize $(($[cw.width] + \$1))p keep\" ;;\
	Up) echo \"Resize keep $(($[cw.height] - \$1))p\" ;;\
	Down) echo \"Resize keep $(($[cw.height] + \$1))p\" ;;\
	*) echo Resize ;;\
	esac"

and you call it like this:

Key Left A M KeyboardResize Left 15

@morbusg

I had to register just to thank you for the function (works perfectly).
Its the second time i take something really usefull (at least for me)from you.

The other is the clipboard function (very practical),for things like.
Download (tarballs,isos,porno :slight_smile: not really etc …) to different folders.
Viewing a web picture with feh.
Setting (again with feh) a wallpaper direct from a web picture.
Editing with gimp an online image.
Listing Live Media with mplayer.
Opening a link with different browsers from Mutt,which i had to use urlview which was a PITA.
Opening a mailto with Mutt.
Paste the selecting text to vim.
Redirect output to different files and so on…

Sorry for posting something unrelated with the thread,but i had the need to thank him. :slight_smile:

Best regards.

If you use $[w.] instead of $[cw.] you won’t get any trouble as Resize command resizes windows, including border.

I’m happy you found it usefull :smiley:

Just for the record, that’s not my invention, I picked it up from somewhere.

I had borderwidth 0, but I’ll try it again with w.width. I guess the real problem was that the steps need to be more than x pixels.

I wonder if “(Opaque)MoveThreshold” could be applicable here… just a thought. But as to why $[w.height/width] doesn’t work is because it’s nonsensical.

$[foo]

just does literal variable interpolation. You cannot do any form of evaluating inside the brackets. This is why PipeRead comes in useful. :slight_smile:

– Thomas Adam

Yep, I know (as you can see from the code). I was just too lazy to write “$[w.height] and $[w.width]”. My point was I tried those AND $[cw.height] and $[cw.width]. :laughing:

I’ll try out the opaque thing, thanks.

$[cw.foo] are the right ones to use in this instance. But it won’t work for all applications, such as Xterms, where the applications use a value larger than 1 for a resize-hint (symptomatic of “ResizeHints”.)

The only other suggestion I can see is if you use:

PipeRead '... xwininfo -id $[w.id] -size ....'

and pass the geometry values in, in units of increment, but that would be slow.

– Thomas Adam

Eh? My function works fine (with xterms, too). I think you are mixing it with the resize xc yc, where c is the client supplied amount?

No, I must have misunderstood your last comment to mean you still had perculiarities with it. My mistake. sorry.

– Thomas Adam