mac tray icon opt
This commit is contained in:
parent
8e3e8ab5bc
commit
3cbcd2e46a
@ -155,7 +155,7 @@ identifier = "com.carriez.rustdesk"
|
||||
icon = ["res/32x32.png", "res/128x128.png", "res/128x128@2x.png"]
|
||||
deb_depends = ["libgtk-3-0", "libxcb-randr0", "libxdo3", "libxfixes3", "libxcb-shape0", "libxcb-xfixes0", "libasound2", "libsystemd0", "curl", "libvdpau1", "libva2"]
|
||||
osx_minimum_system_version = "10.14"
|
||||
resources = ["res/mac-tray-light.png","res/mac-tray-dark.png"]
|
||||
resources = ["res/mac-tray-light.png","res/mac-tray-dark.png", "res/mac-tray-light-x2.png","res/mac-tray-dark-x2.png"]
|
||||
|
||||
#https://github.com/johnthagen/min-sized-rust
|
||||
[profile.release]
|
||||
|
@ -28,6 +28,8 @@
|
||||
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
|
||||
7E4BCD762966B0EC006D24E2 /* mac-tray-light.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E4BCD742966B0EC006D24E2 /* mac-tray-light.png */; };
|
||||
7E4BCD772966B0EC006D24E2 /* mac-tray-dark.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E4BCD752966B0EC006D24E2 /* mac-tray-dark.png */; };
|
||||
7E881462296E98EE00A0C54F /* mac-tray-light-x2.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E881461296E98ED00A0C54F /* mac-tray-light-x2.png */; };
|
||||
7E881464296E991200A0C54F /* mac-tray-dark-x2.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E881463296E991200A0C54F /* mac-tray-dark-x2.png */; };
|
||||
84010BA8292CF66600152837 /* liblibrustdesk.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 84010BA7292CF66600152837 /* liblibrustdesk.dylib */; settings = {ATTRIBUTES = (Weak, ); }; };
|
||||
84010BA9292CF68300152837 /* liblibrustdesk.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = 84010BA7292CF66600152837 /* liblibrustdesk.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
C5E54335B73C89F72DB1B606 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26C84465887F29AE938039CB /* Pods_Runner.framework */; };
|
||||
@ -78,6 +80,8 @@
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
|
||||
7E4BCD742966B0EC006D24E2 /* mac-tray-light.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "mac-tray-light.png"; path = "../../res/mac-tray-light.png"; sourceTree = "<group>"; };
|
||||
7E4BCD752966B0EC006D24E2 /* mac-tray-dark.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "mac-tray-dark.png"; path = "../../res/mac-tray-dark.png"; sourceTree = "<group>"; };
|
||||
7E881461296E98ED00A0C54F /* mac-tray-light-x2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "mac-tray-light-x2.png"; path = "../../res/mac-tray-light-x2.png"; sourceTree = "<group>"; };
|
||||
7E881463296E991200A0C54F /* mac-tray-dark-x2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "mac-tray-dark-x2.png"; path = "../../res/mac-tray-dark-x2.png"; sourceTree = "<group>"; };
|
||||
84010BA7292CF66600152837 /* liblibrustdesk.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = liblibrustdesk.dylib; path = ../../target/release/liblibrustdesk.dylib; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
|
||||
C3BB669FF6190AE1B11BCAEA /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
@ -131,6 +135,8 @@
|
||||
33CC11242044D66E0003C045 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7E881463296E991200A0C54F /* mac-tray-dark-x2.png */,
|
||||
7E881461296E98ED00A0C54F /* mac-tray-light-x2.png */,
|
||||
7E4BCD752966B0EC006D24E2 /* mac-tray-dark.png */,
|
||||
7E4BCD742966B0EC006D24E2 /* mac-tray-light.png */,
|
||||
33CC10F22044A3C60003C045 /* Assets.xcassets */,
|
||||
@ -259,10 +265,12 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
7E881462296E98EE00A0C54F /* mac-tray-light-x2.png in Resources */,
|
||||
7E4BCD762966B0EC006D24E2 /* mac-tray-light.png in Resources */,
|
||||
7E4BCD772966B0EC006D24E2 /* mac-tray-dark.png in Resources */,
|
||||
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */,
|
||||
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */,
|
||||
7E881464296E991200A0C54F /* mac-tray-dark-x2.png in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -264,8 +264,8 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: "82f9eab81cb2c7bfb938def7a1b399a6279bbc75"
|
||||
resolved-ref: "82f9eab81cb2c7bfb938def7a1b399a6279bbc75"
|
||||
ref: "057e6eb1bc7dcbcf9dafd1384274a611e4fe7124"
|
||||
resolved-ref: "057e6eb1bc7dcbcf9dafd1384274a611e4fe7124"
|
||||
url: "https://github.com/Kingtous/rustdesk_desktop_multi_window"
|
||||
source: git
|
||||
version: "0.1.0"
|
||||
|
BIN
res/mac-tray-dark-x2.png
Normal file
BIN
res/mac-tray-dark-x2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 809 B |
Binary file not shown.
Before Width: | Height: | Size: 809 B After Width: | Height: | Size: 275 B |
BIN
res/mac-tray-light-x2.png
Normal file
BIN
res/mac-tray-light-x2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 810 B |
Binary file not shown.
Before Width: | Height: | Size: 810 B After Width: | Height: | Size: 270 B |
@ -34,3 +34,9 @@ extern "C" bool InputMonitoringAuthStatus(bool prompt) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
extern "C" float BackingScaleFactor() {
|
||||
NSScreen* s = [NSScreen mainScreen];
|
||||
if (s) return [s backingScaleFactor];
|
||||
return 1;
|
||||
}
|
||||
|
@ -541,7 +541,6 @@ pub fn is_installed() -> bool {
|
||||
}
|
||||
|
||||
pub fn quit_gui() {
|
||||
use cocoa::appkit::NSApp;
|
||||
unsafe {
|
||||
let () = msg_send!(NSApp(), terminate: nil);
|
||||
};
|
||||
|
21
src/tray.rs
21
src/tray.rs
@ -206,17 +206,28 @@ fn is_service_stopped() -> bool {
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn make_tray() {
|
||||
extern "C" {
|
||||
fn BackingScaleFactor() -> f32;
|
||||
}
|
||||
let f = unsafe { BackingScaleFactor() };
|
||||
use tray_item::TrayItem;
|
||||
let mode = dark_light::detect();
|
||||
let icon_path;
|
||||
match mode {
|
||||
let icon_path = match mode {
|
||||
dark_light::Mode::Dark => {
|
||||
icon_path = "mac-tray-light.png";
|
||||
if f > 1. {
|
||||
"mac-tray-light_x2.png";
|
||||
} else {
|
||||
"mac-tray-light.png";
|
||||
}
|
||||
}
|
||||
dark_light::Mode::Light => {
|
||||
icon_path = "mac-tray-dark.png";
|
||||
if f > 1. {
|
||||
"mac-tray-dark_x2.png";
|
||||
} else {
|
||||
"mac-tray-dark.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if let Ok(mut tray) = TrayItem::new(&crate::get_app_name(), icon_path) {
|
||||
tray.add_label(&format!(
|
||||
"{} {}",
|
||||
|
Loading…
Reference in New Issue
Block a user