omikun / forcenap Goto Github PK
View Code? Open in Web Editor NEWSuspend any one Mac OS apps when not in focus
License: MIT License
Suspend any one Mac OS apps when not in focus
License: MIT License
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!!
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
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.
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
it exist a project called Apppolice which can limit per app cpu usage,And my idea is liking the Project brevent,that
See: https://github.com/jaredks/rumps
Some thoughts:
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)
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.
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?
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.
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?
http://makeareadme.com/ .. is a walk through of many of the things that usually go into readme's
is there any way to execute this script in El Capitan ???
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.