| 1 |
# Written by: Maciej Delmanowski <[email protected]> |
| 2 |
|
| 3 |
# Overview |
| 4 |
# You can find here some functions designed to control and manupulate pages of |
| 5 |
# the desktop and move windows between pages. |
| 6 |
|
| 7 |
# How to use: |
| 8 |
# You can bind functions to a key, or mouse button, or to a panel button. |
| 9 |
# Usually you just need to use the name of selected function, if there are any |
| 10 |
# parameters, they are specified near this function definition (look down). |
| 11 |
|
| 12 |
# A list of functions: |
| 13 |
|
| 14 |
# GotoPage-[Left|Right|Up|Down] |
| 15 |
# ------------------------------ |
| 16 |
# These functions will move you one page in selected direction. Difference |
| 17 |
# between usual FVWM "GotoPage" function is that you cannot specify how much |
| 18 |
# pages you can go, it's always 1 page, and that you can go "around" your |
| 19 |
# desktop, ie. from Page 0 to the left, to the last page on your current |
| 20 |
# desktop. Functions are scalable, so you can make any desk you want, example |
| 21 |
# 12x5, and they should work. |
| 22 |
|
| 23 |
# MoveToPage-Focus |
| 24 |
# ----------------- |
| 25 |
# This is a small wrapper for the "MoveToPage" function. By default, |
| 26 |
# MoveToPage will move a window to the selected page, and leave it's focus |
| 27 |
# unchanged. This wrapper, after moving a window to selected page, will focus |
| 28 |
# next window on the current page. If on the current page there is no other |
| 29 |
# window, moved window stays focused. |
| 30 |
|
| 31 |
# MoveToPage-[Left|Right|Up|Down] |
| 32 |
# -------------------------------- |
| 33 |
# These functions will move currently focused window 1 page in the specified |
| 34 |
# direction, and focus next window on the current page. If there is no window |
| 35 |
# left on the current page, moved window will stay focused. |
| 36 |
|
| 37 |
|
| 38 |
DestroyFunc GotoPage-Left |
| 39 |
AddToFunc GotoPage-Left |
| 40 |
+ I PipeRead 'test $[page.nx] = 0 && echo "GotoPage `expr $[desk.pagesx] - 1` 0p" || echo "GotoPage -1p 0p"' |
| 41 |
|
| 42 |
DestroyFunc GotoPage-Right |
| 43 |
AddToFunc GotoPage-Right |
| 44 |
+ I PipeRead 'test $[page.nx] = `expr $[desk.pagesx] - 1` && echo "GotoPage 0 0p" || echo "GotoPage +1p 0p"' |
| 45 |
|
| 46 |
DestroyFunc GotoPage-Up |
| 47 |
AddToFunc GotoPage-Up |
| 48 |
+ I PipeRead 'test $[page.ny] = 0 && echo "GotoPage 0p `expr $[desk.pagesy] - 1`" || echo "GotoPage 0p -1p"' |
| 49 |
|
| 50 |
DestroyFunc GotoPage-Down |
| 51 |
AddToFunc GotoPage-Down |
| 52 |
+ I PipeRead 'test $[page.ny] = `expr $[desk.pagesy] - 1` && echo "GotoPage 0p 0" || echo "GotoPage 0p +1p"' |
| 53 |
|
| 54 |
|
| 55 |
# Usage: MoveToPage-Focus [x[p] y[p]] | [prev] |
| 56 |
# man FVWM, "MoveToPage" |
| 57 |
DestroyFunc MoveToPage-Focus |
| 58 |
AddToFunc MoveToPage-Focus |
| 59 |
+ I MoveToPage $* |
| 60 |
+ I Next (CurrentPage, AcceptsFocus, Visible) Focus |
| 61 |
|
| 62 |
|
| 63 |
DestroyFunc MoveToPage-Left |
| 64 |
AddToFunc MoveToPage-Left |
| 65 |
+ I PipeRead 'test $[page.nx] = 0 && echo "MoveToPage `expr $[desk.pagesx] - 1` 0p" || echo "MoveToPage -1p 0p"' |
| 66 |
+ I Next (CurrentPage, AcceptsFocus, Visible) Focus |
| 67 |
|
| 68 |
DestroyFunc MoveToPage-Right |
| 69 |
AddToFunc MoveToPage-Right |
| 70 |
+ I PipeRead 'test $[page.nx] = `expr $[desk.pagesx] - 1` && echo "MoveToPage 0 0p" || echo "MoveToPage +1p 0p"' |
| 71 |
+ I Next (CurrentPage, AcceptsFocus, Visible) Focus |
| 72 |
|
| 73 |
DestroyFunc MoveToPage-Up |
| 74 |
AddToFunc MoveToPage-Up |
| 75 |
+ I PipeRead 'test $[page.ny] = 0 && echo "MoveToPage 0p `expr $[desk.pagesy] - 1`" || echo "MoveToPage 0p -1p"' |
| 76 |
+ I Next (CurrentPage, AcceptsFocus, Visible) Focus |
| 77 |
|
| 78 |
DestroyFunc MoveToPage-Down |
| 79 |
AddToFunc MoveToPage-Down |
| 80 |
+ I PipeRead 'test $[page.ny] = `expr $[desk.pagesy] - 1` && echo "MoveToPage 0p 0" || echo "MoveToPage 0p +1p"' |
| 81 |
+ I Next (CurrentPage, AcceptsFocus, Visible) Focus |
| 82 |
|
| 83 |
|
| 84 |
# Usage: WarpToPage [x[p] y[p]] | [prev] |
| 85 |
# man FVWM, "MoveToPage", "GotoPage" |
| 86 |
DestroyFunc WarpToPage |
| 87 |
AddToFunc WarpToPage |
| 88 |
+ I MoveToPage $* |
| 89 |
+ I GotoPage $* |
| 90 |
|
| 91 |
|
| 92 |
DestroyFunc WarpToPage-Left |
| 93 |
AddToFunc WarpToPage-Left |
| 94 |
+ I PipeRead 'test $[page.nx] = 0 && echo "MoveToPage `expr $[desk.pagesx] - 1` 0p" || echo "MoveToPage -1p 0p"' |
| 95 |
+ I PipeRead 'test $[page.nx] = 0 && echo "GotoPage `expr $[desk.pagesx] - 1` 0p" || echo "GotoPage -1p 0p"' |
| 96 |
|
| 97 |
DestroyFunc WarpToPage-Right |
| 98 |
AddToFunc WarpToPage-Right |
| 99 |
+ I PipeRead 'test $[page.nx] = `expr $[desk.pagesx] - 1` && echo "MoveToPage 0 0p" || echo "MoveToPage +1p 0p"' |
| 100 |
+ I PipeRead 'test $[page.nx] = `expr $[desk.pagesx] - 1` && echo "GotoPage 0 0p" || echo "GotoPage +1p 0p"' |
| 101 |
|
| 102 |
DestroyFunc WarpToPage-Up |
| 103 |
AddToFunc WarpToPage-Up |
| 104 |
+ I PipeRead 'test $[page.ny] = 0 && echo "MoveToPage 0p `expr $[desk.pagesy] - 1`" || echo "MoveToPage 0p -1p"' |
| 105 |
+ I PipeRead 'test $[page.ny] = 0 && echo "GotoPage 0p `expr $[desk.pagesy] - 1`" || echo "GotoPage 0p -1p"' |
| 106 |
|
| 107 |
DestroyFunc WarpToPage-Down |
| 108 |
AddToFunc WarpToPage-Down |
| 109 |
+ I PipeRead 'test $[page.ny] = `expr $[desk.pagesy] - 1` && echo "MoveToPage 0p 0" || echo "MoveToPage 0p +1p"' |
| 110 |
+ I PipeRead 'test $[page.ny] = `expr $[desk.pagesy] - 1` && echo "GotoPage 0p 0" || echo "GotoPage 0p +1p"' |
| 111 |
|
| 112 |
# vim:ft=fvwm |