Re: Keybinding, lower window, focus next stacked window
Bob Hepple <[email protected]> Sun, 13 Apr 2014 19:30:04 +1000
| Newsgroups | gmane.comp.window-managers.fluxbox.user |
|---|---|
| Message-ID | <CAHzpm2hazaafWSJdjjt9CCFBnLdwPZSdU5bebDH=2nkYSm70aw@mail.gmail.com> |
On 25 November 2013 05:53, Pedro Martinez-Julia <[email protected]> wrote: > Hi, > > I'm trying to define a keybinding to lower a window and give focus to > the window that is just below it. For the moment I'm using ":MacroCmd > {Lower} {FocusUp}" but it does not do exactly what I want. If you know > how to achieve what I want, please let me know. Thank you. >From the 'better late than never' dept. - I think I have a solution to this little problem. It relies on the 'xdotool' utility (on fedora etc: 'yum install xdotool') In .fluxbox/keys: OnWindow Mod1 Mouse2 :MacroCmd {Lower} {ExecCommand focus-top} ... or whatever keystroke you like. I like Alt-Mouse1 to pop the window to the front and Alt-Mouse2 to pop it to the back. YMMV. Then in a file 'focus-top' somewhere on your path: #!/usr/bin/env bash # use xdotool to give focus to the topmost window containing the cursor: eval $( xdotool getmouselocation --shell ) X_CURSOR=$X Y_CURSOR=$Y HIT= # note that xdotool search displays the windows with the topmost window last: for WIN in $( xdotool search --desktop $( xdotool get_desktop) . ); do eval $( xdotool getwindowgeometry --shell $WIN ) (( X_CURSOR >= X && ( X_CURSOR <= X + WIDTH ) && Y_CURSOR >= Y && ( Y_CURSOR <= Y + HEIGHT) )) && HIT=$WIN done [[ "$HIT" ]] && xdotool windowfocus $HIT ... seems to work for me ... don't forget to 'chmod +x focus-top' Cheers Bob ------------------------------------------------------------------------------ Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test & Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees