go-appimage icon indicating copy to clipboard operation
go-appimage copied to clipboard

Need a way to disable all desktop notifications

Open ghost opened this issue 3 years ago • 11 comments

I'd prefer everything to go in a log file somewhere, I don't need desktop notifications.

Is there a way to disable these? I don't see documentation pointing me how to do this anywhere....

ghost avatar Oct 21 '21 22:10 ghost

This is currently not posisble but if you'd like to implement it I would welcome a pull request.

You could probably change

https://github.com/probonopd/go-appimage/blob/e0577130d6f626aece6a983df800cf9d473d75e2/src/appimaged/notification.go#L22

to write to a log file in case one exists, or something like that.

probonopd avatar Oct 23 '21 11:10 probonopd

@probonopd I would need to learn Go first before submitting a patch ~ steep curve for a minor feature request!

But, I was thinking that if there existed a config option in ~/.config/systemd/user/appimaged.service ... something like Notifications=FALSE that these desktop notifications would just be skipped altogether.

To me, this would seem like something an experienced Go programmer would be able to implement in a short time.

ghost avatar Nov 10 '21 17:11 ghost

It's totally worth learning (and not too hard). In fact,I was learning it "along the way" while I was working on go-appimage.

probonopd avatar Nov 10 '21 18:11 probonopd

I too would love to see a feature like this implemented. However, I don't have any time to learn Go.

589290 avatar Mar 28 '22 17:03 589290

It's totally worth learning (and not too hard). In fact,I was learning it "along the way" while I was working on go-appimage.

Lmao same, while working on this project I was learning go.

pegvin avatar Mar 28 '22 20:03 pegvin

I too would love to see a feature like this implemented. However, I don't have any time to learn Go.

Don't worry bro, I'll implement it and send a pr soon!

pegvin avatar Mar 28 '22 20:03 pegvin

Hey @probonopd

I've Implemented The Logic But I am confused how do i get the information that user wants to show or not show the notifications.

My Code RN:

import (
	...
	"log/syslog"
)

// notification.go
func sendUpdateDesktopNotification(ai *AppImage, version string, notificationInLog bool, _ string) {
	if notificationInLog {
		logWriter, err := syslog.New(syslog.LOG_SYSLOG, "AppImaged")
		if err != nil {
			log.Fatalln("Unable to set logfile:", err.Error())
		} else {
			log.SetOutput(logWriter)
			log.Println(ai.Name + " can be updated to version " + version + ".")
			return
		}
	}
        ...
}

pegvin avatar Mar 29 '22 07:03 pegvin

Hey @probonopd

I've Implemented The Logic But I am confused how do i get the information that user wants to show or not show the notifications.

My Code RN:

import (
	...
	"log/syslog"
)

// notification.go
func sendUpdateDesktopNotification(ai *AppImage, version string, notificationInLog bool, _ string) {
	if notificationInLog {
		logWriter, err := syslog.New(syslog.LOG_SYSLOG, "AppImaged")
		if err != nil {
			log.Fatalln("Unable to set logfile:", err.Error())
		} else {
			log.SetOutput(logWriter)
			log.Println(ai.Name + " can be updated to version " + version + ".")
			return
		}
	}
        ...
}

If your just trying to read the service file, then gopkg.in/ini.v1 is a good library to read and write ini files (which service files generally follow). If you want examples on how it's used, it's used in goappimage to parse app's desktop files.

CalebQ42 avatar Mar 29 '22 13:03 CalebQ42

Maybe we could check for the presence of the file ~/.config/appimaged/no_desktop_notifications and if it exists, show no desktop notifications.

probonopd avatar Mar 31 '22 17:03 probonopd

AppImaged

It's appimaged. Upper/CamelCase for GUI applications, lowercase for command line tools.

probonopd avatar Mar 31 '22 17:03 probonopd

Maybe we could check for the presence of the file ~/.config/appimaged/no_desktop_notifications and if it exists, show no desktop notifications.

Much better and simple

pegvin avatar Apr 01 '22 10:04 pegvin