Full screen display text in custom format on plain background


Anyone has an idea how to display a one sentence text full screen in a custom text format?

For example:
a completely black background with a text that is white with nothing else on the screen?

I'm aware of the existence of 'display large text' function but that's not what I'm after since it's not completely full screen.


Do you mean absolutely full-screen (with no menus)?

Yes, completely full screen.

In that case, I'm not sure. If it didn't need to be kiosk mode, it would be a simple matter of a custom HTML prompt.

Text Window Macro (v9.0.4)

Text Window.kmmacros (2.8 KB)

That looks good to me. Seems a minor nit that the Apple menu still shows.


The only thing I would want is to vertically center the text.
This crude HTML does that for my screen:

body {
background-color: black;
color: white;
text-align: center;

      div {
        display: table-cell;
        width: 2560px;  
        height: 1412px;
        padding: 10px;
        vertical-align: middle;
      text-align: center;

<body data-kmwindow="SCREEN(Main,Left,0%),SCREENVISIBLE(Main,Top,0%),SCREEN(Main,Right,0%),SCREENVISIBLE(Main,Bottom,0%)">
Large window text.

There is probably a better way of doing this.

I wanted to make the div{ } css be based on the screen like this:
width: %Calculate%Local__Screen[3]%px;

But that did not work, and the HTML Prompt does not seem to support KM Variable Token, like this:

@peternlewis, is there a way of doing this?
If not, could you please accept this as a feature request?
It would make creating custom, KM Variable driven, HTML much easier.

It's also possible to do it with a browser that can be put into true kiosk mode. For Firefox, that requires a combination of the "New window without toolbar" add-on and "Enter Full Screen" from the View menu. That makes it truly full screen.

Processing text tokens in an HTML file would be a nightmare since % characters are used all over the place.

You can access Keyboard Maestro variables and call Keyboard Maestro functions from JavaScript as described in Custom HTML Prompt action. Specially:

window.KeyboardMaestro.GetVariable( 'KMVariableName' )
window.KeyboardMaestro.Calculate( 'SCREEN(Main,Width)' )

Also, Keyboard Maestro will call your KMWillShowWindow() function when it is about to show the window.

So you need to implement the KMWillShowWindow() function, and in it you need to set the width, something like (completely untested!)

function KMWillShowWindow()
  let width = window.KeyboardMaestro.Calculate( 'SCREEN(Main,Width)' );
  let myElements = document.querySelectorAll(".div");

  for (let i = 0; i < myElements.length; i++) {
    myElements[i].style.width = width;

Something like that should work (fixing any errors I've made of course).

OK, good point.

But I think rather than a loop to set all occurrences of an element, it would be best to set a CSS style. I just need to figure out how to do that with JavaScript.

OK, I'll answer my own question.

From Set CSS styles with javascript

 var style = document.createElement('style');
  style.innerHTML = `
  #target {
  color: blueviolet;
1 Like

Nice - I looked and could not figure out how to do that.

So it should be straight forward to put together the two solutions to get the desired results.

Thank you all so much for your time, helping out. I'm not super experienced with programming, so what would this 'putting together of solutions' look like?

Could you guys maybe give an example/screenshot of a KB Maestro action with a Variable as text (so that one can change the text that is displayed easily) that gets the desired result?

Again, thank you so much @thoffman666, @JMichaelTX and @peternlewis.

As I mentioned above, to get it truly full screen will require using a browser. A straightforward way to display your custom HTML with a browser is shown below.

Using chosen browser to dispay custom HTML prompt Macro (v9.0.4)

Using chosen browser to dispay custom HTML prompt.kmmacros (1.5 KB)

In other words, don't use KM's Custom HTML Prompt. Rather, save your desired message as an HTML file, then use KM to tell the browser of your choice to display the file. You'll also have to include KM actions to put the browser in kiosk mode.

It just occurred to me that yet another way of doing this is via a PDF, because Adobe Reader has a truly full-screen view option.

So, can you live with the Apple menu bar still showing?
If so, I will work on implementing the JavaScript solution.

And if the visibility of the menu bar is unacceptable, it's a simple matter to use a KM prompt to ask for the desired messages to be displayed, then have KM create the HTML files and display them using a browser. I could show @roelputjeshoven that, if desired.

@JMichaelTX, the method you mention might be quicker than using the mentioned 'browser in kiosk mode' when wanting to change messages every x second (say, every three seconds), is that correct? I would be thankful if you could make an example KB Maestro Action of this method so that I could try it out.

Edit: to answer your question about the menu bar still visible: a small menu bar would be okay, although I still prefer some full screen function. But: I could create a workaround using the Mac OS built in accessibility 'zoom' function zooming in very slightly not showing the menu bar anymore.

@thoffman666 I think I'd know how to make that, but do you think it would be possible to make quick switches between different texts? If I'd want to change the text every x second (say, every three seconds), I would need KB Maestro to close the current tab in the browser and then open the newer created HTML file.

From my experience closing tabs and opening new ones in browsers is not always quick and stable, especially when there would be little time to close a tab and open a new one (for example: changing the text every second). What do you think?

I agree with you. Using a browser will not appear to go from one message to another instantaneously. I suggested that because you wanted true full-screen view. My original solution (using a custom HTML prompt in KM) would be instantaneous, and it's easy to create as many messages as you like and change them as often as you like, but you'd have to live with the Apple menu bar being visible.

@thoffman666 Yes, thanks. I'll dive a little deeper in your original solution then, since I prefer the stableness of it like you described. Thanks again for helping me out!

@thoffman666, One more thing: you suggest the custom HTML prompt in KM is instantaneous when changing the text, how would you do that? When I it tell KB Maestro to change the message (running the HTML prompt again, right? or should I change the text another way), it creates a new window with the newer text in it, leaving the 'old' message underneath it. So, it's basically stacking up windows. When I first close the window with the 'old' message, the window quickly fades out right after it's being closed, which doesn't make the change of texts instantaneous. Do you follow?