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

Let users set some preferences #8

Closed
lwouis opened this issue Aug 27, 2019 · 8 comments
Closed

Let users set some preferences #8

lwouis opened this issue Aug 27, 2019 · 8 comments
Labels
enhancement New feature or request

Comments

@lwouis
Copy link
Owner

lwouis commented Aug 27, 2019

Let users customize some defaults values. In order of usefulness:

  • Keys used in the global shortcuts
  • Max sizes of thumbnails
  • Debounce delay before the thumbnails appear
  • Other: sizes, paddings, colors, fonts, thumbnails quality, basically all constants at the top of Application.swift

To illustrate, this is how HyperSwitch does it:

image

@lwouis
Copy link
Owner Author

lwouis commented Oct 16, 2019

I just merged a commit that adds support for preferences through a JSON file. Starting from version 1.1.0, the app will read a JSON file on launch and use the values inside as preferences. The path to that file should be something like ~/Library/Preferences/alt-tab-macos.json.

To customize the app, just edit that file and restart the app

@jnsl
Copy link

jnsl commented Oct 16, 2019

there is no setting yet for the delay, right?

@lwouis
Copy link
Owner Author

lwouis commented Oct 16, 2019

there is no setting yet for the delay, right?

I completely forgot to make this a preference. I just release version 1.3.0 that has this delay as a preference.

This is the line you want to change in your local ~/Library/Preferences/alt-tab-macos.json. The delay is in milliseconds.

@jfdhuiz
Copy link

jfdhuiz commented Oct 18, 2019

I tried changing the Meta key from 59 to 55. This did not work for me. I verified once more that this is the correct number. Given /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/Events.h it is 0x37 which is hexadecimal for 55.

@lwouis
Copy link
Owner Author

lwouis commented Oct 18, 2019

I tried changing the Meta key from 59 to 55.

You need to change both:

"metaKey": 55,
"metaModifierFlagInt": 1048576,

More documentation here: https://github.com/lwouis/alt-tab-macos/blob/master/alt-tab-macos/logic/Preferences.swift#L77

It's a bit annoying. I'll try to think of a better way to handle these 2 codes.

@jfdhuiz
Copy link

jfdhuiz commented Oct 18, 2019

Thank you, that worked. This application is getting better and better every day <3

That documentation is adequate though I did not know where to find it. Other users may prefer a GUI but for me editing a text file is OK.

Have you considered adding option of cycling through current app's windows? It is a HyperSwitch feature I end up using with browser windows.

Also, I am not sure which values highlightColorString accepts? I tried gray, grey, and black. None of these works.

@lwouis
Copy link
Owner Author

lwouis commented Oct 20, 2019

Have you considered adding option of cycling through current app's windows? It is a HyperSwitch feature I end up using with browser windows.

I think this will be in scope at some point. I think I should break this ticket into: UI to tweak preferenes + 1 ticket per new preference to add. Your suggestion would then be its own ticket

Also, I am not sure which values highlightColorString accepts? I tried gray, grey, and black. None of these works.

It used to be the name of a color in English as a string. However I changed that to a static value because the String -> NSColor constructor requires macOS 10.12. I thought it was not worth-it to requires 10.12 for only 1 line of code, so I removed the preference in a way.

Feel free to open a PR to replace that one line, but avoid the 10.12 API. Maybe replace with the red/blue/green constructor? Here is when/where it happened exactly:

d0face2#diff-ec6f5425853c9a2848e3a69c7bf9e899R82

@lwouis
Copy link
Owner Author

lwouis commented Oct 23, 2019

I released a first UI for users to set their preferences in v1.5.0. I wanted to get this build out so people can do it, though the UI is currently ugly. The goal is to iterate from there to replace some of the text inputs with more specific inputs (e.g. dropdown for the meta key).

The current version combines UI with json file. This means modifying the file as a power-user, or modifying the UI all work nicely together. There is also rudimentary UI validation of the text inputs so that if you type "a" in a field supposed to contain an integer, it will refuse the change.

I will open new individual tickets to not lose suggestions of preferences discussed in this thread

lwouis pushed a commit that referenced this issue Oct 23, 2019
# [1.5.0](v1.4.7...v1.5.0) (2019-10-23)

### Features

* add panel to set user preferences (closes [#8](#8)) ([a994825](a994825))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants