new icon, fix headless systems crashing

This commit is contained in:
Aria Moradi 2021-02-24 11:55:43 +03:30
parent 9613cda79a
commit 7c1c504482
4 changed files with 39 additions and 30 deletions

View File

@ -27,45 +27,54 @@ fun applicationSetup() {
} }
fun openInBrowser() { fun openInBrowser() {
Desktop.browseURL("http://127.0.0.1:4567") try {
Desktop.browseURL("http://127.0.0.1:4567")
} catch (e1: IOException) {
e1.printStackTrace()
}
} }
val icon = Main::class.java.getResource("/icon/faviconlogo.png") val icon = Main::class.java.getResource("/icon/faviconlogo.png")
fun systemTray(): SystemTray? { fun systemTray(): SystemTray? {
// ref: https://github.com/dorkbox/SystemTray/blob/master/test/dorkbox/TestTray.java try {
SystemTray.DEBUG = true; // for test apps, we always want to run in debug mode // ref: https://github.com/dorkbox/SystemTray/blob/master/test/dorkbox/TestTray.java
if (System.getProperty("os.name").startsWith("Windows")) SystemTray.DEBUG = true; // for test apps, we always want to run in debug mode
SystemTray.FORCE_TRAY_TYPE = TrayType.Swing if (System.getProperty("os.name").startsWith("Windows"))
SystemTray.FORCE_TRAY_TYPE = TrayType.Swing
CacheUtil.clear() CacheUtil.clear()
val systemTray = SystemTray.get() ?: return null val systemTray = SystemTray.get() ?: return null
val mainMenu = systemTray.menu val mainMenu = systemTray.menu
mainMenu.add( mainMenu.add(
MenuItem( MenuItem(
"Open Tachidesk", "Open Tachidesk",
ActionListener { ActionListener {
try { try {
Desktop.browseURL("http://127.0.0.1:4567") Desktop.browseURL("http://127.0.0.1:4567")
} catch (e1: IOException) { } catch (e: IOException) {
e1.printStackTrace() e.printStackTrace()
}
} }
} )
) )
)
// systemTray.setTooltip("Tachidesk") // systemTray.setTooltip("Tachidesk")
systemTray.setImage(icon) systemTray.setImage(icon)
// systemTray.status = "No Mail" // systemTray.status = "No Mail"
systemTray.getMenu().add( systemTray.getMenu().add(
MenuItem("Quit") { MenuItem("Quit") {
systemTray.shutdown() systemTray.shutdown()
System.exit(0) System.exit(0)
} }
) )
return systemTray return systemTray
} catch (e: Exception) {
e.printStackTrace()
return null
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 KiB

View File

@ -2,14 +2,14 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<link rel="icon" href="%PUBLIC_URL%/favicon.ico"/> <link rel="icon" href="%PUBLIC_URL%/faviconlogo.ico"/>
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width"/> <meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width"/>
<meta name="theme-color" content="#000000"/> <meta name="theme-color" content="#000000"/>
<meta <meta
name="description" name="description"
content="Web site created using create-react-app" content="A manga reader that runs tachiyomi's extensions"
/> />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png"/> <link rel="apple-touch-icon" href="%PUBLIC_URL%/faviconlogo.png"/>
<!-- <!--
manifest.json provides metadata used when your web app is installed on a manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL. work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`. Learn how to configure a non-root public URL by running `npm run build`.
--> -->
<title>React App</title> <title>Tachidesk</title>
</head> </head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>