Giter Site home page Giter Site logo

synle / display-dj Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 3.0 813 KB

A cross platform desktop application that supports brightness adjustment for integrated laptop monitor as well as external monitors and dark mode toggle supporting Windows and MacOSX at the moment. Adjustment brightness will be quicker and does not require tinkering with the external monitor controls.

Home Page: https://synle.github.io/display-dj

JavaScript 19.49% HTML 3.51% SCSS 0.74% TypeScript 76.25%
brightness darkmode electron windows ddcci mac displaydj

display-dj's Introduction

Hi there ๐Ÿ‘‹

๐Ÿ’ฌ About Me

I am Sy Le, a seasoned software engineer with over a decade of experience, I've honed my skills in developing cutting-edge web applications at renowned companies such as Linkedin, Salesforce, and Yahoo. My expertise spans a diverse range of domains, including CRM, marketing automation, e-commerce, and monitoring platforms. I have a strong command of both JavaScript and React on the front end, as well as Node JS and Express on the backend.

I am actively seeking employment opportunities, particularly in front-end development or full-stack positions with an emphasis on the frontend. While I have a preference for fully remote positions, I am also open to hybrid roles that involve commuting to the South Bay Area (Mountain View, CA). I am adaptable to various technology stacks and am willing to learn whatever is necessary to successfully complete the job. Proficient in Typescript and Node.js, I also possess a solid working understanding of Python and Java.

Education

๐Ÿ“ซ How to reach me?

๐Ÿ”ญ Iโ€™m currently working on

display-dj's People

Contributors

dependabot[bot] avatar synle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

thajj bradcode24

display-dj's Issues

Electron.js Version Upgrade

The DisplayDJ Desktop Application uses an older version of Electron. The framework recommends that updated versions of the framework be used to take advantage of secure defaults and security fixes. [Link]

Platform(s) Affected:

MacOS, Windows

โ€”

Mir Masood Ali, PhD student, University of Illinois at Chicago
Mohammad Ghasemisharif, PhD Candidate, University of Illinois at Chicago
Chris Kanich, Associate Professor, University of Illinois at Chicago
Jason Polakis, Associate Professor, University of Illinois at Chicago

Win32 bug - can't adjust brightness after unhook and hook the monitor back in

Fixes #64 : Win32 bug - can't adjust brightness after unhook and hook the monitor back in

Right now, if you unhook and hook up a monitor. Those display can't be adjusted with display-dj due to a bug in @hensm/ddcci

Repro steps:

  • I have a shared HDMI cable I used for 2 of my machines (mac and PC). Unhook it from PC and hook it up to Mac, then hook it back to PC. Then after that, in the PC, display-dj can't no longer control of the target monitors.

The detailed error

[0] The operating system asynchronously destroyed the monitor which corresponds to this handle because the operating system's state changed. This error typically occurs because the monitor PDO associated with this handle was removed, the monitor PDO associated with this handle was stopped, or a display mode change occurred. A display mode change occurs when windows sends a WM_DISPLAYCHANGE windows message to applications.

The cause

@hensm/ddcci is funky when you disconnect and reconnect the external display. This PR breaks up the commands for DDCCI into a separate script and no longer makes it as part of the main bundle.

The solution

I tried multiple approaches, it seems like the only one that works for me is to break up ddcci related actions into a separate script and has the main display-dj process calls out to this script. It seems the spawning of this new script seems to re-initiate the ddcci module properly.

App Error logs

[0] [TRACE] updateMonitor brightness \\?\DISPLAY#VSCB73A#5&21f33940&0&UID4352#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7} 50

[0] [TRACE] updateMonitorBrightness failed with DccCi, attempting built-in approach \\?\DISPLAY#VSCB73A#5&21f33940&0&UID4352#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7} 50 Error: Failed to set VCP code value

[0] The operating system asynchronously destroyed the monitor which corresponds to this handle because the operating system's state changed. This error typically occurs because the monitor PDO associated with this handle was removed, the monitor PDO associated with this handle was stopped, or a display mode change occurred. A display mode change occurs when windows sends a WM_DISPLAYCHANGE windows message to applications.

Hide dock icon for Mac

This application works in the Tray Menu, so there is no need to add another application in the Dock for mac. This behavior works for Windows, but not work. So this issue is only applicable for Mac at the moment

Before

Note that the dock icon is here

image

Now

No more Dock Icon for mac
image

Brightness doesn't work with M1 macs

Error

For internal display:

/Users/syle/git/display-dj/node_modules/electron/dist/Electron.app/Contents/Resources/brightness: failed to set brightness of display 0x1 (error -536870201)

For external displays:

More info here:

  • kfix/ddcctl#92
  • kfix/ddcctl#86
    D: CGDisplay 3C535519-AEA6-40BB-8B3C-9960A75AD2F4 dispID(#2) (2560x1440 0ยฐ) 108.00 DPI D: CGDisplay B42D0653-90BD-4C09-8994-29942B522374 dispID(#3) (2560x1440 0ยฐ) 108.00 DPI I: found 2 external displays E: Failed to parse WindowServer's preferences! (/Library/Preferences/com.apple.windowserver.plist) I: polling EDID for #2 (ID 3 => (null)) E: Failed to poll display

Potential Solutions

Working code for external display on m1 mac

./m1ddc get luminance

./m1ddc display list
./m1ddc set luminance 50

./m1ddc display 1 set luminance 100
./m1ddc display 2 set luminance 100

/Users/syle/git/display-dj/node_modules/electron/dist/Electron.app/Contents/Resources/m1ddc display 1 set luminance 100

Win32 - Adding a shortcut executable into program file path

Win32 - Adding a shortcut executable into program file path

So if user exits out of the app, they can search for and open display-dj from the Start Menu search bar

https://github.com/electron/windows-installer#handling-squirrel-events

const app = require('app');

// this should be placed at top of main.js to handle setup events quickly
if (handleSquirrelEvent()) {
  // squirrel event handled and app will exit in 1000ms, so don't do anything else
  return;
}

function handleSquirrelEvent() {
  if (process.argv.length === 1) {
    return false;
  }

  const ChildProcess = require('child_process');
  const path = require('path');

  const appFolder = path.resolve(process.execPath, '..');
  const rootAtomFolder = path.resolve(appFolder, '..');
  const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));
  const exeName = path.basename(process.execPath);

  const spawn = function(command, args) {
    let spawnedProcess, error;

    try {
      spawnedProcess = ChildProcess.spawn(command, args, {detached: true});
    } catch (error) {}

    return spawnedProcess;
  };

  const spawnUpdate = function(args) {
    return spawn(updateDotExe, args);
  };

  const squirrelEvent = process.argv[1];
  switch (squirrelEvent) {
    case '--squirrel-install':
    case '--squirrel-updated':
      // Optionally do things such as:
      // - Add your .exe to the PATH
      // - Write to the registry for things like file associations and
      //   explorer context menus

      // Install desktop and start menu shortcuts
      spawnUpdate(['--createShortcut', exeName]);

      setTimeout(app.quit, 1000);
      return true;

    case '--squirrel-uninstall':
      // Undo anything you did in the --squirrel-install and
      // --squirrel-updated handlers

      // Remove desktop and start menu shortcuts
      spawnUpdate(['--removeShortcut', exeName]);

      setTimeout(app.quit, 1000);
      return true;

    case '--squirrel-obsolete':
      // This is called on the outgoing version of your app before
      // we update to the new version - it's the opposite of
      // --squirrel-updated

      app.quit();
      return true;
  }
};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.