A console that goes up/down when we press ALT F12 (yakuake)

hello;
yakuake is cool, but we can make it in fvwm.
Has someone that coded already ?

thanks for the hint

Cheers to fvwm, that’s the best !

There are many alternatives. I use this:

[code]
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] 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.

Cool it works !

I changed bit the code to be closer to yakuake :

My question is :

how can I restore the focus like it was before toggle_kuake ?

well it starts in the middle o fthe screen and not on the top … well no idea why

well this is what i get :
img216.imageshack.us/img216/3397/probjl9.jpg

thanks !!

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

You are welcome.

I am not sure what do you mean. You can save the window id of the currently focused window on a variable like this:

SetEnv focused_window_id $[w.id]

Then you can focus the window with that id by doing this:

WindowId $[focused_window_id] Raise
WindowId $[focused_window_id] Focus

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.

I just edited the previous post with a screenshot;

well, … hmm

And in the code you posted, for you, is it not annoying that you loose the window focus when you toggle hide up the kuake ?

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.

ahhhh
that’s indeed why. you’ve got screenshot ? maybe nice ideas to build my fvwm conf …

Was nice weather today.

I am still fighting with that problem : img216.imageshack.us/img216/3397/probjl9.jpg
pff i guess it is when it starts

You can see some of my fvwm stuff on my web: jesgue.homelinux.org

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.

well now I got a bit better code, tiny:

I start :
mrxvt -name FvwmKuakeTerm -fg green -bg black -g 95x20+0+0

[code]DestroyFunc toggle_kuake
AddToFunc toggle_kuake

  • I All (!Overlapped, FvwmKuakeTerm) WindowShade W
  • I All (FvwmKuakeTerm) Raise
  • I All (FvwmKuakeTerm) Focus
    Key F10 A M toggle_kuake

[/code]

I would like now that mrxvt toggledd returns to previous windows focus
and appears not in the center of the screen

well… pf

it toggles down when I restart fvwm

it is not in the center and I did put +0+0
dont know why

this code is not working either,
… rather at all

[code]#########

Style GameConsole NoTitle, BorderWidth 0

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”

DestroyFunc SetWindowShadeTrue
AddToFunc SetWindowShadeTrue

  • I Test (EnvMatch OpenedTerm False) All (GameConsole) WindowShade True[/code]

I found this other code
which is not wokring

#########

Style GameConsole NoTitle, BorderWidth 0

DestroyFunc StartFunction
AddToFunc StartFunction
+ I Module FvwmButtons MenuButtons

DestroyModuleConfig MenuButtons: *
*MenuButtons: Rows 1
*MenuButtons: Columns 1
*MenuButtons: Back black
*MenuButtons: Geometry 50x50-2-2
*MenuButtons: (1x1, Panel(down, delay 0, steps 30, position root left 0 0) \\
    SubPanel "Module FvwmButtons SubPanel")


DestroyModuleConfig SubPanel: *
*SubPanel: Geometry 600x50
*SubPanel: Rows 1
*SubPanel: Columns 1
*SubPanel: (1x1, Swallow(UseOld,NoHints,Respawn) "coucou" `Exec exec mrxvt -name coucou`)


Key f12 A M press_fakebutton


DestroyFunc press_fakebutton
AddToFunc press_fakebutton
+ I SetEnv CURSOR_X $[pointer.x]
+ I SetEnv CURSOR_Y $[pointer.y]
+ I All [MenuButtons] WarpToWindow 25p 25p #middle of button
+ I FakeClick depth 0 press 1 wait 10 release 1
+ I WindowId root 1 WarpToWindow $[CURSOR_X]p $[CURSOR_Y]p


Key ampersand A MS ToggleTerminal
Key     F10      A   M   press_fakebutton

this one looks to be working better:

######################

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

I tried this to get teh focus back but not working::

[code]
######################

Style GameConsole notitle, sticky

DestroyFunc ToggleTerminal
AddToFunc ToggleTerminal
#+ I SetEnv OpenedTerm “False”

  • I SetEnv focused_window_id $[w.id]
  • 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 TestRc (NoMatch) WindowId $[focused_window_id] Raise
  • I TestRc (NoMatch) WindowId $[focused_window_id] Focus

DestroyFunc StartTerminal
AddToFunc StartTerminal

  • I Exec exec mrxvt -g 120x21+0+0 -name GameConsole
  • I Wait GameConsole
  • I All (GameConsole) Resize 101 keep
  • I SetEnv OpenedTerm “True”

Key F12 A M ToggleTerminal[/code]

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

Not working either :

######################

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 one, the focus works, but I cannot type in mrxvt !!

[code]
#####################

Style GameConsole notitle, sticky
Style FvwmKuakeDesktop notitle, sticky
Style kuakeDesktop notitle, sticky

-1 hidden, any other value means it is visible

SetEnv kuaked_pos -1

DestroyModuleConfig FvwmKuakeDesktop: *
*FvwmKuakeDesktop: Frame 0
*FvwmKuakeDesktop: Font $[ThemeFont]
*FvwmKuakeDesktop: Colorset 9
*FvwmKuakeDesktop: Rows 21
*FvwmKuakeDesktop: Columns 2
*FvwmKuakeDesktop: (2x20, Padding 3 0, Swallow (Respawn, UseOld, NoClose) ‘kuakeDesktop’ ‘Exec exec mrxvt -name kuakeDesktop’)

#*FvwmKuakeDesktop: (2x1, Padding 10 0, Icon terminal.png, ActiveIcon terminal_bright.png, PressIcon terminal_pressed.png, \

Title (Side,Left) “Quakeitor, by Johnny Valderrama’s Inc. ©”, Action (Mouse 1) toggle_kuakeDesktop)

#Piperead ‘echo SetEnv i $(($(($[vp.height] - $[bottom_margin]))/2))’
#Piperead ‘echo SetEnv j $(($[vp.width] - 2* $[small_margin]))’

Module FvwmButtons -g 1015x300+3000+0 FvwmKuakeDesktop

DestroyFunc toggle_kuakeDesktop
AddToFunc toggle_kuakeDesktop

  • I Test (EnvMatch kuaked_pos -1) All (FvwmKuakeDesktop) AnimatedMove +3p +3p
  • I Test (EnvMatch kuaked_pos -1) All (FvwmKuakeDesktop) Focus
  • I Test (EnvMatch kuaked_pos -1) All (FvwmKuakeDesktop) WarpToWindow 90 90
  • I Test (EnvMatch kuaked_pos 1) All (FvwmKuakeDesktop) AnimatedMove -3000p +3p
  • I Piperead ‘echo SetEnv kuaked_pos $((${kuaked_pos} * -1))’

Key F12 A A toggle_kuakeDesktop
Key F12 A M ToggleTerminal[/code]

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

No, it should go into the StartFunction.

– Thomas Adam