On 11846 March 1977, Julien Danjou wrote:

> First of all, let me recall something that pops up once in a while:
> a screen does _not_ have focus. Never. A client can haz it, but not a
> screen. :-)

Well. focus was just a description of "where the action ends up to be". :)

> Then, what's disturbing you is that by default, the keybindings are done
> like this:
>         awful.key({ modkey }, i,  
>                   function ()  
>                         local screen = mouse.screen 
>                         if tags[screen][i] then 
>                             awful.tag.viewonly(tags[screen][i]) 
>                         end 
>                   end), 
> where 'i' is a a tag number.
> It means that when you'll press modkey + 1, it will switch to the
> tag 1 of the screen the mouse is on (mouse.screen).

> You can avoid that by modifying the line
>     local screen = mouse.screen
> with
>     local screen
>     if client.focus then screen = client.focus.screen else screen = 
> mouse.screen end

> So, if a client has focus (client.focus ~= nil) then screen will be that
> client screen number, otherwise it will pick-up your action for the
> screen the mouse is on.

> There is various place with such code, because this has been the default
> behaviour for the last year.

That does work, great.

> And I hope I understand your problem well, otherwise let us know.

Yes you did. And having done the above change to my config I can say it
works. At least for all those where the keybinding actually includes the
screen.

Take the following ones as example:

   awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
   awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
   awful.key({ modkey,           }, "Escape", awful.tag.history.restore),
   awful.key({ modkey,           }, "w", function () mymainmenu:show(true)      
  end),

They still happen to do their action wherever the damn mouse is...
Guess I have to find out how to tell them to restrict themselve in the
same way as your example above. Hope thats possible.

[5 minutes later]

Ok, seems to be, at leasst for the first 3, by not using viewprev/next,
as they unfortunately take no argument. (Wishlist: Let them take a
screen number as an optional argument).

   awful.key({ modkey,           }, "Left", function ()
                                                                                
           local screen
                                                                                
           if client.focus then screen = client.focus.screen else screen = 
mouse.screen end
                                                                                
           awful.tag.viewidx(-1, screen)
                                                                                
        end),
   awful.key({ modkey,           }, "Right", function ()
                                                                                
                local screen
                                                                                
                if client.focus then screen = client.focus.screen else screen = 
mouse.screen end
                                                                                
                awful.tag.viewidx(1, screen)
                                                                                
         end),
   awful.key({ modkey,           }, "Escape", function ()
                                                                                
                local screen
                                                                                
                if client.focus then screen = client.focus.screen else screen = 
mouse.screen end
                                                                                
                awful.tag.history.restore(screen)
                                                                                
         end),

Dont know how to do the same with menus yet.


This is a little "unstable", as it switches "focus" as soon as you
encounter the first empty tag (as then it takes mouse.screen), but its
better than nothing, for now. Maybe there is a way to do it even nicer,
not switching "focus" when one encounters an empty tag.

-- 
bye, Joerg
<madduck> and yes, the ftpmasters are not the most clueful people

-- 
To unsubscribe, send mail to [email protected].

Reply via email to