Comments (4)
Seems to be the same as #147. Ultimately, if the command is returning the wrong information even outside the workflow, there’s nothing I can do. If you do find the cause I can try working around it, but without being able to reproduce I don’t have options for a fix.
Perhaps something changed in Ventura to cause this behavior?
Nope, it still works for me. The update itself may have borked something, though. I’ve been affected by different issues which few other people have, and I’ve also seen the reverse online. As soon as I get the chance I’ll do a fresh install of macOS.
from alfred-workflows.
What's interesting from the previous thread you referenced is this command works fine:
- disabled DND
- enabled DND
- disabled DND
It seems access to the file referenced in dndActive
is not available which leads to this behavior:
I got this working by leveraging the command you share in the other thread. I switched the filter type to zsh
and used the following code:
dnd=`/usr/bin/defaults read com.apple.controlcenter 'NSStatusItem Visible FocusModes'`
# DND enabled
if [ $dnd -eq 1 ]; then
cat << EOB
{
"rerun" : 0.5,
"items": [{
"title": "Turn it off",
"subtitle": "Allow notifications again",
"arg": "off",
"icon": { "path": "icon_alt.png" }
}]
}
EOB
exit
else
# DND disabled
givenTimeout=$1
# Any given value must start with a digit
if [ -z "$givenTimeout" ] || ! [[ "$givenTimeout" =~ ^[0-9] ]]; then
cat << EOB
{
"rerun" : 0.5,
"items": [{
"title": "Turn it on",
"subtitle": "Stop notifications from going through",
"arg": "on"
}]
}
EOB
exit
fi
# Calculate timeout
if [[ "$givenTimeout" =~ ^[0-9]+.h ]]; then
timeoutMinutes=$((`echo $givenTimeout | grep -o -E '[0-9]+'` * 60))
else
timeoutMinutes=`echo $givenTimeout | grep -o -E '[0-9]+'`
fi
# Calculate plurality
if [ $timeoutMinutes -gt 1 ]; then
plurality="minutes"
else
plurality="minute"
fi
cat << EOB
{
"rerun" : 0.5,
"items": [{
"title": "Turn it on",
"subtitle": "Stop notifications from going through for ${timeoutMinutes} ${plurality}",
"arg": ${timeoutMinutes}
}]
}
EOB
fi
from alfred-workflows.
@vitorgalvao Updated to MacOS 13.1 today and the issue persisted. While my code above works, I realize you might not want to replace yours.
If you replace your current dndActive
function with the below code, it resolves this issue.
function dndActive() {
app = Application.currentApplication()
app.includeStandardAdditions = true
const check = app.doShellScript("/usr/bin/defaults read com.apple.controlcenter 'NSStatusItem Visible FocusModes'")
if (check == 1) return true
return false
}
from alfred-workflows.
I’ve updated the workflow to now check status even with the shortcut. Hopefully this means macOS updates will no longer cause breaks. It now lives at a different repo.
Download it from the releases, it will be in the Gallery soon.
from alfred-workflows.
Related Issues (20)
- Add feature to override preserving extension for RenameAction HOT 1
- WatchList: option to 'not Trash' after watching HOT 2
- Feature Request / Questions HOT 1
- CalmNotifications doesn't give the option to turn off the workflow HOT 1
- DownMedia Enhancement - Videos with Passwords HOT 1
- coffee cannot work on alfred 5 HOT 3
- CalmNotifications - execution error HOT 2
- ANU QRNG is currently down HOT 1
- macupdater_client does not exit if scans too frequent, hangs scripts HOT 3
- Support for MacPorts PATH HOT 1
- Workflow not executing HOT 1
- Make it work with Orion Browser? HOT 1
- Bug alfred-workflows HOT 1
- Is there any way to keep the workflow environment variables when updating? HOT 4
- Temporary Email: Can it work with firefox? HOT 3
- TemporaryEmail: Support for Arc Browser HOT 5
- Arc Browser compatibility HOT 3
- Feature Request : Make it Arc (chromium) compatible HOT 1
- IncognitoClone - Not Working Properly HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alfred-workflows.