Hi,
I’ve just written Expo function and here is a code I you want to try it.
[code]DestroyFunc Expose
AddToFunc Expose
- I All (CurrentPage, !Iconic, !Sticky, !Shaded) PipeRead
‘echo “$[w.id] $[w.width] $[w.height] $[w.x] $[w.y]” >> $[FVWM_USERDIR]/.expose_temp’ - I TestRc (Match) PipeRead ‘$[FVWM_USERDIR]/scripts/expose.py expose $[FVWM_USERDIR]/.expose_temp’
- I NoWindow Pick DeExpose $[w.id]
DestroyFunc DeExpose
AddToFunc DeExpose
- I PipeRead ‘$[FVWM_USERDIR]/scripts/expose.py dexpose $[FVWM_USERDIR]/.expose_temp $0’
- I Test (F $[FVWM_USERDIR]/.expose_temp) Exec exec rm -f $[FVWM_USERDIR]/.expose_temp[/code]
And Python’s script for this:
[code]#!/use/bin/env python
author: Bartosz SKOWRON hack at bartskowron dot com
licence: GPL2
####################################
XXX set you screen resolution here
SCREEN_X = 1400
SCREEN_Y = 1050
WIDTH = 300
HEIGHT = 220
SPACE_X = 10
SPACE_Y = 20
START_X = SPACE_X
START_Y = 100
####################################
import sys
if len(sys.argv) < 3:
sys.stderr.write(‘Wrong arguments!\n’)
sys.exit(-1)
parsing file
fh = open(sys.argv[2])
win = {}
for line in fh.readlines():
line = line.split()
win[line[0]] = [ int(i) for i in line[1:] ]
fh.close()
if sys.argv[1] == ‘expose’:
x = START_X
y = START_Y
for w in win:
# resizing
print “WindowId %s Resize %dp %dp” % (w, WIDTH, HEIGHT)
# moving
if x + WIDTH + SPACE_X > SCREEN_X:
x = START_X
y += HEIGHT + SPACE_Y
print “WindowId %s Move %dp %dp” % (w, x, y)
x += WIDTH + SPACE_X
elif sys.argv[1] == ‘dexpose’:
for w in win:
print “WindowId %s ResizeMove %dp %dp %dp %dp” % (w, win[w][0], win[w][1], win[w][2], win[w][3])
print "WindowId %s Raise" % sys.argv[3]
print "WindowId %s Focus" % sys.argv[3][/code]
Ok, so this function works very well [1]. If you would like to have animation, use AnimatedMove istead Move.
It works, if I call it from FvwmConsole.
I bound this in this way:
Key E A 4 Expose
And it doesn’t work from my shortcut.
After pressing Win+E all lines in tempory file are reference only to focused window (number of entries in the file is number of windows on current page) and I get “picking pointer”. What is wrong? Why it works from FvwmConsole?
Another question is about removing temp file. I remove it in DeExpose function but better solution is to remove it at the beginning of Expose func.
+ I Test (F $[FVWM_USERDIR]/.expose_temp) Exec exec rm -f $[FVWM_USERDIR]/.expose_temp
I tried this, and it seems like it works parallely with next function.
So I tried something like:
PipeRead ' if [ -f $FVWM_USERDIR/.expose_temp ]; then rm -f $FVWM_USERDIR/.expose_temp; fi
But after this I should write && and next function…but next function is treating to All windows so I can’t do that and it’s confusing me.
[1] There should be some improvement if it goes about how to fit all windows on the screen. If there will be too many windows there is a problem. There should be checking of how many window we have to resize and then fix width and height of resizing windows. I don’t need it, cause I don’t use more than 4-5 windows per Page. If anyone need is, let me know, I will add 2-3 lines for this issue.