Lurker News

Comments (451) 114 threads

Show all comments

Showing thread 23 of 114

alin231 reply#
I’ve mentioned before on HN how I make around ~$7k from my Lunar app nowadays [0] but controlling monitors is a larger niche and the app was developed and perfected over the course of 5 years.

This time I’d like to show you the progress of my last year’s project, https://lowtechguys.com.
It’s a small macOS app studio and here are my App Store sales for the last month: https://f.alinpanaitiu.com/gjxBpg/Image.png
You can see trends in red because December is a slow month for app sales, not sure why exactly.
But even with just 4 small macOS apps I manage to make ~1k/month with close to zero maintenance.
I have a lot more ideas for small non expensive apps that could add to the revenue but less and less time for them.
Right now I have to rebuild an old wooden house and finally move out of my rented apartment. I’m grateful to have a source of income on the side that can support me this year so I can pause tech while I do field work.
[0] https://news.ycombinator.com/item?id=33620955

gcanyon1 reply#
I have an idea for rcmd -- if possible, it would be great to be able to assign a right-cmd-key to -- or open one if none is. Likewise for calendar.google.com and probably others. I'd pay an extra few dollars for that feature, as I'm forever opening because my tab hygiene is lacking.

I read your piece on window switching -- would AppleScript work? This works:

    tell application "Safari"
      tell item 4 of windows
        set the current tab to item 3 of the tabs
        set the index to 1
        end tell
      activate
    end tell
alin234 replies#
Hey that’s a useful feature indeed, and it can already be added by the user with rcmd’s Window Actions which support AppleScript. I actually have done that myself already for Firefox.

I could maybe try to implement the main part of the “find and switch to the tab if it exists” so that users can simply assign the URL.
Thanks for reminding about this use case!

gcanyon#
Oh, that's interesting. Okay, I'm pulling the trigger. I used to write AppleScript in a previous life, so I think I can handle that part. (we'll see if I'm right...)
gcanyon1 reply#
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.
alin231 reply#
Not 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....

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
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.

gcanyon1 reply#
Wait -- 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.

alin231 reply#
Hammerspoon 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
I'll have to make it more discoverable and user friendly though.

gcanyon#
Ah, 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- 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.

gcanyon#
Okay, I've worked it out and it works perfectly with no requirement for window actions. I created an 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
         if not (exists window 1) then
            make new document with properties {URL:"https://mail.google.com"}
         else
            set mt to make new tab in window 1 with properties {URL:"https://mail.google.com"}
            set the current tab of window 1 to mt
         end if
      else
         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
Then:

   1. I export the script as an app. In the dialog I set it to stay open.
   2. I run the app.
   3. I use the standard rcmd method to assign M to that application.
   4. I quit the app.
   5. I export the script as an app again. In the dialog I *do not* set it to stay open.
And done! Now I rcmd-M and if there is a mail.google.com tab, Safari switches to it and jumps to the front. If there is not a mail.google.com tab, the frontmost window gets a new tab set to mail.google.com. I haven't tested yet what happens if there is no window. It should create one with mail.google.com. I'll test that in a minute and if it doesn't work I'll correct it and update here.
gcanyon#
The solution I posted works for most use cases, but apparently Safari can have zombie windows with no tabs. I quit and restarted, and updated the script to handle the situation where there are no windows, but I need to wait until there are zombie tabs again to double-check that my fix for that works. Once that's done I'll post again.