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

FeatureRequest: Shortcuts #5

Open
zqso opened this issue Jan 20, 2020 · 8 comments
Open

FeatureRequest: Shortcuts #5

zqso opened this issue Jan 20, 2020 · 8 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@zqso
Copy link

zqso commented Jan 20, 2020

Hi jslegendre,
Got any plan to embed some shortcuts in this bundle?
Thanks,
Walter

@jslegendre
Copy link
Owner

I have thought of this but haven’t figured out a way to have the AX shortcuts not interfere with shortcuts of host apps. If you know a way, I’m open!

@jslegendre jslegendre added enhancement New feature or request help wanted Extra attention is needed labels Jan 29, 2020
@DrBones
Copy link

DrBones commented Feb 19, 2020

Hi,

I would love shortcuts as well! Maybe not a solution but would a scriptable interface (like AppleScript, or python, or similar) be feasible in any way? That way one could use tools like BetterTouchTool or Keyboard Maestro, etc to either set up the hotkey in each app individually or simply be cool with it clobbering a default hotkey.

Awesome tool by the way, thank you so much!

@zqso
Copy link
Author

zqso commented Feb 20, 2020

I have thought of this but haven’t figured out a way to have the AX shortcuts not interfere with shortcuts of host apps. If you know a way, I’m open!

or can it be compiled like the original Afloat, with a menubar UI, where shortcuts are changeable in the System Preferences - Keyboard - Shortcuts

@TryTryAgain
Copy link

And/or expose some kind of CLI options?

@zqso
Copy link
Author

zqso commented Dec 16, 2020

Recently the good old "Afloat" acts weirdly in MacForge in Big Sur, so I have to give up on it and eventually switch to "AfloatX".

Still, there are no shortcut or CLI options to make it easy to use for those whose Dock is always hidden.

So I use Applescript to get it done,

Example: Invert Colors of the front app:

on run
	-- get active application
	tell application "System Events" to set activeApp to name of first application process whose frontmost is true
	
	-- right click that application in the dock
	tell application "System Events" to tell UI element activeApp of list 1 of process "Dock"
		perform action "AXShowMenu"
		click menu item "AfloatX" of menu 1
		click menu item "Invert Colors" of menu 1 of menu item "AfloatX" of menu 1
	end tell
end run

Replace the "Invert Colors" with whatever function you want.

References:
How can I assign an application to all desktops using the keyboard? - Ask Different - https://apple.stackexchange.com/questions/200757/how-can-i-assign-an-application-to-all-desktops-using-the-keyboard

@kevinjohncutler
Copy link

Recently the good old "Afloat" acts weirdly in MacForge in Big Sur, so I have to give up on it and eventually switch to "AfloatX".

Still, there are no shortcut or CLI options to make it easy to use for those whose Dock is always hidden.

So I use Applescript to get it done,

Example: Invert Colors of the front app:

on run
	-- get active application
	tell application "System Events" to set activeApp to name of first application process whose frontmost is true
	
	-- right click that application in the dock
	tell application "System Events" to tell UI element activeApp of list 1 of process "Dock"
		perform action "AXShowMenu"
		click menu item "AfloatX" of menu 1
		click menu item "Invert Colors" of menu 1 of menu item "AfloatX" of menu 1
	end tell
end run

Replace the "Invert Colors" with whatever function you want.

References:
How can I assign an application to all desktops using the keyboard? - Ask Different - https://apple.stackexchange.com/questions/200757/how-can-i-assign-an-application-to-all-desktops-using-the-keyboard

Can this be adapted to run when a specific app is launched? I've never worked with applescript before.

@zqso
Copy link
Author

zqso commented Dec 17, 2020

Recently the good old "Afloat" acts weirdly in MacForge in Big Sur, so I have to give up on it and eventually switch to "AfloatX".
Still, there are no shortcut or CLI options to make it easy to use for those whose Dock is always hidden.
So I use Applescript to get it done,
Example: Invert Colors of the front app:

on run
	-- get active application
	tell application "System Events" to set activeApp to name of first application process whose frontmost is true
	
	-- right click that application in the dock
	tell application "System Events" to tell UI element activeApp of list 1 of process "Dock"
		perform action "AXShowMenu"
		click menu item "AfloatX" of menu 1
		click menu item "Invert Colors" of menu 1 of menu item "AfloatX" of menu 1
	end tell
end run

Replace the "Invert Colors" with whatever function you want.
References:
How can I assign an application to all desktops using the keyboard? - Ask Different - https://apple.stackexchange.com/questions/200757/how-can-i-assign-an-application-to-all-desktops-using-the-keyboard

Can this be adapted to run when a specific app is launched? I've never worked with applescript before.

You can use application trigger in Keyboard Maestro to run them when application is launched. Applescript adjustments are needed.

@cocoaaa
Copy link

cocoaaa commented Mar 25, 2022

Recently the good old "Afloat" acts weirdly in MacForge in Big Sur, so I have to give up on it and eventually switch to "AfloatX".

Still, there are no shortcut or CLI options to make it easy to use for those whose Dock is always hidden.

So I use Applescript to get it done,

Example: Invert Colors of the front app:

on run
	-- get active application
	tell application "System Events" to set activeApp to name of first application process whose frontmost is true
	
	-- right click that application in the dock
	tell application "System Events" to tell UI element activeApp of list 1 of process "Dock"
		perform action "AXShowMenu"
		click menu item "AfloatX" of menu 1
		click menu item "Invert Colors" of menu 1 of menu item "AfloatX" of menu 1
	end tell
end run

Replace the "Invert Colors" with whatever function you want.

References: How can I assign an application to all desktops using the keyboard? - Ask Different - https://apple.stackexchange.com/questions/200757/how-can-i-assign-an-application-to-all-desktops-using-the-keyboard

Thank you so much for this. It works like a charm with Alfred: I set a hotkey trigger (e.g. cmd+shift+F) that is linked to the apple script, and now can toggle the "Float Window" options so easily. Much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants