Start LibreWolf Updater thingy
This commit is contained in:
@ -1,3 +1,3 @@
|
|||||||
#Build Number for ANT. Do not edit!
|
#Build Number for ANT. Do not edit!
|
||||||
#Mon Dec 19 22:31:46 UTC 2022
|
#Wed Dec 21 05:02:39 UTC 2022
|
||||||
build.number=308
|
build.number=320
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.i2p.i2pfirefox;
|
package net.i2p.i2pfirefox;
|
||||||
|
|
||||||
import java.awt.AWTException;
|
import java.awt.AWTException;
|
||||||
|
import java.awt.Component;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.awt.Menu;
|
import java.awt.Menu;
|
||||||
import java.awt.MenuItem;
|
import java.awt.MenuItem;
|
||||||
@ -10,6 +11,9 @@ import java.awt.Toolkit;
|
|||||||
import java.awt.TrayIcon;
|
import java.awt.TrayIcon;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.event.MouseListener;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
@ -101,7 +105,9 @@ public class I2PBrowser extends I2PCommonBrowser {
|
|||||||
*
|
*
|
||||||
* @since 0.0.16
|
* @since 0.0.16
|
||||||
*/
|
*/
|
||||||
public I2PBrowser() { initIconFile(); }
|
public I2PBrowser() {
|
||||||
|
initIconFile();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an I2PBrowser class which automatically determines which browser
|
* Construct an I2PBrowser class which automatically determines which browser
|
||||||
@ -287,11 +293,8 @@ public class I2PBrowser extends I2PCommonBrowser {
|
|||||||
ArrayList<String> visitURL = parseArgs(args);
|
ArrayList<String> visitURL = parseArgs(args);
|
||||||
try {
|
try {
|
||||||
if (useSystray) {
|
if (useSystray) {
|
||||||
logger.info("Starting systray");
|
|
||||||
if (systray()) {
|
|
||||||
logger.info("Systray started");
|
|
||||||
}
|
|
||||||
startupSystray();
|
startupSystray();
|
||||||
|
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -339,22 +342,30 @@ public class I2PBrowser extends I2PCommonBrowser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private File initIconFile() {
|
private File initIconFile() {
|
||||||
File icon = new File(runtimeDirectory(""), "icon.png");
|
File iconFile = new File(runtimeDirectory(""), "icon.png");
|
||||||
if (!icon.exists()) {
|
if (!iconFile.exists()) {
|
||||||
InputStream resources =
|
InputStream resources =
|
||||||
I2PBrowser.class.getClassLoader().getResourceAsStream("icon.png");
|
I2PBrowser.class.getClassLoader().getResourceAsStream("icon.png");
|
||||||
try {
|
try {
|
||||||
OutputStream fos = new FileOutputStream(icon);
|
OutputStream fos = new FileOutputStream(iconFile);
|
||||||
copy(resources, fos);
|
copy(resources, fos);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.warning(e.toString());
|
logger.warning(e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return icon;
|
return iconFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TrayIcon initIcon() {
|
private TrayIcon initIcon() {
|
||||||
TrayIcon icon = new TrayIcon(image, "I2P Browser Profile Controller", menu);
|
TrayIcon icon = new TrayIcon(image, "I2P Browser Profile Controller", menu);
|
||||||
|
icon.addMouseListener(new MouseAdapter() {
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
if (e.getClickCount() == 1) {
|
||||||
|
logger.info("Menu clicked");
|
||||||
|
//menu.show(tray, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
icon.setImageAutoSize(true);
|
icon.setImageAutoSize(true);
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
@ -364,6 +375,17 @@ public class I2PBrowser extends I2PCommonBrowser {
|
|||||||
new File(runtimeDirectory(""), "systray.running");
|
new File(runtimeDirectory(""), "systray.running");
|
||||||
if (systrayIsRunningFile.exists()) {
|
if (systrayIsRunningFile.exists()) {
|
||||||
try {
|
try {
|
||||||
|
if (useSystray) {
|
||||||
|
logger.info("Starting systray");
|
||||||
|
try {
|
||||||
|
if (systray()) {
|
||||||
|
logger.info("Systray started");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
logger.info("Adding icon to systray");
|
logger.info("Adding icon to systray");
|
||||||
tray.add(icon);
|
tray.add(icon);
|
||||||
} catch (AWTException e) {
|
} catch (AWTException e) {
|
||||||
@ -429,6 +451,7 @@ public class I2PBrowser extends I2PCommonBrowser {
|
|||||||
public void actionPerformed(ActionEvent e) { shutdownSystray(); }
|
public void actionPerformed(ActionEvent e) { shutdownSystray(); }
|
||||||
});
|
});
|
||||||
menu.add(closeItem);
|
menu.add(closeItem);
|
||||||
|
icon.setPopupMenu(menu);
|
||||||
logger.info("Added close menu item");
|
logger.info("Added close menu item");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
20
src/java/net/i2p/i2pfirefox/I2PLibreWolf.java
Normal file
20
src/java/net/i2p/i2pfirefox/I2PLibreWolf.java
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package net.i2p.i2pfirefox;
|
||||||
|
/**
|
||||||
|
* I2PLibreWolf.java
|
||||||
|
* Copyright (C) 2022 idk <hankhill19580@gmail.com>
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the MIT License. See LICENSE.md for details.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* I2PLibreWolf adds the LibreWolf Updater browser extension if the browser
|
||||||
|
* detected by the Firefox variant launcher is LibreWolf specifically.
|
||||||
|
*
|
||||||
|
* @author idk
|
||||||
|
* @since 1.0.6
|
||||||
|
*/
|
||||||
|
public class I2PLibreWolf {
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user