mattr- / slate

A window management application (replacement for Divvy/SizeUp/ShiftIt)
GNU General Public License v3.0
614 stars 39 forks source link

OS X El Capitan: Storing the layout of a specific desktop (space) #79

Closed ckny closed 5 years ago

ckny commented 8 years ago

I would like to realize the following use case by leveraging slate (or AppleScript):

Store the layouted apps (e.g. Chrom, Evernote, TextEdit, ...) of a certain desktop (say Desktop 3) Change the apps locations on that desktop or e.g. close all apps Recover the complete desktop that display all windows arranged in the way as of step #1 Any chance to do that (with slate or something else)?

So far, I have configured my .slate.js like that:

var snapshot = slate.operation("snapshot", { "name" : "theName", "save" : true, "stack" : false }); slate.bind("1:ctrl,alt", snapshot);

var deleteSnapshot = slate.operation("delete-snapshot", { "name" : "theName", "all" : true, }); slate.bind("2:ctrl,alt", deleteSnapshot);

var activateSnapshot = slate.operation("activate-snapshot", { "name" : "theName", "delete" : false, }); slate.bind("3:ctrl,alt", activateSnapshot); Saving and activating works as such but obviously there is no reliable way to do it for a specific desktop. Say save desktop 2 (via snapshot), save desktop 3 (via snapshot) and so on .... and then e.g. only recover say Desktop 3.

Any help would be highly appreciated.

ckny commented 8 years ago

Trent was so kind to feedback in another thread regarding solution options (with Hammerspoon): https://github.com/mattr-/slate/issues/26#issuecomment-248132212

ckny commented 8 years ago

@tscheffe Thanks a lot for your great feedback! I agree regarding the location of the post but I have actually also edited my initial post https://github.com/mattr-/slate/issues/26#issuecomment-246977474 recently to "...Hence, any kind of input ... to achieve with Hammerspoon (or slate of course) would be great.". So I am open to any solution that fulfills the requirements - with slate or Hammerspoon ;-).

To your questions:

  1. Term "Desktop": as you have assumed correctly, Desktop in the sense of the new/latest Mac OS X terminology where they changed the naming from spaces to desktop. Apparently, they also label the "different" arrangements now "Desktop 1", "Desktop 2" and so on. Surprisingly, Apple still talks about spaces in Mission Control. At least in 10.11.6. Anyway, I guess we all now know what the issue is about.
  2. Use case clarifications: pretty much exactly what you have summarized.

Arrange your applications on a particular Desktop, dump/save the current locations, and then reconstruct those windows again on the (? given|specific|primary) Desktop at will.

I could live with just "create a new desktop" for restoring saved "desktops" and then re-arrange manually. So for example: I researched something around a specific topic "XYZ" which led to a "Desktop 3" with the following apps opened (in different sizes): e.g. 1 Evernote window with a note displayed, 2 PDFs (opened in preview separately), 1 image (opened with the quick viewer), etc. Now I would like to save the current state of Desktop 3 (apps opened, ideally with the current layout and sizes of the apps/windows, etc.) and eventually close the Desktop 3. Say a day later, I would like to continue to work on the subject or maybe show the results to somebody else. Hence, I would love to simply restore that "Desktop 3" so that all is in place as before without impacting all other currently opened desktops. Therefore, I could also live with just adding the Desktop to the end which might simplify the solution a bit. So in case 4 desktops existed before restore, a 5th desktop would be created with the restored session. At the moment I use http://www.one-tab.com/ and https://chrome.google.com/webstore/detail/session-buddy/edacconmaakjimmfgnblocblbcdcpbko to save bookmarks which helps a bit but still does not allow to deal with other relevant content (PDFs in preview, etc.) which obviously can't be restored by the bookmark manager.

In case there is any slate related solution option, I would appreciate any feedback as well of course. I assume this use case is relevant for others as well.

Regarding the Hammerspoon options, I will check them out asap and let you know - in the Hammerspoon repo then ;-) or via private mail.