Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Issues #2

Open
Kotlin-GDE opened this issue Nov 3, 2023 · 1 comment
Open

Some Issues #2

Kotlin-GDE opened this issue Nov 3, 2023 · 1 comment

Comments

@Kotlin-GDE
Copy link

Kotlin-GDE commented Nov 3, 2023

hi

i using java 21, ubuntu 23.10

ScriptEngineManager providers.next(): javax.script.ScriptEngineFactory: Provider apple.applescript.AppleScriptEngineFactory not found
ScriptEngineManager providers.next(): javax.script.ScriptEngineFactory: Provider apple.applescript.AppleScriptEngineFactory not found

why this error and why show twice ?

  1. timeout not work (toast close after default timeout even i specify large amount of seconds)
  2. listeners not triggered (clicked, closed)
  3. customize position of toast
  4. to set icons path, the only way i found is to set an absolute path, so why not allow to use relative path, also how
    change icons size
  5. more documentation for how to customize toasts
@brett-smith
Copy link
Contributor

brett-smith commented Jul 9, 2024

  1. This error happens because two-slices is searching for the best provider for the operating system, and Java seems to output this message (with no way to stop it) when you search for script engines that might not exist. The particular implementation doing this (Growl for Mac OS) was long ago deprecated, so should probably be completely removed anyway. For now though, I have made it so it won't even attempt to look unless on Mac OS. That should stop the error for you.

2,3 and 4 will depend on exactly what toaster implementation is being chosen. It's hard to answer exactly without knowing this.

Being as you you state you are on Ubuntu, DBUSNotifyToaster is the most integrated choice. This will require trhat you have dbus-java-transport-native-unixsocket (https://mvnrepository.com/artifact/com.github.hypfvieh/dbus-java-core) included in your project. If you do not have these DBUS libraries, it will then depend on what GUI toolkit your application is using. You'll either end up with the JavaFXToaster, AWTToaster or SWTToaster (if you have the additional library added). If none of these are available, the fallback NotifyToaster uses the notify-send command if it's available.

Timeouts work on all Linux implementations, so I am going to guess you are using the DBUSNotifyToaster or NotifyToaster because there is a known issue on Ubuntu that I sadly cannot do anything about. https://bugs.launchpad.net/ubuntu/+source/notify-osd/+bug/390508

Listeners not being triggered suggests though that you are using NotifyToaster, as this one does not support any kind of events.

The position of the popups can't really changed for any implementation except the two that two-slices fully implements itself, i.e. JavaFXToaster and SWTToaster. For all other types, the position is dictated by the notification backend. If you use either of these two, then the position can be set thusly ..

ToasterSettings settings = new ToasterSettings();
settings.setPosition(Position.TL); // e.g. top left
ToasterFactory.setSettings(settings);

For you final point 5, unfortunately no, you cannot use relative paths. This is because of the question "relative to what?". The icon might be being actually rendered by a totally different process running in a different location.

From the Javadoc ...

All notification systems support absolute path names to file resources, as well as string representations of URLs. Some may support logical names, such as Freedesktop Icon Names like dialog-info.

Note, it should also support resource URLs fine, so you can used icons bundled in jars as resources. Internally though, these are extract to local absolute file paths as that is the lowest common denominator across all implementations,

The size can currently only be set by the SWTToaster. It is unlikely other toasters will ever get support for this.

ToasterSettings settings = new ToasterSettings();
settings.getHints().put(BasicToastHint.ICON_SIZE, 64);
ToasterFactory.setSettings(settings);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants