Added bar:force_no_tray

typo
This commit is contained in:
vaxerski 2022-04-14 18:23:47 +02:00
parent 1898839d4c
commit ca432cc589
2 changed files with 20 additions and 0 deletions

View file

@ -152,6 +152,9 @@ void CStatusBar::destroyModule(SBarModule* module) {
}
void CStatusBar::setupTray() {
if (ConfigManager::getInt("bar:force_no_tray") == 1)
return;
Debug::log(LOG, "Setting up tray!");
char atomName[strlen("_NET_SYSTEM_TRAY_S") + 11];
@ -260,6 +263,9 @@ void CStatusBar::setupTray() {
}
void CStatusBar::fixTrayOnCreate() {
if (ConfigManager::getInt("bar:force_no_tray") == 1)
return;
if (m_bHasTray && ConfigManager::getInt("bar:no_tray_saving") == 0) {
for (auto& tray : g_pWindowManager->trayclients) {
xcb_reparent_window(g_pWindowManager->DisplayConnection, tray.window, g_pWindowManager->statusBar->trayWindowID, 0, 0);
@ -285,6 +291,8 @@ void CStatusBar::fixTrayOnCreate() {
}
void CStatusBar::saveTrayOnDestroy() {
if (ConfigManager::getInt("bar:force_no_tray") == 1)
return;
// TODO: fix this instead of disabling it.
@ -312,6 +320,9 @@ void CStatusBar::setup(int MonitorID) {
}
}
if (ConfigManager::getInt("bar:force_no_tray") == 1)
m_bHasTray = false;
const auto MONITOR = g_pWindowManager->monitors[MonitorID];
Debug::log(LOG, "Bar monitor found to be " + std::to_string(MONITOR.ID));
@ -548,6 +559,8 @@ int CStatusBar::drawWorkspacesModule(SBarModule* mod, int off) {
}
int CStatusBar::drawTrayModule(SBarModule* mod, int off) {
if (ConfigManager::getInt("bar:force_no_tray") == 1)
return 0;
const auto PAD = 2;
@ -655,6 +668,9 @@ int CStatusBar::drawModule(SBarModule* mod, int off) {
}
void CStatusBar::ensureTrayClientDead(xcb_window_t window) {
if (ConfigManager::getInt("bar:force_no_tray") == 1)
return;
auto temp = g_pWindowManager->trayclients;
g_pWindowManager->trayclients.clear();
@ -668,6 +684,9 @@ void CStatusBar::ensureTrayClientDead(xcb_window_t window) {
}
void CStatusBar::ensureTrayClientHidden(xcb_window_t window, bool hide) {
if (ConfigManager::getInt("bar:force_no_tray") == 1)
return;
for (auto& trayitem : g_pWindowManager->trayclients) {
if (trayitem.window == window)
trayitem.hidden = hide;

View file

@ -38,6 +38,7 @@ void ConfigManager::init() {
configValues["bar:font.secondary"].strValue = "Noto Sans";
configValues["bar:mod_pad_in"].intValue = 4;
configValues["bar:no_tray_saving"].intValue = 1;
configValues["bar:force_no_tray"].intValue = 1;
configValues["status_command"].strValue = "date +%I:%M\\ %p"; // Time // Deprecated