Skip to content

Commit

Permalink
Merge pull request rustdesk#5990 from 21pages/remove_wallpaper_win_linux
Browse files Browse the repository at this point in the history
win,linux remove desktop wallpaper
  • Loading branch information
rustdesk authored Oct 14, 2023
2 parents e0e5cc0 + bd36ee4 commit f200bd2
Show file tree
Hide file tree
Showing 45 changed files with 452 additions and 44 deletions.
23 changes: 23 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ clipboard = { path = "libs/clipboard" }
ctrlc = "3.2"
arboard = "3.2"
system_shutdown = "4.0"
shutdown_hooks = "0.1"

[target.'cfg(target_os = "windows")'.dependencies]
winapi = { version = "0.3", features = ["winuser", "wincrypt", "shellscalingapi"] }
Expand All @@ -96,7 +97,6 @@ windows-service = "0.6"
virtual_display = { path = "libs/virtual_display", optional = true }
impersonate_system = { git = "https://github.com/21pages/impersonate-system" }
shared_memory = "0.12"
shutdown_hooks = "0.1"
tauri-winrt-notification = "0.1.2"

[target.'cfg(target_os = "macos")'.dependencies]
Expand All @@ -118,6 +118,9 @@ image = "0.24"
[target.'cfg(any(target_os = "macos", target_os = "linux"))'.dependencies]
keepawake = { git = "https://github.com/rustdesk-org/keepawake-rs" }

[target.'cfg(any(target_os = "windows", target_os = "linux"))'.dependencies]
wallpaper = { git = "https://github.com/21pages/wallpaper.rs" }

[target.'cfg(target_os = "linux")'.dependencies]
psimple = { package = "libpulse-simple-binding", version = "2.27" }
pulse = { package = "libpulse-binding", version = "2.27" }
Expand Down
82 changes: 82 additions & 0 deletions flutter/lib/desktop/pages/desktop_setting_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';

Expand Down Expand Up @@ -322,6 +323,24 @@ class _GeneralState extends State<_General> {
'enable-confirm-closing-tabs',
isServer: false),
_OptionCheckBox(context, 'Adaptive bitrate', 'enable-abr'),
if (Platform.isWindows || Platform.isLinux)
Row(
children: [
Flexible(
child: _OptionCheckBox(
context,
'Remove wallpaper during incoming sessions',
'allow-remove-wallpaper'),
),
_CountDownButton(
text: 'Test',
second: 5,
onPressed: () {
bind.mainTestWallpaper(second: 5);
},
)
],
),
_OptionCheckBox(
context,
'Open connection in new tab',
Expand Down Expand Up @@ -1873,6 +1892,69 @@ class _ComboBox extends StatelessWidget {
}
}

class _CountDownButton extends StatefulWidget {
_CountDownButton({
Key? key,
required this.text,
required this.second,
required this.onPressed,
}) : super(key: key);
final String text;
final VoidCallback? onPressed;
final int second;

@override
State<_CountDownButton> createState() => _CountDownButtonState();
}

class _CountDownButtonState extends State<_CountDownButton> {
bool _isButtonDisabled = false;

late int _countdownSeconds = widget.second;

Timer? _timer;

@override
void dispose() {
_timer?.cancel();
super.dispose();
}

void _startCountdownTimer() {
_timer = Timer.periodic(Duration(seconds: 1), (timer) {
if (_countdownSeconds <= 0) {
setState(() {
_isButtonDisabled = false;
});
timer.cancel();
} else {
setState(() {
_countdownSeconds--;
});
}
});
}

@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: _isButtonDisabled
? null
: () {
widget.onPressed?.call();
setState(() {
_isButtonDisabled = true;
_countdownSeconds = widget.second;
});
_startCountdownTimer();
},
child: Text(
_isButtonDisabled ? '$_countdownSeconds s' : translate(widget.text),
),
);
}
}

//#endregion

//#region dialogs
Expand Down
12 changes: 12 additions & 0 deletions src/flutter_ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1613,6 +1613,18 @@ pub fn main_start_ipc_url_server() {
std::thread::spawn(move || crate::server::start_ipc_url_server());
}

