npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

x-multimon-kiosk

v1.0.0

Published

multi-monitor management for kiosk systems and interactive installations

Downloads

7

Readme

The Problem

Building a Linux/X-based kiosk (POI/POS) system is tricky when multiple monitors are involved. This module is designed to be used by a NodeJS application that is started, for example, in a user's ~/.xprofile.

Single output

All connected monitors are combined to create a single output that can be rendered to by a single instance of, say, chromium in kiosk mode, or any other full screen application. Normally, when entering full screen mode, an application's window only covers one of the monitors. Spanning all monitors is acomplished by using a feature of compiz.

Consistent ordering

Different startup times between monitors might affect in which order they are detected by the graphics hardware. This can cause inconistencies between system startups. The image for the right monitor might end up on the left monitor and vice versa. This module uses xrandr to find out about the connected screens and to configure their positions in the combined output. You can provide a sort function for custom ordering based on your graphics card's connector names. (e.g. the monitor connected to 'Displayport-1' always should be to the left of'the monitor connected to 'Displayport-2'.)

Screen resolution independence

Sometimes media installations use exotic hardware that might not be available to you as a developer. You must write software that works on your development machine as well as on the production system that uses different monitor dimensions and resolutions. Therefore it is not a good idea to hard-code screen resolutions into your code or even config files. This module finds out about the connected monitors' resolutions at start-up.

Example usage

const xmmk = require('x-multimon-kiosk');

xmmk( (err, monitors)=> {
    // monitors is an array of objects
    // with these properties
    /* [
            {name: 'DP-1',  // connector name
             xres: 1920,    // width in pixels
             yres: 1080,    // height in pixels
             left: 0,       // x-position in combined output
             top: 0         // y-position in combined output
            },
            {name: 'DP-2',
             xres: 1920,
             yres: 1080,
             left: 1920,
             top: 0
            },
       ] */
});

Dependencies

You need to use compiz as your window manager and you need the xrandr binary.

API

xmmk([options], cb)

Options are:

  • sortFunc a function used to sort monitors by connector name (see Array.sort). Defaults to alphanumerical order.
  • arrange must be xmmk.HORIZONTAL (VERTICAL is not implemented yet). Defines whether monitors are arranged next to each other or below each other.
  • xrandrPath - path to xrandr binary (defaults to /usr/bin/xrandr)
  • compizConfigPath - path to config file (it ill be overwritten!, defaults to ${process.env.HOME}/.config/compiz-1/compizconfig/Default.ini)
  • compizConfigTemplate - a function that creates the contents of the config file. It is called with one argument, which is an object containing properties xres and yres. Defaults to:
function compizTemplate({xres, yres}) {
	return `
[core]
s0_detect_outputs = false
s0_outputs = ${xres}x${yres}+0+0;

[place]
s0_multioutput_mode = 3
`;
}

How it works

This module runs xrandr to find out what screens are connected. It then uses a user-defined (or default) sort function to order the screens. It then runs xrandr again to set their position in the combined output. Finnaly it runs xrandr yet again, to get the final result, which is passed to the user-defined callback. Before that callback is called, it creates a configuration for compiz to implement the combined output. You shuld run compiz --replace afterwards.