No internet connection
  1. Home
  2. How to

How to activate functions in Tidal when not in focus.

By Robbin Clemente @Robbin_Clemente
    2024-09-04 08:42:02.231Z

    Hello, I am new to Soundflow and the Stream deck. I purchased a stream deck XL and trying to create an external controller for Tidal when I'm working. I have used the keyboard command Modifier keys to access the KB shortcuts when the Tidal application is active. I would like to know if you can in the background operate these controls like for example when I'm browsing on chrome and adjust track playback, volume up and down etc. The built in Key modifiers are what I used to access the controls. I know I could use the KB Volume control but you know, the stream deck is way cooler. How to do that function without losing focus on the chrome or Davinci Resolve or whatever application i'm working in. Thank you!

    Rob

    • 4 replies
    1. Dana Nielsen @Dana_Nielsen
        2024-09-15 08:49:04.268Z

        Came here looking for the same answer, @Robbin_Clemente! Not specifically for Tidal (love Tidal tho!) but to control a different non-focused app such as Canva or Keynote to turn pages on a presentation while staying put in OBS, for example. Hoping there is some kind of solution or workaround to control apps running in the background but not visible on screen so as not to distract from the task (screen) at hand. Many thanks in advance for any suggestions here! 🙏🏻

        1. Chad Wahlbrink @Chad2024-09-16 16:06:53.393Z

          Hey @Dana_Nielsen,

          Typically any "UI automation" can be performed in the background, depending on the accessibility of the specific app you are trying to control.

          This video starting around 3:20 is a good example of how to use UI automation instead of "keyboard simulation" to perform actions without the need for an application to be focused. Using "keyboard simulation" like "press keys," "type text," or "mouse click" macro actions does require the app to focused.
          https://youtu.be/vZmFMfT0GOc?si=qxC_V2QNCPeg36-6&t=201

          Canva, and Tidal for that matter, are not "native" mac apps, and use some level of a web app interface ported to desktop format. Tidal is a bit more accessible than Canva and has more menu options, which makes it a bit more scriptable. However, Canva's scripting capabilities appear to be somewhat limited based on a first look.

          Something you could try would be storing the currently "frontmost app," then activating Canva quickly, running a "press keys" action to fire a keyboard shortcut, then re-activate the stored frontmost app.

          I think you would need a script to accomplish this, looking something like this for Canva:

          let frontmost = sf.ui.invalidate().frontmostApp; 
          
          sf.ui.app("com.canva.canvaeditor").appActivate();
          
          sf.keyboard.press({keys:"right"});
          
          frontmost.appActivate();
          

          or for Keynote:

          let frontmost = sf.ui.invalidate().frontmostApp; 
          
          sf.ui.app("com.apple.iWork.Keynote").appActivate();
          
          sf.keyboard.press({keys:"right"});
          
          frontmost.appActivate();
          
          1. Chad Wahlbrink @Chad2024-09-16 16:12:52.079Z

            Keynote is more scriptable overall as it has a lot more options for menu items and the UI is fully accessible, plus it has great apple script support. However... it seems like when you use "Play" > "Play Slideshow" Keynote does not respond to key commands, menu clicks, or apple script in the same way.

            You may still need to use the activate then re-activate frontmost app method. I believe this wouldn't cause too much issue if you have the presentation on a separate display, but if it's playing from a single display, then there may be some jumping back and forth.

        2. In reply toRobbin_Clemente:
          Chad Wahlbrink @Chad2024-09-16 15:53:15.483Z

          Hey @Robbin_Clemente,

          I have a package on the SoundFlow Store that has a few basic controls for Tidal Playback. It's open source if you want to see how I'm accomplishing some of these functions. In general any app is controllable from other apps as long as you are not using "keyboard simulation" like "press keys," "type text," or "mouse click" macro actions.

          In general, I'm just using generic Menu commands like this:

          const tidalApp = sf.ui.app('com.tidal.desktop')
          
          tidalApp.menuClick({
              menuPath: ["Playback", "Next"]
          });
          

          The Playback/Pause command uses a ternary operator since the menu changes based on playback state:

          const tidalApp = sf.ui.app('com.tidal.desktop')
          
          // Determine if Play or Pause exists in Playback menu
          var playOrPause = (tidalApp.getMenuItem("Playback", "Play").exists) ? "Play" : "Pause";
          
          tidalApp.menuClick({
              menuPath: ["Playback", playOrPause]
          });