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

working-hardly

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

working-hardly - npm Package Compare versions

Comparing version 1.1.3 to 2.0.0

22

.vscode/settings.json
{
"git.ignoreLimitWarning": true,
"workbench.colorCustomizations": {
"activityBar.background": "#352D05",
"titleBar.activeBackground": "#4A3F08",
"titleBar.activeForeground": "#FDFAEB"
}
"activityBar.background": "#322908",
"titleBar.activeBackground": "#060501",
"titleBar.activeForeground": "#e7e7e7",
"activityBar.activeBackground": "#322908",
"activityBar.activeBorder": "#126e5a",
"activityBar.foreground": "#e7e7e7",
"activityBar.inactiveForeground": "#e7e7e799",
"activityBarBadge.background": "#126e5a",
"activityBarBadge.foreground": "#e7e7e7",
"statusBar.background": "#060501",
"statusBar.border": "#060501",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#322908",
"titleBar.border": "#060501",
"titleBar.inactiveBackground": "#06050199",
"titleBar.inactiveForeground": "#e7e7e799"
},
"peacock.color": "#060501"
}

34

cli.js

@@ -19,3 +19,3 @@ #!/usr/bin/env node

const defaultActionInterval = 240 * 1000;
const defaultActionInterval = 240;

@@ -27,5 +27,8 @@ program

.option('-k, --key [value]', 'Provide a keep awake key.')
.option('-f, --force', 'do not skip movement if the mouse has changed position between last runs..')
.option('-r, --run', 'Run immediately')
.parse(process.argv);
let lastKnownPosition = robot.getMousePos();
if(program.run) {

@@ -36,7 +39,9 @@ logger.log('info', 'Running action now.');

logger.log('info', 'Moving the mouse every %s seconds.', program.interval / 1000);
const movementIntervalInSeconds = program.interval * 1000;
logger.log('info', 'Moving the mouse every %s seconds.', movementIntervalInSeconds / 1000);
setInterval(function(){
keepPCAwakeAction();
}, program.interval);
}, movementIntervalInSeconds);

@@ -59,10 +64,23 @@ function keepPCAwakeAction() {

let screenSize = robot.getScreenSize();
let height = (screenSize.height / 2) - 10;
let width = screenSize.width;
const currentPosition = robot.getMousePos();
// Do not move mouse if its moved recently
if(!program.force) {
if(lastKnownPosition.x !== currentPosition.x ||
lastKnownPosition.y !== currentPosition.y) {
logger.log('info', 'The mouse appears to have moved since we last ran, skipping movement.');
return;
}
} else {
logger.log('info', 'Skipping mouse position check.');
}
const screenSize = robot.getScreenSize();
const desiredHeight = (screenSize.height / 2) - 10;
const desiredWidth = screenSize.width / 2;
logger.log('info', 'Moving mouse.');
robot.moveMouse(width, height);
robot.moveMouseSmooth(width / 2, height);
robot.moveMouseSmooth(desiredWidth, desiredHeight);
lastKnownPosition = robot.getMousePos();
}

@@ -69,0 +87,0 @@

{
"name": "working-hardly",
"version": "1.1.3",
"version": "2.0.0",
"description": "Moves your mouse every N seconds.",

@@ -44,4 +44,4 @@ "main": "index.js",

"eslint": "^6.8.0",
"nodemon": "^2.0.2"
"nodemon": "^2.0.4"
}
}
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