No internet connection
  1. Home
  2. How to

Is it possible to make the computer screens go black using a stream deck button?

By Michael Hartung @Michael_Hartung
    2021-10-12 17:01:14.923Z

    Hello, I tried to find this here on the forum but didn't see anything specific to this. So, is it possible in some way to use a stream deck button to trigger all the computer screens to go dark? I do have a work around using a blank screen saver which I activate by placing the mouse in the corner that triggers it, but the slightest touch of the mouse brings them back on again. I was hoping that there was something better out there. Any ideas?

    • 13 replies
    1. Hey Michael,

      I use the following to turn off my displays:

      sf.system.exec({ commandLine: 'pmset displaysleepnow' });
      

      It's the same as pressing Ctrl+Shift+Eject.

      Although if you move the mouse, they'll come back up. I don't know if there's a way to avoid that.

      1. In reply toMichael_Hartung:
        samuel henriques @samuel_henriques
          2021-10-12 21:03:56.043Z

          Good one @raphaelsepulveda, I'll save this one.

          Hello Michael,
          Here's my idea.
          Create a black surface for each screen, the size of the screen.
          Then copy the surface ids:

          and paste them in this script, on the lines 'package:ckuojvuc200003k103aw0516u', and 'package:ckuojxfwh00033k10avdfqm4y' :

          Then add a stream deck trigger and that's it. SoundFlow will remember the location of the surfaces.

          function openColorSurface(id) {
          
              sf.surfaces.get(id).open({
                  device: sf.devices.localMachine,
              });
          }
          
          function closeColorSurface(id) {
              sf.surfaces.get(id).surfacesSurfaceCloseAll()
          
          }
          
          
          /// Surfaces Ids
          const commandIds = [
              'package:ckuojvuc200003k103aw0516u',
              'package:ckuojxfwh00033k10avdfqm4y']
          
          
          globalState.openColorSurface = !globalState.openColorSurface
          
          if (globalState.openColorSurface) {
          
              commandIds.forEach(surface => openColorSurface(surface))
          } else {
              
              commandIds.forEach(surface => closeColorSurface(surface))
          
          }
          
          
          1. MMichael Hartung @Michael_Hartung
              2021-10-12 22:04:27.180Z

              Hi @raphaelsepulveda ,
              I just don't know what you mean about making a black surface. Is this like a custom deck surface in sound flow? I've never done that before. I've always used my stream deck. If that's what you mean, I'll look on the forum on how to do that. Thanks!!

              1. MMichael Hartung @Michael_Hartung
                  2021-10-12 22:19:08.970Z

                  OK, I think I figured out how to make a surface and copy the ID, but the script fails on line 3 for some reason. Also the text formatting colors look different when I copy them into my editor. Does that matter?

                  1. samuel henriques @samuel_henriques
                      2021-10-12 22:25:33.159Z

                      Cool, could you post the script as you have it now?
                      And it must be a surface, not a deck

                      1. MMichael Hartung @Michael_Hartung
                          2021-10-12 22:36:20.952Z

                          Hi, Here's the script as I had it. I replaced the text as I thought it should be done but I'm not sure if it's correct.

                          function openColorSurface(id) {
                          
                              sf.surfaces.get(id).open({
                                  device: sf.devices.localMachine,
                              });
                          }
                          
                          function closeColorSurface(id) {
                              sf.surfaces.get(id).surfacesSurfaceCloseAll()
                          
                          }
                          
                          
                          /// Surfaces Ids
                          const commandIds = [
                              'package:ckuomufl70000gj10e1y5hyq3']
                          
                          
                          globalState.openColorSurface = !globalState.openColorSurface
                          
                          if (globalState.openColorSurface) {
                          
                              commandIds.forEach(surface => openColorSurface(surface))
                          } else {
                          
                              commandIds.forEach(surface => closeColorSurface(surface))
                          
                          }
                          
                          1. MMichael Hartung @Michael_Hartung
                              2021-10-12 22:39:09.001Z

                              Odd thing just happened when I pasted it into the forum, the colors changed back to the way you had it. Here's a picture of how the colors are different in my editor.

                              1. samuel henriques @samuel_henriques
                                  2021-10-12 22:41:30.699Z

                                  The colors are ok. As long as there are no red underline.
                                  Could you confirm this is a surface, not a deck and it's on the same package as the script?
                                  And the idea is to make a surface for each screen, so you need to make a new surface and get the surface I'd for each of them.

                      2. M
                        In reply toMichael_Hartung:
                        Michael Hartung @Michael_Hartung
                          2021-10-12 22:43:41.284Z

                          I did make a surface, yes. Not a deck.

                          1. MMichael Hartung @Michael_Hartung
                              2021-10-12 22:44:36.003Z

                              I’ll have to look at it tomorrow when I get back to the studio. Thanks for all the help so far!

                              1. samuel henriques @samuel_henriques
                                  2021-10-12 22:51:01.477Z

                                  ok, let me know how it goes, don't see anything wrong with what you did.

                              2. N
                                In reply toMichael_Hartung:
                                Nicolai Linck @Nicolai_Linck7
                                  2023-01-05 13:14:22.087Z2023-01-05 13:24:05.124Z

                                  This is superl! Du you know if its possible to to cover all of the screen including the menubar?
                                  And the surface is loaded it makes a transparent line in the bottom and the right side?
                                  Best N

                                  1. N
                                    In reply toMichael_Hartung:
                                    Nicolai Linck @Nicolai_Linck7
                                      2023-01-05 13:33:28.198Z

                                      It was the menubar that messed with the Surface size. I found at applescript that hides and de hides the menubar but i need some help getting it in to soundflow;)
                                      Best N