Focus running window with --tab

2011-07-17
2012-09-14
  • Tim Pequignot

    Tim Pequignot - 2011-07-17

    I like to make my launcher for ROXTerm open a new tab in the existing window,
    so I've added "--tab" to its arguments and it performs as it should in that
    aspect.

    The problem: If the window is minimized or behind another window when I launch
    it, It doesn't gain focus. I don't know if this should be the default
    behavior, but It should certainly be an option (if it isn't already. Maybe I'm
    just overlooking it).

    I've started looking at the code to see about implementing this, but I haven't
    gotten very far.

    I'm looking forward to hearing any tips, code, or even a script to help me
    figure this out

    A big THANKS to everyone that's made this project what it has become.

     
  • Tony Houghton

    Tony Houghton - 2011-07-17

    What window manager are you using? Some have "focus stealing prevention" so
    you might need to reconfigure your wm to fix this.

     
  • Tony Houghton

    Tony Houghton - 2011-07-17

    Also try this:

    diff --git a/src/multitab.c b/src/multitab.c
    index d271b75..90f0856 100644
    --- a/src/multitab.c
    +++ b/src/multitab.c
    @@ -2079,6 +2079,8 @@ static void multi_win_add_tab(MultiWin * win, MultiTab * t
         {
             multi_win_add_tab_to_notebook(win, tab, position);
             gtk_widget_show(tab->widget);
    +        if (win->ntabs > 1)
    +            gtk_window_present(GTK_WINDOW(win->gtkwin));
         }
         multi_win_shade_menus_for_tabs(win);
         multi_win_select_tab(win, tab);
    
     
  • Tim Pequignot

    Tim Pequignot - 2011-07-23

    I didn't subscribe to this and I was very impressed that the replies were the
    same day.

    The patch works great. Thanks! I couldn't figure out git-diff, so I just added
    the lines by hand and learned a lot in the process. Thank you on many levels.

    For the record I'm using Metacity-- Ubuntu 11.04 in 'Classic' Gnome mode. My
    window focus setting was set to its default, "smart" i believe.

    Is there any reason this wouldn't become a default setting?

     
  • Tony Houghton

    Tony Houghton - 2011-07-28

    Sorry about the delay, I've been on holiday. And sorry for not explaining that
    bit of code, I assumed that if you could build stuff from source you'd
    recognise it as a patch. The usual way to apply one is with the command:

    patch -p1 < patch_file_name
    

    I've made the same change to my master copy so future releases will raise the
    window, but --tab won't be the default because I think most people would
    expect a command to open a new window unless explicitly told otherwise.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks