Giter Site home page Giter Site logo

beeep's People

Contributors

altoid0 avatar anjannath avatar equim-chan avatar florianloch avatar gen2brain avatar hhh0pe avatar itanken avatar leonjza avatar martinlindhe avatar muesli avatar nervo avatar owenthereal avatar pasqualguerrero avatar prologic avatar r10r avatar sjmulder avatar stefanb avatar xiorcal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beeep's Issues

Replace MessageBox with Toast notification for windows 8+?

Hello @gen2brain ,

First of all, I'm glad that I have the chance to welcome this library to the Go Community by opening the first issue here! You did a very good job, it's quite simple library but structured very well and you can extend it even more.

I was thinking instead of using the message box, if windows 8 or windows 10 then use the toast notification (right-side notification box, just like more window apps do it) because message box is good for showing errors and things like that but I think showing "information" as notification is the best option to go.

Open application from the Notifications dialog

There is a way so that when the user gets a notification, they can click it and it will open an application, passing in a route path and it will take them directly to the data that corresponds to the Notification.

Simple example being email.
You get a Notification of " my Amazon order will arrive today", and you click it and it opens the Email app and take you to the exact email.

I saw a golang library that did just this, and it would be an awesome compliment to this library but cant fo the life of me find it on github :)

windows 10 version not recognized

hi!

trying to use a basic err := beeep.Notify("Title", "Message body", "assets/icon128.png")
I go t the following panic : panic: exec: "msg": executable file not found in %PATH%

I dug a little and found that getWindowsVersionString() returns unknown on my computer

package main

import (
	"bytes"
	"fmt"
	"os/exec"
	"strings"
)

func main() {
	cmd := exec.Command("cmd", "ver")
	var out bytes.Buffer
	cmd.Stdout = &out
	err := cmd.Run()
	if err != nil {
		panic(err)
	}
	fmt.Println(out.String())
	s := strings.Replace(out.String(), "\r\n", "", -1)
	p1 := strings.Index(s, "[Version")
	p2 := strings.Index(s, "]")
	var ver string
	if p1 == -1 || p2 == -1 {
		ver = "unknown"
	} else {
		ver = s[p1+9 : p2]
	}
	fmt.Printf("%v\n", ver)
}

outputs

go run .\main.go
Microsoft Windows [version 10.0.16299.192]
(c) 2017 Microsoft Corporation. Tous droits r�serv�s.


unknown

seems to me that it comes from the lower case "version" instead of the expected "Version"

How to use icon on macOS ?

I can see an simple explanation here https://github.com/gen2brain/beeep#macos but what to write on the beeep.Alert(title, message, "??") method ?

You are using assets directory but I don't have any assets in my bundle, which is work fine by the way (Application icon, system tray).

➜ tree Twitch\ Clip.app
drwxr-xr-x    - quentin  9 May 20:38 Twitch Clip.app
drwxr-xr-x    - quentin  9 May 20:38 └── Contents
.rw-r--r--  456 quentin  9 May 20:38    ├── Info.plist
drwxr-xr-x    - quentin  9 May 21:04    ├── MacOS
.rwxr-xr-x 9.8M quentin  9 May 21:04    │  └── twitch-clip
drwxr-xr-x    - quentin  9 May 20:38    └── Resources
.rw-r--r--  91k quentin  9 May 20:38       ├── icon.icns
.rw-r--r--  17k quentin  9 May 20:38       └── logo.png

I only have the AppleScript icon.

How to bundle app icons

For icons to show up when using Alert() or Notify(), you will need to bundle your application with a app icon.

Any example on how to do this? I can't seem to find good information on Google.

Thank you for your hard work!

`title` and `message` not escaped when using AppleScript on macOS

func Notify(title, message, appIcon string) error {
...
	cmd := exec.Command(osa, "-e", `display notification "`+message+`" with title "`+title+`"`)
func Alert(title, message, appIcon string) error {
...
	cmd := exec.Command(osa, "-e", `tell application "System Events" to display notification "`+message+`" with title "`+title+`" sound name "default"`)

the code calls the binary osascript, but it fails if title or message contains a double quotation mark

go install support

Go get has been deprecated. Please update this repo to support go install

allow for passing in applicationID

Would you consider adding support for passing a custom applicationID to the Notify() method? Perhaps it could be solved using the functional options pattern, to avoid breaking API.

Also, I can't really understand why beeep digs out that powershell appID for use in toastNotify? Why powershell? Because, like, go-toast happens to use some powershell-shenanigans to actually show the toast? But then you get the powershell icon/name in the title of the toast. It would make sense to be if users of beeep could instead set the appID

Windows 11 support?

Anyone knows if this package works with windows 11 aswell? Because i'm trying to implent it in my application but it doesn't send any system notification, i managed to make work only the beeep.Beep() .

Windows 10 encoding

Hello, in windows 10 notify window has unreadable characters if string not english

err := beeep.Notify("привет", "привет", "assets/information.png")

Clicking the notification opens AppleScript editor

As the title says, with the example like :

package main

import (
	"github.com/gen2brain/beeep"
)

func main() {

	err := beeep.Notify("Title", "Message body", "")
	if err != nil {
		panic(err)
	}

	select {}
}

When the notification is clicked it will open the AppleScript editor. This seems to be a side effect from using the applescript approach: https://discussions.apple.com/thread/6449168

This issue is pretty old so maybe a solution was become available in the meantime?

Support for closing notifications

https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html

Taken from the spec:

org.freedesktop.Notifications.CloseNotification

void org.freedesktop.Notifications.CloseNotification ( );  
UINT32 id;
 

Causes a notification to be forcefully closed and removed from the user's view. It can be used, for example, in the event that what the notification pertains to is no longer relevant, or to cancel a notification with no expiration time.

Add support for tray icons

Just started using the library and I like how it has been written using pure go and syscalls. While there are cgo packages that handle system tray icons i haven't found one that uses syscalls and was thinking of trying it. Would it be within the scope of this project to add that in? If so I will start looking into it.

Macos icon

In the readme it states "For icons to show up when using Alert() or Notify(), you will need to bundle your application with a app icon." but I'm not sure how that should work.

I've created an app bundle like so:

> tree danotify.app

danotify.app
└── Contents
    ├── MacOS
    │   └── danotify
    ├── Resources
    │   └── icon.icns
    └── info.plist

3 directories, 3 files

And the app has the icon I assigned, but notifications are still the default 'pen on paper' icon

Support for notification urgency

https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html

Taken from the spec:

Urgency Levels

Notifications have an urgency level associated with them. This defines the importance of the notification. For example, "Joe Bob signed on" would be a low urgency. "You have new mail" or "A USB device was unplugged" would be a normal urgency. "Your computer is on fire" would be a critical urgency.

Urgency levels are defined as follows:

Table 3. Urgency Levels

Type Description
0 Low
1 Normal
2 Critical

Developers must use their own judgement when deciding the urgency of a notification. Typically, if the majority of programs are using the same level for a specific type of urgency, other applications should follow them.

For low and normal urgencies, server implementations may display the notifications how they choose. They should, however, have a sane expiration timeout dependent on the urgency level.

Critical notifications should not automatically expire, as they are things that the user will most likely want to know about. They should only be closed when the user dismisses them, for example, by clicking on the notification.

win 8.1 - no alerts nor notifications

Can't get this to display in win 8.1. Instead it comes up with an error "2019/01/13 02:15:38 exec: "msg": executable file not found in %PATH%"

What msg executable?

Support BSD's

All the BSD's use the same notify-send program as Linux. It would be nice to see this working.

building for windows from osx

I cant get a Windows build :)

I have a setup for cross platform builds running from OSX and Linux.
But I cant build for Windows from OSX.

Would appreciate advice here !

Step to repo:


make build-win-fromosx

Makefile you can run from anywhere:



LIB=github.com/gen2brain/beeep
LIB_FSPATH=$(GOPATH)/src/$(LIB)

NAME=n

print:
	@echo Lib  -
	@echo LIB :$(LIB)
	@echo LIB_FSPATH  : $(LIB_FSPATH)
	#cd $(LIB_FSPATH) && ls -al 
	@echo


dep:
	go get $(LIB)

open-code:
	code $(LIB_FSPATH)

open-bash:
	bash $(LIB_FSPATH)


build-list:
	cd $(LIB_FSPATH) && ls -al

build-clean:
	cd $(LIB_FSPATH) && rm -rf $(NAME) go$(NAME) $(NAME).exe go$(NAME).exe *.tar.gz

build-win-fromosx:
	brew install mingw-w64

	go get gopkg.in/toast.v1

	#windows with cgo. It needs CGO
	#apt-get install gcc-multilib 
	#apt-get install gcc-mingw-w64
	cd $(LIB_FSPATH) && CC=i686-w64-mingw32-gcc-win32 CGO_ENABLED=1 GOOS=windows GOARCH=386 go build -o $(NAME).exe && tar zcfv "$(NAME)-windows-386.tar.gz" $(NAME).exe
	cd $(LIB_FSPATH) && rm -rf $(NAME).exe
	cd $(LIB_FSPATH) && CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -o $(NAME).exe && tar zcfv "$(NAME)-windows-amd64.tar.gz" $(NAME).exe
	cd $(LIB_FSPATH) && rm -rf $(NAME).exe

build-win-fromlinux:
	#windows with cgo
	#apt-get install gcc-multilib 
	#apt-get install gcc-mingw-w64
	cd $(LIB_FSPATH) && CC=i686-w64-mingw32-gcc-win32 CGO_ENABLED=1 GOOS=windows GOARCH=386 go build -o $(NAME).exe && tar zcfv "$(NAME)-windows-386.tar.gz" $(NAME).exe
	cd $(LIB_FSPATH) && rm -rf $(NAME).exe
	cd $(LIB_FSPATH) && CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -o $(NAME).exe && tar zcfv "$(NAME)-windows-amd64.tar.gz" $(NAME).exe
	cd $(LIB_FSPATH) && rm -rf $(NAME).exe


build-linux:
	#linux 
	go get github.com/godbus/dbus
	
	cd $(LIB_FSPATH) && CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -o $(NAME) -ldflags "-s -w" && tar zcfv "$(NAME)-linux-386.tar.gz" $(NAME)
	cd $(LIB_FSPATH) && rm -rf $(NAME)
	cd $(LIB_FSPATH) && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(NAME) -ldflags "-s -w" && tar zcfv "$(NAME)-linux-amd64.tar.gz" $(NAME)
	cd $(LIB_FSPATH) && rm -rf $(NAME)

build-darwin:
	#darwin
	cd $(LIB_FSPATH) && CGO_ENABLED=0 GOOS=darwin GOARCH=386 go build -o $(NAME) -ldflags "-s -w" && tar zcfv "$(NAME)-darwin-386.tar.gz" $(NAME)
	cd $(LIB_FSPATH) && rm -rf $(NAME)
	cd $(LIB_FSPATH) && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o $(NAME) -ldflags "-s -w" && tar zcfv "$(NAME)-darwin-amd64.tar.gz" $(NAME)
	cd $(LIB_FSPATH) && rm -rf $(NAME)

	

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.