feat: tray icon
This commit is contained in:
8 files changed
+432
No files matched your search
@@ -36,5 +36,9 @@ in
|
||||
(lib.mkIf cfg.tgWsProxy.enable (
|
||||
import ./tg-ws-proxy.nix { inherit lib pkgs cfg; }
|
||||
))
|
||||
|
||||
(lib.mkIf cfg.tray.enable (
|
||||
import ./tray.nix { inherit config lib pkgs cfg; }
|
||||
))
|
||||
]);
|
||||
}
|
||||
@@ -393,6 +393,22 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
tray = {
|
||||
enable = mkEnableOption "system tray indicator for proxy-suite";
|
||||
|
||||
pollInterval = mkOption {
|
||||
type = types.int;
|
||||
default = 5;
|
||||
description = "Status polling interval in seconds.";
|
||||
};
|
||||
|
||||
autostart = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to autostart the tray application for all graphical users via XDG desktop autostart.";
|
||||
};
|
||||
};
|
||||
|
||||
tgWsProxy = {
|
||||
enable = mkEnableOption "Telegram MTProto WebSocket proxy";
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
# Tray indicator module for proxy-suite
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
cfg,
|
||||
}:
|
||||
|
||||
let
|
||||
tray = cfg.tray;
|
||||
|
||||
proxyTray = import ../../pkgs/proxy-suite-tray.nix {
|
||||
inherit pkgs;
|
||||
pollInterval = tray.pollInterval;
|
||||
};
|
||||
|
||||
desktopEntryText = ''
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Version=1.0
|
||||
Name=Proxy Suite Tray
|
||||
Comment=System tray indicator for proxy-suite
|
||||
Exec=${proxyTray}/bin/proxy-suite-tray
|
||||
Icon=network-vpn
|
||||
Categories=Network;System;
|
||||
StartupNotify=false
|
||||
Terminal=false
|
||||
'';
|
||||
|
||||
desktopEntry = pkgs.writeTextFile {
|
||||
name = "proxy-suite-tray.desktop";
|
||||
destination = "/share/applications/proxy-suite-tray.desktop";
|
||||
text = desktopEntryText;
|
||||
};
|
||||
|
||||
autostartEntry = pkgs.writeTextFile {
|
||||
name = "proxy-suite-tray-autostart.desktop";
|
||||
destination = "/share/xdg/autostart/proxy-suite-tray.desktop";
|
||||
text = ''
|
||||
${desktopEntryText}
|
||||
X-GNOME-Autostart-enabled=true
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [
|
||||
proxyTray
|
||||
desktopEntry
|
||||
];
|
||||
|
||||
environment.etc = lib.mkIf tray.autostart {
|
||||
"xdg/autostart/proxy-suite-tray.desktop".source =
|
||||
"${autostartEntry}/share/xdg/autostart/proxy-suite-tray.desktop";
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user