Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

active-window-shortcuts

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

active-window-shortcuts - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

49

index.js

@@ -0,7 +1,48 @@

const path = require('path');
// const {promisify} = require('util');
const childProcess = require('child_process');
// const execFile = promisify(childProcess.execFile);
// const bin = path.join(__dirname, '../main');
const parseMac = stdout => {
try {
const result = JSON.parse(stdout);
if (result !== null) {
result.platform = 'macos';
return result;
}
} catch (error) {
console.error(error);
throw new Error('Error parsing window data');
}
};
module.exports = () => {
if (process.platform === 'darwin') {
return require('./lib').sync();
// if (process.platform === 'darwin') {
// return require('./lib').sync();
// }
// throw new Error('sorry, macOS only.');
const blar = path.join(__dirname, './main')
console.log({blar})
const bla = childProcess.execFileSync('/Users/philippkuehn/Projekte/active-window-shortcuts/main', {
encoding: 'utf8',
// cwd: process.cwd(),
})
// console.log({bla})
return parseMac(bla)
return {
app: 'nope',
shortcuts: [],
}
throw new Error('sorry, macOS only.');
};

31

lib/index.js
'use strict';
const path = require('path');
const {promisify} = require('util');
// const {promisify} = require('util');
const childProcess = require('child_process');
const execFile = promisify(childProcess.execFile);
// const execFile = promisify(childProcess.execFile);
const bin = path.join(__dirname, '../main');

@@ -22,7 +22,24 @@

module.exports = async () => {
const {stdout} = await execFile(bin);
return parseMac(stdout);
// module.exports = async () => {
// const {stdout} = await execFile(bin);
// return parseMac(stdout);
// };
// module.exports.sync = () => parseMac(childProcess.execFileSync(bin, {encoding: 'utf8'}));
module.exports.sync = () => {
// return parseMac()
console.log(process.cwd(), __dirname, {bin})
const bla = childProcess.execFileSync('../main', {
encoding: 'utf8',
cwd: process.cwd(),
})
console.log({bla})
return {
app: 'nope',
shortcuts: [],
}
};
module.exports.sync = () => parseMac(childProcess.execFileSync(bin, {encoding: 'utf8'}));
{
"name": "active-window-shortcuts",
"version": "0.1.0",
"version": "0.1.1",
"author": "Philipp Kühn",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc