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

@idrive-remotepc/display-utility

v1.0.2

Published

Linux utility to retrieve various information about desktop display, capture screen and convert them into video frames using xrandr and x264 encoding

Downloads

18

Readme

Display Utility

Linux utility to

  1. Display information about the X11 desktop display like number of outputs, output names, current resolution and list of possible resolutions for all outputs using X11 and xrandr C libraries.
  2. Capture screen as a RGB bitmap, encode using x264 and output continuous video frames.
  3. Lock screen of any linux desktop using lock-system package.

Usage

Install from NPM to your dependencies

npm install @idrive-remotepc/display-utility

Import the various utilities as required from the package

Typescipt

import { displayUtility, lockUtility, screenCaptureUtility } from '@idrive-remotepc/display-utility';

Javascript

const { displayUtility, lockUtility, screenCaptureUtility } = require('@idrive-remotepc/display-utility');

Functions exposed

displayUtility.getConnectedOutputs(): number[] | undefined

Returns list of numbers which represents the RROutput corresponding to all the outputs.

displayUtility.getOutputName(rROutput: number): string

Returns the name of the output (monitor) given the RROutput number for that output

displayUtility.getCurrentResolution(rROutput: number): IResolution | undefined

Returns the current resolution of the output (monitor) given the RROutput number for that output

displayUtility.getResolutions(rROutput: number): IResolution[] | undefined

Returns the list of possible resolutions for an output (montior) given the RROutput number for that output

displayUtility.setResolution(rROutput: number, resolution: IResolution): void

Sets a particular resolution for an output (monitor) given the RROutput number for that output and the new resolution to be set.

displayUtility.makeScreenBlank(): void

Reduces the brightness of all connected outputs to 0 and makes the screen blank.

displayUtility.reverseBlankScreen(): void

Reverses the operation performed by makeScreenBlank()

displayUtility.getPrimaryRROutput(): number

Get the RROutput number corresponding to the primary monitor

Note: When no monitor is marked as primary, one of the connected monitor's RROutput number is returned

displayUtility.getExtendedMonitorResolution: IResolution | undefined

Get the complete resolution of the display when multiple monitors are connected.

Note: Returns same value as getCurrentResolution(), when single monitor is connected

displayUtility.getAllCurrentResolutionsWithOffset(): IResolutionWithOffset[] | undefined

Get the position (x-offset and y-offset), height and width of connected monitors

screenCaptureUtility.init(singleMonitorCapture: boolean, rROutput?: number): void

Initialises the screen capturer and x264 encoder for capturing screen.

To capture a single output (monitor) with RROutput number 65 (example):

screenCaptureUtility.init(true, 65);

To capture the complete display including all connected outputs (monitors):

screenCaptureUtility.init();

screenCaptureUtility.getNextFrame(callback: (nextFrame: ArrayBuffer) => void): void

Returns the captured and encoded frame buffer as a callback.

screenCaptureUtility.getNextFrame((frame: ArrayBuffer) => {
    // perform operation with frame
});

lockUtility.lockScreen(): void

Locks the computer when executed

Issues

Please feel free to raise issues on this repository, be it bugs or feature requests. We would be happy to address them.

Debugging

Debugging the native node modules is possible using lldb extension in Visual Studio Code. Following are the steps:

  1. Install recommended vscode extension vadimcn.vscode-lldb.

  2. Install lldb in your system if it is not already installed.

    # For debian
    apt install lldb
    
    # For RPM
    yum install lldb
  3. Write required functions to debug in test.ts and start debugging using F5.