Libxapp, and Blanking other monitors
by clem 12

Screen blanking in Xplayer

Xplayer, the media player, was given the availability to blank other monitors.

capture-du-2016-09-29-10-49-40

If you have more than one monitor, you can now press the “Blank Other Monitors” button when playing a video in full screen. Your video will continue playing and all your other monitors will turn black.

The blanking can be toggled back and forth and automatically stops if you leave fullscreen or close the player.

This feature is also available if you plug an external monitor to a laptop, so it allows you to blank the external monitor, or to blank the laptop itself without having to close the lid.

You could already do this by switching monitors off manually, or by closing laptops lids, but that was troublesome for some people because of power management settings, the settings daemon reinterpreting your monitor configuration (thus moving your windows) or in the case of issues with energy saving (that’s common on Dell monitors for instance).

Screen blanking in other XApps

Going forward, this feature should also be added to Pix and Xviewer when showing pictures full screen or in diaporama mode, and in Xreader when running presentations.

Screen blanking in other applications

Not only are Xapps developed for the entire Linux community, but we’re also making sure features like this one are available to all applications within and without the scope of the Xapps projects.

In other words, a new library called “libxapp” was created and it can be used by any application to gain such functionality.

Here’s a quick example of how you can blank monitors in C:

And to unblank them:

You can also test whether they’re being blanked or not by testing:

In Python, you would do it like this:

Other features from libxapp

If you’re interested in using libxapp, please do not hesitate to get in touch with us. Not only we would like to hear your thoughts and know where it is being used, but you can also impact and contribute to its development.

We’re just getting started with this. Naming and design can be reviewed and the lib isn’t documented yet.

Going forward, we’re likely to externalize some of the functionality currently present in Cinnamon, MDM, and some of the Mint tools  into libxapp, to facilitate the development of cross-DE and cross-distribution software.

This includes functionality like this one (for instance, the ability to inhibit the session/screensaver, but straight up available to all apps, without using a template pattern) or even the distribution of composite widgets, like the ones we’re using in Cinnamon Settings.

Link to libxapp on github: https://github.com/linuxmint/xapps

12 thoughts on “Libxapp, and Blanking other monitors

  1. Reply Samuel Tiago Sep 30,2016 00:00

    Muito bom!!! Oi Clem, sou brasileiro, uso o Linux Mint 18, gostaria de esclarecer uma duvida quero usar o driver proprietário AMDGPU-PRO por causa de Steam pra jogar, instalei, e depois reiniciei ficou assim na tela preta é um problema com Cinnamon ou Driver? AMDGPU-PRO vai funciona no Linux Mint 18.1? Quando vai lançar o Linux Mint 18.1.

  2. Reply Baptiste Sep 30,2016 22:36

    This is awesome. Exactly my main problem with dual monitors. They put out a lot of light, and not only the second monitor is distracting : it’s common to use a higher quality main monitor, and a low quality second monitor.

    I would even blank the monitor if used alone, since for unknown reasons the screen saver or power management isn’t working anymore and it leaves a big very power hungry monitor running for many hours on. If I can blank it myself with a tiny program and leave the seat, I’ll do.

    • Reply JosephM Oct 1,2016 07:13

      This isn’t actually shutting your monitor off. It just puts a fullscreen window over the top of your other monitor to cover it’s content.

      • Reply clem Oct 1,2016 11:22

        Oh yes, this doesn’t stop your monitor from using power, it’s not meant as a power-saving feature. It’s meant to hide content and reduce light.. typically in the scope of projecting a movie, a PDF presentation or a picture diaporama.

        The blanking function takes a window as an argument. It looks at the position of that window to assess which monitor it’s located on, and blanks all the other monitors.

  3. Reply M.Z. Oct 2,2016 04:48

    I love this idea! For me something like this would make a fair amount of my computing easier & more intuitive. Of course for me the big question is this: could there be a way to integrate something like this into a web browser so my laptop screen goes blank when I’m watching something on Hulu or Netflix on my TV via HDMI out? If there was a way to make all browsers use this sort of functionality automatically via system settings it would be a perfect solution for people that stream the way I do. If that’s not practical perhaps it could be integrated into a site specific browser. Whatever else it could be used for it’s a great idea.

    • Reply clem Oct 2,2016 09:55

      The screen blanking could have been implemented in two different ways. We discussed this within the dev team and decided to make it cross-DE. So it’s now something in a library anybody can use. For it to get into your browser, the browser developers would need to add it, but it then would work in all desktops.

      In contrast, we discussed the idea of making this a libmuffin (the Cinnamon window-manager) feature. That would have added this functionality at window-manager level. It would have been there automatically, for all fullscreen applications, without needing their developer to add anything. Of course the issue with that is that it would have been specific to Cinnamon and wouldn’t have worked in other desktops.

  4. Reply Anand Oct 3,2016 06:16

    An aside – I think current Brightness applet in Cinnamon works only for laptop monitors. Recently discovered this app** which adjust brightness of my Samsung Monitor. Any chance such functionality can be extended for external monitors as well?

    **
    https://apps.ubuntu.com/cat/applications/brightness-controller/

  5. Reply MediaServerLover Oct 13,2016 14:37

    The only thing that is missing is being able to play media from upnp/dlna servers from within the player.

  6. Reply Sergio Oct 20,2016 07:10

    Blanking or Blacking? (Just kidding)

  7. Reply klu Oct 23,2016 18:25

    why waste electricity and let libxapp turn off the whole the monitor?

  8. Reply Chris. Nov 6,2016 22:16

    What about the other way? How about fixing all the people who need dual monitors, but Mint 18 has one or both blank?

    I’d try and fix the other way (getting monitor to work) before spending time going this way.

    Chris.

Leave a Reply