Comments (6)
Go doesn't support fork()
in the way used by libtinynotify-systemwide, due to the way the Golang runtime works: it needs multiple Go routines which might map to multiple OS-level threads. After a fork()
syscall only the current OS-level thread would be running in the child, with the other OS-level threads lost, which might happen to have the garbage collector, background IO handlers, et cetera.
Go only supports running a new process (as a child) from some binary. What actually is possible (and what I am doing in a the lxkns package), is to run the same binary /proc/self/exe
again as a child process via Command.Start()
. You can pass some special env variable or CLI flag to tell the child to just carry out connecting to a dedicated dbus instance. Of course, you need to write all the parameter passing from parent to re-executed child.
from beeep.
It is already like that in code https://github.com/gen2brain/beeep/blob/master/alert_darwin.go#L14, i.e. tell System Events. Did you try to use it, what happens and what is expected?
from beeep.
On Linux the notifications only work for the user that the function is run as.
Running beeep with sudo will not create notifications for the user on Linux.
It would be nice if beeep as root would notify users of the system.
from beeep.
There is support currently for sw-notify-send
that I use, repo is here https://github.com/mgorny/libtinynotify-systemwide/ .
As written there "All it does is looking over procfs (/proc) for all D-Bus session buses,
and trying to send the notification to every one of them". I think all that can be reproduced in Go, just not sure about the fork()
and setreuid()
, it seems it is needed and Go still has some issues with it.
from beeep.
Thanks @gen2brain I will look into that a little more.
from beeep.
If someone stumbles on this issue, here is workaround I found:
godbus/dbus#246
You can rename main
function to init
in reproducer code from the issue above and in new main function run beeep.Notify
and it will just work.
Note: you need dbus version from this pr: godbus/dbus#247
from beeep.
Related Issues (20)
- Add support for tray icons HOT 4
- Support for supplying image-data as a blob HOT 3
- Blink icon app notification HOT 4
- Clicking the notification opens AppleScript editor HOT 3
- Go module support? HOT 1
- `title` and `message` not escaped when using AppleScript on macOS HOT 3
- Icon not displayed HOT 3
- Macos icon HOT 2
- Use terminal-notifier or alerter when available HOT 4
- How to use icon on macOS ? HOT 1
- Support for *BSD (e.g: FreeBSD) HOT 22
- go install support HOT 3
- Alert() `title` and `message` not escaped when using AppleScript on macOS HOT 2
- Windows 11 support? HOT 7
- allow for passing in applicationID
- Support for notification urgency HOT 2
- Support for closing notifications HOT 3
- The terminal is cleared on Windows 11 when sending a notification HOT 4
- Window 7 does not automatically close the system tray icon
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 beeep.