Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Most of applications don't recover #45

Closed
ZerdoX-x opened this issue Sep 24, 2019 · 23 comments
Closed

Most of applications don't recover #45

ZerdoX-x opened this issue Sep 24, 2019 · 23 comments

Comments

@ZerdoX-x
Copy link

ZerdoX-x commented Sep 24, 2019

  • Ubuntu 19.04
  • Node v10.16.3

Opera:

zerdox@zerdox-A320M-H:~$ lwsm restore
Status: "Opera developer.Opera developer" is running: false 1 0
Starting: Opera developer.desktop
Status: "google-chrome-unstable.Google-chrome-unstable" is running: false 1 0
Starting: google-chrome-unstable.desktop
Status: "gnome-terminal-server.Gnome-terminal" is running: true 1 0
Wait for all applications to start
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: spawn Opera ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Visual Studio:

zerdox@zerdox-A320M-H:~$ lwsm restore
Status: "gnome-terminal-server.Gnome-terminal" is running: true 1 0
Status: "Opera developer.Opera developer" is running: true 1 0
Status: "code - insiders.Code - Insiders" is running: false 1 0
Starting: code - insiders.desktop
Wait for all applications to start
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: spawn code ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)

I guess 19.04 is not supported? Any alternatives?

@ZerdoX-x ZerdoX-x changed the title Most of applications doesn't recover Most of applications don't recover Sep 24, 2019
@johannesjo
Copy link
Owner

johannesjo commented Sep 24, 2019

Thanks for reporting. Just a guess: are you using wayland?

If so, please have a look at the troubleshooting section.

@ZerdoX-x
Copy link
Author

ZerdoX-x commented Sep 25, 2019

are you using wayland?

I'm not sure because I'm new to Linux, but I guess I'm using Xorg. I uploaded photo to be clear.
IMG_20190925_183902
I have tried to login to Ubuntu on Wayland and surprisingly, it works better for me, all apps restore but they all are in one worspace, even I saved 9 windows on 4 workspaces. Am I need to move to Wayland, or still use Xorg?

Updated: Also some apps for example GitKraken asks me to login, but if I reopen it manually, it's fine. Tried to save or restore session as root, got error that I can't run this command as root user

@johannesjo
Copy link
Owner

It works better with Wayland? Well it certainly should be the other way round :)

Why would you need to run it as root, i wonder?

@ZerdoX-x
Copy link
Author

On Xorg - errors, on Wayland - lwsm can't remember in which workspace which window.

I tried to run it as root because some apps can't get profile settings, I thought it will help..

So now I have two problems on Wayland:

  • lwsm doesn't recover workspaces (main problem)
  • some apps can't get profile data, I guess when they are ran with lwsm, they don't have much permissions.

And one big problem on Xorg I described above - it just doesn't work.

@johannesjo
Copy link
Owner

johannesjo commented Sep 25, 2019

You can probably add the missing applications to your config file like described in the troubleshooting section in the readme. This should fix the error. Please let me know what changes you made, so I can make it available to everyone (a pull request would be welcome as well :))

Workspaces won't probably work on Wayland, because it is very niggardly regarding the information it gives away and there is currently no way that I know of to make this work better.

@ZerdoX-x
Copy link
Author

Oh.. I'm so stupid.. In last vid I was using another script. I'm so sorry

@ZerdoX-x
Copy link
Author

Please watch this, I was trying to fix problem same as in troubleshooting section, what was I doing wrong?

https://youtu.be/0QIAIjDgkio

@ZerdoX-x
Copy link
Author

I have edited string in /usr/share/applications/opera-developer.desktop
"name=Opera developer" to "name=opera-developer". Now it works great with opera, but how can I add other applications without editing their .desktop file?

@johannesjo
Copy link
Owner

You don't need to edit the desktop files. You need to edit your config, as stated in the troubleshooting section of the readme and the output you get when executing lwsm from the command line :)

