mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added experimental option to disable touch bar on macOS.
This commit is contained in:
parent
df935e0477
commit
f956c0f227
4 changed files with 23 additions and 2 deletions
|
@ -8,7 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "platform/mac/main_window_mac.h"
|
#include "platform/mac/main_window_mac.h"
|
||||||
|
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "mainwidget.h"
|
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "core/sandbox.h"
|
#include "core/sandbox.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
|
@ -25,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "platform/platform_specific.h"
|
#include "platform/platform_specific.h"
|
||||||
#include "platform/platform_notifications_manager.h"
|
#include "platform/platform_notifications_manager.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
|
#include "base/options.h"
|
||||||
#include "boxes/peer_list_controllers.h"
|
#include "boxes/peer_list_controllers.h"
|
||||||
#include "boxes/about_box.h"
|
#include "boxes/about_box.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
@ -300,7 +300,12 @@ void MainWindow::initHook() {
|
||||||
if (auto view = reinterpret_cast<NSView*>(winId())) {
|
if (auto view = reinterpret_cast<NSView*>(winId())) {
|
||||||
if (auto window = [view window]) {
|
if (auto window = [view window]) {
|
||||||
_private->setNativeWindow(window, view);
|
_private->setNativeWindow(window, view);
|
||||||
_private->initTouchBar(window, &controller());
|
if (!base::options::lookup<bool>(
|
||||||
|
Window::kOptionDisableTouchbar).value()) {
|
||||||
|
_private->initTouchBar(window, &controller());
|
||||||
|
} else {
|
||||||
|
LOG(("Touch Bar was disabled from Experimental Settings."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,6 +156,7 @@ void SetupExperimental(
|
||||||
addToggle(Core::kOptionSkipUrlSchemeRegister);
|
addToggle(Core::kOptionSkipUrlSchemeRegister);
|
||||||
addToggle(Data::kOptionExternalVideoPlayer);
|
addToggle(Data::kOptionExternalVideoPlayer);
|
||||||
addToggle(Window::kOptionNewWindowsSizeAsFirst);
|
addToggle(Window::kOptionNewWindowsSizeAsFirst);
|
||||||
|
addToggle(Window::kOptionDisableTouchbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -74,9 +74,23 @@ base::options::toggle OptionNewWindowsSizeAsFirst({
|
||||||
.description = "Open new windows with a size of the main window.",
|
.description = "Open new windows with a size of the main window.",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
base::options::toggle OptionDisableTouchbar({
|
||||||
|
.id = kOptionDisableTouchbar,
|
||||||
|
.name = "Disable Touch Bar (macOS only).",
|
||||||
|
.scope = [] {
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
return true;
|
||||||
|
#else // !Q_OS_MAC
|
||||||
|
return false;
|
||||||
|
#endif // !Q_OS_MAC
|
||||||
|
},
|
||||||
|
.restartRequired = true,
|
||||||
|
});
|
||||||
|
|
||||||
} // namespace.
|
} // namespace.
|
||||||
|
|
||||||
const char kOptionNewWindowsSizeAsFirst[] = "new-windows-size-as-first";
|
const char kOptionNewWindowsSizeAsFirst[] = "new-windows-size-as-first";
|
||||||
|
const char kOptionDisableTouchbar[] = "touchbar-disabled";
|
||||||
|
|
||||||
const QImage &Logo() {
|
const QImage &Logo() {
|
||||||
static const auto result = QImage(u":/gui/art/logo_256.png"_q);
|
static const auto result = QImage(u":/gui/art/logo_256.png"_q);
|
||||||
|
|
|
@ -55,6 +55,7 @@ struct CounterLayerArgs {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const char kOptionNewWindowsSizeAsFirst[];
|
extern const char kOptionNewWindowsSizeAsFirst[];
|
||||||
|
extern const char kOptionDisableTouchbar[];
|
||||||
|
|
||||||
[[nodiscard]] QImage GenerateCounterLayer(CounterLayerArgs &&args);
|
[[nodiscard]] QImage GenerateCounterLayer(CounterLayerArgs &&args);
|
||||||
[[nodiscard]] QImage WithSmallCounter(QImage image, CounterLayerArgs &&args);
|
[[nodiscard]] QImage WithSmallCounter(QImage image, CounterLayerArgs &&args);
|
||||||
|
|
Loading…
Add table
Reference in a new issue