• Stars
    star
    394
  • Rank 109,295 (Top 3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A tool to store and reload open windows and window positions for x11 desktops like unity and gnome.

MIT license

This is a library / command line tool that let's you save and reload your opened programs and the positions of their windows. Supports Unity and Gnome Desktops and possibly all other compositing window managers using X (including XWayland).

There's also a companion tool in form of an indicator applet, a gnome-shell-extension and a Ulauncher extension if you like such things but this package can also be used standalone.

Installation

NodeJs needs to be installed properly before you can use lwsm. Have a look at google if you need help with that.

npm install -g linux-window-session-manager

For older distros, you also might need to install the locate command via sudo apt-get install mlocate.

Updating

npm uninstall -g linux-window-session-manager && npm i -g linux-window-session-manager
# (optional) delete config to update it to the newest version
rm ~/.config/lwsm/config.json

CMD Usage

Saving a session:

# save the current session to ~/.config/lwsm/sessionData/DEFAULT.json
lwsm save

# save the current session to ~/.config/lwsm/sessionData/my-session.json
lwsm save my-session   

Note that the session are stored for the specific display combination, you're currently running. If you want to store a different layout for when you have an external monitor plugged in this is possible. Just run the save command again for the same session.

Restoring a session:

# restore the session from ~/.config/lwsm/sessionData/DEFAULT.json
lwsm restore

# restore the session from ~/.config/lwsm/sessionData/my-session.json
lwsm restore my-session   

# gracefully close all running apps before starting the session
lwsm restore --closeAllOpenWindows

List saved sessions:

lwsm list

Rename a saved session:

lwsm rename oldName newName

Adjusting the configuration:

You can manually edit the config file present at ~/.config/lwsm/config.json and the session files in ~/.config/lwsm/sessionData/[sessionName].json.

Command-line completion:

# Automatically install command-line completion
lwsm --setupCompletion
# Generate command-line completion code for bash and zsh shells for manual installation
lwsm --completion
# Generate command-line completion code for fish shell for manual installation
lwsm --completion-fish

Command-line completion implemented by omelette, so you may refer it's README to check file where completion code will be added on automatic install. Restart your shell after automatic install to apply changes.

Known Quirks

In order to resize and move the windows the X window manager is used. Unfortunately it has some bugs:

  • Windows moved to the very left of the screen will always be off by some pixels in Unity
  • Sometimes a window can't be restored properly any more. In those cases it helps to close the window and restart the application.
  • When you're using Wayland as display manager all gnome applications won't be saved or restored. Only XWayland applications will work.

Troubleshooting & Issues

!!! please read this before opening up an issue !!!

If you're using Wayland, have a look at above at the known qurks section

Application are not started/lwsm doesn't work

Related error message: undefined findDesktopFile cant find file

lwsm needs to guess the right executable path for your applications. In some cases lwsm might be unable to do so. There are a couple of things, that you can do:

  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 ~/.config/lwsm/{currentSessionName}.json (depending on the version used the file might be located here instead: ~/.config/lwsm/{currentSessionName}.json). If you want to persist that mapping you might also want to open ~/.config/lwsm/config.json (depending on the version used the file might be located here instead: ~/.config/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).
# example  entry in ~/.config/lwsm/config.json:
# WM_CLASS(STRING)             Desktop file name
"google-chrome.Google-chrome": "google-chrome.desktop",
  1. If the desktop files are consistently stored in a folder not mapped by lwsm you might want to add it's location to the DESKTOP_FILE_LOCATIONS property in ~/.config/lwsm/config.json(depending on the version used the file might be located here instead: ~/.config/lwsm/config.json) to make sure this folder is also searched the next lwsm tries to guess an desktop file path. If you think the path should be there per default please open up an issue.

You can also see this comment for more detailed instructions.

Ignoring applications

If you want lwsm to ignore the application, you can add it to the ignore list in ~/.config/lwsm/config.json (depending on the version used the file might be located here instead: ~/.config/lwsm/config.json) which is located under the WM_CLASS_EXCLUSIONS property.

If everything fails please open up an issue.

Gnome Terminal or other Gnome applications not restored

Chances are you're running Wayland as a display manager. I'd recommend switching back to Xorg.

❀ contribute ❀

I'm happy for any reported issue or feature request.

More Repositories

1

super-productivity

Super Productivity is an advanced todo list app with integrated Timeboxing and time tracking capabilities. It also comes with integrations for Jira, Gitlab, GitHub and Open Project.
TypeScript
11,214
star
2

angular-material-css-vars

Little library to use css variables with @angular/material
SCSS
193
star
3

ng-fab-form

Convenient forms for Angular with no extra markup? Fabulous!
JavaScript
172
star
4

angular-promise-buttons

Chilled loading buttons for AngularJS
JavaScript
153
star
5

super-productivity-android

Android App for Super Productivity (https://super-productivity.com/)
Kotlin
105
star
6

gnome-shell-extension-window-session-manager

An indicator that let's you save and restore your open apps and the window positions and arrangements over multiple real and virtual displays.
JavaScript
91
star
7

angular2-promise-buttons

Chilled loading buttons for angular2
TypeScript
86
star
8

generator-angular-auto-admin-loopback

Generator for automatic CRUD angular backend for loopback apps and apis
JavaScript
32
star
9

generator-modular-angular

A truly modular yeoman generator for AngularJS all device apps.
JavaScript
21
star
10

angular-material-sass-files

The sass files of the angular-material repository
CSS
20
star
11

super-productivity-themes

The repository for user made themes for Super Productivity <3
SCSS
18
star
12

sp2

Super Productivity2
TypeScript
11
star
13

generator-angular2-lib

A generator for angular 2 libraries with all the basic stuff setup to get you started quickly.
TypeScript
9
star
14

rainbow-bash-unicorn

Awesome happy rainbow bash theme with unicorn inside!!!!
8
star
15

super-productivity-ios

Repository of the iOS app for Super Productivity
7
star
16

super-productivity-chrome-extension

Allows communication with jira and idle time tracking for super productivity inside the browser.
JavaScript
7
star
17

linux-window-session-manger-indicator

TypeScript
6
star
18

angular-auto-forms

Auto form markup helper
JavaScript
6
star
19

bumcss

Scalable css architecture for web apps and websites
6
star
20

procrastinate-somewhere-else

A little program to keep you away from the computer from a certain point of time, via a message, shutting down or going to sleep mode.
JavaScript
5
star
21

gps-recorder

Records the GPS position over time
JavaScript
5
star
22

direct-video

Chrome extension to directly play videos in a new window in the native video player.
JavaScript
2
star
23

pods-wp-cli

Pods WP-CLI package
PHP
2
star
24

angular-auto-admin-looopback

JavaScript
2
star
25

clone-rename

Little script to clone a directory and rename all files with a certain pattern as well as all variable names in it.
JavaScript
2
star
26

chrome-extension-simple-vocabulary-trainer

Simple vocabulary trainer using chrome notifications. Uses a custom vocabulary list to remind you in a given interval of your vocabulary.
JavaScript
2
star
27

gnome-shell-extension-super-productivity

The companion gnome shell extension for super productivity
JavaScript
2
star
28

johannesjo.github.io

my github pages
1
star
29

cover-img

Simple jQuery Cover IMG plugin
JavaScript
1
star
30

git-count

...
1
star