shawnrice / alfred-2-caffeinate-workflow Goto Github PK
View Code? Open in Web Editor NEWAn Alfred2 workflow to control the system caffeinate utility (prevents sleep).
License: MIT License
An Alfred2 workflow to control the system caffeinate utility (prevents sleep).
License: MIT License
I Think this cause by:
VPREFS="$HOME/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/"
NVPREFS="$HOME/Library/Application Support/Alfred 2/Workflow Data/"
by change NVPREFS variable:
NVPREFS="$HOME/Library/Application Support/Alfred 2/Workflow Data/"
It works!
Is there a way to set a default timeout, i.e. can I make it so that if I activate caffeinate without any arguments, it would be automatically disabled after say, 5 hours?
It looks like the check for whether caffeinate is running forever doesn't always work. For me, in script.sh
on line 35, $total
is 0, not empty.
if [[ -z "$total" ]]; then
The check should be something like
if [[ -z "$total" || "$total" == 0 ]]; then
When invoking workflow search command
ps -eo etime,args|grep -w caffeinate|grep -v grep|sed -e 's|^[[:space:]]*||'
on my system, I get following results:
16:39 /bin/bash /Users/schrodinger_cat/Library/Scripts/com.plexapp.plexmediaserver.caffeinate.sh
05:41 /Applications/Alfred 3.app/Contents/Preferences/Alfred Preferences.app/Contents/MacOS/Alfred Preferences /Users/schrodinger_cat/Downloads/caffeinate_control.alfredworkflow
00:07 caffeinate -s -t 300
The problem is, this gives false positive results when searching, therefore workflow is always showing that caffeinate is activated and prevents enabling of caffeinate command.
Most of the time I want Caffeinate to let my display sleep, but sometimes I want to keep it on. Could you add a parameter to the command to let me specify a one-off mode override?
Also, an option to disable the screen saver would be nice.
Got this error:
[ERROR: alfred.workflow.action.script] Code 0: cat: $HOME/Library/Application Support/Alfred 2/Workflow Data/com.shawn.patrick.rice.caffeinate.control/preferences: No such file or directory
There's no com.shawn.patrick.rice.caffeinate.control/
under Alfred 2/Workflow Data/
.
Great workflow! But there is an issue. The "configuration" dialog refused to display on my system. I traced the problem to file "conf-and-help.scpt" and particularly the following lines:
set the file_ to open for access file path_
try
set text_ to read the contents of file_
on error errMsg
set text_ to "d"
end try
close access the file_
Basically, the "open" command was raising an exception on my system, which prevented the "configuration" dialog from displaying. The exception was because the preferences file did not exist yet. I suggest the following change:
try
set the file_ to open for access file path_
set text_ to read the contents of file_
close access the file_
on error errMsg
set text_ to "d"
end try
A second, but almost insignificant issue is the preferences file path. Currently, the preferences file is saved in "com.caffeinate.control.shawn.patrick.rice", but the workflow bundle ID is "com.shawn.patrick.rice.caffeinate.control". This leads to the creation of two different directories for the same workflow.
Howdy!
I'm a big fan of this workflow, and as part of some automation I'm looking to add it as a submodule to one of my own repos.
I noticed there's not a license file or note in the repo; would it be possible to add one?
The workflow does not work on Alfred v4. It is probably just a matter of updating some paths in the library.sh file, but I did not manage to make it work
Looks like the standartized place for workflow searches
Title says it all! Not sure how to fix, running Alfred 4 and this issue was hard to find an answer to. Thanks so much!
When turning caffeinate on the display and CPU still go to sleep. I'm using Alfred 4 so I assume it's to do with the update?
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.