Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
906f45b156 | ||
|
|
a8dfe6fb15 | ||
|
|
dd84561293 | ||
|
|
d2eac0f0d2 | ||
|
|
f94a56ec58 |
19
Makefile
Executable file → Normal file
19
Makefile
Executable file → Normal file
@@ -1,12 +1,13 @@
|
|||||||
# usage: make [CONFIG=debug|release]
|
# usage: make [CONFIG=debug|release]
|
||||||
|
|
||||||
ifeq ($(CONFIG), debug)
|
ifeq ($(CONFIG), debug)
|
||||||
CFLAGS=-Onone -g
|
CFLAGS=-Onone -g
|
||||||
else
|
else
|
||||||
CFLAGS=-O
|
CFLAGS=-O
|
||||||
endif
|
endif
|
||||||
|
|
||||||
PLIST=$(shell grep -A1 $(1) src/Info.plist | tail -1 | cut -d'>' -f2 | cut -d'<' -f1)
|
PLIST=$(shell grep -A1 $(1) src/Info.plist | tail -1 | cut -d'>' -f2 | cut -d'<' -f1)
|
||||||
|
HAS_SIGN_IDENTITY=$(shell security find-identity -v -p codesigning | grep -q "Apple Development" && echo 1 || echo 0)
|
||||||
|
|
||||||
|
|
||||||
Memmon.app: SDK_PATH=$(shell xcrun --show-sdk-path --sdk macosx)
|
Memmon.app: SDK_PATH=$(shell xcrun --show-sdk-path --sdk macosx)
|
||||||
@@ -24,15 +25,27 @@ Memmon.app: src/*
|
|||||||
@cp src/Info.plist Memmon.app/Contents/Info.plist
|
@cp src/Info.plist Memmon.app/Contents/Info.plist
|
||||||
@touch Memmon.app
|
@touch Memmon.app
|
||||||
@echo
|
@echo
|
||||||
|
ifeq ($(HAS_SIGN_IDENTITY),1)
|
||||||
codesign -v -s 'Apple Development' --options=runtime --timestamp Memmon.app
|
codesign -v -s 'Apple Development' --options=runtime --timestamp Memmon.app
|
||||||
|
else
|
||||||
|
codesign -v -s - Memmon.app
|
||||||
|
endif
|
||||||
@echo
|
@echo
|
||||||
@echo 'Verify Signature...'
|
@echo 'Verify Signature...'
|
||||||
@echo
|
@echo
|
||||||
codesign -dvv Memmon.app
|
codesign -dvv Memmon.app
|
||||||
@echo
|
@echo
|
||||||
codesign -vvv --deep --strict Memmon.app
|
codesign -vvv --deep --strict Memmon.app
|
||||||
|
ifeq ($(HAS_SIGN_IDENTITY),1)
|
||||||
@echo
|
@echo
|
||||||
spctl -vvv --assess --type exec Memmon.app
|
-spctl -vvv --assess --type exec Memmon.app
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -rf Memmon.app bin_x64 bin_arm64
|
||||||
|
|
||||||
|
|
||||||
.PHONY: release
|
.PHONY: release
|
||||||
release: VERSION=$(call PLIST,CFBundleShortVersionString)
|
release: VERSION=$(call PLIST,CFBundleShortVersionString)
|
||||||
|
|||||||
55
README.md
55
README.md
@@ -8,57 +8,82 @@
|
|||||||
|
|
||||||
Memmon remembers what your Mac forgets – A simple deamon that restores your window positions on external monitors.
|
Memmon remembers what your Mac forgets – A simple deamon that restores your window positions on external monitors.
|
||||||
|
|
||||||
**Limitations:** Currently, Memmon restores windows in other spaces only if the space is activated. If you know a way to access the accessibility settings of a different space, let me know.
|
**Limitations:**
|
||||||
|
- Currently, Memmon restores windows in other spaces only if the space is activated.
|
||||||
|
If you know a way to access the accessibility settings of a different space, let me know.
|
||||||
|
- Support for the Misson Control config option “Displays have separate Spaces” is not tested.
|
||||||
|
I will add support for this as soon as I have access to an external monitor again (issue [#5](https://github.com/relikd/Memmon/issues/5#issuecomment-1040611494)).
|
||||||
|
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
1. You will need macOS 10.10 or newer.
|
1. You will need macOS 10.10 or newer.
|
||||||
2. Grant Memmon the Accessibility privilege. Go to "System Preference" > "Security & Privacy" > "Accessibility" and add Memmon to that list. Otherwise, you can't move other application windows around and the app has no purpose.
|
Download and unzip the tar.gz from [latest release](https://github.com/relikd/Memmon/releases/latest).
|
||||||
3. Thats it. The app runs in your status bar.
|
2. Grant Memmon the Accessibility privilege.
|
||||||
|
Go to "System Preference" > "Security & Privacy" > "Accessibility" and add Memmon to that list.
|
||||||
|
(Otherwise, the app has no purpose as it can't move application windows around.)
|
||||||
|
3. Thats it. The app runs in your menu bar.
|
||||||
|
|
||||||
|
Alternatively, you can compile Memmon from source by running `make`, or call the script directly (`swift src/main.swift`) without building an app bundle.
|
||||||
|
|
||||||
|
|
||||||
### Status Icon
|
### Menu Bar Icon
|
||||||
|
|
||||||
You can hide the status icon either via `defaults` or the same-titled menu entry. If you do so, the only way to quit the app is by killing the process (with Activity.app or `killall Memmon`). The status icon stays hidden during this execution only. If you restart the OS or app it will reappear (unless you hide the icon with `defaults`).
|
You can hide the menu bar icon either via `defaults` or the same-titled menu entry.
|
||||||
|
If you do so, the only way to quit the app is by killing the process (with Activity.app or `killall Memmon`).
|
||||||
|
The menu bar icon stays hidden during this execution only. If you restart the OS or app it will reappear (unless you hide the icon with `defaults`).
|
||||||
|
|
||||||
Memmon has exactly one app-setting, the status icon. You can manipulate the display of the icon, or hide the icon completely:
|
Memmon has exactly one app-setting, the menu bar icon.
|
||||||
|
You can manipulate the display of the icon, or hide the icon completely:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# disable status icon completely
|
# disable menu bar icon completely
|
||||||
defaults write de.relikd.Memmon icon -int 0
|
defaults write de.relikd.Memmon icon -int 0
|
||||||
# Use window-dots-icon
|
# Use window-dots-icon
|
||||||
defaults write de.relikd.Memmon icon -int 1
|
defaults write de.relikd.Memmon icon -int 1
|
||||||
# Use monitor-with-windows icon (default)
|
# Use monitor-with-windows icon (default)
|
||||||
defaults write de.relikd.Memmon icon -int 2
|
defaults write de.relikd.Memmon icon -int 2
|
||||||
# re-enable status icon and use default icon
|
# re-enable menu bar icon and use default icon
|
||||||
defaults delete de.relikd.Memmon icon
|
defaults delete de.relikd.Memmon icon
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
### Why‽
|
### Why‽
|
||||||
|
|
||||||
I am frustrated! Why does my Mac forget all window positions which I moved to a second screen? Every time I unplug the monitor. Every time I close my Macbook lid. Every time I lock my Mac.
|
I am frustrated!
|
||||||
|
Why does my Mac forget all window positions which I moved to a second screen?
|
||||||
|
Every time I unplug the monitor.
|
||||||
|
Every time I close my Macbook lid.
|
||||||
|
Every time I lock my Mac.
|
||||||
|
|
||||||
Is it macOS 11? Is it the USB-C-to-HDMI converter dongle (notably one made by Apple)? Why do I have to fix things that Apple should have fixed long ago? …
|
Is it macOS 11?
|
||||||
|
Is it the USB-C-to-HDMI converter dongle (notably one made by Apple)?
|
||||||
|
Why do I have to fix things that Apple should have fixed long ago? …
|
||||||
|
|
||||||
|
|
||||||
### Aren't there other solutions?
|
### Aren't there other solutions?
|
||||||
|
|
||||||
Yes, for example [Mjolnir](https://github.com/mjolnirapp/mjolnir) or [Hammerspoon](https://github.com/Hammerspoon/hammerspoon) (and some comercial ones). But I do not need a full-fledged window manager. Nor the dependencies they rely on. I just need to fix this damn bug.
|
Yes, for example, you can use [Mjolnir](https://github.com/mjolnirapp/mjolnir) or [Hammerspoon](https://github.com/Hammerspoon/hammerspoon) (and some comercial ones) to restore your perfect window setup on a button press.
|
||||||
|
But I do not need a full-fledged window manager or the dependencies it relies on.
|
||||||
|
Nor do I want to constantly adjust for new windows.
|
||||||
|
Actually, I don't want to think about this problem at all – I just want to fix this damn bug.
|
||||||
|
|
||||||
|
|
||||||
### What is it good for?
|
### What is it good for?
|
||||||
|
|
||||||
First off, Memmon is less than 300 lines of code – no dependencies. You can audit it in 10 minutes... And build it from scratch – just run `make`.
|
First off, Memmon is less than 300 lines of code – no dependencies.
|
||||||
|
You can audit it in 10 minutes...
|
||||||
|
And build it from scratch – just run `make`.
|
||||||
|
|
||||||
Secondly, it does one thing and one thing only: Save and restore window positions whenever your monitor setup changes.
|
Secondly, it does one thing and one thing only:
|
||||||
|
Save and restore window positions whenever your monitor setup changes.
|
||||||
|
|
||||||
|
|
||||||
### Develop
|
### Develop
|
||||||
|
|
||||||
You can either run the `main.swift` file directly with `swift main.swift`, via Terminal `./main.swift` (`chmod 755 main.swift`), or create a new Xcode project. Select the Command-Line template and after creation replace the existing `main.swift` with the bundled one.
|
You can either run the `main.swift` file directly with `swift main.swift`, via Terminal `./main.swift` (`chmod 755 main.swift`), or create a new Xcode project.
|
||||||
|
In Xcode, select the Command-Line template and replace the template provided `main.swift` with this one.
|
||||||
|
|||||||
Reference in New Issue
Block a user