To quote the readme:

  1. You can locate the executable or desktop file manually for the application which isn't started (e.g. via the locate command), and add it to ~/.lwsm/{currentSessionName}.json.
    If you want to persist that mapping you might also want to open ~/.lwsm/config.json and edit the WM_CLASS_AND_EXECUTABLE_FILE_MAP property. You can find out which property name to use by executing xprop and clicking on an open window of the application. Look for WM_CLASS(STRING) (Or just execute xprop | grep "WM_CLASS(STRING)"). For finding the desktop file the locate command is usful (e.g.: locate google-chrome.desktop).
 // ~/.lwsm/config.json
 "WM_CLASS_AND_EXECUTABLE_FILE_MAP": {
    "{result of xprop}": "opera-developer.desktop",
  },

@ZerdoX-x
Copy link
Author

But it doesn't work, have you seen the video?

https://youtu.be/0QIAIjDgkio

@ZerdoX-x
Copy link
Author

I have just found that config doesn't save after I reload pc, what's wrong?

@johannesjo
Copy link
Owner

What doesn't save?

@ZerdoX-x
Copy link
Author

ZerdoX-x commented Sep 27, 2019

Sorry for bad english. I mean config isn't saved after reloading ubuntu (passive voice, english grammar)

@johannesjo
Copy link
Owner

You mean the config. json?

@ZerdoX-x
Copy link
Author

ZerdoX-x commented Sep 27, 2019

yes, when I edit it, lwsm can't see changes (as in video), and when i reload my pc, all changes disappear

@johannesjo
Copy link
Owner

When do the changes disappear? When you reload your pc or after executing the application?

@ZerdoX-x
Copy link
Author

after I reload my pc

@ZerdoX-x
Copy link
Author

image
also I cant ignore apps (file is saved)

@ZerdoX-x
Copy link
Author

I have found the problem and I have fixed this, I am going to describe problem and how to fix it soon, hope you will add this to readme.

@ZerdoX-x
Copy link
Author

How to recognise problem:

  • Your applications can't restore (e.g. Error: spawn Opera ENOENT)
  • When you save session there are a lot of lines of text (screenshot below)

image

DO NOT TRUST LAST LINE
SAVED SESSION: test — that's not true.

How to fix problem:

  1. Find name of your application in this log (e.g. "Opera developer.Opera developer")
    image

  2. Find .desktop file of your application

    • You can do it like this from cli: locate *<keyword of application's name>*.desktop
      zerdox@zerdox-A320M-H:~$ locate *opera*.desktop
      /usr/share/applications/opera-developer.desktop
      
    • Or you can locate into your applications directory and find it there:
      image
  3. Write name of your application from first paragraph and your .desktop file's name into ~/.lwsm/config.json like this
    Find "WM_CLASS_AND_EXECUTABLE_FILE_MAP" object and put in it a new value

"WM_CLASS_AND_EXECUTABLE_FILE_MAP": {
    ...
    ...
    "Opera developer.Opera developer": "opera-developer.desktop",
},
  1. Save session again (make sure you have closed every window except problematic application)
zerdox@zerdox-A320M-H:~$ lwsm save test
SAVED SESSION: test

Now, when you got only one line SAVED SESSION: test you can restore session. Now you have added this application to config.

If you will try to save and restore session with two or more problematic apps, your config.json may resets to it's default, you need to add applications one by one.

And finally, when you have added all apps to config, you can use lwsm correctly.

@ZerdoX-x
Copy link
Author

ZerdoX-x commented Sep 28, 2019

Hope this will help someone. Please add more info to your 'troubleshooting' section and 'use' section of readme. Thank you very much <3

@ZerdoX-x
Copy link
Author

And using xprop in this case is bad practise:

zerdox@zerdox-A320M-H:~$ xprop | grep "WM_CLASS(STRING)"
WM_CLASS(STRING) = "Opera developer", "Opera developer"

But I would need "Opera developer.Opera developer"

I tried just to copy result of xprop and just put dot between to names, but this is not working with other apps, it's more reliable to copy name from lwsm log after saving session

@johannesjo
Copy link
Owner

Thanks for sharing your solution! Glad that it works now for you. I'll extend the troubleshooting section with your guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants