linux-window-session-manager icon indicating copy to clipboard operation
linux-window-session-manager copied to clipboard

Not a single app got restored to its originall position

Open emsi opened this issue 4 years ago • 7 comments

:ghost: Brief Description

I installed lwsm it on Ubuntu 16.04. I saved and restored my session and not even single window was restored in proper position.

:tophat: My workflow configuration

Two monitors. Left one horizontal 1920x1080, right one (vertical flip!) 1200x1920. [Total resolution of 3120x3010] 16 workspaces (two monitors each) in 4x4 fashion:

| 1| 2| 3| 4|
| 5| 6| 7| 8|
| 9|10|11|12|
|13|14|15|16|

Steps To Reproduce

Steps to reproduce the behavior:

  1. Use Ubuntu 16.04 default Unity wm.
  2. Start at least 5 Firefox windows. One of the first monitor on very first (top left corner), second on the right monitor on first window, similarly second and forth Firefox window on 3rd workspace to the right and fifth on the 4th wokspace left monitor.
  3. on the second workspace to the left start terminal
  4. start a bunch of other apps on other workspaces and monitors.
  5. on the terminal on the second workspace run lwsm save
  6. close all apps or relogin
  7. start terminal on second workspace left monitor and run: lwsm restore
  8. observe windows opening on random workspaces and windows without any relation to original layout whatsoever
  9. observe at least 5 additional empty Firefox windows opened lurking somewhere beneath terminal and Firefox windows (or some on plain sight).

Additional note: while restoring I got messages like: Status: "Navigator.Firefox" is running: false 5 0

:police_car: Expected behavior

I'd expect roughly the same window layout. At least windows placed on the same workspace.

:heavy_plus_sign: Additional context

My saved session file. At a glance it seems that resolution is not right....

{
  "name": "DEFAULT",
  "displaysCombinations": [
    {
      "id": "3120x1920",
      "windowList": [
        {
          "windowId": "0x360000a",
          "windowIdDec": 56623114,
          "wmCurrentDesktopNr": 0,
          "states": [
            "_NET_WM_STATE_MAXIMIZED_VERT",
            "_NET_WM_STATE_MAXIMIZED_HORZ"
          ],
          "wmType": "_NET_WM_WINDOW_TYPE_NORMAL",
          "wmPid": 5535,
          "wmClassName": "gnome-terminal-server.Gnome-terminal",
          "x": -3061,
          "y": 1944,
          "width": 1861,
          "height": 1056,
          "simpleName": "Gnome-terminal",
          "executableFile": "/usr/lib/gnome-terminal/gnome-terminal-server"
        },
        {
          "windowId": "0x360066b",
          "windowIdDec": 56624747,
          "wmCurrentDesktopNr": 0,
          "states": [
            "_NET_WM_STATE_MAXIMIZED_VERT",
            "_NET_WM_STATE_MAXIMIZED_HORZ",
            "_NET_WM_STATE_FOCUSED"
          ],
          "wmType": "_NET_WM_WINDOW_TYPE_NORMAL",
          "wmPid": 5535,
          "wmClassName": "gnome-terminal-server.Gnome-terminal",
          "x": 59,
          "y": 24,
          "width": 1861,
          "height": 1056,
          "simpleName": "Gnome-terminal",
          "executableFile": "/usr/lib/gnome-terminal/gnome-terminal-server"
        },
        {
          "windowId": "0x5600004",
          "windowIdDec": 90177540,
          "wmClassName": "spotify.Spotify",
          "executableFile": "/snap/spotify/43/usr/share/spotify/spotify",
          "wmCurrentDesktopNr": 0,
          "states": [
            "_NET_WM_STATE_MAXIMIZED_VERT",
            "_NET_WM_STATE_MAXIMIZED_HORZ"
          ],
          "wmPid": 7159,
          "x": -3061,
          "y": 5784,
          "width": 1861,
          "height": 1056,
          "simpleName": "Spotify"
        },
        {
          "windowId": "0x3600943",
          "windowIdDec": 56625475,
          "wmCurrentDesktopNr": 0,
          "states": [
            "_NET_WM_STATE_MAXIMIZED_VERT",
            "_NET_WM_STATE_MAXIMIZED_HORZ"
          ],
          "wmType": "_NET_WM_WINDOW_TYPE_NORMAL",
          "wmPid": 5535,
          "wmClassName": "gnome-terminal-server.Gnome-terminal",
          "x": 59,
          "y": 1944,
          "width": 1861,
          "height": 1056,
          "simpleName": "Gnome-terminal",
          "executableFile": "/usr/lib/gnome-terminal/gnome-terminal-server"
        },
        {
          "windowId": "0x5a0004c",
          "windowIdDec": 94371916,
          "wmCurrentDesktopNr": 0,
          "wmType": "_NET_WM_WINDOW_TYPE_NORMAL",
          "states": [
            "_NET_WM_STATE_MAXIMIZED_VERT",
            "_NET_WM_STATE_MAXIMIZED_HORZ"
          ],
          "wmPid": 15422,
          "wmClassName": "jetbrains-pycharm.jetbrains-pycharm",
          "x": 1920,
          "y": 1944,
          "width": 1200,
          "height": 1896,
          "simpleName": "jetbrains-pycharm",
          "executableFile": "jetbrains-pycharm.desktop",
          "desktopFilePath": "......./jetbrains-pycharm.desktop"
        },
        {
          "windowId": "0x360b77c",
          "windowIdDec": 56670076,
          "wmCurrentDesktopNr": 0,
          "states": [],
          "wmType": "_NET_WM_WINDOW_TYPE_NORMAL",
          "wmPid": 5535,
          "wmClassName": "gnome-terminal-server.Gnome-terminal",
          "x": 490,
          "y": 4066,
          "width": 1036,
          "height": 542,
          "simpleName": "Gnome-terminal",
          "executableFile": "/usr/lib/gnome-terminal/gnome-terminal-server"
        },
        {
          "windowId": "0x366c0c4",
          "windowIdDec": 57065668,
          "wmCurrentDesktopNr": 0,
          "states": [],
          "wmType": "_NET_WM_WINDOW_TYPE_NORMAL",
          "wmPid": 5535,
          "wmClassName": "gnome-terminal-server.Gnome-terminal",
          "x": 3449,
          "y": 6002,
          "width": 1036,
          "height": 542,
          "simpleName": "Gnome-terminal",
          "executableFile": "/usr/lib/gnome-terminal/gnome-terminal-server"
        },
        {
          "windowId": "0x7400001",
          "windowIdDec": 121634817,
          "wmCurrentDesktopNr": 0,
          "states": [],
          "wmPid": 28320,
          "wmClassName": "xfreerdp.xfreerdp",
          "x": 3179,
          "y": 5840,
          "width": 1840,
          "height": 1028,
          "simpleName": "xfreerdp",
          "executableFile": "xfreerdp.desktop",
          "desktopFilePath": "....../.local/share/applications/xfreerdp.desktop"
        },
        {
          "windowId": "0x3681595",
          "windowIdDec": 57152917,
          "wmCurrentDesktopNr": 0,
          "states": [],
          "wmType": "_NET_WM_WINDOW_TYPE_NORMAL",
          "wmPid": 5535,
          "wmClassName": "gnome-terminal-server.Gnome-terminal",
          "x": -3051,
          "y": 3920,
          "width": 1036,
          "height": 542,
          "simpleName": "Gnome-terminal",
          "executableFile": "/usr/lib/gnome-terminal/gnome-terminal-server"
        },
        {
          "windowId": "0x7e00013",
          "windowIdDec": 132120595,
          "wmCurrentDesktopNr": 0,
          "states": [],
          "wmType": "_NET_WM_WINDOW_TYPE_NORMAL",
          "wmPid": 24439,
          "wmClassName": "VirtualBox Manager.VirtualBox Manager",
          "x": 407,
          "y": 4287,
          "width": 960,
          "height": 540,
          "simpleName": "VirtualBox Manager",
          "executableFile": "/usr/lib/virtualbox/VirtualBox"
        },
        {
          "windowId": "0x8000013",
          "windowIdDec": 134217747,
          "wmCurrentDesktopNr": 0,
          "states": [],
          "wmType": "_NET_WM_WINDOW_TYPE_NORMAL",
          "wmPid": 24598,
          "wmClassName": "VirtualBox Machine.VirtualBox Machine",
          "x": 904,
          "y": 4280,
          "width": 720,
          "height": 441,
          "simpleName": "VirtualBox Machine",
          "executableFile": "/usr/lib/virtualbox/VirtualBoxVM"
        },
        {
          "windowId": "0x37191a6",
          "windowIdDec": 57774502,
          "wmCurrentDesktopNr": 0,
          "states": [],
          "wmType": "_NET_WM_WINDOW_TYPE_NORMAL",
          "wmPid": 5535,
          "wmClassName": "gnome-terminal-server.Gnome-terminal",
          "x": 306,
          "y": 4091,
          "width": 1036,
          "height": 542,
          "simpleName": "Gnome-terminal",
          "executableFile": "/usr/lib/gnome-terminal/gnome-terminal-server"
        },
        {
          "windowId": "0x8e00001",
          "windowIdDec": 148897793,
          "wmCurrentDesktopNr": 0,
          "states": [],
          "wmPid": 12673,
          "wmClassName": "xfreerdp.xfreerdp",
          "x": 88,
          "y": 3947,
          "width": 1800,
          "height": 1000,
          "simpleName": "xfreerdp",
          "executableFile": "xfreerdp.desktop",
          "desktopFilePath": "....../.local/share/applications/xfreerdp.desktop"
        },
        {
          "windowId": "0x4200003",
          "windowIdDec": 69206019,
          "wmCurrentDesktopNr": 0,
          "states": [
            "_NET_WM_STATE_MAXIMIZED_VERT",
            "_NET_WM_STATE_MAXIMIZED_HORZ"
          ],
          "wmType": "_NET_WM_WINDOW_TYPE_NORMAL",
          "wmPid": 25008,
          "wmClassName": "Navigator.Firefox",
          "x": -1200,
          "y": 24,
          "width": 1200,
          "height": 1896,
          "simpleName": "Firefox",
          "executableFile": "firefox.desktop",
          "desktopFilePath": "/usr/share/applications/firefox.desktop"
        },
        {
          "windowId": "0x4200021",
          "windowIdDec": 69206049,
          "wmCurrentDesktopNr": 0,
          "states": [
            "_NET_WM_STATE_MAXIMIZED_VERT",
            "_NET_WM_STATE_MAXIMIZED_HORZ"
          ],
          "wmType": "_NET_WM_WINDOW_TYPE_NORMAL",
          "wmPid": 25008,
          "wmClassName": "Navigator.Firefox",
          "x": 6299,
          "y": 24,
          "width": 1861,
          "height": 1056,
          "simpleName": "Firefox",
          "executableFile": "firefox.desktop",
          "desktopFilePath": "/usr/share/applications/firefox.desktop"
        },
        {
          "windowId": "0x420002e",
          "windowIdDec": 69206062,
          "wmCurrentDesktopNr": 0,
          "states": [
            "_NET_WM_STATE_MAXIMIZED_VERT",
            "_NET_WM_STATE_MAXIMIZED_HORZ"
          ],
          "wmType": "_NET_WM_WINDOW_TYPE_NORMAL",
          "wmPid": 25008,
          "wmClassName": "Navigator.Firefox",
          "x": 3179,
          "y": 24,
          "width": 1861,
          "height": 1056,
          "simpleName": "Firefox",
          "executableFile": "firefox.desktop",
          "desktopFilePath": "/usr/share/applications/firefox.desktop"
        },
        {
          "windowId": "0x4200039",
          "windowIdDec": 69206073,
          "wmCurrentDesktopNr": 0,
          "states": [],
          "wmType": "_NET_WM_WINDOW_TYPE_NORMAL",
          "wmPid": 25008,
          "wmClassName": "Navigator.Firefox",
          "x": 5040,
          "y": 90,
          "width": 1200,
          "height": 1056,
          "simpleName": "Firefox",
          "executableFile": "firefox.desktop",
          "desktopFilePath": "/usr/share/applications/firefox.desktop"
        },
        {
          "windowId": "0x4200044",
          "windowIdDec": 69206084,
          "wmCurrentDesktopNr": 0,
          "states": [
            "_NET_WM_STATE_MAXIMIZED_VERT",
            "_NET_WM_STATE_MAXIMIZED_HORZ"
          ],
          "wmType": "_NET_WM_WINDOW_TYPE_NORMAL",
          "wmPid": 25008,
          "wmClassName": "Navigator.Firefox",
          "x": -3061,
          "y": 24,
          "width": 1861,
          "height": 1056,
          "simpleName": "Firefox",
          "executableFile": "firefox.desktop",
          "desktopFilePath": "/usr/share/applications/firefox.desktop"
        },
        {
          "windowId": "0x3800007",
          "windowIdDec": 58720263,
          "executableFile": "gnome-calculator",
          "wmCurrentDesktopNr": 0,
          "states": [],
          "wmType": "_NET_WM_WINDOW_TYPE_NORMAL",
          "wmPid": 488,
          "wmClassName": "gnome-calculator.Gnome-calculator",
          "x": -3061,
          "y": 52,
          "width": 548,
          "height": 455,
          "simpleName": "Gnome-calculator"
        }
      ]
    }
  ]
}```

emsi avatar Feb 26 '21 20:02 emsi

Hi there! Could you may narrow the problem down by starting with a minimal setup and than working your way up to the configuration you'd like to see work? Also: As it handles it's windows itself the only way to make Firefox open special windows is by adding command line flags manually to the saved window configuration.

johannesjo avatar Feb 27 '21 10:02 johannesjo

Hi! Seems actually any single app restoration goes wrong. Apparently it's due to the wrong resolution being detected for my dual monitor setup which looks like this: image Right monitor pivoted causes left side to be padded with black off-screen area. I guess it causes resolution detection to fail.

emsi avatar Mar 01 '21 12:03 emsi

wmctrl shows following dimensions:

$ wmctrl -d
0  * DG: 12480x7680  VP: 3120,0  WA: 59,24 3061x1896  N/A

emsi avatar Mar 03 '21 11:03 emsi

Are these dimensions correct? I'll add another debugging line for this to a new release of lwsm.

johannesjo avatar Mar 06 '21 12:03 johannesjo

Roughly. I assume some space was subtracted for UI elements. Instead of 3061x1896 it should be 3120x1920 so small pixel counts are missing for the top ribbon and left tool bar in Unity. Other than that all adds up. 12480 is 4 times 3120 and 7680 is 4 times 1920 so it matches my 4x4 workspaces layout.

Let me know when and how I can trigger additional debug.

emsi avatar Mar 06 '21 18:03 emsi

@johannesjo Hi! Any progress with new version with additional debug?

emsi avatar Mar 25 '21 09:03 emsi

Ah yes the version should be out. Sorry, forgot to inform you.

johannesjo avatar Mar 25 '21 09:03 johannesjo