This mapping has 5 all-to-all groups: every node on one side corresponds to every node on the other, and none is deleted or inserted. Each member carries an all N:M badge; selecting one highlights all of its counterparts, in the tree and in the code view alike.

Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–10 unchanged (10 lines)
11 log,
12 message_proto::{DisplayInfo, Resolution},
13 regex::{Captures, Regex},
14};
15use std::{
16 cell::RefCell,
17 ffi::OsStr,
18 path::{Path, PathBuf},
19 process::{Child, Command},
20 string::String,
21 sync::{
22 atomic::{AtomicBool, Ordering},
23 Arc,
24 },
…lines 25–43 unchanged (19 lines)
44 Err(err) => {
45 log::error!("Failed to initialize xterm-256color database: {}", err);
46 None
47 }
48 }
49 };
50}
51
52thread_local! {
53 static XDO: RefCell<Xdo> = RefCell::new(unsafe { xdo_new(std::ptr::null()) });
54 static DISPLAY: RefCell<*mut c_void> = RefCell::new(unsafe { XOpenDisplay(std::ptr::null())});
55}
56
…lines 57–769 unchanged (713 lines)
770 None => get_active_user_id_name(),
771 };
772 let cmd = std::env::current_exe()?;
773 if uid.is_empty() {
774 bail!("No valid uid");
775 }
776 let xdg = &format!("XDG_RUNTIME_DIR=/run/user/{}", uid) as &str;
777 let mut args = vec![xdg, "-u", &username, cmd.to_str().unwrap_or("")];
778 args.append(&mut arg.clone());
779 // -E is required to preserve env
780 args.insert(0, "-E");
781
782 let task = Command::new("sudo").envs(envs).args(args).spawn()?;
783 Ok(Some(task))
784}
785
786pub fn get_pa_monitor() -> String {
787 get_pa_sources()
788 .drain(..)
789 .map(|x| x.0)
…lines 790–856 unchanged (67 lines)
857 p.to_str().unwrap_or_default().starts_with("/usr")
858 || p.to_str().unwrap_or_default().starts_with("/nix/store")
859 } else {
860 false
861 }
862}
863
864#[inline]
865fn get_env(name: &str, uid: &str, process: &str) -> String {
866 let cmd = format!("ps -u {} -f | grep -E '{}' | grep -v 'grep' | tail -1 | awk '{{print $2}}' | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\\0' '\\n' | grep '^{}=' | tail -1 | sed 's/{}=//g'", uid, process, name, name);
867 if let Ok(x) = run_cmds(&cmd) {
868 x.trim_end().to_string()
869 } else {
…lines 870–1095 unchanged (226 lines)
1096
1097mod desktop {
1098 use super::*;
1099
1100 pub const XFCE4_PANEL: &str = "xfce4-panel";
1101 pub const SDDM_GREETER: &str = "sddm-greeter";
1102
1103 const XWAYLAND: &str = "Xwayland";
1104 const IBUS_DAEMON: &str = "ibus-daemon";
1105 const PLASMA_KDED: &str = "kded[0-9]+";
1106 const GNOME_GOA_DAEMON: &str = "goa-daemon";
1107
1108 #[derive(Debug, Clone, Default)]
1109 pub struct Desktop {
1110 pub sid: String,
1111 pub username: String,
1112 pub uid: String,
1113 pub protocol: String,
…lines 1114–1130 unchanged (17 lines)
1131 }
1132
1133 #[inline]
1134 pub fn is_headless(&self) -> bool {
1135 self.sid.is_empty() || self.is_rustdesk_subprocess
1136 }
1137
1138 fn get_display_xauth_xwayland(&mut self) {
1139 let tray = format!("{} +--tray", crate::get_app_name().to_lowercase());
1140 for _ in 1..=10 {
1141 let display_proc = vec![
1142 XWAYLAND,
1143 IBUS_DAEMON,
1144 GNOME_GOA_DAEMON,
1145 PLASMA_KDED,
1146 tray.as_str(),
1147 ];
1148 for proc in display_proc {
1149 self.display = get_env("DISPLAY", &self.uid, proc);
1150 self.xauth = get_env("XAUTHORITY", &self.uid, proc);
1151 self.wl_display = get_env("WAYLAND_DISPLAY", &self.uid, proc);
1152 self.dbus = get_env("DBUS_SESSION_BUS_ADDRESS", &self.uid, proc);
1153 if !self.display.is_empty() && !self.xauth.is_empty() {
1154 return;
1155 }
1156 }
1157 sleep_millis(300);
1158 }
…lines 1159–1165 unchanged (7 lines)
1166 GNOME_GOA_DAEMON,
1167 PLASMA_KDED,
1168 XFCE4_PANEL,
1169 SDDM_GREETER,
1170 ];
1171 for proc in display_proc {
1172 self.display = get_env("DISPLAY", &self.uid, proc);
1173 if !self.display.is_empty() {
1174 break;
1175 }
1176 }
1177 if !self.display.is_empty() {
1178 break;
…lines 1179–1356 unchanged (178 lines)
1357 if !self.sid.is_empty() && is_active_and_seat0(&self.sid) {
1358 // Xwayland display and xauth may not be available in a short time after login.
1359 if is_xwayland_running() && !self.is_login_wayland() {
1360 self.get_display_xauth_xwayland();
1361 self.is_rustdesk_subprocess = false;
1362 }
1363 return;
1364 }
1365
1366 let seat0_values = get_values_of_seat0_with_gdm_wayland(&[0, 1, 2]);
1367 if seat0_values[0].is_empty() {
1368 *self = Self::default();
1369 self.is_rustdesk_subprocess = false;
…lines 1370–1382 unchanged (13 lines)
1383
1384 self.get_home();
1385 if self.is_wayland() {
1386 if is_xwayland_running() {
1387 self.get_display_xauth_xwayland();
1388 } else {
1389 self.display = "".to_owned();
1390 self.xauth = "".to_owned();
1391 }
1392 self.is_rustdesk_subprocess = false;
1393 } else {
1394 self.get_display_x11();
1395 self.get_xauth_x11();
1396 self.set_is_subprocess();
…lines 1397–1620 unchanged (224 lines)

After

…lines 1–10 unchanged (10 lines)
11 log,
12 message_proto::{DisplayInfo, Resolution},
13 regex::{Captures, Regex},
14};
15use std::{
16 cell::RefCell,
17 ffi::{OsStr, OsString},
18 os::unix::ffi::OsStrExt,
19 path::{Path, PathBuf},
20 process::{Child, Command},
21 string::String,
22 sync::{
23 atomic::{AtomicBool, Ordering},
24 Arc,
…lines 25–44 unchanged (20 lines)
45 Err(err) => {
46 log::error!("Failed to initialize xterm-256color database: {}", err);
47 None
48 }
49 }
50 };
51 // https://github.com/rustdesk/rustdesk/issues/13705
52 // Check if `sudo -E` actually preserves environment.
53 //
54 // This flag is only used by `run_as_user()` (root service -> user session). If the current process is not
55 // running as `root`, this check is meaningless (and `sudo -n` may fail), so we return `false` directly.
56 //
57 // On Ubuntu 25.10, `sudo -E` may still succeed but effectively ignores `-E`. Some versions print a warning
58 // to stderr (wording may vary by locale), so we verify behavior instead:
59 // - Inject a sentinel environment variable into the `sudo` process
60 // - Run `sudo -n -E env` and check whether the sentinel is present in stdout
61 static ref SUDO_E_PRESERVES_ENV: bool = {
62 if !is_root() {
63 log::warn!("Not running as root, SUDO_E_PRESERVES_ENV check skipped");
64 false
65 } else {
66 let key = format!("__RUSTDESK_SUDO_E_TEST_{}", std::process::id());
67 let val = "1";
68 let expected = format!("{key}={val}");
69 Command::new("sudo")
70 // -n for non-interactive to avoid password prompt
71 .env(&key, val)
72 .args(["-n", "-E", "env"])
73 .output()
74 .map(|o| {
75 o.status.success()
76 && String::from_utf8_lossy(&o.stdout).contains(expected.as_str())
77 })
78 .unwrap_or(false)
79 }
80 };
81}
82
83thread_local! {
84 static XDO: RefCell<Xdo> = RefCell::new(unsafe { xdo_new(std::ptr::null()) });
85 static DISPLAY: RefCell<*mut c_void> = RefCell::new(unsafe { XOpenDisplay(std::ptr::null())});
86}
…lines 87–801 unchanged (715 lines)
802 };
803 let cmd = std::env::current_exe()?;
804 if uid.is_empty() {
805 bail!("No valid uid");
806 }
807
808 let xdg = &format!("XDG_RUNTIME_DIR=/run/user/{uid}");
809 if *SUDO_E_PRESERVES_ENV {
810 // Original logic: use sudo -E to preserve environment
811 let mut args = vec![xdg, "-u", &username, cmd.to_str().unwrap_or("")];
812 args.append(&mut arg.clone());
813 // -E is required to preserve env
814 args.insert(0, "-E");
815 let task = Command::new("sudo").envs(envs).args(args).spawn()?;
816 Ok(Some(task))
817 } else {
818 // Fallback: sudo -u username env VAR=VALUE ... cmd args
819 // For systems where sudo -E is not supported (e.g., Ubuntu 25.10+)
820 //
821 // SECURITY: No shell is involved here (we use execve-style argv).
822 // Environment is passed via `env` arguments,
823 // so there is no shell injection vector.
824 //
825 // Only accept portable env var names (POSIX portable character set for shells).
826 // Most legitimate env vars follow [A-Za-z_][A-Za-z0-9_]* convention.
827 // Variables with dots (e.g., "java.home") are Java system properties, not env vars.
828 // Being restrictive here is intentional for security in this sudo context.
829 fn is_valid_env_key(key: &str) -> bool {
830 let mut it = key.chars();
831 match it.next() {
832 Some(c) if c.is_ascii_alphabetic() || c == '_' => {}
833 _ => return false,
834 }
835 it.all(|c| c.is_ascii_alphanumeric() || c == '_')
836 }
837
838 let mut sudo = Command::new("sudo");
839 sudo.arg("-u").arg(&username).arg("--").arg("env").arg(xdg);
840
841 for (k, v) in envs {
842 let key = k.as_ref().to_string_lossy();
843 if !is_valid_env_key(&key) {
844 log::warn!("Skipping environment variable with invalid key: '{}'. Only [A-Za-z_][A-Za-z0-9_]* are allowed in sudo context.", key);
845 continue;
846 }
847 // IMPORTANT: do NOT add shell quotes here; `Command` does not invoke a shell.
848 // Passing KEY=VALUE as a single argv element is safe and preserves spaces.
849 let mut arg = OsString::from(&*key);
850 arg.push("=");
851 arg.push(v.as_ref());
852 sudo.arg(arg);
853 }
854
855 sudo.arg(cmd).args(arg);
856 let task = sudo.spawn()?;
857 Ok(Some(task))
858 }
859}
860
861pub fn get_pa_monitor() -> String {
862 get_pa_sources()
863 .drain(..)
864 .map(|x| x.0)
…lines 865–932 unchanged (68 lines)
933 || p.to_str().unwrap_or_default().starts_with("/nix/store")
934 } else {
935 false
936 }
937}
938
939/// Get multiple environment variables from a process matching the given criteria.
940/// This version reads /proc directly instead of spawning shell commands.
941///
942/// # Arguments
943/// * `uid` - User ID to filter processes
944/// * `process_pat` - Regex pattern to match process cmdline
945/// * `names` - Environment variable names to retrieve. **Must be <= 64 elements** due to
946/// the internal bitmask used for tie-breaking.
947///
948/// # Panics (debug builds)
949/// Panics if `names.len() > 64`.
950///
951/// # Implementation notes
952/// - Returns values from a *single* best-matching process_pat (for consistency).
953/// - Avoids repeated scanning by parsing `environ` once per process.
954fn get_envs<'a>(
955 uid: &str,
956 process_pat: &str,
957 names: &[&'a str],
958) -> std::collections::HashMap<&'a str, String> {
959 // The tie-breaking logic uses a u64 bitmask, limiting us to 64 variables.
960 debug_assert!(
961 names.len() <= 64,
962 "get_envs: names.len() must be <= 64, got {}",
963 names.len()
964 );
965
966 let empty: std::collections::HashMap<&'a str, String> =
967 names.iter().map(|&n| (n, String::new())).collect();
968
969 let Ok(uid_num) = uid.parse::<u32>() else {
970 return empty;
971 };
972 let Ok(re) = Regex::new(process_pat) else {
973 return empty;
974 };
975
976 // Used for stable tie-breaking when multiple processes match.
977 // Higher bits correspond to earlier entries in `names`.
978 let name_indices: std::collections::HashMap<&'a str, usize> =
979 names.iter().enumerate().map(|(i, &n)| (n, i)).collect();
980
981 let mut best = empty.clone();
982 let mut best_count = 0usize;
983 let mut best_mask: u64 = 0;
984
985 // Iterate /proc to find matching processes
986 let Ok(entries) = std::fs::read_dir("/proc") else {
987 return best;
988 };
989
990 for entry in entries.flatten() {
991 let file_name = entry.file_name();
992 let Some(pid_str) = file_name.to_str() else {
993 continue;
994 };
995 if !pid_str.chars().all(|c| c.is_ascii_digit()) {
996 continue;
997 }
998
999 let proc_path = entry.path();
1000
1001 // Check if process belongs to the specified uid
1002 if let Ok(meta) = std::fs::metadata(&proc_path) {
1003 use std::os::unix::fs::MetadataExt;
1004 if meta.uid() != uid_num {
1005 continue;
1006 }
1007 } else {
1008 continue;
1009 }
1010
1011 // Check cmdline matches process pattern
1012 let cmdline_path = proc_path.join("cmdline");
1013 let Ok(cmdline) = std::fs::read(&cmdline_path) else {
1014 continue;
1015 };
1016 let cmdline_str = String::from_utf8_lossy(&cmdline).replace('\0', " ");
1017 if !re.is_match(&cmdline_str) {
1018 continue;
1019 }
1020
1021 // Read environ and extract matching variables
1022 let environ_path = proc_path.join("environ");
1023 let Ok(environ) = std::fs::read(&environ_path) else {
1024 continue;
1025 };
1026
1027 let mut found = empty.clone();
1028 let mut found_count = 0usize;
1029 let mut found_mask: u64 = 0;
1030
1031 for part in environ.split(|&b| b == 0) {
1032 if part.is_empty() {
1033 continue;
1034 }
1035 let Some(eq) = part.iter().position(|&b| b == b'=') else {
1036 continue;
1037 };
1038 let key_bytes = &part[..eq];
1039 let val_bytes = &part[eq + 1..];
1040
1041 let Ok(key) = std::str::from_utf8(key_bytes) else {
1042 continue;
1043 };
1044 if let Some(slot) = found.get_mut(key) {
1045 if slot.is_empty() {
1046 *slot = String::from_utf8_lossy(val_bytes).into_owned();
1047 found_count += 1;
1048
1049 if let Some(&idx) = name_indices.get(key) {
1050 let total = names.len();
1051 if total <= 64 {
1052 let bit = 1u64 << (total - 1 - idx);
1053 found_mask |= bit;
1054 }
1055 }
1056
1057 if found_count == names.len() {
1058 return found;
1059 }
1060 }
1061 }
1062 }
1063
1064 if found_count > best_count || (found_count == best_count && found_mask > best_mask) {
1065 best = found;
1066 best_count = found_count;
1067 best_mask = found_mask;
1068 }
1069 }
1070
1071 best
1072}
1073
1074/// Deprecated: Use `get_envs` instead.
1075///
1076/// https://github.com/rustdesk/rustdesk/discussions/11959
1077///
1078/// **Note**: This function is retained for conservative migration. The plan is to gradually
1079/// transition all callers to `get_envs` after it proves stable and reliable. Once `get_envs`
1080/// is confirmed to work correctly across all use cases, this function will be removed entirely.
1081///
1082/// # Arguments
1083/// * `name` - Environment variable name to retrieve
1084/// * `uid` - User ID to filter processes
1085/// * `process` - Process name pattern to match
1086///
1087/// # Returns
1088/// The environment variable value, or empty string if not found
1089#[inline]
1090fn get_env(name: &str, uid: &str, process: &str) -> String {
1091 let cmd = format!("ps -u {} -f | grep -E '{}' | grep -v 'grep' | tail -1 | awk '{{print $2}}' | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\\0' '\\n' | grep '^{}=' | tail -1 | sed 's/{}=//g'", uid, process, name, name);
1092 if let Ok(x) = run_cmds(&cmd) {
1093 x.trim_end().to_string()
1094 } else {
…lines 1095–1321 unchanged (227 lines)
1322mod desktop {
1323 use super::*;
1324
1325 pub const XFCE4_PANEL: &str = "xfce4-panel";
1326 pub const SDDM_GREETER: &str = "sddm-greeter";
1327
1328 // xdg-desktop-portal runs on all Wayland desktops (GNOME, KDE, wlroots, etc.)
1329 const XDG_DESKTOP_PORTAL: &str = "xdg-desktop-portal";
1330 const XWAYLAND: &str = "Xwayland";
1331 const IBUS_DAEMON: &str = "ibus-daemon";
1332 const PLASMA_KDED: &str = "kded[0-9]+";
1333 const GNOME_GOA_DAEMON: &str = "goa-daemon";
1334
1335 const ENV_KEY_DISPLAY: &str = "DISPLAY";
1336 const ENV_KEY_XAUTHORITY: &str = "XAUTHORITY";
1337 const ENV_KEY_WAYLAND_DISPLAY: &str = "WAYLAND_DISPLAY";
1338 const ENV_KEY_DBUS_SESSION_BUS_ADDRESS: &str = "DBUS_SESSION_BUS_ADDRESS";
1339
1340 #[derive(Debug, Clone, Default)]
1341 pub struct Desktop {
1342 pub sid: String,
1343 pub username: String,
1344 pub uid: String,
…lines 1345–1363 unchanged (19 lines)
1364
1365 #[inline]
1366 pub fn is_headless(&self) -> bool {
1367 self.sid.is_empty() || self.is_rustdesk_subprocess
1368 }
1369
1370 fn get_display_xauth_wayland(&mut self) {
1371 for _ in 1..=10 {
1372 // Prefer Wayland-related variables first when multiple portal processes match.
1373 let mut envs = get_envs(
1374 &self.uid,
1375 XDG_DESKTOP_PORTAL,
1376 &[
1377 ENV_KEY_WAYLAND_DISPLAY,
1378 ENV_KEY_DBUS_SESSION_BUS_ADDRESS,
1379 ENV_KEY_DISPLAY,
1380 ENV_KEY_XAUTHORITY,
1381 ],
1382 );
1383 self.display = envs.remove(ENV_KEY_DISPLAY).unwrap_or_default();
1384 self.xauth = envs.remove(ENV_KEY_XAUTHORITY).unwrap_or_default();
1385 self.wl_display = envs.remove(ENV_KEY_WAYLAND_DISPLAY).unwrap_or_default();
1386 self.dbus = envs
1387 .remove(ENV_KEY_DBUS_SESSION_BUS_ADDRESS)
1388 .unwrap_or_default();
1389 // For pure Wayland sessions, prefer `WAYLAND_DISPLAY`.
1390 // NOTE: On some systems (e.g. Ubuntu 25.10), `DISPLAY`/`XAUTHORITY` may exist even when XWayland
1391 // is not running, so do NOT treat them as a success condition here.
1392 let has_wayland = !self.wl_display.is_empty();
1393 let has_dbus = !self.dbus.is_empty();
1394 if has_wayland && has_dbus {
1395 return;
1396 }
1397 sleep_millis(300);
1398 }
1399 }
1400
1401 fn get_display_xauth_xwayland(&mut self) {
1402 let tray = format!("{} +--tray", crate::get_app_name().to_lowercase());
1403 for _ in 1..=10 {
1404 let display_proc = vec![
1405 XDG_DESKTOP_PORTAL,
1406 XWAYLAND,
1407 IBUS_DAEMON,
1408 GNOME_GOA_DAEMON,
1409 PLASMA_KDED,
1410 tray.as_str(),
1411 ];
1412 for proc in display_proc {
1413 self.display = get_env(ENV_KEY_DISPLAY, &self.uid, proc);
1414 self.xauth = get_env(ENV_KEY_XAUTHORITY, &self.uid, proc);
1415 self.wl_display = get_env(ENV_KEY_WAYLAND_DISPLAY, &self.uid, proc);
1416 self.dbus = get_env(ENV_KEY_DBUS_SESSION_BUS_ADDRESS, &self.uid, proc);
1417 if !self.display.is_empty() && !self.xauth.is_empty() {
1418 return;
1419 }
1420 }
1421 sleep_millis(300);
1422 }
…lines 1423–1429 unchanged (7 lines)
1430 GNOME_GOA_DAEMON,
1431 PLASMA_KDED,
1432 XFCE4_PANEL,
1433 SDDM_GREETER,
1434 ];
1435 for proc in display_proc {
1436 self.display = get_env(ENV_KEY_DISPLAY, &self.uid, proc);
1437 if !self.display.is_empty() {
1438 break;
1439 }
1440 }
1441 if !self.display.is_empty() {
1442 break;
…lines 1443–1619 unchanged (177 lines)
1620 pub fn refresh(&mut self) {
1621 if !self.sid.is_empty() && is_active_and_seat0(&self.sid) {
1622 // Xwayland display and xauth may not be available in a short time after login.
1623 if is_xwayland_running() && !self.is_login_wayland() {
1624 self.get_display_xauth_xwayland();
1625 self.is_rustdesk_subprocess = false;
1626 } else if self.is_wayland() {
1627 self.get_display_xauth_wayland();
1628 }
1629 return;
1630 }
1631
1632 let seat0_values = get_values_of_seat0_with_gdm_wayland(&[0, 1, 2]);
1633 if seat0_values[0].is_empty() {
1634 *self = Self::default();
…lines 1635–1648 unchanged (14 lines)
1649
1650 self.get_home();
1651 if self.is_wayland() {
1652 if is_xwayland_running() {
1653 self.get_display_xauth_xwayland();
1654 } else {
1655 self.get_display_xauth_wayland();
1656 }
1657 self.is_rustdesk_subprocess = false;
1658 } else {
1659 self.get_display_x11();
1660 self.get_xauth_x11();
1661 self.set_is_subprocess();
…lines 1662–1885 unchanged (224 lines)

Before

source_file
use_declaration
use "use"
scoped_use_list
super "super"
:: "::"
use_list
{ "{"
identifier "gtk_sudo"
, ","
identifier "CursorData"
, ","
identifier "ResultType"
} "}"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "desktop"
:: "::"
identifier "Desktop"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "hbb_common"
:: "::"
identifier "config"
:: "::"
identifier "keys"
:: "::"
identifier "OPTION_ALLOW_LINUX_HEADLESS"
; ";"
use_declaration
visibility_modifier
pub "pub"
use "use"
use_wildcard
scoped_identifier
scoped_identifier
identifier "hbb_common"
:: "::"
identifier "platform"
:: "::"
identifier "linux"
:: "::"
* "*"
; ";"
use_declaration (+59 nodes collapsed)
use_declaration
use "use"
scoped_use_list
identifier "std"
:: "::"
use_list
{ "{"
scoped_identifier
identifier "cell"
:: "::"
identifier "RefCell"
, ","
scoped_identifier
identifier "ffi"
:: "::"
identifier "OsStr"
, ","
scoped_use_list
identifier "path"
:: "::"
use_list
{ "{"
identifier "Path"
, ","
identifier "PathBuf"
} "}"
, ","
scoped_use_list
identifier "process"
:: "::"
use_list
{ "{"
identifier "Child"
, ","
identifier "Command"
} "}"
, ","
scoped_identifier
identifier "string"
:: "::"
identifier "String"
, ","
scoped_use_list
identifier "sync"
:: "::"
use_list
{ "{"
scoped_use_list
identifier "atomic"
:: "::"
use_list
{ "{"
identifier "AtomicBool"
, ","
identifier "Ordering"
} "}"
, ","
identifier "Arc"
, ","
} "}"
, ","
scoped_use_list
identifier "time"
:: "::"
use_list
{ "{"
identifier "Duration"
, ","
identifier "Instant"
} "}"
, ","
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "terminfo"
:: "::"
use_list
{ "{"
use_as_clause
identifier "capability"
as "as"
identifier "cap"
, ","
identifier "Database"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "users"
:: "::"
use_list
{ "{"
identifier "get_user_by_name"
, ","
scoped_identifier
scoped_identifier
identifier "os"
:: "::"
identifier "unix"
:: "::"
identifier "UserExt"
} "}"
; ";"
use_declaration
use "use"
identifier "wallpaper"
; ";"
type_item
type "type"
type_identifier "Xdo"
= "="
pointer_type
* "*"
const "const"
type_identifier "c_void"
; ";"
const_item
visibility_modifier
pub "pub"
const "const"
identifier "PA_SAMPLE_RATE"
: ":"
primitive_type "u32"
= "="
integer_literal "48000"
; ";"
static_item
static "static"
mutable_specifier "mut"
identifier "UNMODIFIED"
: ":"
primitive_type "bool"
= "="
boolean_literal
true "true"
; ";"
const_item (+30 nodes collapsed)
const_item (+36 nodes collapsed)
macro_invocation
scoped_identifier
identifier "lazy_static"
:: "::"
identifier "lazy_static"
! "!"
token_tree
{ "{"
pub "pub"
static "static"
identifier "ref"
identifier "IS_X11"
: ":"
primitive_type "bool"
= "="
identifier "hbb_common"
:: "::"
identifier "platform"
:: "::"
identifier "linux"
:: "::"
identifier "is_x11_or_headless"
token_tree
( "("
) ")"
; ";"
static "static"
identifier "ref"
identifier "DATABASE_XTERM_256COLOR"
: ":"
identifier "Option"
< "<"
identifier "Database"
> ">"
= "="
token_tree (+53 nodes collapsed)
; ";"
} "}"
macro_invocation (+70 nodes collapsed)
foreign_mod_item (+172 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "link"
token_tree
( "("
identifier "name"
= "="
string_literal
" "\""
string_content "X11"
" "\""
) ")"
] "]"
foreign_mod_item (+31 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "link"
token_tree
( "("
identifier "name"
= "="
string_literal
" "\""
string_content "Xfixes"
" "\""
) ")"
] "]"
foreign_mod_item (+45 nodes collapsed)
line_comment
// "//"
attribute_item
# "#"
[ "["
attribute
identifier "repr"
token_tree
( "("
identifier "C"
) ")"
] "]"
struct_item (+67 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+28 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+60 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+35 nodes collapsed)
function_item (+167 nodes collapsed)
function_item
visibility_modifier
pub "pub"
fn "fn"
identifier "reset_input_cache"
parameters
( "("
) ")"
block
{ "{"
} "}"
function_item (+372 nodes collapsed)
function_item (+160 nodes collapsed)
function_item (+625 nodes collapsed)
function_item (+112 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Suggests the best terminal type based on the environment.\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " The function prioritizes terminal types in the following or"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " 1. `screen-256color`: Preferred when running inside `tmux` "...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " as these multiplexers often support advanced terminal fe"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " 2. `xterm-256color`: Selected if the terminal supports 256 "...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " suitable for modern terminal applications.\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " 3. `xterm`: Used as a fallback for basic terminal compatibi"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Terminals like `linux` and `vt100` are excluded because the"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " modern features required by many applications.\n"
function_item (+85 nodes collapsed)
function_item (+33 nodes collapsed)
function_item (+33 nodes collapsed)
function_item (+56 nodes collapsed)
function_item (+98 nodes collapsed)
function_item (+187 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+433 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+88 nodes collapsed)
function_item (+142 nodes collapsed)
function_item (+139 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+42 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+75 nodes collapsed)
function_item (+520 nodes collapsed)
line_comment
// "//"
line_comment
// "//"
function_item (+27 nodes collapsed)
function_item (+863 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+64 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+35 nodes collapsed)
function_item (+157 nodes collapsed)
function_item (+153 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+30 nodes collapsed)
line_comment
// "//"
function_item (+96 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+35 nodes collapsed)
function_item (+104 nodes collapsed)
function_item (+138 nodes collapsed)
function_item (+66 nodes collapsed)
function_item (+36 nodes collapsed)
line_comment
// "//"
function_item (+105 nodes collapsed)
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
function_item (+140 nodes collapsed)
function_item (+27 nodes collapsed)
function_item (+58 nodes collapsed)
function_item
visibility_modifier
pub "pub"
fn "fn"
identifier "run_as_user"
type_parameters
< "<"
type_parameter
type_identifier "I"
, ","
type_parameter
type_identifier "K"
, ","
type_parameter
type_identifier "V"
> ">"
parameters (+35 nodes collapsed)
-> "->"
generic_type
type_identifier "ResultType"
type_arguments
< "<"
generic_type
type_identifier "Option"
type_arguments
< "<"
type_identifier "Child"
> ">"
> ">"
where_clause (+43 nodes collapsed)
block
{ "{"
let_declaration (+36 nodes collapsed)
let_declaration
let "let"
identifier "cmd"
= "="
try_expression
call_expression
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "env"
:: "::"
identifier "current_exe"
arguments
( "("
) ")"
? "?"
; ";"
expression_statement (+26 nodes collapsed)
let_declaration
let "let"
identifier "xdg"
= "="
type_cast_expression
reference_expression
& "&"
macro_invocation
identifier "format"
! "!"
token_tree
( "("
string_literal
" "\""
string_content "XDG_RUNTIME_DIR=/run/user/{}" all 2:1
" "\""
, ","
identifier "uid" all 2:1
) ")"
as "as"
reference_type
& "&"
primitive_type "str"
; ";"
let_declaration (+36 nodes collapsed)
expression_statement (+21 nodes collapsed)
line_comment
// "//"
expression_statement
call_expression
field_expression
identifier "args"
. "."
field_identifier "insert"
arguments
( "("
integer_literal "0"
, ","
string_literal
" "\""
string_content "-E"
" "\""
) ")"
; ";"
let_declaration (+42 nodes collapsed)
call_expression
identifier "Ok"
arguments
( "("
call_expression
identifier "Some"
arguments
( "("
identifier "task"
) ")"
) ")"
} "}"
function_item (+91 nodes collapsed)
function_item (+92 nodes collapsed)
function_item (+198 nodes collapsed)
function_item (+167 nodes collapsed)
function_item (+50 nodes collapsed)
function_item
visibility_modifier
pub "pub"
fn "fn"
identifier "toggle_blank_screen"
parameters
( "("
parameter
identifier "_v"
: ":"
primitive_type "bool"
) ")"
block
{ "{"
line_comment
// "//"
} "}"
function_item (+38 nodes collapsed)
function_item (+99 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+110 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+101 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "link"
token_tree
( "("
identifier "name"
= "="
string_literal
" "\""
string_content "gtk-3"
" "\""
) ")"
] "]"
foreign_mod_item
extern_modifier
extern "extern"
string_literal
" "\""
string_content "C"
" "\""
declaration_list
{ "{"
function_signature_item
fn "fn"
identifier "gtk_main_quit"
parameters
( "("
) ")"
; ";"
} "}"
function_item (+24 nodes collapsed)
block_comment
/* "/*"
*/ "*/"
function_item (+47 nodes collapsed)
block_comment
/* "/*"
*/ "*/"
type_item
type "type"
type_identifier "GtkSettingsPtr"
= "="
pointer_type
* "*"
mutable_specifier "mut"
type_identifier "c_void"
; ";"
type_item
type "type"
type_identifier "GObjectPtr"
= "="
pointer_type
* "*"
mutable_specifier "mut"
type_identifier "c_void"
; ";"
attribute_item
# "#"
[ "["
attribute
identifier "link"
token_tree
( "("
identifier "name"
= "="
string_literal
" "\""
string_content "gtk-3"
" "\""
) ")"
] "]"
foreign_mod_item (+21 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "link"
token_tree
( "("
identifier "name"
= "="
string_literal
" "\""
string_content "gobject-2.0"
" "\""
) ")"
] "]"
foreign_mod_item (+32 nodes collapsed)
function_item (+114 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+198 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+27 nodes collapsed)
function_item (+371 nodes collapsed)
function_item (+159 nodes collapsed)
function_item (+107 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+54 nodes collapsed)
mod_item
mod "mod"
identifier "desktop"
declaration_list
{ "{"
use_declaration
use "use"
use_wildcard
super "super"
:: "::"
* "*"
; ";"
const_item
visibility_modifier
pub "pub"
const "const"
identifier "XFCE4_PANEL"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "xfce4-panel"
" "\""
; ";"
const_item
visibility_modifier
pub "pub"
const "const"
identifier "SDDM_GREETER"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "sddm-greeter"
" "\""
; ";"
const_item
const "const"
identifier "XWAYLAND"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "Xwayland"
" "\""
; ";"
const_item
const "const"
identifier "IBUS_DAEMON"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "ibus-daemon"
" "\""
; ";"
const_item
const "const"
identifier "PLASMA_KDED"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "kded[0-9]+"
" "\""
; ";"
const_item
const "const"
identifier "GNOME_GOA_DAEMON"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "goa-daemon"
" "\""
; ";"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
, ","
identifier "Clone"
, ","
identifier "Default"
) ")"
] "]"
struct_item (+78 nodes collapsed)
impl_item
impl "impl"
type_identifier "Desktop"
declaration_list
{ "{"
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+23 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+39 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+33 nodes collapsed)
function_item
fn "fn"
identifier "get_display_xauth_xwayland"
parameters
( "("
self_parameter
& "&"
mutable_specifier "mut"
self "self"
) ")"
block
{ "{"
let_declaration (+27 nodes collapsed)
expression_statement
for_expression
for "for"
_ "_"
in "in"
range_expression
integer_literal "1"
..= "..="
integer_literal "10"
block
{ "{"
let_declaration
let "let"
identifier "display_proc"
= "="
macro_invocation
identifier "vec"
! "!"
token_tree
[ "["
identifier "XWAYLAND"
, ","
identifier "IBUS_DAEMON"
, ","
identifier "GNOME_GOA_DAEMON"
, ","
identifier "PLASMA_KDED"
, ","
identifier "tray"
. "."
identifier "as_str"
token_tree
( "("
) ")"
, ","
] "]"
; ";"
expression_statement
for_expression
for "for"
identifier "proc"
in "in"
identifier "display_proc"
block
{ "{"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "display"
= "="
call_expression
identifier "get_env"
arguments
( "("
string_literal all 2:1
" "\"" all 2:1
string_content "DISPLAY" all 2:1
" "\"" all 2:1
, ","
reference_expression
& "&"
field_expression
self "self"
. "."
field_identifier "uid"
, ","
identifier "proc"
) ")"
; ";"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "xauth"
= "="
call_expression
identifier "get_env"
arguments
( "("
string_literal
" "\""
string_content "XAUTHORITY"
" "\""
, ","
reference_expression
& "&"
field_expression
self "self"
. "."
field_identifier "uid"
, ","
identifier "proc"
) ")"
; ";"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "wl_display"
= "="
call_expression
identifier "get_env"
arguments
( "("
string_literal
" "\""
string_content "WAYLAND_DISPLAY"
" "\""
, ","
reference_expression
& "&"
field_expression
self "self"
. "."
field_identifier "uid"
, ","
identifier "proc"
) ")"
; ";"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "dbus"
= "="
call_expression
identifier "get_env"
arguments
( "("
string_literal
" "\""
string_content "DBUS_SESSION_BUS_ADDRESS"
" "\""
, ","
reference_expression
& "&"
field_expression
self "self"
. "."
field_identifier "uid"
, ","
identifier "proc"
) ")"
; ";"
expression_statement (+38 nodes collapsed)
} "}"
expression_statement
call_expression
identifier "sleep_millis"
arguments
( "("
integer_literal "300"
) ")"
; ";"
} "}"
} "}"
function_item
fn "fn"
identifier "get_display_x11"
parameters
( "("
self_parameter
& "&"
mutable_specifier "mut"
self "self"
) ")"
block
{ "{"
expression_statement
for_expression
for "for"
_ "_"
in "in"
range_expression
integer_literal "1"
..= "..="
integer_literal "10"
block
{ "{"
let_declaration (+23 nodes collapsed)
expression_statement
for_expression
for "for"
identifier "proc"
in "in"
identifier "display_proc"
block
{ "{"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "display"
= "="
call_expression
identifier "get_env"
arguments
( "("
string_literal all 2:1
" "\"" all 2:1
string_content "DISPLAY" all 2:1
" "\"" all 2:1
, ","
reference_expression
& "&"
field_expression
self "self"
. "."
field_identifier "uid"
, ","
identifier "proc"
) ")"
; ";"
expression_statement (+23 nodes collapsed)
} "}"
expression_statement (+23 nodes collapsed)
expression_statement
call_expression
identifier "sleep_millis"
arguments
( "("
integer_literal "300"
) ")"
; ";"
} "}"
expression_statement (+39 nodes collapsed)
expression_statement (+36 nodes collapsed)
expression_statement (+51 nodes collapsed)
} "}"
function_item (+89 nodes collapsed)
function_item (+396 nodes collapsed)
function_item (+446 nodes collapsed)
function_item (+400 nodes collapsed)
function_item (+102 nodes collapsed)
function_item
visibility_modifier
pub "pub"
fn "fn"
identifier "refresh"
parameters
( "("
self_parameter
& "&"
mutable_specifier "mut"
self "self"
) ")"
block
{ "{"
expression_statement
if_expression
if "if"
binary_expression (+26 nodes collapsed)
block
{ "{"
line_comment
// "//"
expression_statement
if_expression
if "if"
binary_expression
call_expression
identifier "is_xwayland_running"
arguments
( "("
) ")"
&& "&&"
unary_expression
! "!"
call_expression
field_expression
self "self"
. "."
field_identifier "is_login_wayland"
arguments
( "("
) ")"
block (+23 nodes collapsed)
expression_statement
return_expression
return "return"
; ";"
} "}"
let_declaration
let "let"
identifier "seat0_values"
= "="
call_expression
identifier "get_values_of_seat0_with_gdm_wayland"
arguments
( "("
reference_expression
& "&"
array_expression
[ "["
integer_literal "0"
, ","
integer_literal "1"
, ","
integer_literal "2"
] "]"
) ")"
; ";"
expression_statement (+47 nodes collapsed)
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "sid"
= "="
call_expression
field_expression
index_expression
identifier "seat0_values"
[ "["
integer_literal "0"
] "]"
. "."
field_identifier "clone"
arguments
( "("
) ")"
; ";"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "uid"
= "="
call_expression
field_expression
index_expression
identifier "seat0_values"
[ "["
integer_literal "1"
] "]"
. "."
field_identifier "clone"
arguments
( "("
) ")"
; ";"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "username"
= "="
call_expression
field_expression
index_expression
identifier "seat0_values"
[ "["
integer_literal "2"
] "]"
. "."
field_identifier "clone"
arguments
( "("
) ")"
; ";"
expression_statement (+26 nodes collapsed)
expression_statement (+64 nodes collapsed)
expression_statement
call_expression
field_expression
self "self"
. "."
field_identifier "get_home"
arguments
( "("
) ")"
; ";"
expression_statement
if_expression
if "if"
call_expression
field_expression
self "self"
. "."
field_identifier "is_wayland"
arguments
( "("
) ")"
block
{ "{"
expression_statement
if_expression
if "if"
call_expression
identifier "is_xwayland_running"
arguments
( "("
) ")"
block
{ "{"
expression_statement
call_expression
field_expression
self "self"
. "."
field_identifier "get_display_xauth_xwayland"
arguments
( "("
) ")"
; ";"
} "}"
else_clause
else "else"
block
{ "{"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "display"
= "="
call_expression
field_expression
string_literal
" "\""
" "\""
. "."
field_identifier "to_owned"
arguments
( "("
) ")"
; ";"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "xauth"
= "="
call_expression
field_expression
string_literal
" "\""
" "\""
. "."
field_identifier "to_owned"
arguments
( "("
) ")"
; ";"
} "}"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "is_rustdesk_subprocess"
= "="
boolean_literal
false "false"
; ";"
} "}"
else_clause (+35 nodes collapsed)
} "}"
} "}"
attribute_item
# "#"
[ "["
attribute
identifier "cfg"
token_tree
( "("
identifier "test"
) ")"
] "]"
mod_item (+164 nodes collapsed)
} "}"
struct_item
visibility_modifier
pub "pub"
struct "struct"
type_identifier "WakeLock"
ordered_field_declaration_list
( "("
generic_type
type_identifier "Option"
type_arguments
< "<"
scoped_type_identifier
identifier "keepawake"
:: "::"
type_identifier "AwakeHandle"
> ">"
) ")"
; ";"
impl_item (+88 nodes collapsed)
function_item (+77 nodes collapsed)
function_item (+47 nodes collapsed)
function_item (+132 nodes collapsed)
function_item (+186 nodes collapsed)
function_item (+190 nodes collapsed)
function_item (+162 nodes collapsed)
function_item (+82 nodes collapsed)
function_item (+133 nodes collapsed)
struct_item (+25 nodes collapsed)
impl_item (+351 nodes collapsed)
impl_item (+117 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item
visibility_modifier
pub "pub"
fn "fn"
identifier "is_x11"
parameters
( "("
) ")"
-> "->"
primitive_type "bool"
block
{ "{"
unary_expression
* "*"
identifier "IS_X11"
} "}"
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+148 nodes collapsed)

After

source_file
use_declaration
use "use"
scoped_use_list
super "super"
:: "::"
use_list
{ "{"
identifier "gtk_sudo"
, ","
identifier "CursorData"
, ","
identifier "ResultType"
} "}"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "desktop"
:: "::"
identifier "Desktop"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "hbb_common"
:: "::"
identifier "config"
:: "::"
identifier "keys"
:: "::"
identifier "OPTION_ALLOW_LINUX_HEADLESS"
; ";"
use_declaration
visibility_modifier
pub "pub"
use "use"
use_wildcard
scoped_identifier
scoped_identifier
identifier "hbb_common"
:: "::"
identifier "platform"
:: "::"
identifier "linux"
:: "::"
* "*"
; ";"
use_declaration (+59 nodes collapsed)
use_declaration
use "use"
scoped_use_list
identifier "std"
:: "::"
use_list
{ "{"
scoped_identifier
identifier "cell"
:: "::"
identifier "RefCell"
, ","
scoped_use_list
identifier "ffi"
:: "::"
use_list
{ "{"
identifier "OsStr"
, ","
identifier "OsString"
} "}"
, ","
scoped_identifier
scoped_identifier
scoped_identifier
identifier "os"
:: "::"
identifier "unix"
:: "::"
identifier "ffi"
:: "::"
identifier "OsStrExt"
, ","
scoped_use_list
identifier "path"
:: "::"
use_list
{ "{"
identifier "Path"
, ","
identifier "PathBuf"
} "}"
, ","
scoped_use_list
identifier "process"
:: "::"
use_list
{ "{"
identifier "Child"
, ","
identifier "Command"
} "}"
, ","
scoped_identifier
identifier "string"
:: "::"
identifier "String"
, ","
scoped_use_list
identifier "sync"
:: "::"
use_list
{ "{"
scoped_use_list
identifier "atomic"
:: "::"
use_list
{ "{"
identifier "AtomicBool"
, ","
identifier "Ordering"
} "}"
, ","
identifier "Arc"
, ","
} "}"
, ","
scoped_use_list
identifier "time"
:: "::"
use_list
{ "{"
identifier "Duration"
, ","
identifier "Instant"
} "}"
, ","
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "terminfo"
:: "::"
use_list
{ "{"
use_as_clause
identifier "capability"
as "as"
identifier "cap"
, ","
identifier "Database"
} "}"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "users"
:: "::"
use_list
{ "{"
identifier "get_user_by_name"
, ","
scoped_identifier
scoped_identifier
identifier "os"
:: "::"
identifier "unix"
:: "::"
identifier "UserExt"
} "}"
; ";"
use_declaration
use "use"
identifier "wallpaper"
; ";"
type_item
type "type"
type_identifier "Xdo"
= "="
pointer_type
* "*"
const "const"
type_identifier "c_void"
; ";"
const_item
visibility_modifier
pub "pub"
const "const"
identifier "PA_SAMPLE_RATE"
: ":"
primitive_type "u32"
= "="
integer_literal "48000"
; ";"
static_item
static "static"
mutable_specifier "mut"
identifier "UNMODIFIED"
: ":"
primitive_type "bool"
= "="
boolean_literal
true "true"
; ";"
const_item (+30 nodes collapsed)
const_item (+36 nodes collapsed)
macro_invocation
scoped_identifier
identifier "lazy_static"
:: "::"
identifier "lazy_static"
! "!"
token_tree
{ "{"
pub "pub"
static "static"
identifier "ref"
identifier "IS_X11"
: ":"
primitive_type "bool"
= "="
identifier "hbb_common"
:: "::"
identifier "platform"
:: "::"
identifier "linux"
:: "::"
identifier "is_x11_or_headless"
token_tree
( "("
) ")"
; ";"
static "static"
identifier "ref"
identifier "DATABASE_XTERM_256COLOR"
: ":"
identifier "Option"
< "<"
identifier "Database"
> ">"
= "="
token_tree (+53 nodes collapsed)
; ";"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
static "static"
identifier "ref"
identifier "SUDO_E_PRESERVES_ENV"
: ":"
primitive_type "bool"
= "="
token_tree
{ "{"
if "if"
! "!"
identifier "is_root"
token_tree
( "("
) ")"
token_tree
{ "{"
identifier "log"
:: "::"
identifier "warn"
! "!"
token_tree
( "("
string_literal
" "\""
string_content "Not running as root, SUDO_E_PRESERVES_ENV check skipped"
" "\""
) ")"
; ";"
boolean_literal
false "false"
} "}"
identifier "else"
token_tree
{ "{"
let "let"
identifier "key"
= "="
identifier "format"
! "!"
token_tree
( "("
string_literal
" "\""
string_content "__RUSTDESK_SUDO_E_TEST_{}"
" "\""
, ","
identifier "std"
:: "::"
identifier "process"
:: "::"
identifier "id"
token_tree
( "("
) ")"
) ")"
; ";"
let "let"
identifier "val"
= "="
string_literal
" "\""
string_content "1"
" "\""
; ";"
let "let"
identifier "expected"
= "="
identifier "format"
! "!"
token_tree
( "("
string_literal
" "\""
string_content "{key}={val}"
" "\""
) ")"
; ";"
identifier "Command"
:: "::"
identifier "new"
token_tree
( "("
string_literal
" "\""
string_content "sudo"
" "\""
) ")"
line_comment
// "//"
. "."
identifier "env"
token_tree
( "("
& "&"
identifier "key"
, ","
identifier "val"
) ")"
. "."
identifier "args"
token_tree
( "("
token_tree
[ "["
string_literal
" "\""
string_content "-n"
" "\""
, ","
string_literal
" "\""
string_content "-E"
" "\""
, ","
string_literal
" "\""
string_content "env"
" "\""
] "]"
) ")"
. "."
identifier "output"
token_tree
( "("
) ")"
. "."
identifier "map"
token_tree
( "("
| "|"
identifier "o"
| "|"
token_tree
{ "{"
identifier "o"
. "."
identifier "status"
. "."
identifier "success"
token_tree
( "("
) ")"
&& "&&"
identifier "String"
:: "::"
identifier "from_utf8_lossy"
token_tree
( "("
& "&"
identifier "o"
. "."
identifier "stdout"
) ")"
. "."
identifier "contains"
token_tree
( "("
identifier "expected"
. "."
identifier "as_str"
token_tree
( "("
) ")"
) ")"
} "}"
) ")"
. "."
identifier "unwrap_or"
token_tree
( "("
boolean_literal
false "false"
) ")"
} "}"
} "}"
; ";"
} "}"
macro_invocation (+70 nodes collapsed)
foreign_mod_item (+172 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "link"
token_tree
( "("
identifier "name"
= "="
string_literal
" "\""
string_content "X11"
" "\""
) ")"
] "]"
foreign_mod_item (+31 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "link"
token_tree
( "("
identifier "name"
= "="
string_literal
" "\""
string_content "Xfixes"
" "\""
) ")"
] "]"
foreign_mod_item (+45 nodes collapsed)
line_comment
// "//"
attribute_item
# "#"
[ "["
attribute
identifier "repr"
token_tree
( "("
identifier "C"
) ")"
] "]"
struct_item (+67 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+28 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+60 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+35 nodes collapsed)
function_item (+167 nodes collapsed)
function_item
visibility_modifier
pub "pub"
fn "fn"
identifier "reset_input_cache"
parameters
( "("
) ")"
block
{ "{"
} "}"
function_item (+372 nodes collapsed)
function_item (+160 nodes collapsed)
function_item (+625 nodes collapsed)
function_item (+112 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Suggests the best terminal type based on the environment.\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " The function prioritizes terminal types in the following or"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " 1. `screen-256color`: Preferred when running inside `tmux` "...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " as these multiplexers often support advanced terminal fe"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " 2. `xterm-256color`: Selected if the terminal supports 256 "...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " suitable for modern terminal applications.\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " 3. `xterm`: Used as a fallback for basic terminal compatibi"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Terminals like `linux` and `vt100` are excluded because the"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " modern features required by many applications.\n"
function_item (+85 nodes collapsed)
function_item (+33 nodes collapsed)
function_item (+33 nodes collapsed)
function_item (+56 nodes collapsed)
function_item (+98 nodes collapsed)
function_item (+187 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+433 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+88 nodes collapsed)
function_item (+142 nodes collapsed)
function_item (+139 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+42 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+75 nodes collapsed)
function_item (+520 nodes collapsed)
line_comment
// "//"
line_comment
// "//"
function_item (+27 nodes collapsed)
function_item (+863 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+64 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+35 nodes collapsed)
function_item (+157 nodes collapsed)
function_item (+153 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+30 nodes collapsed)
line_comment
// "//"
function_item (+96 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+35 nodes collapsed)
function_item (+104 nodes collapsed)
function_item (+138 nodes collapsed)
function_item (+66 nodes collapsed)
function_item (+36 nodes collapsed)
line_comment
// "//"
function_item (+105 nodes collapsed)
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
function_item (+140 nodes collapsed)
function_item (+27 nodes collapsed)
function_item (+58 nodes collapsed)
function_item
visibility_modifier
pub "pub"
fn "fn"
identifier "run_as_user"
type_parameters
< "<"
type_parameter
type_identifier "I"
, ","
type_parameter
type_identifier "K"
, ","
type_parameter
type_identifier "V"
> ">"
parameters (+35 nodes collapsed)
-> "->"
generic_type
type_identifier "ResultType"
type_arguments
< "<"
generic_type
type_identifier "Option"
type_arguments
< "<"
type_identifier "Child"
> ">"
> ">"
where_clause (+43 nodes collapsed)
block
{ "{"
let_declaration (+36 nodes collapsed)
let_declaration
let "let"
identifier "cmd"
= "="
try_expression
call_expression
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "env"
:: "::"
identifier "current_exe"
arguments
( "("
) ")"
? "?"
; ";"
expression_statement (+26 nodes collapsed)
let_declaration
let "let"
identifier "xdg"
= "="
reference_expression
& "&"
macro_invocation
identifier "format"
! "!"
token_tree
( "("
string_literal
" "\""
string_content "XDG_RUNTIME_DIR=/run/user/{uid}" all 2:1
" "\""
) ")"
; ";"
expression_statement
if_expression
if "if"
unary_expression
* "*"
identifier "SUDO_E_PRESERVES_ENV"
block
{ "{"
line_comment
// "//"
let_declaration (+36 nodes collapsed)
expression_statement (+21 nodes collapsed)
line_comment
// "//"
expression_statement
call_expression
field_expression
identifier "args"
. "."
field_identifier "insert"
arguments
( "("
integer_literal "0"
, ","
string_literal
" "\""
string_content "-E"
" "\""
) ")"
; ";"
let_declaration (+42 nodes collapsed)
call_expression
identifier "Ok"
arguments
( "("
call_expression
identifier "Some"
arguments
( "("
identifier "task"
) ")"
) ")"
} "}"
else_clause
else "else"
block
{ "{"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
function_item
fn "fn"
identifier "is_valid_env_key"
parameters
( "("
parameter
identifier "key"
: ":"
reference_type
& "&"
primitive_type "str"
) ")"
-> "->"
primitive_type "bool"
block
{ "{"
let_declaration
let "let"
mutable_specifier "mut"
identifier "it"
= "="
call_expression
field_expression
identifier "key"
. "."
field_identifier "chars"
arguments
( "("
) ")"
; ";"
expression_statement
match_expression
match "match"
call_expression
field_expression
identifier "it"
. "."
field_identifier "next"
arguments
( "("
) ")"
match_block
{ "{"
match_arm
match_pattern
tuple_struct_pattern
identifier "Some"
( "("
identifier "c"
) ")"
if "if"
binary_expression
call_expression
field_expression
identifier "c"
. "."
field_identifier "is_ascii_alphabetic"
arguments
( "("
) ")"
|| "||"
binary_expression
identifier "c"
== "=="
char_literal "'_'"
=> "=>"
block
{ "{"
} "}"
match_arm
match_pattern
_ "_"
=> "=>"
return_expression
return "return"
boolean_literal
false "false"
, ","
} "}"
call_expression
field_expression
identifier "it"
. "."
field_identifier "all"
arguments
( "("
closure_expression
closure_parameters
| "|"
identifier "c"
| "|"
binary_expression
call_expression
field_expression
identifier "c"
. "."
field_identifier "is_ascii_alphanumeric"
arguments
( "("
) ")"
|| "||"
binary_expression
identifier "c"
== "=="
char_literal "'_'"
) ")"
} "}"
let_declaration
let "let"
mutable_specifier "mut"
identifier "sudo"
= "="
call_expression
scoped_identifier
identifier "Command"
:: "::"
identifier "new"
arguments
( "("
string_literal
" "\""
string_content "sudo"
" "\""
) ")"
; ";"
expression_statement
call_expression
field_expression
call_expression
field_expression
call_expression
field_expression
call_expression
field_expression
call_expression
field_expression
identifier "sudo"
. "."
field_identifier "arg"
arguments
( "("
string_literal
" "\""
string_content "-u"
" "\""
) ")"
. "."
field_identifier "arg"
arguments
( "("
reference_expression
& "&"
identifier "username"
) ")"
. "."
field_identifier "arg"
arguments
( "("
string_literal
" "\""
string_content "--"
" "\""
) ")"
. "."
field_identifier "arg"
arguments
( "("
string_literal
" "\""
string_content "env"
" "\""
) ")"
. "."
field_identifier "arg"
arguments
( "("
identifier "xdg"
) ")"
; ";"
expression_statement
for_expression
for "for"
tuple_pattern
( "("
identifier "k"
, ","
identifier "v"
) ")"
in "in"
identifier "envs"
block
{ "{"
let_declaration
let "let"
identifier "key"
= "="
call_expression
field_expression
call_expression
field_expression
identifier "k"
. "."
field_identifier "as_ref"
arguments
( "("
) ")"
. "."
field_identifier "to_string_lossy"
arguments
( "("
) ")"
; ";"
expression_statement
if_expression
if "if"
unary_expression
! "!"
call_expression
identifier "is_valid_env_key"
arguments
( "("
reference_expression
& "&"
identifier "key"
) ")"
block
{ "{"
expression_statement
macro_invocation
scoped_identifier
identifier "log"
:: "::"
identifier "warn"
! "!"
token_tree
( "("
string_literal
" "\""
string_content "Skipping environment variable with invalid key: '{}'. Only ["...
" "\""
, ","
identifier "key"
) ")"
; ";"
expression_statement
continue_expression
continue "continue"
; ";"
} "}"
line_comment
// "//"
line_comment
// "//"
let_declaration
let "let"
mutable_specifier "mut"
identifier "arg"
= "="
call_expression
scoped_identifier
identifier "OsString"
:: "::"
identifier "from"
arguments
( "("
reference_expression
& "&"
unary_expression
* "*"
identifier "key"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "arg"
. "."
field_identifier "push"
arguments
( "("
string_literal
" "\""
string_content "="
" "\""
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "arg"
. "."
field_identifier "push"
arguments
( "("
call_expression
field_expression
identifier "v"
. "."
field_identifier "as_ref"
arguments
( "("
) ")"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "sudo"
. "."
field_identifier "arg"
arguments
( "("
identifier "arg"
) ")"
; ";"
} "}"
expression_statement
call_expression
field_expression
call_expression
field_expression
identifier "sudo"
. "."
field_identifier "arg"
arguments
( "("
identifier "cmd"
) ")"
. "."
field_identifier "args"
arguments
( "("
identifier "arg"
) ")"
; ";"
let_declaration
let "let"
identifier "task"
= "="
try_expression
call_expression
field_expression
identifier "sudo"
. "."
field_identifier "spawn"
arguments
( "("
) ")"
? "?"
; ";"
call_expression
identifier "Ok"
arguments
( "("
call_expression
identifier "Some"
arguments
( "("
identifier "task"
) ")"
) ")"
} "}"
} "}"
function_item (+91 nodes collapsed)
function_item (+92 nodes collapsed)
function_item (+198 nodes collapsed)
function_item (+167 nodes collapsed)
function_item (+50 nodes collapsed)
function_item
visibility_modifier
pub "pub"
fn "fn"
identifier "toggle_blank_screen"
parameters
( "("
parameter
identifier "_v"
: ":"
primitive_type "bool"
) ")"
block
{ "{"
line_comment
// "//"
} "}"
function_item (+38 nodes collapsed)
function_item (+99 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Get multiple environment variables from a process matching "...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " This version reads /proc directly instead of spawning shell"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " # Arguments\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " * `uid` - User ID to filter processes\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " * `process_pat` - Regex pattern to match process cmdline\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " * `names` - Environment variable names to retrieve. **Must "...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " the internal bitmask used for tie-breaking.\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " # Panics (debug builds)\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Panics if `names.len() > 64`.\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " # Implementation notes\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " - Returns values from a *single* best-matching process_pat "...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " - Avoids repeated scanning by parsing `environ` once per pr"...
function_item
fn "fn"
identifier "get_envs"
type_parameters
< "<"
lifetime_parameter
lifetime
' "'"
identifier "a"
> ">"
parameters
( "("
parameter
identifier "uid"
: ":"
reference_type
& "&"
primitive_type "str"
, ","
parameter
identifier "process_pat"
: ":"
reference_type
& "&"
primitive_type "str"
, ","
parameter
identifier "names"
: ":"
reference_type
& "&"
array_type
[ "["
reference_type
& "&"
lifetime
' "'"
identifier "a"
primitive_type "str"
] "]"
, ","
) ")"
-> "->"
generic_type
scoped_type_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "collections"
:: "::"
type_identifier "HashMap"
type_arguments
< "<"
reference_type
& "&"
lifetime
' "'"
identifier "a"
primitive_type "str"
, ","
type_identifier "String"
> ">"
block
{ "{"
line_comment
// "//"
expression_statement
macro_invocation
identifier "debug_assert"
! "!"
token_tree
( "("
identifier "names"
. "."
identifier "len"
token_tree
( "("
) ")"
<= "<="
integer_literal "64"
, ","
string_literal
" "\""
string_content "get_envs: names.len() must be <= 64, got {}"
" "\""
, ","
identifier "names"
. "."
identifier "len"
token_tree
( "("
) ")"
) ")"
; ";"
let_declaration
let "let"
identifier "empty"
: ":"
generic_type
scoped_type_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "collections"
:: "::"
type_identifier "HashMap"
type_arguments
< "<"
reference_type
& "&"
lifetime
' "'"
identifier "a"
primitive_type "str"
, ","
type_identifier "String"
> ">"
= "="
call_expression
field_expression
call_expression
field_expression
call_expression
field_expression
identifier "names"
. "."
field_identifier "iter"
arguments
( "("
) ")"
. "."
field_identifier "map"
arguments
( "("
closure_expression
closure_parameters
| "|"
reference_pattern
& "&"
identifier "n"
| "|"
tuple_expression
( "("
identifier "n"
, ","
call_expression
scoped_identifier
identifier "String"
:: "::"
identifier "new"
arguments
( "("
) ")"
) ")"
) ")"
. "."
field_identifier "collect"
arguments
( "("
) ")"
; ";"
let_declaration
let "let"
tuple_struct_pattern
identifier "Ok"
( "("
identifier "uid_num"
) ")"
= "="
call_expression
generic_function
field_expression
identifier "uid"
. "."
field_identifier "parse"
:: "::"
type_arguments
< "<"
primitive_type "u32"
> ">"
arguments
( "("
) ")"
else "else"
block
{ "{"
expression_statement
return_expression
return "return"
identifier "empty"
; ";"
} "}"
; ";"
let_declaration
let "let"
tuple_struct_pattern
identifier "Ok"
( "("
identifier "re"
) ")"
= "="
call_expression
scoped_identifier
identifier "Regex"
:: "::"
identifier "new"
arguments
( "("
identifier "process_pat"
) ")"
else "else"
block
{ "{"
expression_statement
return_expression
return "return"
identifier "empty"
; ";"
} "}"
; ";"
line_comment
// "//"
line_comment
// "//"
let_declaration
let "let"
identifier "name_indices"
: ":"
generic_type
scoped_type_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "collections"
:: "::"
type_identifier "HashMap"
type_arguments
< "<"
reference_type
& "&"
lifetime
' "'"
identifier "a"
primitive_type "str"
, ","
primitive_type "usize"
> ">"
= "="
call_expression
field_expression
call_expression
field_expression
call_expression
field_expression
call_expression
field_expression
identifier "names"
. "."
field_identifier "iter"
arguments
( "("
) ")"
. "."
field_identifier "enumerate"
arguments
( "("
) ")"
. "."
field_identifier "map"
arguments
( "("
closure_expression
closure_parameters
| "|"
tuple_pattern
( "("
identifier "i"
, ","
reference_pattern
& "&"
identifier "n"
) ")"
| "|"
tuple_expression
( "("
identifier "n"
, ","
identifier "i"
) ")"
) ")"
. "."
field_identifier "collect"
arguments
( "("
) ")"
; ";"
let_declaration
let "let"
mutable_specifier "mut"
identifier "best"
= "="
call_expression
field_expression
identifier "empty"
. "."
field_identifier "clone"
arguments
( "("
) ")"
; ";"
let_declaration
let "let"
mutable_specifier "mut"
identifier "best_count"
= "="
integer_literal "0usize"
; ";"
let_declaration
let "let"
mutable_specifier "mut"
identifier "best_mask"
: ":"
primitive_type "u64"
= "="
integer_literal "0"
; ";"
line_comment
// "//"
let_declaration
let "let"
tuple_struct_pattern
identifier "Ok"
( "("
identifier "entries"
) ")"
= "="
call_expression
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "fs"
:: "::"
identifier "read_dir"
arguments
( "("
string_literal
" "\""
string_content "/proc"
" "\""
) ")"
else "else"
block
{ "{"
expression_statement
return_expression
return "return"
identifier "best"
; ";"
} "}"
; ";"
expression_statement
for_expression
for "for"
identifier "entry"
in "in"
call_expression
field_expression
identifier "entries"
. "."
field_identifier "flatten"
arguments
( "("
) ")"
block
{ "{"
let_declaration
let "let"
identifier "file_name"
= "="
call_expression
field_expression
identifier "entry"
. "."
field_identifier "file_name"
arguments
( "("
) ")"
; ";"
let_declaration
let "let"
tuple_struct_pattern
identifier "Some"
( "("
identifier "pid_str"
) ")"
= "="
call_expression
field_expression
identifier "file_name"
. "."
field_identifier "to_str"
arguments
( "("
) ")"
else "else"
block
{ "{"
expression_statement
continue_expression
continue "continue"
; ";"
} "}"
; ";"
expression_statement
if_expression
if "if"
unary_expression
! "!"
call_expression
field_expression
call_expression
field_expression
identifier "pid_str"
. "."
field_identifier "chars"
arguments
( "("
) ")"
. "."
field_identifier "all"
arguments
( "("
closure_expression
closure_parameters
| "|"
identifier "c"
| "|"
call_expression
field_expression
identifier "c"
. "."
field_identifier "is_ascii_digit"
arguments
( "("
) ")"
) ")"
block
{ "{"
expression_statement
continue_expression
continue "continue"
; ";"
} "}"
let_declaration
let "let"
identifier "proc_path"
= "="
call_expression
field_expression
identifier "entry"
. "."
field_identifier "path"
arguments
( "("
) ")"
; ";"
line_comment
// "//"
expression_statement
if_expression
if "if"
let_condition
let "let"
tuple_struct_pattern
identifier "Ok"
( "("
identifier "meta"
) ")"
= "="
call_expression
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "fs"
:: "::"
identifier "metadata"
arguments
( "("
reference_expression
& "&"
identifier "proc_path"
) ")"
block
{ "{"
use_declaration
use "use"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "os"
:: "::"
identifier "unix"
:: "::"
identifier "fs"
:: "::"
identifier "MetadataExt"
; ";"
expression_statement
if_expression
if "if"
binary_expression
call_expression
field_expression
identifier "meta"
. "."
field_identifier "uid"
arguments
( "("
) ")"
!= "!="
identifier "uid_num"
block
{ "{"
expression_statement
continue_expression
continue "continue"
; ";"
} "}"
} "}"
else_clause
else "else"
block
{ "{"
expression_statement
continue_expression
continue "continue"
; ";"
} "}"
line_comment
// "//"
let_declaration
let "let"
identifier "cmdline_path"
= "="
call_expression
field_expression
identifier "proc_path"
. "."
field_identifier "join"
arguments
( "("
string_literal
" "\""
string_content "cmdline"
" "\""
) ")"
; ";"
let_declaration
let "let"
tuple_struct_pattern
identifier "Ok"
( "("
identifier "cmdline"
) ")"
= "="
call_expression
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "fs"
:: "::"
identifier "read"
arguments
( "("
reference_expression
& "&"
identifier "cmdline_path"
) ")"
else "else"
block
{ "{"
expression_statement
continue_expression
continue "continue"
; ";"
} "}"
; ";"
let_declaration
let "let"
identifier "cmdline_str"
= "="
call_expression
field_expression
call_expression
scoped_identifier
identifier "String"
:: "::"
identifier "from_utf8_lossy"
arguments
( "("
reference_expression
& "&"
identifier "cmdline"
) ")"
. "."
field_identifier "replace"
arguments
( "("
char_literal "'\\0'"
, ","
string_literal
" "\""
string_content " "
" "\""
) ")"
; ";"
expression_statement
if_expression
if "if"
unary_expression
! "!"
call_expression
field_expression
identifier "re"
. "."
field_identifier "is_match"
arguments
( "("
reference_expression
& "&"
identifier "cmdline_str"
) ")"
block
{ "{"
expression_statement
continue_expression
continue "continue"
; ";"
} "}"
line_comment
// "//"
let_declaration
let "let"
identifier "environ_path"
= "="
call_expression
field_expression
identifier "proc_path"
. "."
field_identifier "join"
arguments
( "("
string_literal
" "\""
string_content "environ"
" "\""
) ")"
; ";"
let_declaration
let "let"
tuple_struct_pattern
identifier "Ok"
( "("
identifier "environ"
) ")"
= "="
call_expression
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "fs"
:: "::"
identifier "read"
arguments
( "("
reference_expression
& "&"
identifier "environ_path"
) ")"
else "else"
block
{ "{"
expression_statement
continue_expression
continue "continue"
; ";"
} "}"
; ";"
let_declaration
let "let"
mutable_specifier "mut"
identifier "found"
= "="
call_expression
field_expression
identifier "empty"
. "."
field_identifier "clone"
arguments
( "("
) ")"
; ";"
let_declaration
let "let"
mutable_specifier "mut"
identifier "found_count"
= "="
integer_literal "0usize"
; ";"
let_declaration
let "let"
mutable_specifier "mut"
identifier "found_mask"
: ":"
primitive_type "u64"
= "="
integer_literal "0"
; ";"
expression_statement
for_expression
for "for"
identifier "part"
in "in"
call_expression
field_expression
identifier "environ"
. "."
field_identifier "split"
arguments
( "("
closure_expression
closure_parameters
| "|"
reference_pattern
& "&"
identifier "b"
| "|"
binary_expression
identifier "b"
== "=="
integer_literal "0"
) ")"
block
{ "{"
expression_statement
if_expression
if "if"
call_expression
field_expression
identifier "part"
. "."
field_identifier "is_empty"
arguments
( "("
) ")"
block
{ "{"
expression_statement
continue_expression
continue "continue"
; ";"
} "}"
let_declaration
let "let"
tuple_struct_pattern
identifier "Some"
( "("
identifier "eq"
) ")"
= "="
call_expression
field_expression
call_expression
field_expression
identifier "part"
. "."
field_identifier "iter"
arguments
( "("
) ")"
. "."
field_identifier "position"
arguments
( "("
closure_expression
closure_parameters
| "|"
reference_pattern
& "&"
identifier "b"
| "|"
binary_expression
identifier "b"
== "=="
char_literal "b'='"
) ")"
else "else"
block
{ "{"
expression_statement
continue_expression
continue "continue"
; ";"
} "}"
; ";"
let_declaration
let "let"
identifier "key_bytes"
= "="
reference_expression
& "&"
index_expression
identifier "part"
[ "["
range_expression
.. ".."
identifier "eq"
] "]"
; ";"
let_declaration
let "let"
identifier "val_bytes"
= "="
reference_expression
& "&"
index_expression
identifier "part"
[ "["
range_expression
binary_expression
identifier "eq"
+ "+"
integer_literal "1"
.. ".."
] "]"
; ";"
let_declaration
let "let"
tuple_struct_pattern
identifier "Ok"
( "("
identifier "key"
) ")"
= "="
call_expression
scoped_identifier
scoped_identifier
identifier "std"
:: "::"
identifier "str"
:: "::"
identifier "from_utf8"
arguments
( "("
identifier "key_bytes"
) ")"
else "else"
block
{ "{"
expression_statement
continue_expression
continue "continue"
; ";"
} "}"
; ";"
expression_statement
if_expression
if "if"
let_condition
let "let"
tuple_struct_pattern
identifier "Some"
( "("
identifier "slot"
) ")"
= "="
call_expression
field_expression
identifier "found"
. "."
field_identifier "get_mut"
arguments
( "("
identifier "key"
) ")"
block
{ "{"
expression_statement
if_expression
if "if"
call_expression
field_expression
identifier "slot"
. "."
field_identifier "is_empty"
arguments
( "("
) ")"
block
{ "{"
expression_statement
assignment_expression
unary_expression
* "*"
identifier "slot"
= "="
call_expression
field_expression
call_expression
scoped_identifier
identifier "String"
:: "::"
identifier "from_utf8_lossy"
arguments
( "("
identifier "val_bytes"
) ")"
. "."
field_identifier "into_owned"
arguments
( "("
) ")"
; ";"
expression_statement
compound_assignment_expr
identifier "found_count"
+= "+="
integer_literal "1"
; ";"
expression_statement
if_expression
if "if"
let_condition
let "let"
tuple_struct_pattern
identifier "Some"
( "("
reference_pattern
& "&"
identifier "idx"
) ")"
= "="
call_expression
field_expression
identifier "name_indices"
. "."
field_identifier "get"
arguments
( "("
identifier "key"
) ")"
block
{ "{"
let_declaration
let "let"
identifier "total"
= "="
call_expression
field_expression
identifier "names"
. "."
field_identifier "len"
arguments
( "("
) ")"
; ";"
expression_statement
if_expression
if "if"
binary_expression
identifier "total"
<= "<="
integer_literal "64"
block
{ "{"
let_declaration
let "let"
identifier "bit"
= "="
binary_expression
integer_literal "1u64"
<< "<<"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "total"
- "-"
integer_literal "1"
- "-"
identifier "idx"
) ")"
; ";"
expression_statement
compound_assignment_expr
identifier "found_mask"
|= "|="
identifier "bit"
; ";"
} "}"
} "}"
expression_statement
if_expression
if "if"
binary_expression
identifier "found_count"
== "=="
call_expression
field_expression
identifier "names"
. "."
field_identifier "len"
arguments
( "("
) ")"
block
{ "{"
expression_statement
return_expression
return "return"
identifier "found"
; ";"
} "}"
} "}"
} "}"
} "}"
expression_statement
if_expression
if "if"
binary_expression
binary_expression
identifier "found_count"
> ">"
identifier "best_count"
|| "||"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "found_count"
== "=="
identifier "best_count"
&& "&&"
binary_expression
identifier "found_mask"
> ">"
identifier "best_mask"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "best"
= "="
identifier "found"
; ";"
expression_statement
assignment_expression
identifier "best_count"
= "="
identifier "found_count"
; ";"
expression_statement
assignment_expression
identifier "best_mask"
= "="
identifier "found_mask"
; ";"
} "}"
} "}"
identifier "best"
} "}"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Deprecated: Use `get_envs` instead.\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " https://github.com/rustdesk/rustdesk/discussions/11959\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " **Note**: This function is retained for conservative migrat"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " transition all callers to `get_envs` after it proves stable"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " is confirmed to work correctly across all use cases, this f"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " # Arguments\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " * `name` - Environment variable name to retrieve\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " * `uid` - User ID to filter processes\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " * `process` - Process name pattern to match\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " # Returns\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " The environment variable value, or empty string if not foun"...
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+110 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+101 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "link"
token_tree
( "("
identifier "name"
= "="
string_literal
" "\""
string_content "gtk-3"
" "\""
) ")"
] "]"
foreign_mod_item
extern_modifier
extern "extern"
string_literal
" "\""
string_content "C"
" "\""
declaration_list
{ "{"
function_signature_item
fn "fn"
identifier "gtk_main_quit"
parameters
( "("
) ")"
; ";"
} "}"
function_item (+24 nodes collapsed)
block_comment
/* "/*"
*/ "*/"
function_item (+47 nodes collapsed)
block_comment
/* "/*"
*/ "*/"
type_item
type "type"
type_identifier "GtkSettingsPtr"
= "="
pointer_type
* "*"
mutable_specifier "mut"
type_identifier "c_void"
; ";"
type_item
type "type"
type_identifier "GObjectPtr"
= "="
pointer_type
* "*"
mutable_specifier "mut"
type_identifier "c_void"
; ";"
attribute_item
# "#"
[ "["
attribute
identifier "link"
token_tree
( "("
identifier "name"
= "="
string_literal
" "\""
string_content "gtk-3"
" "\""
) ")"
] "]"
foreign_mod_item (+21 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "link"
token_tree
( "("
identifier "name"
= "="
string_literal
" "\""
string_content "gobject-2.0"
" "\""
) ")"
] "]"
foreign_mod_item (+32 nodes collapsed)
function_item (+114 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+198 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+27 nodes collapsed)
function_item (+371 nodes collapsed)
function_item (+159 nodes collapsed)
function_item (+107 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+54 nodes collapsed)
mod_item
mod "mod"
identifier "desktop"
declaration_list
{ "{"
use_declaration
use "use"
use_wildcard
super "super"
:: "::"
* "*"
; ";"
const_item
visibility_modifier
pub "pub"
const "const"
identifier "XFCE4_PANEL"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "xfce4-panel"
" "\""
; ";"
const_item
visibility_modifier
pub "pub"
const "const"
identifier "SDDM_GREETER"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "sddm-greeter"
" "\""
; ";"
line_comment
// "//"
const_item
const "const"
identifier "XDG_DESKTOP_PORTAL"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "xdg-desktop-portal"
" "\""
; ";"
const_item
const "const"
identifier "XWAYLAND"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "Xwayland"
" "\""
; ";"
const_item
const "const"
identifier "IBUS_DAEMON"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "ibus-daemon"
" "\""
; ";"
const_item
const "const"
identifier "PLASMA_KDED"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "kded[0-9]+"
" "\""
; ";"
const_item
const "const"
identifier "GNOME_GOA_DAEMON"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "goa-daemon"
" "\""
; ";"
const_item
const "const"
identifier "ENV_KEY_DISPLAY"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal all 2:1
" "\"" all 2:1
string_content "DISPLAY" all 2:1
" "\"" all 2:1
; ";"
const_item
const "const"
identifier "ENV_KEY_XAUTHORITY"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "XAUTHORITY"
" "\""
; ";"
const_item
const "const"
identifier "ENV_KEY_WAYLAND_DISPLAY"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "WAYLAND_DISPLAY"
" "\""
; ";"
const_item
const "const"
identifier "ENV_KEY_DBUS_SESSION_BUS_ADDRESS"
: ":"
reference_type
& "&"
primitive_type "str"
= "="
string_literal
" "\""
string_content "DBUS_SESSION_BUS_ADDRESS"
" "\""
; ";"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
, ","
identifier "Clone"
, ","
identifier "Default"
) ")"
] "]"
struct_item (+78 nodes collapsed)
impl_item
impl "impl"
type_identifier "Desktop"
declaration_list
{ "{"
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+23 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+39 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+33 nodes collapsed)
function_item
fn "fn"
identifier "get_display_xauth_wayland"
parameters
( "("
self_parameter
& "&"
mutable_specifier "mut"
self "self"
) ")"
block
{ "{"
expression_statement
for_expression
for "for"
_ "_"
in "in"
range_expression
integer_literal "1"
..= "..="
integer_literal "10"
block
{ "{"
line_comment
// "//"
let_declaration
let "let"
mutable_specifier "mut"
identifier "envs"
= "="
call_expression
identifier "get_envs"
arguments
( "("
reference_expression
& "&"
field_expression
self "self"
. "."
field_identifier "uid"
, ","
identifier "XDG_DESKTOP_PORTAL"
, ","
reference_expression
& "&"
array_expression
[ "["
identifier "ENV_KEY_WAYLAND_DISPLAY"
, ","
identifier "ENV_KEY_DBUS_SESSION_BUS_ADDRESS"
, ","
identifier "ENV_KEY_DISPLAY"
, ","
identifier "ENV_KEY_XAUTHORITY"
, ","
] "]"
, ","
) ")"
; ";"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "display"
= "="
call_expression
field_expression
call_expression
field_expression
identifier "envs"
. "."
field_identifier "remove"
arguments
( "("
identifier "ENV_KEY_DISPLAY"
) ")"
. "."
field_identifier "unwrap_or_default"
arguments
( "("
) ")"
; ";"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "xauth"
= "="
call_expression
field_expression
call_expression
field_expression
identifier "envs"
. "."
field_identifier "remove"
arguments
( "("
identifier "ENV_KEY_XAUTHORITY"
) ")"
. "."
field_identifier "unwrap_or_default"
arguments
( "("
) ")"
; ";"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "wl_display"
= "="
call_expression
field_expression
call_expression
field_expression
identifier "envs"
. "."
field_identifier "remove"
arguments
( "("
identifier "ENV_KEY_WAYLAND_DISPLAY"
) ")"
. "."
field_identifier "unwrap_or_default"
arguments
( "("
) ")"
; ";"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "dbus"
= "="
call_expression
field_expression
call_expression
field_expression
identifier "envs"
. "."
field_identifier "remove"
arguments
( "("
identifier "ENV_KEY_DBUS_SESSION_BUS_ADDRESS"
) ")"
. "."
field_identifier "unwrap_or_default"
arguments
( "("
) ")"
; ";"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
let_declaration
let "let"
identifier "has_wayland"
= "="
unary_expression
! "!"
call_expression
field_expression
field_expression
self "self"
. "."
field_identifier "wl_display"
. "."
field_identifier "is_empty"
arguments
( "("
) ")"
; ";"
let_declaration
let "let"
identifier "has_dbus"
= "="
unary_expression
! "!"
call_expression
field_expression
field_expression
self "self"
. "."
field_identifier "dbus"
. "."
field_identifier "is_empty"
arguments
( "("
) ")"
; ";"
expression_statement
if_expression
if "if"
binary_expression
identifier "has_wayland"
&& "&&"
identifier "has_dbus"
block
{ "{"
expression_statement
return_expression
return "return"
; ";"
} "}"
expression_statement
call_expression
identifier "sleep_millis"
arguments
( "("
integer_literal "300"
) ")"
; ";"
} "}"
} "}"
function_item
fn "fn"
identifier "get_display_xauth_xwayland"
parameters
( "("
self_parameter
& "&"
mutable_specifier "mut"
self "self"
) ")"
block
{ "{"
let_declaration (+27 nodes collapsed)
expression_statement
for_expression
for "for"
_ "_"
in "in"
range_expression
integer_literal "1"
..= "..="
integer_literal "10"
block
{ "{"
let_declaration
let "let"
identifier "display_proc"
= "="
macro_invocation
identifier "vec"
! "!"
token_tree
[ "["
identifier "XDG_DESKTOP_PORTAL"
, ","
identifier "XWAYLAND"
, ","
identifier "IBUS_DAEMON"
, ","
identifier "GNOME_GOA_DAEMON"
, ","
identifier "PLASMA_KDED"
, ","
identifier "tray"
. "."
identifier "as_str"
token_tree
( "("
) ")"
, ","
] "]"
; ";"
expression_statement
for_expression
for "for"
identifier "proc"
in "in"
identifier "display_proc"
block
{ "{"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "display"
= "="
call_expression
identifier "get_env"
arguments
( "("
identifier "ENV_KEY_DISPLAY"
, ","
reference_expression
& "&"
field_expression
self "self"
. "."
field_identifier "uid"
, ","
identifier "proc"
) ")"
; ";"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "xauth"
= "="
call_expression
identifier "get_env"
arguments
( "("
identifier "ENV_KEY_XAUTHORITY"
, ","
reference_expression
& "&"
field_expression
self "self"
. "."
field_identifier "uid"
, ","
identifier "proc"
) ")"
; ";"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "wl_display"
= "="
call_expression
identifier "get_env"
arguments
( "("
identifier "ENV_KEY_WAYLAND_DISPLAY"
, ","
reference_expression
& "&"
field_expression
self "self"
. "."
field_identifier "uid"
, ","
identifier "proc"
) ")"
; ";"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "dbus"
= "="
call_expression
identifier "get_env"
arguments
( "("
identifier "ENV_KEY_DBUS_SESSION_BUS_ADDRESS"
, ","
reference_expression
& "&"
field_expression
self "self"
. "."
field_identifier "uid"
, ","
identifier "proc"
) ")"
; ";"
expression_statement (+38 nodes collapsed)
} "}"
expression_statement
call_expression
identifier "sleep_millis"
arguments
( "("
integer_literal "300"
) ")"
; ";"
} "}"
} "}"
function_item
fn "fn"
identifier "get_display_x11"
parameters
( "("
self_parameter
& "&"
mutable_specifier "mut"
self "self"
) ")"
block
{ "{"
expression_statement
for_expression
for "for"
_ "_"
in "in"
range_expression
integer_literal "1"
..= "..="
integer_literal "10"
block
{ "{"
let_declaration (+23 nodes collapsed)
expression_statement
for_expression
for "for"
identifier "proc"
in "in"
identifier "display_proc"
block
{ "{"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "display"
= "="
call_expression
identifier "get_env"
arguments
( "("
identifier "ENV_KEY_DISPLAY"
, ","
reference_expression
& "&"
field_expression
self "self"
. "."
field_identifier "uid"
, ","
identifier "proc"
) ")"
; ";"
expression_statement (+23 nodes collapsed)
} "}"
expression_statement (+23 nodes collapsed)
expression_statement
call_expression
identifier "sleep_millis"
arguments
( "("
integer_literal "300"
) ")"
; ";"
} "}"
expression_statement (+39 nodes collapsed)
expression_statement (+36 nodes collapsed)
expression_statement (+51 nodes collapsed)
} "}"
function_item (+89 nodes collapsed)
function_item (+396 nodes collapsed)
function_item (+446 nodes collapsed)
function_item (+400 nodes collapsed)
function_item (+102 nodes collapsed)
function_item
visibility_modifier
pub "pub"
fn "fn"
identifier "refresh"
parameters
( "("
self_parameter
& "&"
mutable_specifier "mut"
self "self"
) ")"
block
{ "{"
expression_statement
if_expression
if "if"
binary_expression (+26 nodes collapsed)
block
{ "{"
line_comment
// "//"
expression_statement
if_expression
if "if"
binary_expression
call_expression
identifier "is_xwayland_running"
arguments
( "("
) ")"
&& "&&"
unary_expression
! "!"
call_expression
field_expression
self "self"
. "."
field_identifier "is_login_wayland"
arguments
( "("
) ")"
block (+23 nodes collapsed)
else_clause
else "else"
if_expression
if "if"
call_expression
field_expression
self "self"
. "."
field_identifier "is_wayland"
arguments
( "("
) ")"
block
{ "{"
expression_statement
call_expression
field_expression
self "self"
. "."
field_identifier "get_display_xauth_wayland"
arguments
( "("
) ")"
; ";"
} "}"
expression_statement
return_expression
return "return"
; ";"
} "}"
let_declaration
let "let"
identifier "seat0_values"
= "="
call_expression
identifier "get_values_of_seat0_with_gdm_wayland"
arguments
( "("
reference_expression
& "&"
array_expression
[ "["
integer_literal "0"
, ","
integer_literal "1"
, ","
integer_literal "2"
] "]"
) ")"
; ";"
expression_statement (+47 nodes collapsed)
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "sid"
= "="
call_expression
field_expression
index_expression
identifier "seat0_values"
[ "["
integer_literal "0"
] "]"
. "."
field_identifier "clone"
arguments
( "("
) ")"
; ";"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "uid"
= "="
call_expression
field_expression
index_expression
identifier "seat0_values"
[ "["
integer_literal "1"
] "]"
. "."
field_identifier "clone"
arguments
( "("
) ")"
; ";"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "username"
= "="
call_expression
field_expression
index_expression
identifier "seat0_values"
[ "["
integer_literal "2"
] "]"
. "."
field_identifier "clone"
arguments
( "("
) ")"
; ";"
expression_statement (+26 nodes collapsed)
expression_statement (+64 nodes collapsed)
expression_statement
call_expression
field_expression
self "self"
. "."
field_identifier "get_home"
arguments
( "("
) ")"
; ";"
expression_statement
if_expression
if "if"
call_expression
field_expression
self "self"
. "."
field_identifier "is_wayland"
arguments
( "("
) ")"
block
{ "{"
expression_statement
if_expression
if "if"
call_expression
identifier "is_xwayland_running"
arguments
( "("
) ")"
block
{ "{"
expression_statement
call_expression
field_expression
self "self"
. "."
field_identifier "get_display_xauth_xwayland"
arguments
( "("
) ")"
; ";"
} "}"
else_clause
else "else"
block
{ "{"
expression_statement
call_expression
field_expression
self "self"
. "."
field_identifier "get_display_xauth_wayland"
arguments
( "("
) ")"
; ";"
} "}"
expression_statement
assignment_expression
field_expression
self "self"
. "."
field_identifier "is_rustdesk_subprocess"
= "="
boolean_literal
false "false"
; ";"
} "}"
else_clause (+35 nodes collapsed)
} "}"
} "}"
attribute_item
# "#"
[ "["
attribute
identifier "cfg"
token_tree
( "("
identifier "test"
) ")"
] "]"
mod_item (+164 nodes collapsed)
} "}"
struct_item
visibility_modifier
pub "pub"
struct "struct"
type_identifier "WakeLock"
ordered_field_declaration_list
( "("
generic_type
type_identifier "Option"
type_arguments
< "<"
scoped_type_identifier
identifier "keepawake"
:: "::"
type_identifier "AwakeHandle"
> ">"
) ")"
; ";"
impl_item (+88 nodes collapsed)
function_item (+77 nodes collapsed)
function_item (+47 nodes collapsed)
function_item (+132 nodes collapsed)
function_item (+186 nodes collapsed)
function_item (+190 nodes collapsed)
function_item (+162 nodes collapsed)
function_item (+82 nodes collapsed)
function_item (+133 nodes collapsed)
struct_item (+25 nodes collapsed)
impl_item (+351 nodes collapsed)
impl_item (+117 nodes collapsed)
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item
visibility_modifier
pub "pub"
fn "fn"
identifier "is_x11"
parameters
( "("
) ")"
-> "->"
primitive_type "bool"
block
{ "{"
unary_expression
* "*"
identifier "IS_X11"
} "}"
attribute_item
# "#"
[ "["
attribute
identifier "inline"
] "]"
function_item (+148 nodes collapsed)