1 USING: kernel combinators sequences math math.functions math.vectors mortar
2 slot-accessors x x.widgets.wm.root x.widgets.wm.frame sequences.lib ;
5 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7 : up-till-frame ( window -- wm-frame )
8 { { [ dup <wm-frame> is? ]
10 { [ dup $dpy $default-root $id over $id = ]
13 [ <- parent up-till-frame ] } } cond ;
15 : pointer-window ( -- window ) dpy> <- pointer-window ;
17 : pointer-frame ( -- wm-frame )
18 pointer-window up-till-frame dup <wm-frame> is? [ ] [ drop f ] if ;
20 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
22 : maximize ( -- ) pointer-frame wm-frame-maximize drop ;
24 : minimize ( -- ) pointer-frame <- unmap drop ;
26 : maximize-vertical ( -- ) pointer-frame wm-frame-maximize-vertical drop ;
28 : restore ( -- ) pointer-frame <- restore-state drop ;
30 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
39 [ check-window-table ] map
44 wm-root> <- size { 1/2 1 } v*
45 [ floor ] map <-- resize
51 wm-root> <- width 2 / floor [ <-- set-width ] curry map
52 wm-root> <- height over length / floor [ <-- set-height ] curry map
54 wm-root> <- width 2 / floor [ <-- set-x ] curry map
56 wm-root> <- height over length / over length [ * floor ] map-with
57 [ <-- set-y <- adjust-child ] 2map
63 ! : tile-master ( -- )
67 ! [ <- mapped? ] filter
68 ! [ check-window-table ] map
71 ! { { [ dup empty? ] [ drop ] }
72 ! { [ dup length 1 = ] [ drop maximize ] }
73 ! { [ t ] [ tile-master* ] }