Giter Club home page Giter Club logo

active-window's People

Contributors

octalmage avatar robsonvn avatar zenozeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

active-window's Issues

Minor issue

I just tried on my Mac

System Version: OS X 10.11.5 (15F34)
Kernel Version: Darwin 15.5.0

I installed the module using npm install --save active-window and tried to run example and got a minor error TypeError: monitor.getActiveWindow is not a function

I need to modify the example to use monitor(callback); and it worked.

Just wondering if this could be used to get the title of any running app .. i.e. not necessarily the active window?

An error occurs when executing duplicates.

Test Code

setInterval(function() {
  monitor.getActiveWindow(callback);
}, 1000);

Error

error

Cause

// active-window/index.js
parameters = config.parameters;
parameters.push(repeats);
parameters.push(interval);
console.log(parameters); // overwrite configs...

Fixed

const parameters = config.parameters.slice();
parameters.push(repeats);
parameters.push(interval);

error

End.

Random crashes in OSX

Hey i've been giving this a good test and found it randomly crashes when switching windows. I can't seem to find a culprit it just appears to be random.

This is the error I see:

/usr/local/lib/node_modules/time-tracker/node_modules/active-window/index.js:42
throw stderr.toString();
^
/usr/local/lib/node_modules/time-tracker/node_modules/active-window/scripts/mac.scpt:314:319:

Error : uncaught Exception

Hi guys, I am using this module for a NodeJS/Electron/angular2 desktop application. Everything works good in the development mode but I don't understand why it doesn't work when I create a build/executable.
I have this error :
" ERROR uncaughtException: The argument 'C:\Users\loic\AppData\Local\Programs\my-app\resources\app.asar\node_modules\active-window\scripts\windows.ps1' to the -File parameter does not exist. Provide the path to an existing '.ps1' file as an argument to the -File parameter. "

Do you have any idea where it could come from ?

Thanks,
I am working on Windows 10

A positional parameter cannot be found that accepts argument '1'

This is the error I'm getting when running this in Electron on Windows 10:

D:\dev\becomethegamer\overlay\node_modules\active-window\index.js:42 Uncaught D:\dev\becomethegamer\overlay\node_modules\active-window\scripts\windows.ps1 : A positional parameter cannot be found 
that accepts argument '1'.
(anonymous function) @ D:\dev\becomethegamer\overlay\node_modules\active-window\index.js:42emitOne @ events.js:90emit @ events.js:182readableAddChunk @ _stream_readable.js:153Readable.push @ _stream_readable.js:111onread @ net.js:531
D:\dev\becomethegamer\overlay\node_modules\active-window\index.js:42 Uncaught     + CategoryInfo          : InvalidArgument: (:) [windows.ps1], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : PositionalParameterNotFound,windows.ps1
(anonymous function) @ D:\dev\becomethegamer\overlay\node_modules\active-window\index.js:42emitOne @ events.js:90emit @ events.js:182readableAddChunk @ _stream_readable.js:153Readable.push @ _stream_readable.js:111onread @ net.js:531
D:\dev\becomethegamer\overlay\node_modules\active-window\index.js:42 Uncaught D:\dev\becomethegamer\overlay\node_modules\active-window\scripts\windows.ps1 : A positional parameter cannot be found 
that accepts argument '1'.
    + CategoryInfo          : InvalidArgument: (:) [windows.ps1], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : PositionalParameterNotFound,windows.ps1

I can provide any additional information you need.

Any suggestions?

how to get activeWindow one more times

I have a problem, I want to get now active window when i press some keys。so first i press key ,I can get the active window,but second press back throw stderr.toString();
this is my code :
`'use strict';
const ioHook = require('iohook');
const monitor = require('active-window');

ioHook.on("keydown", event => {
console.log(event);
/* You get object like this
{
type: 'mousemove',
x: 700,
y: 400
}
*/
if (event.keycode === 67 && event.rawcode === 120) {
monitor.getActiveWindow(() => {
try {
console.log("App: " + window.app);
console.log("Title: " + window.title);
}catch(err) {
console.log(err);
}
});
}
});

//Register and start hook
ioHook.start();

`

the errors :
throw stderr.toString();

Doesn't work with cyrillic on windows

Powershell on windows with cyrillic locale uses koir8-r encoding. To fix this issue, just add

[Console]::OutputEncoding = [System.Text.Encoding]::UTF8

before Write-Host in scripts/windows.ps1

Readme changes

Heya! Love this -- though just a quick note -- the readme indicates a .getActiveWindow function while it actually exports the fn itself, didn't know if you wanted to update the readme with this or if the intent is to expose a getActiveWindow fn in the future, as well as other behavior (Rubs hands!)

Another one is that I use iTerm and I wigged for a second when OSx wanted me to grant accessibility rights to iTerm. but then I understood.

Thanks!

It's probably better to use sindresorhus/active-win

As this project seems abandoned, this is just a heads up for new users.

There are several old Pull Requests here that haven't even been reviewed (a couple of them are mine).

https://github.com/sindresorhus/active-win might be a quite better bet now.

It supports macOS, Linux and Windows. And it has several advantages (apart from being currently maintained). For example, it supports being used with Electron (this project would generate issues in several cases).

Disclaimer: I fixed the Linux implementation and added support for Windows.

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.