npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

plugunplugreminder

v2.0.0

Published

Play & Stop Sound in Node JS Applications using VLC

Downloads

25

Readme

plugUnplugReminder Node Package

Installation

This package provides an Executable Command

So You will have to install this package globally to be able to use this Package.

npm install g plugunplugreminder

or

To Execute Immediately

npx plugunplugreminder

How to Use

Install this Globally then run this command and let it run in the Background and it will let you know to Plug or Unplug your Device

pur

If you want to it run when your Device Boots follow the following steps

  • Create a pur.sh file paste this code inside
#!/bin/bash

# Run the plugUnplugReminder command
pur
  • Now paste the pur.sh file in the startup folder

For Windows

  • Make Sure Git Bash is installed or any other Terminal which can execute Bash Code
  • Make sure when you open the pur.sh file it executes instead of being opened in a text editor
  • To execute the sh file when clicked use the Open With option and open with Bash.exe then select always
  • Now add the Startup Folder path in Environment Variables

So now every time you start your windows laptop this will work.

Save yourself the hassle above and use Pure Battery Add On by Medha Chaitanya

I don't have a Mac Device so I can't help you

Features

  • Monitors battery level and charging status in every Minute.
  • Sends notifications when the battery level is below 20% and not charging, or above 80% while charging.
  • Provides visual feedback in the console with clear and colorful messages.

Source Code

#!/usr/bin/env node

import path from "path";
import { fileURLToPath } from "url";
import notifier from "node-notifier";
import batteryLevel from "battery-level";
import isCharging from "is-charging";
import chalk from "chalk";
import boxen from "boxen";

const __dirname = path.dirname(fileURLToPath(import.meta.url));

async function checkBatteryLevel() {
  const level = await batteryLevel(); // Get battery level
  const charging = await isCharging(); // Check if device is charging

  const plugIn = path.resolve(__dirname, "./plugIn.png");
  const unplug = path.resolve(__dirname, "./unplug.png");

  console.clear();
  console.log(chalk.yellow.bold(boxen("Plug Unplug Reminder", { padding: 1 })));
  console.log(chalk.gray("\nListening to battery level..."));
  console.log(
    chalk.green.bold(`\nCurrent Battery Percentage: ${level * 100}%`)
  );
  console.log(
    chalk.cyan(
      "\nIt will notify you when the battery percentage is below 20% and not Charging & above 80% while Charging."
    )
  );

  if (level < 0.2 && !charging) {
    notifier.notify({
      title: "Plug In Reminder",
      message:
        "Battery level is below 20%. Please plug in your device to keep the battery in optimum health.",
      icon: plugIn,
      sound: true, // Play default system notification sound
    });
    console.log(
      chalk.red.bold("Battery level is low. Reminder sent to plug in device.")
    );
  } else if (level > 0.8 && charging) {
    notifier.notify({
      title: "Unplug Reminder",
      message:
        "Battery level is above 80%. You can unplug your device to keep the battery in optimum health.",
      icon: unplug,
      sound: true, // Play default system notification sound
    });
    console.log(
      chalk.green.bold("Battery level is high. Reminder sent to unplug device.")
    );
  }
}

// Check battery level immediately and then every 60 seconds
checkBatteryLevel(); // Run immediately
const interval = setInterval(checkBatteryLevel, 60 * 1000); // Run every 60 seconds

// Log what the application is doing
process.on("SIGINT", () => {
  clearInterval(interval);
  console.log(chalk.yellow.bold("\nPlugUnplugReminder Stopped."));
});

License

This project is licensed under the MIT License


Made by Sooraj Gupta


Credits for PNG Icons Used

Unplug icon by Icons8 Electrical icon by Icons8