Comments (22)
Thank you for opening this issue!
🔔 @ThatNerdSquared @marcjulianschwarz @GastroGeek @pernielsentikaer @lokot0k @ThatNerdSquared you might want to have a look.
💡 Author and Contributors commands
The author and contributors of ThatNerd/timers
can trigger bot actions by commenting:
@raycastbot close this issue
Closes the issue.@raycastbot rename this issue to "Awesome new title"
Renames the issue.@raycastbot reopen this issue
Reopen the issue.
from extensions.
Hi @ivanmauricio, thanks for using Timers!
That's a weird one - thank you for all the debugging information you've provided.
Do you get a banner notification like this one when your timer finishes?
Also, when did you start having this problem? Did it start ever since you installed the extension, or did it work for you before?
Thanks again.
from extensions.
thanks for your quick reply @ThatNerdSquared!
i'm not getting a banner notification. i've checked the notification system settings for macOS and they are allowed for Script Editor
.
the problem started since I installed the extension on a new macbook (i.e. the end sound has never played on this laptop). i had it on my old macbook and it was working fine.
i've tried uninstalling and installing the extension and also restarting my computer.
I also tried the sleep timer extension (https://www.raycast.com/dtmzr/sleep-timer) as I saw it has similar functionality to this one and that works as intended.
from extensions.
so i downloaded the repo to take a look and looks like the problem is that the command osascript -e 'display notification "Timer \\"${timerName}\\" complete" with title "Ding!"'
doesn't execute and so all the commands after it don't run as they're chained together. i removed the notification command and everything seems to be working so will use my local version for now.
i'm happy that it's working as i was relying on this timer! though would be curious if you have any ideas why osascript
command might not be working from node
on a new machine. i had a look at permissions and have all the same ones as on my old laptop 🤷🏽♂️
here's what i changed the code to in case it's of interest
async function startTimer(timeInSeconds: number, timerName = "Untitled", selectedSound = "default") {
popToRoot();
const fileName = environment.supportPath + "/" + new Date().toISOString() + "---" + timeInSeconds + ".timer";
const masterName = fileName.replace(/:/g, "__");
writeFileSync(masterName, timerName);
const prefs = getPreferenceValues<Preferences>();
const selectedSoundPath = `${
environment.assetsPath + "/" + (selectedSound === "default" ? prefs.selectedSound : selectedSound)
}`;
const cmdParts = [`sleep ${timeInSeconds}`];
const afplayString = `afplay "${selectedSoundPath}" --volume ${prefs.volumeSetting.replace(",", ".")}`;
let alert = "";
if (prefs.selectedSound === "speak_timer_name") {
alert = `say "${timerName}"`;
} else {
alert = afplayString;
}
cmdParts.push(`if [ -f "${masterName}" ]; then ${alert}`);
if (prefs.ringContinuously) {
const dismissFile = `${masterName}`.replace(".timer", ".dismiss");
writeFileSync(dismissFile, ".dismiss file for Timers");
cmdParts.push(`while [ -f "${dismissFile}" ]; do ${afplayString}; done`);
}
cmdParts.push(`rm "${masterName}"; else echo "Timer deleted"; fi`);
exec(cmdParts.join(" && "), (error, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}
});
await showHUD(`Timer "${timerName}" started for ${formatTime(timeInSeconds)}! 🎉`);
}
from extensions.
Hm, okay. Thanks for the detailed testing, that's really helpful. I suspected the command wasn't executing at all but it's very strange that it doesn't work, given I'm only using built-in/system included tooling.
Does that osascript
command work when manually copy-pasted into your terminal?
from extensions.
i just ran osascript -e 'display notification "Hello World!" with title "Ding"'
in the terminal and the banner notification shows up
from extensions.
Hm, okay. What macOS version are you on? I'm on Sonoma 14.2 - not sure if that might be related?
I've also created this simple test script for debugging purposes. If you could save this as notif-test.mjs
and run it with node notif-test.mjs
, that would be helpful in seeing if it's actually exec
and osascript
on your machine that are interacting to cause problems here, or if there are some other errors with how I'm doing things in the extension.
(On running the script, it should send a single banner notification).
import { exec } from "child_process";
async function fireNotif() {
const timerName = "Test Notif";
const cmdParts = [];
cmdParts.push(
`osascript -e 'display notification "Timer \\"${timerName}\\" complete" with title "Ding!"'`
);
exec(cmdParts.join(" && "), (error, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}
});
}
fireNotif();
from extensions.
I tested the script and nothing happened (I also have same issue). I also edited the extension according to @ivanmauricio script and now the extension works. I hear the alarm that is. I'm on 14.4.1 (23E224)Sonoma
from extensions.
Hm, okay. I've just updated to macOS Sonoma 14.4.1 and am still unable to reproduce the issue.
Would you mind checking that you're on Raycast version 1.72.1
? And also, for the "System Events" settings to be on under System Settings > Privacy & Security > Automation > Raycast?
from extensions.
Yes am on newest version of Raycast and yes all these are selected in system settings. I tried running the notif-test.mjs again and this time it worked. Adding sound name also makes a sound.
from extensions.
Warning: -[NSWindow makeKeyWindow] called on RaycastApp.ToastHUDWindow 0x123a68490 which returned NO from -[NSWindow canBecomeKeyWindow].
get this error in console
from extensions.
@asgeirtj do you know what changed between the notif-test.mjs not working and working? I still have not been able to reproduce the issue.
@ivanmauricio have you been able to check any of the debugging steps above? Particularly the System Events setting.
Maybe the Privacy & Security > Accessibility > Raycast
switch also has some effect?
As for the Console error, it looks like something else unrelated in Raycast - @pernielsentikaer can you confirm?
from extensions.
@ThatNerdSquared I tested it inside the directory of my fork of your extension and then it didn't work. Then i tested it in my Downloads folder. No idea if that makes sense since it works now inside the folder. Maybe I just did something wrong. But only thing that's different is that testing it inside the folder then you are inside a git folder. However even though it works the extension doesn't give me a notification so.
from extensions.
@ThatNerdSquared I think this might be some permissions problem I'm experiencing those kinds of problems with more apps (where the accessibility permission reverts and such). Can you please tell me all the permissions needed for this to work? I'm going to try and reset all of them. All I would need with Raycast, Script editor etc in all categories like accessibility, automation, notification also etc.
from extensions.
@asgeirtj the ones I know of are:
- Privacy & Security > Accessibility > Raycast
- Privacy & Security > Automation > Raycast > System Events
- Privacy & Security > Automation > Raycast > Terminal
- Notifications > Script Editor > Allow notifications
These should be all the ones necessary.
I suspect that after the new macOS update, some of these permissions were reset for various apps, including Raycast. Probably Apple patched the bug before I installed the update, or the reset does not happen consistently. This would also make sense with Ivan's report above on the notifications working on an older mac.
from extensions.
@ThatNerdSquared Didn't fix it unfortunately.
from extensions.
A quick update on the situation: I'm currently trying to avoid this problem along with other osascript
limitations by writing a new notification system using Swift to call directly into the platform APIs. I'm not entirely sure if it will work yet, but it seems promising. I'll be working on this over the next couple days - sorry for the delay, hopefully this will solve the issue.
from extensions.
This issue has been automatically marked as stale because it did not have any recent activity.
It will be closed if no further activity occurs in the next 10 days to keep our backlog clean 😊
from extensions.
This issue has been automatically closed due to inactivity.
Feel free to comment in the thread when you're ready to continue working on it 🙂
You can also catch us in Slack if you want to discuss this.
from extensions.
@raycastbot reopen this issue
Unfortunately, the more robust fix I had been working on above was not allowed into the Raycast store due to various technical limitations. The team has informed me they're working on making this possible, but for now I will not be able to improve the notification system significantly.
For now, I've just submitted to the store a "bandaid fix" - this should separate the sound command from the notification, such that if the osascript
call fails, the sound should still play. Unfortunately this still does not address notifications not showing up from osascript
, but, as stated above, there's not much I can do about that at the moment.
from extensions.
@raycastbot reopen this issue
Unfortunately, the more robust fix I had been working on above was not allowed into the Raycast store due to various technical limitations. The team has informed me they're working on making this possible, but for now I will not be able to improve the notification system significantly.
For now, I've just submitted to the store a "bandaid fix" - this should separate the sound command from the notification, such that if the
osascript
call fails, the sound should still play. Unfortunately this still does not address notifications not showing up fromosascript
, but, as stated above, there's not much I can do about that at the moment.
Just wanted to report that the fix is working and I see the Script Editor notification
from extensions.
Just wanted to report that the fix is working and I see the Script Editor notification
That's great to hear! Looks like the Script Editor notification is a bit volatile then, I guess macOS started re-recognizing the permissions.
I'll be closing this issue and #11897 now, given that the fix seems to be working properly, but feel free to reopen or open a new one if you find any other bugs, or have any feature requests :)
@raycastbot close this issue
from extensions.
Related Issues (20)
- Claude HOT 1
- Input/Output presets [Set Audio Device] HOT 4
- [Raindrop.io] Add support for Vivaldi for "Save Browser Tab" feature HOT 1
- [Next.js Documentation] No documentation HOT 1
- [Google Meet] ... HOT 10
- [YouTube Music] ... HOT 1
- [Apple Reminders] Wrong Date HOT 2
- [Coffee] Countdown HOT 4
- [Clipboard History] Always Pin Today's History To The Top HOT 2
- [Arc] Failed to fetch latest data HOT 1
- Everhour Time Tracking not loading tasks HOT 1
- [YouTube Downloader] ... HOT 4
- Bitwarden unable to log in into the vault HOT 3
- [OBS Control] Toggle Virtual Camera erroring out on OBS 30.2.0 HOT 3
- [Things] Tags not applying to new todo HOT 2
- [Hue] After several changes to mapping of lights to rooms, "Set Scene" crashes in Raycast. "Control Groups" still works. HOT 1
- [SimpleTexOCR] "The maximum number of concurrent requests exceeded, please try again later" HOT 1
- [Time-Traveling World Clock] Add day of the week with Time. HOT 1
- [Time-Traveling World Clock] Add country flag as icon HOT 2
- Figma File Search fails to provide access to raycast HOT 3
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 extensions.