pub fn main_test_wallpaper(_second: u64) {
#[cfg(any(target_os = "windows", target_os = "linux"))]
std::thread::spawn(move || match crate::platform::WallPaperRemover::new() {
Ok(_remover) => {
std::thread::sleep(std::time::Duration::from_secs(_second));
}
Err(e) => {
log::info!("create wallpaper remover failed:{:?}", e);
}
});
}

/// Send a url scheme throught the ipc.
///
/// * macOS only
Expand Down
4 changes: 3 additions & 1 deletion src/lang/ar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/ca.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/cn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "启动时检查软件更新"),
("upgrade_rustdesk_server_pro_to_{}_tip", "请升级专业版服务器到{}或更高版本!"),
("pull_group_failed_tip", "获取组信息失败"),
("Filter by intersection", "按交集过滤")
("Filter by intersection", "按交集过滤"),
("Remove wallpaper during incoming sessions", "接受会话时移除桌面壁纸"),
("Test", "测试"),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/cs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Kontrola aktualizace softwaru při spuštění"),
("upgrade_rustdesk_server_pro_to_{}_tip", "Aktualizujte prosím RustDesk Server Pro na verzi {} nebo novější!"),
("pull_group_failed_tip", "Nepodařilo se obnovit skupinu"),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/da.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
2 changes: 2 additions & 0 deletions src/lang/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Beim Start auf Softwareaktualisierung prüfen"),
("upgrade_rustdesk_server_pro_to_{}_tip", "Bitte aktualisieren Sie RustDesk Server Pro auf die Version {} oder neuer!"),
("pull_group_failed_tip", "Aktualisierung der Gruppe fehlgeschlagen"),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
("Filter by intersection", "Nach Schnittpunkt filtern")
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/el.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/eo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/es.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Comprobar actualización al iniciar"),
("upgrade_rustdesk_server_pro_to_{}_tip", "¡Por favor, actualiza RustDesk Server Pro a la versión {} o superior"),
("pull_group_failed_tip", "No se ha podido refrescar el grupo"),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/fa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/fr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Vérifier la disponibilité des mises à jour au démarrage"),
("upgrade_rustdesk_server_pro_to_{}_tip", "Veuillez mettre à jour RustDesk Server Pro avec la version {} ou une version plus récente !"),
("pull_group_failed_tip", "Échec de l'actualisation du groupe"),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/hu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Periksa pembaruan aplikasi saat sistem dinyalakan."),
("upgrade_rustdesk_server_pro_to_{}_tip", "Silahkan perbarui RustDesk Server Pro ke versi {} atau yang lebih baru!"),
("pull_group_failed_tip", "Gagal memperbarui grup"),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/it.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "All'avvio verifica presenza aggiornamenti programma"),
("upgrade_rustdesk_server_pro_to_{}_tip", "Aggiorna RustDesk Server Pro alla versione {} o successiva!"),
("pull_group_failed_tip", "Impossibile aggiornare il gruppo"),
("Filter by intersection", "Filtra per incrocio")
("Filter by intersection", "Filtra per incrocio"),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/ja.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/ko.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/kz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/lt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/lv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Startējot pārbaudīt, vai nav programmatūras atjauninājumu"),
("upgrade_rustdesk_server_pro_to_{}_tip", "Lūdzu, jauniniet RustDesk Server Pro uz versiju {} vai jaunāku!"),
("pull_group_failed_tip", "Neizdevās atsvaidzināt grupu"),
("Filter by intersection", "Filtrēt pēc krustpunkta")
("Filter by intersection", "Filtrēt pēc krustpunkta"),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/nl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Checken voor updates bij opstarten"),
("upgrade_rustdesk_server_pro_to_{}_tip", "Upgrade RustDesk Server Pro naar versie {} of nieuwer!"),
("pull_group_failed_tip", "Vernieuwen van groep mislukt"),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
4 changes: 3 additions & 1 deletion src/lang/pl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Sprawdź aktualizacje przy starcie programu"),
("upgrade_rustdesk_server_pro_to_{}_tip", "Proszę zaktualizować RustDesk Server Pro do wersji {} lub nowszej!"),
("pull_group_failed_tip", "Błąd odświeżania grup"),
("Filter by intersection", "")
("Filter by intersection", ""),
("Remove wallpaper during incoming sessions", ""),
("Test", ""),
].iter().cloned().collect();
}
Loading

0 comments on commit f200bd2

Please sign in to comment.