I WindowStyle !Title, BorderWidth 0, HandleWidth 0,
Sticky, !Iconifiable, WindowListSkip
I UpdateStyles
I ThisWindow (!Maximized) Maximize true $[kuake_width] 100
I Piperead ‘echo SetEnv new_border_width $((($[vp.height]-$[cw.height]+1)/2))’
I WindowStyle BorderWidth $[new_border_width], HandleWidth $[new_border_width],
Sticky, !Iconifiable, WindowListSkip
I UnsetEnv new_border_width
DestroyFunc create_kuake
AddToFunc create_kuake
I Test (x screen) Exec $[terminal] -name FvwmKuakeTerm -title FvwmKuakeTerm -e screen -c $[screenrc] -D -RR
I Test (!x screen) Exec $[terminal] -name FvwmKuakeTerm -title FvwmKuakeTerm
I Wait FvwmKuakeTerm
I Next (FvwmKuakeTerm) fix_kuake_borders
I All (FvwmKuakeTerm) State 0 True[/code]
I like it on the left side of the screen. It should be trivial enough to change this to be on the top border if that is what you want. fix_kuake_borders change the borders width, so the window fill the whole height of the screen (since the geometry in urxvt and most terminals is calculated as multiples of the font size and such, and most times that means that the window will not fill the whole screen.
The borders are changed to fill that gap. If you use something like konsole, then you will not need the funciton to fix the borders, since konsole understands the standard pixel geometry.
To use this I just bind a key to it:
Key z A 4 toggle_kuake
I also have this on my ExitFunction:
DestroyFunc ExitFunction
AddToFunc ExitFunction
+ I All (FvwmKuakeTerm) Close
There are many alternatives for this, if you look around in the forums you might see alternative implementations for this functionality.
Style FvwmKuakeTerm BorderWidth 0, HandleWidth 0, NoTitle, Sticky
sentenv kuake_width 1024
sentenv kuake_height 40
Key F12 A M toggle_kuake
DestroyFunc toggle_kuake
AddToFunc toggle_kuake
+ I None (FvwmKuakeTerm) create_kuake
+ I All (FvwmKuakeTerm, CurrentPage, Overlapped, !State 0) Nop
+ I TestRc (Match) All (FvwmKuakeTerm) Focus
+ I TestRc (Match) All (FvwmKuakeTerm) Raise
+ I TestRc (Match) Break
+ I All (FvwmKuakeTerm, State 0) Move screen 0 +0p +0p
+ I TestRc (Match) All (FvwmKuakeTerm) Focus
+ I TestRc (Match) All (FvwmKuakeTerm) Raise
+ I TestRc (Match) All (FvwmKuakeTerm) State 0 False
+ I TestRc (Match) Break
+ I All (FvwmKuakeTerm) Move -$[vp.width]p +0p
+ I All (FvwmKuakeTerm) State 0 True
+ I UnSetEnv i
DestroyFunc fix_kuake_borders
AddToFunc fix_kuake_borders
+ I WindowStyle !Title, BorderWidth 0, HandleWidth 0, \
Sticky, !Iconifiable, WindowListSkip
+ I UpdateStyles
#+ I ThisWindow (!Maximized) Maximize true $[kuake_width] $[kuake_height]
+ I Piperead 'echo SetEnv new_border_width $((($[vp.height]-$[cw.height]+1)/2))'
+ I WindowStyle BorderWidth $[new_border_width], HandleWidth $[new_border_width], \
Sticky, !Iconifiable, WindowListSkip
+ I UnsetEnv new_border_width
DestroyFunc create_kuake
AddToFunc create_kuake
+ I Test (x screen) Exec mrxvt -name FvwmKuakeTerm -title FvwmKuakeTerm -g 1024x20+0+0
+ I Test (!x screen) Exec mrxvt -name FvwmKuakeTerm -title FvwmKuakeTerm -g 1024x20+0+0
+ I Wait FvwmKuakeTerm
+ I Next (FvwmKuakeTerm) fix_kuake_borders
+ I All (FvwmKuakeTerm) State 0 True
I don’t know if that is what you are asking for. If it is, then you can include this commands on the part of the toggle_kuake function that hides the window.
Well, as I use sloppyfocus, I never noticed any negative effect. Unless I issue a Focus command, the window under the mouse pointer will be focused automatically. And I usually have only one big window on each desktop page. But yes, it would be an undesiderable behavior, as you say.
Can you post your toggle_kuake, fix_kuake_borders and create_kuake if you modified them? I don’t use mrxvt but it should work the same that my urxvtc does.
######################
Style GameConsole notitle, sticky
DestroyFunc ToggleTerminal
AddToFunc ToggleTerminal
#+ I SetEnv OpenedTerm "False"
+ I None (GameConsole) StartTerminal
+ I Next (GameConsole) Focus
+ I Next (GameConsole) Raise
+ I Next (GameConsole, Shaded) WindowShade False
+ I TestRc (NoMatch) Next (GameConsole, !Shaded) WindowShade True
DestroyFunc StartTerminal
AddToFunc StartTerminal
+ I Exec exec mrxvt -g 144x25+0+0 -name GameConsole
+ I Wait GameConsole
+ I All (GameConsole) Resize 101 keep
+ I SetEnv OpenedTerm "True"
Key F12 A M ToggleTerminal
I now have to find a way to get teh focus back to the window
this was almost working : but the focus still do not appear back
######################
Style GameConsole notitle, sticky
#SetEnv focused_window_id $[w.id]
DestroyFunc ToggleTerminal
AddToFunc ToggleTerminal
#+ I SetEnv OpenedTerm "False"
+ I None (GameConsole) StartTerminal
+ I Next (GameConsole) Focus
+ I Next (GameConsole) Raise
+ I Next (GameConsole, Shaded) WindowShade False
+ I TestRc (NoMatch) Next (GameConsole, !Shaded) WindowShade True
+ I Next (GameConsole, !Shaded) WindowShade False
+ I SetEnv focused_window_id $[w.id]
+ I TestRc (NoMatch) WindowId $[focused_window_id] RaiseFocus
DestroyFunc RaiseFocus
AddToFunc RaiseFocus
+ I Raise
+ I Focus
DestroyFunc StartTerminal
AddToFunc StartTerminal
+ I Exec exec mrxvt -g 120x21+0+0 -name GameConsole -fg green -bg black
+ I Wait GameConsole
+ I All (GameConsole) Resize 101 keep
+ I SetEnv OpenedTerm "True"
Key F12 A M ToggleTerminal
Some progresses :
now it focus all teh time the previous window
i googled lot lot i would like that when the terminal is down, then , no focus of the prev. active window
pff i will never manage
######################
Style GameConsole notitle, sticky
#SetEnv focused_window_id $[w.id]
DestroyFunc ToggleTerminal
AddToFunc ToggleTerminal
+ I Thiswindow SetEnv focused_window_id $[w.id]
#+ I SetEnv OpenedTerm "False"
+ I None (GameConsole) StartTerminal
+ I Next (GameConsole) Focus
+ I Next (GameConsole) Raise
+ I Next (GameConsole, Shaded) WindowShade False
+ I TestRc (NoMatch) Next (GameConsole, !Shaded) WindowShade True
+ I Next (GameConsole, !Shaded) WindowShade False
+ I TestRc (NoMatch) Next (GameConsole, Shaded) WindowShade True
+ I Test (EnvMatch OpenedTerm False) All (GameConsole) WindowShade True
+ I TestRc (NoMatch) WindowId $[focused_window_id] RaiseFocus
DestroyFunc RaiseFocus
AddToFunc RaiseFocus
+ I Raise
+ I Focus
DestroyFunc StartTerminal
AddToFunc StartTerminal
+ I Exec exec mrxvt -g 120x21+0+0 -name GameConsole -fg green -bg black
+ I Wait GameConsole
+ I All (GameConsole) Resize 101 keep
+ I SetEnv OpenedTerm "True"
Key F12 A M ToggleTerminal
######################
Style GameConsole notitle, sticky
#SetEnv focused_window_id $[w.id]
SetEnv kuaked_pos -1
SetEnv frenchnoob -1
DestroyFunc ToggleTerminal
AddToFunc ToggleTerminal
+ I Thiswindow SetEnv focused_window_id $[w.id]
#+ I SetEnv OpenedTerm "False"
+ I None (GameConsole) StartTerminal
+ I Next (GameConsole) Focus
+ I Next (GameConsole) Raise
+ I Next (GameConsole, Shaded) Piperead 'echo SetEnv frenchnoob $(( -1 ))'
+ I Test (EnvMatch frenchnoob -1) WindowShade False
+ I TestRc (NoMatch) Piperead 'echo SetEnv frenchnoob $(( 1 ))'
+ I Test (EnvMatch frenchnoob 1) Next (GameConsole, !Shaded) WindowShade True
#+ I Next (GameConsole, !Shaded) WindowShade False
#+ I TestRc (NoMatch) Next (GameConsole, Shaded) WindowShade True
#+ I Test (EnvMatch OpenedTerm True) WindowId $[focused_window_id] RaiseFocus
#+ I Test (EnvMatch kuaked_pos -1) WindowId $[focused_window_id] Raisefocus
#+ I Test (EnvMatch frenchnoob 1) WindowId $[focused_window_id] Nop
+ I Test (EnvMatch frenchnoob -1) WindowId $[focused_window_id] Raisefocus
#+ I Piperead 'echo SetEnv frenchnoob $((${frenchnoob} * -1))'
DestroyFunc RaiseFocus
AddToFunc RaiseFocus
+ I Raise
+ I Focus
DestroyFunc StartTerminal
AddToFunc StartTerminal
+ I Exec exec mrxvt -g 120x21+0+0 -name GameConsole -fg green -bg black
+ I Wait GameConsole
+ I All (GameConsole) Resize 101 keep
+ I SetEnv OpenedTerm "True"
Key F12 A M ToggleTerminal
This is the code I wrote to popup (un)shade an aterm at the bottom of the screen and grabs focus on unshade and focuses the previous window on shade.
DestroyFunc toggle_term
AddToFunc toggle_term
+ I All (pterm,Shaded) unshade
+ I All (pterm,!Shaded) shade
DestroyFunc shade
AddToFunc shade
+ I All (pterm) WindowShade on
+ I Prev (CurrentPage) Focus
+ I Break 2
DestroyFunc unshade
AddToFunc unshade
+ I All (pterm) WindowShade off
+ I All (pterm) Focus
+ I Break 2
DestroyFunc pterm
AddToFunc pterm
+ I Exec aterm -name pterm -geometry +0-0 +sb -ls
Key t A M toggle_term
Style "pterm" Sticky, TittleAtBottom, !Title, !Borders
the pterm function should go into the InitFunction