Page 3 of 6 FirstFirst 12345 ... LastLast
Results 21 to 30 of 52

Thread: HOWTO: Make a launcher restore an open window (dock-like)

  1. #21
    Join Date
    Feb 2007
    Beans
    191

    Re: HOWTO: Make a launcher restore an open window (dock-like)

    Code:
    ['0x03600025', '0', 'gedit.Gedit', 'jon', 'launch-restore (/usr/local/bin) - gedit\n']
    * []
    Traceback (most recent call last):
      File "/usr/local/bin/launch-restore", line 257, in <module>
        Counts, IDData, DeskData, MinData, CurDesktop, CurWin, StackOrder = GetWinInfo(Match, MatchClass)
      File "/usr/local/bin/launch-restore", line 110, in GetWinInfo
        Hidden = '_NET_WM_STATE_HIDDEN' in os.popen('xprop -id %s | nawk \'/_NET_WM_STATE/ {print $0; exit;}\'' % Split[0]).readlines()[0]
    IndexError: list index out of range

    Also, Thunar isn't working with launch-restore. Using the script causes it to open a window (and multiple instances thereof). On a hunch I ran wmctrl -lx and I noticed the output for the Thunar window was this:

    Code:
    0x03800003  0 <unknown>.<unknown>   jon jon - File Manager
    Just running Thunar alone (via the terminal) wmctrl reports that window correctly (thunar.Thunar).

    Edit: I tried "tricking" it by using -n 'File Manager' and got this debug output:

    Code:
    ['0x03800003', '0', '<unknown>.<unknown>', 'jon', 'jon - File Manager\n']
    * []
    Traceback (most recent call last):
      File "/usr/local/bin/launch-restore", line 257, in <module>
        Counts, IDData, DeskData, MinData, CurDesktop, CurWin, StackOrder = GetWinInfo(Match, MatchClass)
      File "/usr/local/bin/launch-restore", line 110, in GetWinInfo
        Hidden = '_NET_WM_STATE_HIDDEN' in os.popen('xprop -id %s | nawk \'/_NET_WM_STATE/ {print $0; exit;}\'' % Split[0]).readlines()[0]
    IndexError: list index out of range
    Edit2: Tried Gaim for the heck of it (partially the reason I wanted to be able to handle multiple windows ) and got this output:

    Code:
    ['0x0180005a', '0', 'gaim.Gaim', 'jon', 'Buddy List\n']
    * ['_NET_WM_STATE(ATOM) = \n']
    ['0x0180ae99', '0', 'gaim.Gaim', 'jon', 'FreeFragSGS\n']
    * []
    Traceback (most recent call last):
      File "/usr/local/bin/launch-restore", line 257, in <module>
        Counts, IDData, DeskData, MinData, CurDesktop, CurWin, StackOrder = GetWinInfo(Match, MatchClass)
      File "/usr/local/bin/launch-restore", line 110, in GetWinInfo
        Hidden = '_NET_WM_STATE_HIDDEN' in os.popen('xprop -id %s | nawk \'/_NET_WM_STATE/ {print $0; exit;}\'' % Split[0]).readlines()[0]
    IndexError: list index out of range
    Last edited by Mblackwell; April 29th, 2007 at 05:03 AM.

  2. #22
    Join Date
    Dec 2006
    Beans
    678

    Re: HOWTO: Make a launcher restore an open window (dock-like)

    Your last round of output allows to clearly see why it's crashing for you, but I've no idea what the root cause, and can't reproduce it on my machine. I've posted another version that allows the test for a minimized window to fail without halting the script (but it does spit out a bit of debugging info). Hopefully this means that while I continue to sort this out, it will work, except that occasionally it will fail to recognize that a window has been minimized (which would prevent you from using the launcher to minimize alll, but it should still restore evertyhing). Please all give the new terminal output for the same set of programs (Thunar, Gaim, Gedit).

  3. #23
    Join Date
    Feb 2007
    Beans
    191

    Re: HOWTO: Make a launcher restore an open window (dock-like)

    interestingly Gaim now works fine, but Gnome-Terminal does not. It will work if an instance is already open but won't open a new one. It gives this debug output:

    Code:
    0x03600020
    ['0x00c00003 -1 gnome-panel.Gnome-panel  jon Bottom Centered Panel\n', '0x00c0002b -1 gnome-panel.Gnome-panel  jon Top Expanded Edge Panel\n', '0x00c00030 -1 gnome-panel.Gnome-panel  jon Bottom Centered Panel\n', '0x0140001f -1 desktop_window.Nautilus  jon Desktop\n', '0x019ba5c2  0 gaim.Gaim             jon FreeFragSGS\n', '0x0180005a  0 gaim.Gaim             jon Buddy List\n', '0x00c1d1e9  0 gnome-panel.Gnome-panel  jon Launcher Properties\n', '0x03400003  0 <unknown>.<unknown>   jon jon - File Manager\n', '0x03600020  0 gnome-terminal.Gnome-terminal  jon jon@jon: ~\n', '0x0380001e  0 gedit.Gedit           jon Unsaved Document 1 - gedit\n', '0x03a0006f  0 Gecko.Firefox-bin     jon HOWTO: Make a launcher restore an open window (dock-like) - Ubuntu Forums - Mozilla Firefox\n']
    ['0x00c00003 -1 gnome-panel.Gnome-panel  jon Bottom Centered Panel\n', '0x00c0002b -1 gnome-panel.Gnome-panel  jon Top Expanded Edge Panel\n', '0x00c00030 -1 gnome-panel.Gnome-panel  jon Bottom Centered Panel\n', '0x0140001f -1 desktop_window.Nautilus  jon Desktop\n', '0x019ba5c2  0 gaim.Gaim             jon FreeFragSGS\n', '0x0180005a  0 gaim.Gaim             jon Buddy List\n', '0x00c1d1e9  0 gnome-panel.Gnome-panel  jon Launcher Properties\n', '0x03400003  0 <unknown>.<unknown>   jon jon - File Manager\n', '0x03600020  0 gnome-terminal.Gnome-terminal  jon jon@jon: ~\n', '0x0380001e  0 gedit.Gedit           jon Unsaved Document 1 - gedit\n', '0x03a0006f  0 Gecko.Firefox-bin     jon HOWTO: Make a launcher restore an open window (dock-like) - Ubuntu Forums - Mozilla Firefox\n']
    ['_NET_ACTIVE_WINDOW(WINDOW): window id # 0x3600020\n']
    ['_NET_CLIENT_LIST_STACKING(WINDOW): window id # 0x140001f, 0x3400003, 0xc0002b, 0x3a0006f, 0x180005a, 0xc00003, 0xc1d1e9, 0x380001e, 0x19ba5c2, 0x3600020, 0xc00030\n']
    Somehow Thunar still gets classed as <unknown>.<unknown> when launched with launch-restore. Using the -n method I did before I was able to get this debug output:

    Code:
    0x03400003
    ['0x00c00003 -1 gnome-panel.Gnome-panel  jon Bottom Centered Panel\n', '0x00c0002b -1 gnome-panel.Gnome-panel  jon Top Expanded Edge Panel\n', '0x00c00030 -1 gnome-panel.Gnome-panel  jon Bottom Centered Panel\n', '0x0140001f -1 desktop_window.Nautilus  jon Desktop\n', '0x019ba5c2  0 gaim.Gaim             jon (*)[1] FreeFragSGS\n', '0x0180005a  0 gaim.Gaim             jon Buddy List\n', '0x0380001e  0 gedit.Gedit           jon Unsaved Document 1 - gedit\n', '0x03a0006f  0 Gecko.Firefox-bin     jon HOWTO: Make a launcher restore an open window (dock-like) - Page 3 - Ubuntu Forums - Mozilla Firefox\n', '0x03400003  0 <unknown>.<unknown>   jon jon - File Manager\n', '0x03600020  0 gnome-terminal.Gnome-terminal  jon jon@jon: ~\n', '0x01400255  0 nautilus.Nautilus     jon Trash - File Browser\n']
    ['0x00c00003 -1 gnome-panel.Gnome-panel  jon Bottom Centered Panel\n', '0x00c0002b -1 gnome-panel.Gnome-panel  jon Top Expanded Edge Panel\n', '0x00c00030 -1 gnome-panel.Gnome-panel  jon Bottom Centered Panel\n', '0x0140001f -1 desktop_window.Nautilus  jon Desktop\n', '0x019ba5c2  0 gaim.Gaim             jon (*)[1] FreeFragSGS\n', '0x0180005a  0 gaim.Gaim             jon Buddy List\n', '0x0380001e  0 gedit.Gedit           jon Unsaved Document 1 - gedit\n', '0x03a0006f  0 Gecko.Firefox-bin     jon HOWTO: Make a launcher restore an open window (dock-like) - Page 3 - Ubuntu Forums - Mozilla Firefox\n', '0x03400003  0 <unknown>.<unknown>   jon jon - File Manager\n', '0x03600020  0 gnome-terminal.Gnome-terminal  jon jon@jon: ~\n', '0x01400255  0 nautilus.Nautilus     jon Trash - File Browser\n']
    ['_NET_ACTIVE_WINDOW(WINDOW): window id # 0x3600020\n']
    ['_NET_CLIENT_LIST_STACKING(WINDOW): window id # 0x140001f, 0x1400255, 0x180005a, 0x19ba5c2, 0x380001e, 0x3400003, 0x3a0006f, 0x3600020, 0xc0002b, 0xc00003, 0xc00030\n']
    Gedit gives:

    Code:
    0x0380001e
    ['0x00c00003 -1 gnome-panel.Gnome-panel  jon Bottom Centered Panel\n', '0x00c0002b -1 gnome-panel.Gnome-panel  jon Top Expanded Edge Panel\n', '0x00c00030 -1 gnome-panel.Gnome-panel  jon Bottom Centered Panel\n', '0x0140001f -1 desktop_window.Nautilus  jon Desktop\n', '0x019ba5c2  0 gaim.Gaim             jon (*)[1] II Orblivion II\n', '0x0180005a  0 gaim.Gaim             jon Buddy List\n', '0x0380001e  0 gedit.Gedit           jon Unsaved Document 1 - gedit\n', '0x03a0006f  0 Gecko.Firefox-bin     jon HOWTO: Make a launcher restore an open window (dock-like) - Page 3 - Ubuntu Forums - Mozilla Firefox\n', '0x03400003  0 <unknown>.<unknown>   jon jon - File Manager\n', '0x03600020  0 gnome-terminal.Gnome-terminal  jon jon@jon: ~\n']
    ['0x00c00003 -1 gnome-panel.Gnome-panel  jon Bottom Centered Panel\n', '0x00c0002b -1 gnome-panel.Gnome-panel  jon Top Expanded Edge Panel\n', '0x00c00030 -1 gnome-panel.Gnome-panel  jon Bottom Centered Panel\n', '0x0140001f -1 desktop_window.Nautilus  jon Desktop\n', '0x019ba5c2  0 gaim.Gaim             jon (*)[1] II Orblivion II\n', '0x0180005a  0 gaim.Gaim             jon Buddy List\n', '0x0380001e  0 gedit.Gedit           jon Unsaved Document 1 - gedit\n', '0x03a0006f  0 Gecko.Firefox-bin     jon HOWTO: Make a launcher restore an open window (dock-like) - Page 3 - Ubuntu Forums - Mozilla Firefox\n', '0x03400003  0 <unknown>.<unknown>   jon jon - File Manager\n', '0x03600020  0 gnome-terminal.Gnome-terminal  jon jon@jon: ~\n']
    ['_NET_ACTIVE_WINDOW(WINDOW): window id # 0x3600020\n']
    ['_NET_CLIENT_LIST_STACKING(WINDOW): window id # 0x140001f, 0x180005a, 0x3400003, 0x19ba5c2, 0x3a0006f, 0x380001e, 0x3600020, 0xc0002b, 0xc00003, 0xc00030\n']

  4. #24
    Join Date
    Dec 2006
    Beans
    678

    Re: HOWTO: Make a launcher restore an open window (dock-like)

    Oddly, I WAS able to reproduce the gnome-terminal issue, but still not the others. The gnome-terminal problem is fixed and posted above (obviously you should ignore the temporary warning line); possibly the same cure solved some of the other problems. I now also have it spitting out a lot of information each run, so please pass on the output from anything that still isn't working as you expect. Hopefully it works, but if not I should be able to isolate the problem, as I've at least narrowed down the problem to a very small set of possibilities.

  5. #25
    Join Date
    Feb 2007
    Beans
    191

    Re: HOWTO: Make a launcher restore an open window (dock-like)

    The only one with an issue still that I noticed is Gedit, in that it won't minimize. Launching it gives this:

    Code:
    $ launch-restore Gedit gedit
    /usr/local/bin/launch-restore
    Gedit
    gedit
    0x04600003  0 thunar.Thunar         jon jon - File Manager
    0x0360006f  0 Gecko.Firefox-bin     jon HOWTO: Make a launcher restore an open window (dock-like) - Ubuntu Forums - Mozilla Firefox
    0x01200f1f -1 N/A                   jon N/A
    0x00c00003 -1 gnome-panel.Gnome-panel  jon Bottom Centered Panel
    0x00c0002b -1 gnome-panel.Gnome-panel  jon Top Expanded Edge Panel
    0x00c00030 -1 gnome-panel.Gnome-panel  jon Bottom Centered Panel
    0x0140001f -1 desktop_window.Nautilus  jon Desktop
    0x0180005a  0 gaim.Gaim             jon Buddy List
    0x019da032  0 gaim.Gaim             jon ReverendTerminX
    0x03c00003  0 totem.Totem           jon 10 Red Oyster Cult.m4a
    0x03400021  0 gnome-terminal.Gnome-terminal  jon jon@jon: ~
    and a second time:

    Code:
    $ launch-restore Gedit gedit
    0x0380001e
    _NET_WINDOW_DECOR(INTEGER) = 20061011, 14739549, 12, 6, 28, 6, 12, 6, 28, 6, 108, 0
    _NET_WM_ICON_GEOMETRY(CARDINAL) = 1157, 1177, 176, 23
    XKLAVIER_STATE(INTEGER) = 0, 0
    WM_STATE(WM_STATE):
    window state: Normal
    icon window: 0x0
    _NET_FRAME_EXTENTS(CARDINAL) = 12, 6, 28, 6
    _NET_FRAME_WINDOW(WINDOW): window id # 0x1201221
    _NET_WM_DESKTOP(CARDINAL) = 0
    WM_HINTS(WM_HINTS):
    Client accepts input or input focus: True
    Initial state is Normal State.
    bitmap id # to use for icon: 0x3800021
    bitmap id # of mask for icon: 0x3800028
    window id # of group leader: 0x3800001
    XdndAware(ATOM) = BITMAP
    _MOTIF_DRAG_RECEIVER_INFO(_MOTIF_DRAG_RECEIVER_INFO) = 0x6c, 0x0, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0
    _NET_WM_ICON(CARDINAL) = 22, 22, 0, 0, 0, 4291076096, 0, 4291076096, 0, 4291076096, 0, 4291076096
    _NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
    WM_WINDOW_ROLE(STRING) = "gedit-window-22694-1000-1-1177889461-0@jon"
    _NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_STICK, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_CHANGE_DESKTOP
    _NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 58720288
    WM_CLIENT_LEADER(WINDOW): window id # 0x3800001
    _NET_WM_PID(CARDINAL) = 22694
    WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
    WM_CLIENT_MACHINE(STRING) = "jon"
    WM_NORMAL_HINTS(WM_SIZE_HINTS):
    program specified minimum size: 352 by 201
    window gravity: Forget
    WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
    WM_CLASS(STRING) = "gedit", "Gedit"
    WM_ICON_NAME(STRING) = "Unsaved Document 1 - gedit"
    _NET_WM_ICON_NAME(UTF8_STRING) = 0x55, 0x6e, 0x73, 0x61, 0x76, 0x65, 0x64, 0x20, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x31, 0x20, 0x2d, 0x20, 0x67, 0x65, 0x64, 0x69, 0x74
    WM_NAME(STRING) = "Unsaved Document 1 - gedit"
    _NET_WM_NAME(UTF8_STRING) = 0x55, 0x6e, 0x73, 0x61, 0x76, 0x65, 0x64, 0x20, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x31, 0x20, 0x2d, 0x20, 0x67, 0x65, 0x64, 0x69, 0x74
    0x04600003  0 thunar.Thunar         jon jon - File Manager
    0x01200f1f -1 N/A                   jon N/A
    0x00c00003 -1 gnome-panel.Gnome-panel  jon Bottom Centered Panel
    0x00c0002b -1 gnome-panel.Gnome-panel  jon Top Expanded Edge Panel
    0x00c00030 -1 gnome-panel.Gnome-panel  jon Bottom Centered Panel
    0x0140001f -1 desktop_window.Nautilus  jon Desktop
    0x0180005a  0 gaim.Gaim             jon Buddy List
    0x019da032  0 gaim.Gaim             jon II Orblivion II
    0x03c00003  0 totem.Totem           jon 10 Red Oyster Cult.m4a
    0x03400021  0 gnome-terminal.Gnome-terminal  jon jon@jon: ~
    0x0380001e  0 gedit.Gedit           jon Unsaved Document 1 - gedit
    0x0360006f  0 Gecko.Firefox-bin     jon HOWTO: Make a launcher restore an open window (dock-like) - Page 3 - Ubuntu Forums - Mozilla Firefox

  6. #26
    Join Date
    Dec 2006
    Beans
    678

    Re: HOWTO: Make a launcher restore an open window (dock-like)

    I wish I could say I'd fixed that, but I'm entirely unable to make Gedit misbehave in any way. I've posted yet another version that should just output a single letter. Please tell me which letter is output (and when it did not act as you expect) for three situations: launching initially, restoring focus, and then "sleep 1; launch-restore Gedit gedit" where you use the 1 second delay to switch from the terminal to the Gedit window (so it should minimize). Then repeat the second and third with 3 additional scenarios:
    1) with -a option
    2) when terminal window is on desktop 2 and gedit is on desktop 1
    3) 1 & 2 together

  7. #27
    Join Date
    Feb 2007
    Beans
    191

    Re: HOWTO: Make a launcher restore an open window (dock-like)

    Well crap. Chalk it up to user error. At some point during restarts I lost the launch-restore call in my Gedit launcher/shortcut. Everything works as of now.

    Sorry to give you so much trouble. But at least there were some other bug fixes in the process .

  8. #28
    Join Date
    Aug 2006
    Beans
    33

    Re: HOWTO: Make a launcher restore an open window (dock-like)

    Hi,
    can someone post a screenshot or a video about this script?

    i'm curios about that...i would like a dock for metacity.

    thanks in advance

  9. #29
    Join Date
    Dec 2006
    Beans
    678

    Re: HOWTO: Make a launcher restore an open window (dock-like)

    Quote Originally Posted by Mblackwell View Post
    Well crap. Chalk it up to user error. At some point during restarts I lost the launch-restore call in my Gedit launcher/shortcut. Everything works as of now.

    Sorry to give you so much trouble. But at least there were some other bug fixes in the process .
    Not a problem - the exercise enabled me to find a couple of other subtle bugs while I was trying to figure out the Gedit issue. I think it's fairly stable now; the newest version is uploaded as a .deb to make installation easier.

  10. #30
    Join Date
    Dec 2006
    Beans
    678

    Re: HOWTO: Make a launcher restore an open window (dock-like)

    Quote Originally Posted by Freedreamer View Post
    Hi,
    can someone post a screenshot or a video about this script?

    i'm curios about that...i would like a dock for metacity.

    thanks in advance
    There's not really anything to show - the script itself is entirely invisible. You can arrange the panel/launchers however you want, and as long as the launcher command includes the necessary "launch-restore" bit, the launcher then also serves as a window managing icon. I personally use a mixture of 3 scenarios: launchers that use launch-restore & hide the program from the taskbar; launchers that use launch-restore but don't hide the window (generally text editors, etc. as I want to see multiple document names in the taskbar), and a few launchers I don't use launch-restore at all.

Page 3 of 6 FirstFirst 12345 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •