How to use active-win - 4 common examples

To help you get started, we’ve selected a few active-win examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imfunniee / youtube-discord-rpc / index.js View on Github external
async function youtube() {
  let window = activeWin.sync();

  try {
    let appExtension = isWin() ? ".exe" : ".app";
    let processName = window.owner.name;
    let windowTitle = window.title;

    if (processName.toLowerCase() == `chrome${appExtension}`) {
      if (windowTitle.includes('YouTube')) {
          let title = windowTitle.split('YouTube');
          if (title[0] !== video) {
            video = title[0].slice(0,-2);
            var splitEachChar = video.split('');
            var count = getOccurrence(splitEachChar,'-'); // prevent it from splittin to much, certain youtubers loves to put "-" in title
            if(count <= 1){
            artist = video.split("-")[0]; //for music channels get artist
            video = video.split("-")[1]; //and song name
github EasyWebApp / puppeteer-browser / test / index.js View on Github external
async function isActiveWindow(page,  yes = true) {

    const assert = yes ? equal : notEqual;

    const window = await activeWin(), path = PuppeteerBrowser.executablePath();

    if ( window.owner.path )
        assert(path, window.owner.path);
    else
        assert(path.match( /([^/]+)(\.\w+)?$/ )[1],  window.owner.name);
}
github slay / photoshop-rich-presence / rpc.js View on Github external
async function checkPhotoshop() {
  let window = monitor.sync();

  try {
    let appExtension = isWin() ? ".exe" : ".app";
    let processName = window.owner.name;
    let windowTitle = window.title;

    if (processName.toLowerCase() == `photoshop${appExtension}`) {
      if (windowTitle.includes('.psd') || windowTitle.includes('% (RGB/')) {
          let split = windowTitle.split('@');

          if (split[0] !== currentFile) {
            currentFile = split[0];
            updateRP(`Editing ${currentFile}`);
          }
      } else {
          if (currentFile !== "IDLE") {
github kmteras / timenaut / src / models / heartbeat_model.ts View on Github external
constructor(time: bigint) {
        this.time = Math.floor(new Date().getTime() / 1000);
        const windowInfo = activeWin.sync();

        this.idle = powerMonitor.getSystemIdleTime() > Settings.getIdleTime();

        if (windowInfo !== undefined) {
            this.process = new ProcessModel(windowInfo.owner.path, windowInfo.owner.name);
            this.window = new WindowModel(windowInfo.title, this.process);
        } else {
            throw new Error("Could not get active window");
        }
    }

active-win

Get metadata about the active window and open windows (title, id, bounds, owner, URL, etc)

MIT
Latest version published 7 months ago

Package Health Score

53 / 100
Full package analysis

Popular active-win functions