diff options
author | Anton Khirnov <anton@khirnov.net> | 2014-01-20 18:34:41 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2014-01-20 18:34:41 +0100 |
commit | 71c61fa63f1782a343fd797d6848d29ab7472c69 (patch) | |
tree | 222295ee812130e3ef000f47c40ef0801652b752 | |
parent | 0a158488734ae043f466b64b01741d634ff883a8 (diff) |
Remember last page per desk.
-rw-r--r-- | bindings.config | 2 | ||||
-rw-r--r-- | functions.config | 21 | ||||
-rwxr-xr-x | scripts/calc_desk.py | 32 | ||||
-rwxr-xr-x | scripts/goto_desk_page.py | 27 |
4 files changed, 79 insertions, 3 deletions
diff --git a/bindings.config b/bindings.config index 3fce6c6..8881fe5 100644 --- a/bindings.config +++ b/bindings.config @@ -78,7 +78,7 @@ Key Right A 4 DeskNext Key L A 4 DeskNext # select a desktop with win+<f*> -Piperead 'for i in `seq 0 11`; do j=$(($i+1)); echo Key F$j A 4 GotoDesk 0 $i; done' +Piperead 'for i in `seq 0 11`; do j=$(($i+1)); echo Key F$j A 4 DeskGoto $i; done' # name desktops Key n A 4 FormDeskName diff --git a/functions.config b/functions.config index eb8194b..a1a7492 100644 --- a/functions.config +++ b/functions.config @@ -104,20 +104,37 @@ AddToFunc UpdateNumDesks + I InfoStoreAdd desk_max 0 + I NoWindow All (!StickyAcrossDesks) UpdateNumDesksForWindow +DestroyFunc UpdateCurDesk +AddToFunc UpdateCurDesk ++ I InfoStoreAdd last_page_$[desk.n] $[page.ny] + +DestroyFunc WrapperGotoPage +AddToFunc WrapperGotoPage ++ I PipeRead '$[FVWM_USERDIR]/scripts/goto_desk_page.py $0 $[infostore.last_page_$0] $[page.ny]' + DestroyFunc DeskNext AddToFunc DeskNext + I UpdateNumDesks -+ I GotoDesk 1 0 $[infostore.desk_min] $[infostore.desk_max] ++ I UpdateCurDesk ++ I PipeRead '$[FVWM_USERDIR]/scripts/calc_desk.py $[desk.n] inc $[infostore.desk_min] $[infostore.desk_max]' ++ I WrapperGotoPage $[infostore.target_desk] DestroyFunc DeskPrev AddToFunc DeskPrev + I UpdateNumDesks -+ I GotoDesk -1 0 $[infostore.desk_min] $[infostore.desk_max] ++ I UpdateCurDesk ++ I PipeRead '$[FVWM_USERDIR]/scripts/calc_desk.py $[desk.n] dec $[infostore.desk_min] $[infostore.desk_max]' ++ I WrapperGotoPage $[infostore.target_desk] DestroyFunc FormDeskName AddToFunc FormDeskName + I Module FvwmForm FormDeskName DESK=$[desk.n] +DestroyFunc DeskGoto +AddToFunc DeskGoto ++ I UpdateCurDesk ++ I WrapperGotoPage $0 + ############################ #Don't steal focus DestroyFunc UrgencyFunc diff --git a/scripts/calc_desk.py b/scripts/calc_desk.py new file mode 100755 index 0000000..06e1b71 --- /dev/null +++ b/scripts/calc_desk.py @@ -0,0 +1,32 @@ +#!/usr/bin/python + +import sys + + +def exit_usage(): + sys.stderr.write('Usage: %s <curdesk> <mode> <min> <max>\n' + % sys.argv[0]) + sys.exit(1) + +if len(sys.argv) < 5: + exit_usage() + +sys.stderr.write(str(sys.argv) + '\n') + +curdesk = int(sys.argv[1]) +mode = sys.argv[2] +min = int(sys.argv[3]) +max = int(sys.argv[4]) + +if mode == 'inc': + desk = curdesk + 1 +else: + desk = curdesk - 1 + +if desk > max: + desk = min +elif desk < min: + desk = max + +sys.stdout.write('InfoStoreAdd target_desk %d\n' % desk) +sys.exit(0) diff --git a/scripts/goto_desk_page.py b/scripts/goto_desk_page.py new file mode 100755 index 0000000..920635e --- /dev/null +++ b/scripts/goto_desk_page.py @@ -0,0 +1,27 @@ +#!/usr/bin/python + +# switch to desk and page + +import sys + + +def exit_usage(): + sys.stderr.write('Usage: %s <desknum> <pagenum> <curpage>' % sys.argv[0]) + sys.exit(1) + +if len(sys.argv) < 4: + exit_usage() + +sys.stderr.write(str(sys.argv) + '\n') + +desknum = int(sys.argv[1]) +pagenum = sys.argv[2] +curpage = int(sys.argv[3]) + +if pagenum[0] == '$': + page = int(curpage) +else: + page = int(pagenum) + +sys.stdout.write('GotoDeskAndPage %d 0 %d\n' % (desknum, page)) +sys.exit(0) |