mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Implement close to taskbar option
This commit is contained in:
@@ -346,6 +346,7 @@ void SetupSystemIntegrationContent(
|
||||
checkbox(std::move(label), checked),
|
||||
st::settingsCheckboxPadding));
|
||||
};
|
||||
|
||||
if (Platform::TrayIconSupported()) {
|
||||
const auto trayEnabled = [] {
|
||||
const auto workMode = Core::App().settings().workMode();
|
||||
@@ -406,6 +407,29 @@ void SetupSystemIntegrationContent(
|
||||
}, taskbar->lifetime());
|
||||
}
|
||||
}
|
||||
|
||||
if (!Platform::IsMac()) {
|
||||
const auto closeToTaskbar = addSlidingCheckbox(
|
||||
tr::lng_settings_close_to_taskbar(),
|
||||
Core::App().settings().closeToTaskbar());
|
||||
|
||||
const auto closeToTaskbarShown = std::make_shared<rpl::variable<bool>>(false);
|
||||
Core::App().settings().workModeValue(
|
||||
) | rpl::start_with_next([=](WorkMode workMode) {
|
||||
*closeToTaskbarShown = (workMode == WorkMode::WindowOnly)
|
||||
|| !Platform::TrayIconSupported();
|
||||
}, closeToTaskbar->lifetime());
|
||||
|
||||
closeToTaskbar->toggleOn(closeToTaskbarShown->value());
|
||||
closeToTaskbar->entity()->checkedChanges(
|
||||
) | rpl::filter([=](bool checked) {
|
||||
return (checked != Core::App().settings().closeToTaskbar());
|
||||
}) | rpl::start_with_next([=](bool checked) {
|
||||
Core::App().settings().setCloseToTaskbar(checked);
|
||||
Local::writeSettings();
|
||||
}, closeToTaskbar->lifetime());
|
||||
}
|
||||
|
||||
if (Ui::Platform::NativeWindowFrameSupported()) {
|
||||
const auto nativeFrame = addCheckbox(
|
||||
tr::lng_settings_native_frame(),
|
||||
@@ -419,6 +443,7 @@ void SetupSystemIntegrationContent(
|
||||
Core::App().saveSettingsDelayed();
|
||||
}, nativeFrame->lifetime());
|
||||
}
|
||||
|
||||
if (Platform::AutostartSupported() && controller) {
|
||||
const auto minimizedToggled = [=] {
|
||||
return cStartMinimized()
|
||||
|
Reference in New Issue
Block a user