Notes
RustDesk has moved to using Flutter as the UI framework. This guide was written before this change, and parts may be outdated.
Customizing RustDesk
Some tips for customizing RustDesk for Windows (other platforms might require additional changes)
- Changing the application name
- Changing the application icons
- Embedding the UI resources
- Embedding sciter.dll
- Toggling the console window
- Hosting your own server
- Using a static encryption key
Following all of these steps will result in a portable single file application that will only utilize your own personal server.
Changing the application name
-
In
Cargo.toml
under the[package]
block, modify the following values[package] name = "myapp" # your exe name version = "1.2.0" authors = ["rustdesk <info@rustdesk.com>"] edition = "2021" build= "build.rs" description = "A remote control software." default-run = "myapp" # should be same as name
-
Also in
Cargo.toml
under the[package.metadata.bundle]
block, modify these values[package.metadata.bundle] name = "My App" # Your app name here identifier = "com.polarisworkforce.remote" 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", "pipewire", "curl", "libayatana-appindicator3-1", "libvdpau1", "libva2"] osx_minimum_system_version = "10.14" resources = ["res/mac-tray-light.png","res/mac-tray-dark.png"]
-
In
/rustdesk/libs/hbb_common/src/config.rs
change the APP_NAME variable (line 50)pub static ref APP_NAME: Arc<RwLock<String>> = Arc::new(RwLock::new("My App".to_owned()));
-
(Optional) Replace 'RustDesk' in any of the language localization files (i.e.
/rustdesk/src/lang/en.rs
)
Changing the application icons
The icons are stored in a number of locations, which change depending on platform
There are a few *.png, *.svg, and *.ico files in /rustdesk/res
, you can replace those with your own versions.
There is also a Base64 encoded icon in the source code. Open /rustdesk/libs/hbb_common/src/config.rs
and modify the following lines (starting at line 32)
// 128x128
#[cfg(target_os = "macos")] // 128x128 on 160x160 canvas, then shrink to 128, mac looks better with padding
pub const ICON: &str = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAAyVBMVEUAAAAAcf8Acf8Acf8Acv8Acf8Acf8Acf8Acf8AcP8Acf8Ab/8AcP8Ac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5nITj/yrlFpAVrDpTJT5llQLaLMHwshY7UDgvD+VujDC96WWWsBtSAE5FnChFnAeUkDMdAvw88EqTNT5SYXpTlgPaRQM1AIGorkolNnoUS1gJHigCX48SaoF3Asuspg4Mz0U8+FTgIkCG01V09kwBQP8xG5ofD5AXeirkPEJSUlwSVIfP5ykVQNaggvz+k7prTvVgDKF8BnUXP4kqgEe/257E8Ig7EE1gA8g2stBTz7FLxqrB3SIeYaeQ2IG6gE5l2+Cmt5MGOfP4KsGiH8DOYWOoujnDY2ALHF3810goZFOQDVBTFx9Uj7eI6bp6QTgnLjeGGq6KeJuoRUQixN3pDYWyz1Rva8XIL5UPFQZCsmG3gV7R+dieS+Jd3iHLglce7oBuCOhp3zwHLxPQpfQDvBOSKjZqUIml3ZJ6AD6AajFSZJwewWR8ZPsEY26SQDaJOMeZP23w6bTJ6kBjAJQILm9hzqm7otu4G+nhgGxIQUlPLKzL7GhbxqAboMCuN2XXd+lAL0ajAMwclV+FD6jAPEy5ghAlhfwX2FODX445gHKxyN++fs64PUHmDMAbbYN2DlKk2QaScwdgMs4SZxMv4OJJSoIIQBl2Qtk3gk4qiOUANRPJQHB+0A6j5AC4J27QQEZ4eZPAsYBXFk0N/YD7iUrxRBqALxOTzoMC3x8lCFlfkMjuz8iLfk6fzQCQgjg8q3ZEd8RzUVuKelBh96Nzcc3qelL1V+2zfRv1xc56Ino3tpdPT7cd//MspfTrD/7R6p4W4O2qLMObfnyIHvvYcrPtkZjDybW7d/eb32Bg/UlHnYXuXz5CMt8rC90sr7Uy/5iN+vL/ewveLS/5NNKwcbyR1r2a3/h8wdY+v3L2tZC5oUvW2uO1M7qyvp/Xv6/48z4CTxjJEfyjEaMAAAAAElFTkSuQmCC
";
Convert your image to Base64 and then replace the contents of ICON
with your base64 encoded image (it should start with data:image/png;base64,
followed by your image data). Your image should be 128x128
Embedding UI / Enable Inline Builds
In order to include the applicatin's UI resources in the executable, you will need to enable the inline
feature. This compiles the application resources (src/ui) into the executable so you do not have to deploy them yourself.
-
Enable
inline
feature by editingCargo.toml
Under the
[features]
block, find this linedefault = ["use_dasp"]
and change it to read
default = ["use_dasp", "inline"]
-
Build the UI resources (requires Python 3 to be installed)
Run
python res/inline-sciter.py
every time you want to build the UI resources again (i.e. every time you modify the UI)If it complains that it cannot find python or the command is unrecognized, you need to install the latest version of Python 3 and add it to your PATH environment variable.
-
Now build and run application via
cargo run
orcargo build
Embedding Sciter.dll
If you want a single portable executable file, you can either statically link Sciter, or embed the DLL. Statically linking it requires you license Sciter, which costs money--so I went with embedding the dll.
-
Copy sciter.dll to your project root directory (where Cargo.toml resides)
-
Add the following lines into
fn main()
in src/main.rs (around line 23 or so)let bytes = std::include_bytes!("..\\sciter.dll"); std::fs::write("sciter.dll", bytes.as_slice());
Note: Do not remove the "..\" as main.rs resides in /rustdesk/src, and will not be able to find the file otherwise. Alternatively you can put
sciter.dll
in /rustdesk/srcAlso please make sure you are putting this in the
fn main()
that is targeting Windows, where it specifies#[cfg(not(any(target_os = "android", target_os = "ios", feature = "cli")))]
as there are other
fn main()
that target OTHER platforms.The function should now look like so:
#[cfg(not(any(target_os = "android", target_os = "ios", feature = "cli")))] fn main() { //BEGIN CHANGES //Embed the Sciter.dll file into the exe, and then write it to disk when application starts println!("================ LOADING SCITER DLLL =================="); let bytes = std::include_bytes!("..\\sciter.dll"); //since main.rs is in rustdesk/src, we need to go up one level (to rustdesk) std::fs::write("sciter.dll", bytes.as_slice()); //END CHANGES if !common::global_init() { return; } if let Some(args) = crate::core_main::core_main().as_mut() { ui::start(args); } common::global_clean(); }
Hide Console Window
You can toggle the console terminal window by uncommenting line 3 in src/main.rs
#![windows_subsystem = "windows"]
Comment it out to show console window, uncomment it to hide.
Hosting Your Own Server
Follow the instructions on RustDesk to host your own server instance
Before proceeding, verify your server works with your existing client, by overriding the ID and Relay Server values in the client.
See RustDesk docs for how to do this
You will also need to specify the public key you generated on your server. Once you have verified your server is working, you can make your changes permanent below.
Modify /rustdesk/libs/hbb_common/src/config.rs
, line 73. Replace the array of RENDEVOUS_SERVERS
pub const RENDEZVOUS_SERVERS: &'static [&'static str] = &[
"myserver.com" //or the IP address
];
You might also want to modify /rustdesk/src/common.rs
and swap out the server specified in fn check_software_update()
(line 517)
let rendezvous_server =
socket_client::get_target_addr(&format!("myserver.com:{}", config::RENDEZVOUS_PORT))?;
Please note that if you have values in the ID/Relay fields in the client, they will override these static values, as they are loaded from a config file in %APPDATA%/AppName/config/AppName.toml
, where AppName is RustDesk or whatever name you customized it with in the Changing the application name section. So you may want to delete this file.
Using a static encryption key
If you wish to only allow the public key for your own server, you can hard code it and ignore any config values entirely, preventing the end user from overriding it. Otherwise you can only do Step 1 and ignore the rest.
- Assign the public key (id_ed25519.pub) generated on your server to the RS_PUB_KEY variable in
/rustdesk/libs/hbb_common/src/config.rs
at line 78pub const RS_PUB_KEY: &'static str = "your public key goes here";
- (Optional) Anywhere the key is loaded from config, change it to just point at RS_PUB_KEY if you wish to make it permanent
- /rustdesk/src/client.rs (line 426)
let rs_pk = get_rs_pk(hbb_common::config::RS_PUB_KEY); //remove the if statement and just assign it directly
- /rustdesk/src/server.rs (line 235)
let mut licence_key = hbb_common::config::RS_PUB_KEY.to_owned(); //was Config::get_option("key");
- /rustdesk/src/platform/windows.rs (line 1356)
lic.key = hbb_common::config::RS_PUB_KEY.to_owned(); //was get_reg("Key");
- /rustdesk/src/ui_session_interface.rs (line 1401)
let mut key = hbb_common::config::RS_PUB_KEY.to_owned(); //was options.remove("key").unwrap_or("".to_owned());
- /rustdesk/src/client.rs (line 426)