3 ms·
I have rcmd installed and working, and I wrote this AppleScript: tell application "Safari" repeat with w in windows set mt to (tabs of w whos
by gcanyon 4y ago
I have rcmd installed and working, and I wrote this AppleScript:
tell application "Safari"
repeat with w in windows
set mt to (tabs of w whose URL contains "https://mail.google.com/")
if mt ≠ {} then exit repeat
end repeat
if mt ≠ {} then
set mt to item 1 of mt
set the current tab of w to mt
set the index of w to 1
end if
-- activate -- needed if not activated otherwise
end tell
How do I set up window actions in rcmd? I don't see that in the page on your site.
- alin23 4y agoNot sure if you already installed the Experimental Window Switching part, leaving it here just in case: Click on Switcher in the rcmd menu Scroll to the bottom and click on Try experimental window switching Install Hammerspoon Install the rcmd script Screenshot: https://lowtechguys.com/static/img/rcmd-window-experimental.png https://lowtechguys.com/static/img/rcmd-window-experimental.... After that, you should be able to press Right Option + Equals ralt-= to assign a key and an action to the currently focused app: https://files.lowtechguys.com/rcmd-window-actions.png https://files.lowtechguys.com/rcmd-window-actions.png If assigning doesn't do anything, try restarting both Hammerspoon and rcmd, there can be a race condition when the script is installed the first time.
- gcanyon 4y agoWait -- why do I need Hammerspoon to trigger an AppleScript that I wrote? Actually, now that I think about it, isn't this easier to do: 1. Write the AppleScript (done) 2. Save it as an app 3. Assign a right-command to that app. 4. There is no step 4.
- alin23 4y agoHammerspoon is needed because App Store apps are sandboxed and can't focus specific windows, can't run arbitrary scripts and AppleScripts. What that gives you is the ability to map Right Option+letter to specific windows or tabs of the currently focused app. So in your case you could dorcmd-s for Safari then ralt-m for mail tab, ralt-h for HN tab and so on, and it can also open those tabs/windows if they aren't already open. And you also get a visual switcher to see what your options are in case you tend to forget these shortcuts. Here are some examples of how I tend to use that feature: https://files.lowtechguys.com/rcmd-window-actions-h264.mp4 https://files.lowtechguys.com/rcmd-window-actions-h264.mp4 I'll have to make it more discoverable and user friendly though.
- gcanyon 4y agoAh, okay. Did you know that AppleScripts can be saved as "apps"? I'm happily launching the mail tab in safari by pressing rcmd-m without Hammerspoon or anything other than stock RCMD. That gives me everything I was looking for. It would be nice to be able to assign ralt-<letter> to launch different apps -- e.g. rcmd-m does gmail in Safari, ralt-m opens Messages. and rcmd+ralt-m could do something else entirely. I've used Windows at times, but I don't miss window switching beyond the above use cases.