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

Persist workspace assignments without modifying the config #57

Open
vfaberd opened this issue Dec 15, 2023 · 4 comments
Open

Persist workspace assignments without modifying the config #57

vfaberd opened this issue Dec 15, 2023 · 4 comments
Labels
design-needed triaged The issue makes sense to maintainers

Comments

@vfaberd
Copy link

vfaberd commented Dec 15, 2023

Hi, thank you for this amazing tool! I love how lightweight and unobtrusive it is.

Question:
Is there a way to persist assignments to workspaces other than adding each individual app to the config? I have a lot of apps that I do not use often and that are specific to only one machine. Consequently, I'd rather avoid cluttering my config with these apps. However, I still want them to remain in the workspaces where I put them after reboots or application restarts.

@nikitabobko
Copy link
Owner

Reference: https://i3wm.org/docs/layout-saving.html

@gogamid
Copy link

gogamid commented May 18, 2024

Of course, having a layout file as in i3 would be the dream. Until it’s implemented, I’ve found a handy workaround. I use a bash script, triggered via Alfred, to set up the simple layouts that I frequently use. For instance, I have setups for different scenarios like tutorials, thesis writing, or work workspaces. Just thought I’d share this tip while we wait for the layout file feature. Hope this helps!

#!/bin/bash
view=$1
if [ "$view" == "tutorial" ]; then
	ws=1
	open -a Firefox
	aerospace move-node-to-workspace $ws

	open -a IINA
	sleep 1
	aerospace layout tiling
	aerospace move-node-to-workspace $ws

	open -a WezTerm
	aerospace move-node-to-workspace $ws

	aerospace workspace $ws
	aerospace layout tiling
	for i in {1..3}; do
		aerospace move left
	done
fi

if [ "$view" == "thesis" ]; then
	ws=2
	open -a sioyek
	sleep 1
	aerospace move-node-to-workspace $ws

	open -a WezTerm
	aerospace move-node-to-workspace $ws

	open -a Firefox
	aerospace move-node-to-workspace $ws

	aerospace workspace $ws
	aerospace layout tiling
	for i in {1..3}; do
		aerospace move left
	done
fi

function open_move_fullscreen {
	open -a $1
	aerospace move-node-to-workspace $2
	aerospace fullscreen
}

if [ "$view" == "default" ]; then
	aerospace close-all-windows-but-current
	open_move_fullscreen "ChatAll" A
	open_move_fullscreen Firefox B
	open_move_fullscreen WezTerm T
	aerospace workspace B
fi

if [ "$view" == "work" ]; then
	ws=C
	open -a "Microsoft Teams"
	sleep 1
	aerospace move-node-to-workspace $ws

	open -a "Microsoft Outlook"
	sleep 1
	aerospace move-node-to-workspace $ws

	aerospace workspace $ws
	aerospace layout tiling
fi

@januz
Copy link

januz commented May 27, 2024

Layout files would be fantastic! This is the feature I'm waiting most eagerly for (and others in this and also this issue).

@nikitabobko Do you still have this feature on the roadmap? Thanks!

@af3556
Copy link

af3556 commented Nov 11, 2024

I've created this small script to save and restore window -> workspace config; I run aerospace-save_restore.sh save before a aerospace "cold restart" (e.g. aerospace version update) and aerospace-save_restore.sh restore after. It's only useful when window IDs persist, so won't be useful to recover from OS updates/reboots.

https://gist.github.com/bdlow/59a35c8adeed8294929f1f6f8b0e1de7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design-needed triaged The issue makes sense to maintainers
Projects
None yet
Development

No branches or pull requests

5 participants