1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
# FVWM-Crystal: Fullscreen
# Written by: Maciej Delmanowski <harnir@linux.net.pl>
# Modifications: Thomas Adam <thomas@edulinux.homeunix.org>
# Bug fixes, disappear and restart functions: Dominique Michel 2008-2013
# <dominique_libre@users.sourceforge.net>
#
# Fullscreen overview:
# After using this function, current window will lose it's border and title
# and will be maximized to the full screen (wow). After using Fullscreen
# function on a "full-screened" window it will return to it's previous size and
# position and border/title will be brought back.
#
# How to use:
# Bind "Fullscreen" command somewhere, example:
#
# Key KP_Multiply A $[Mod1] Fullscreen
#
# Disappear overview
# When using this function, Fvwm-Crystal will cycle through all the fullscreened
# windows and the workbench on the current page.
# To use it, bind "Disappear" command somewhere.
#
# Key KP_Multiply A $[Mod2] Disappear
#
# The other window size functions are into Window-Buttons.
#
# 'Fullscreen-Start' and 'Fullscreen-Stop' functions shouldn't be called
# directly, use 'Fullscreen' function instead.
# 'Disappear-On' and 'Disappear-Off' functions shouldn't be called
# directly, use 'Disappear' function instead.
#
# Know bugs, limitations:
# - some terminals and gvim does not scale corectly in full-screen. This is because
# they use characters instead of pixels to adjust their width.
# If you know how to fix this, please send me a mail:
# <dominique.michel@users.sourceforge.net>
InfoStoreAdd TmpDirectory "/tmp"
# Wrapper function {{{1
# State 19 = FS (fullscreen), State 20 = visible
DestroyFunc Fullscreen
AddToFunc Fullscreen
+ I ThisWindow (State 19, !FvwmButtons, !FvwmPager, !FvwmMiniConsoleNeedsUniqueName, !QuakeConsoleNeedsUniqueName, !FvwmIconMan, !MPlayer) Fullscreen-Stop
+ I TestRc (NoMatch) ThisWindow (!State 19, !FvwmButtons, !FvwmPager, !FvwmMiniConsoleNeedsUniqueName, !QuakeConsoleNeedsUniqueName, !FvwmIconMan, !MPlayer) Fullscreen-Start
# fullscreen {{{2
DestroyFunc Fullscreen-Start
AddToFunc Fullscreen-Start
+ I WindowStyle !Title, !Borders, !Handles, Iconifiable, ResizeHintOverride
+ I UpdateStyles
+ I WindowStyle State 19
+ I WindowStyle State 20
+ I Maximize ewmhiwa True 100 100
+ I WindowStyle !Maximizable, FixedSize, FixedPosition
+ I UpdateStyles
# We need 1 temporary file for restoring the window state after restart
+ I Exec exec touch $[infostore.TmpDirectory]/fullscreen.19.$[w.id].$[page.nx].$[page.ny].tmp
# quit fullscreen {{{2
DestroyFunc Fullscreen-Stop
AddToFunc Fullscreen-Stop
+ I WindowStyle Title, Borders, Handles, HandleWidth $[infostore.handle_width], Iconifiable, !ResizeHintOverride
+ I WindowStyle Maximizable, !FixedSize, !FixedPosition
+ I WindowStyle !State 19
+ I WindowStyle !State 20
+ I Test (f $[infostore.TmpDirectory]/fullscreen.19.$[w.id].$[page.nx].$[page.ny].tmp) Exec exec rm -f $[infostore.TmpDirectory]/fullscreen.19.$[w.id].$[page.nx].$[page.ny].tmp
+ I UpdateStyles
+ I NS-Default
# Wrapper function {{{1
DestroyFunc Disappear
AddToFunc Disappear
# if FS; then if !State20; then show; else hide all; fi
+ I PipeRead 'if [ "$(ls $[infostore.TmpDirectory]/fullscreen.19.0x???????.$[page.nx].$[page.ny].tmp 2>/dev/null)" != "" ]; then \
for i in $(ls $[infostore.TmpDirectory]/fullscreen.19.0x???????.$[page.nx].$[page.ny].tmp 2>/dev/null); \
do file=`echo "${i}"|sed -e \'s:fullscreen.19:fullscreen.20:\'`; \
if [ -e "${file}" ]; then echo "WindowId $(echo $file | cut -d . -f 3) Disappear-Off"; exit; \
fi; \
done; \
for i in $(ls $[infostore.TmpDirectory]/fullscreen.19.0x???????.$[page.nx].$[page.ny].tmp 2>/dev/null); \
do echo "WindowId $(echo $i | cut -d . -f 3) Disappear-On"; done; fi'
# disappear {{{2
# file tmp_dir/fuulscreen.20.* = hidden
DestroyFunc Disappear-On
AddToFunc Disappear-On
# Those 2 lines are needed if we want to cycle onto the windows original pages
+ I WarpToWindow $[pointer.x]p $[pointer.y]p
+ I Exec exec touch $[infostore.TmpDirectory]/fullscreen.20.$[w.id].$[page.nx].$[page.ny].tmp
+ I WindowStyle !State 20
+ I WindowStyle NoIcon
+ I UpdateStyles
+ I Iconify true
# appear {{{2
DestroyFunc Disappear-Off
AddToFunc Disappear-Off
+ I ThisWindow MoveToPage $[page.nx] 0
+ I Iconify false
+ I WindowStyle State 20
+ I WindowStyle Icon
+ I UpdateStyles
+ I Test (f $[infostore.TmpDirectory]/fullscreen.20.$[w.id].$[page.nx].$[page.ny].tmp) Exec exec rm -f $[infostore.TmpDirectory]/fullscreen.20.$[w.id].$[page.nx].$[page.ny].tmp
# Restore Fullscreen after restart {{{1
# Called by StartFunction
DestroyFunc Fullscreen-Recover
AddToFunc Fullscreen-Recover
+ I WindowStyle !Title, !Borders, !Handles, Iconifiable, ResizeHintOverride
+ I UpdateStyles
+ I WindowStyle State 19
+ I WindowStyle State 20
+ I Maximize ewmhiwa True 100 100
+ I WindowStyle !Maximizable, FixedSize
+ I UpdateStyles
DestroyFunc Disappear-Recover
AddToFunc Disappear-Recover
+ I WindowStyle !State 20
+ I WindowStyle NoIcon
+ I UpdateStyles
+ I Iconify true
DestroyFunc Disappear-Test
AddToFunc Disappear-Test
+ I Test (F $[infostore.TmpDirectory]/fullscreen.20.$[w.id].$[page.nx].$[page.ny].tmp) WindowId $[w.id] Disappear-Recover
# wrapper {{{2
DestroyFunc RecoverFullscreen
AddToFunc RecoverFullscreen
PipeRead 'for i in $[infostore.TmpDirectory]/fullscreen.19.*; do wid=`basename "$i" | awk --field-separator . \'{print $$3}\'`; echo "+ I WindowId ${wid} Fullscreen-Recover"; done'
PipeRead "for i in $[infostore.TmpDirectory]/fullscreen.20.*; do wid=`basename $i | awk --field-separator . '{print $$3}'`; echo \"+ I WindowId ${wid} Disappear-Recover\"; done"
AddToFunc StartFunction I Schedule 1000 RecoverFullscreen
AddToFunc ExitFunction I Test (!ToRestart) Exec rm -f $[infostore.TmpDirectory]/fullscreen.19.*
AddToFunc ExitFunction I Test (!ToRestart) Exec rm -f $[infostore.TmpDirectory]/fullscreen.20.*
AddToFunc ExitFunction I Test (Quit) Exec rm -f $[infostore.TmpDirectory]/fullscreen.*
# Be sure the temporary files are destroyed when a window is closed
DestroyFunc Window-Fullscreen-Destroy
AddToFunc Window-Fullscreen-Destroy
+ i PipeRead 'for file in /tmp/fullscreen.??.$[w.id].?.?.tmp; do rm $file 2>/dev/null; done'
DestroyModuleConfig FvwmEvent-Window-Fullscreen-Destroy: *
*FvwmEvent-Window-FullScreen-Destroy: destroy_window Window-Fullscreen-Destroy
Module FvwmEvent FvwmEvent-Window-Fullscreen-Destroy
# Rearrange in fullscreen
DestroyFunc Fullscreen-Rearrange
AddToFunc Fullscreen-Rearrange
+ I All (CurrentPage, !Iconic, !FvwmButtons, !FvwmPager, !FvwmConsoleNeedsUniqueName, !QuakeConsoleNeedsUniqueName, !FvwmIconMan, !MPlayer) Fullscreen
# vim:ft=fvwm
|