1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-11-30 04:30:47 +01:00

make tray icon configurable, disabled by default

This commit is contained in:
Robin Appelman 2026-11-08 16:32:47 +01:00
commit 2de025694f
Signed by: robin
SSH key fingerprint: SHA256:kifqgrqnut7q1YUIrI0AdMNC23qiKAS/T9uGFmIYvbE
3 changed files with 9 additions and 2 deletions

View file

@ -27,6 +27,7 @@ Add the following configuration to the `haze.toml` configuration file:
address = "haze.example.com" # the base domain for the proxy to use address = "haze.example.com" # the base domain for the proxy to use
listen = "127.0.0.1:8080" # the port+ip to listen on listen = "127.0.0.1:8080" # the port+ip to listen on
# listen = "/var/run/haze/haze.sock" # or a unix socket path # listen = "/var/run/haze/haze.sock" # or a unix socket path
# tray = true # show a system tray item, defaults to false
``` ```
### Without a reverse proxy ### Without a reverse proxy

View file

@ -7,8 +7,8 @@ use std::convert::TryFrom;
use std::env::home_dir; use std::env::home_dir;
use std::fs::read_to_string; use std::fs::read_to_string;
use std::net::IpAddr; use std::net::IpAddr;
use toml::map::Map;
use toml::Value; use toml::Value;
use toml::map::Map;
#[derive(Debug, Deserialize, Default)] #[derive(Debug, Deserialize, Default)]
#[serde(from = "RawHazeConfig")] #[serde(from = "RawHazeConfig")]
@ -205,6 +205,8 @@ pub struct ProxyConfig {
pub cert: Option<String>, pub cert: Option<String>,
#[serde(default)] #[serde(default)]
pub key: Option<String>, pub key: Option<String>,
#[serde(default)]
pub tray: bool,
} }
impl ProxyConfig { impl ProxyConfig {

View file

@ -167,7 +167,11 @@ pub async fn proxy(docker: Docker, config: HazeConfig) -> Result<()> {
let shutdown = Arc::new(Notify::new()); let shutdown = Arc::new(Notify::new());
#[cfg(feature = "tray")] #[cfg(feature = "tray")]
let tray = crate::tray::spawn_tray(docker.clone(), config.clone(), shutdown.clone()).await; let tray = if config.proxy.tray {
crate::tray::spawn_tray(docker.clone(), config.clone(), shutdown.clone()).await
} else {
None
};
let instances = ActiveInstances::new(docker, config); let instances = ActiveInstances::new(docker, config);
let result = serve(instances, listen, base_address, acceptor, shutdown).await; let result = serve(instances, listen, base_address, acceptor, shutdown).await;