Code Monkey home page Code Monkey logo

forcenap's People

Contributors

dagbrown avatar joesanford avatar omikun avatar sadovnychyi 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

forcenap's Issues

Compatibility List

I think it'd be a good idea to consolidate a "Compatibility List" since napping some apps will cause them to hang indefinitely unless the script is killed and restarted. I use iTerm2 and made the mistake of doing the default "nap everything" setting. It napped even the calling shell so that caused some issues lol.

Rename tech to MacNap

You can just straight rename the repo in GitHub. All incoming links to the old URL get forwarded just fine :)

or MacNapper or NapMac !

Aim big!!

MAKE file for compiling

I see the README.md but the compile instructions could be easier.

Having a MAKE file would make it easier to follow. Or maybe a BUILDING.md or COMPILING.md file?

New logo/icon

Hi, I am a graphic designer, I want to help others in graphic design.

After I reviewed your project, you have no logo on this project. Therefore I want to contribute to this project by creating a new logo / icon. what do you think?

python in High sierra

In High Sierra I've got this:

/usr/bin/python /Users/masteranza/Projects/MyAppNap/myAppNap.py Spotify Monitoring Spotify, with PIDs: ['528', '607', '611', '612', '619'] Currently focused on iTerm2 Stopping Spotify Traceback (most recent call last): File "/Users/masteranza/Projects/MyAppNap/myAppNap.py", line 64, in <module> os.kill(pid, signal.SIGSTOP) TypeError: an integer is required

A simple cast to int fixes the problem:
os.kill(int(pid), signal.SIGCONT)
os.kill(int(pid), signal.SIGSTOP)

utf support

hi

i have this result when running:


~/workspace/MyAppNap> /usr/bin/python myAppNap.py Zdjęcia
Invalid app name, will not suspend/resume anything
        Will monitor apps in focus, switch to your desired app to see valid name
Currently focused on Terminal
myAppNap.py:53: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if last_active_app == desiredApp:

Currently focused on Zdjęcia # its photos app in polish

Currently focused on Terminal


^C
Exiting script
~/workspace/MyAppNap> /usr/bin/python myAppNap.py Trello 
Monitoring Trello, with PIDs: ['2018', '2019', '2028', '2030'] # multiple PIDs, not working then
Currently focused on Terminal
Stopping Trello
Traceback (most recent call last):
  File "myAppNap.py", line 64, in <module>
    os.kill(pid, signal.SIGSTOP)
TypeError: an integer is required

Publish to Homebrew

Many developers use brew to install known apps and dependencies. Would be nice to add this to brew cask so that developers can get updates without continually checking for the latest release here.

Improvement: Replace the polling loop with use of the NSWorkspace's notificationCenter

Presently, the script uses a polling loop to check the NSWorkspace's activeApplication (note: activeApplication is deprecated). It would be more efficient to register an observer for notification name NSWorkspaceDidActivateApplicationNotification, which notification is sent just as soon as an application is activated/focused.

I experimented with this approach in a currently private fork of this repository. Handling Ctrl+C / SIGINT was somewhat tricky, but I posted about how to do this on Stack Overflow:
https://stackoverflow.com/questions/49092405/how-to-register-a-sigint-handler-that-will-run-as-soon-as-ctrlc-is-pressed

High CPU Usage when running the script

I wanted to try out this tool on Safari just to see how it works, however as these screenshots show, the script itself is using a lot more CPU power (and logically battery) than Safari does (and yes I know Safari probably already does AppNap). The first image is with the script running, second without. Also it tends to crash Safari once I kill the script.

screen shot 2018-03-04 at 2 45 20 pm

screen shot 2018-03-04 at 2 45 40 pm

Future Feature Implementations

Some thoughts:

  • Menu bar integration where you can select open apps to nap
  • Universal timer that naps all apps after X amount of time
  • Specific timers to nap select apps after X amount of time
  • Whitelist to prevent selected apps to nap and avoid conflicts (e.g. Chrome)
  • Option to nap only when on battery
  • Option to allow power source to dictate if apps nap or not (e.g. switching to battery naps apps and switching from battery to power source prevents/turns off naps)
  • When switching foreground app to fullscreen mode nap all other background apps
  • Warning list for apps that may be conflicted (e.g. Chrome and Firefox)
  • Keyboard shortcuts
  • Alfred workflow implementation
  • Timer to track how long an app has napped
  • Recommend an app or apps to nap based upon energy usage and lack of activity after X amount of time

I am planning for restart this project

it exist a project called Apppolice which can limit per app cpu usage,And my idea is liking the Project brevent,that

  1. limit the cpu usage of Non-First-front App,and being more strict by time,
  2. force Nap that app after out of time
  3. periodly restart backgound apps to let them sync with server.

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.