Skip to content

Commit

Permalink
Removed app transparency (#1209)
Browse files Browse the repository at this point in the history
At least for three reasons:
 1. App transparency isn't for normal windows — it may be used with "desktop widgets" like analog clocks, and even in those cases, it isn't a reliable way of having transparency;
 2. We have terminal transparency; and
 3. App transparency is only for X11, which, ironically, does not support transparency without a compositor.

Closes #1192
  • Loading branch information
tsujan authored Dec 12, 2024
1 parent e985e1c commit b814eb5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 66 deletions.
48 changes: 11 additions & 37 deletions src/forms/propertiesdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -275,32 +275,6 @@
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="appTransparencyLabel">
<property name="text">
<string>Application transparency</string>
</property>
<property name="buddy">
<cstring>appTransparencyBox</cstring>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QSpinBox" name="appTransparencyBox">
<property name="suffix">
<string> %</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>99</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Terminal transparency</string>
Expand All @@ -310,7 +284,7 @@
</property>
</widget>
</item>
<item row="12" column="1">
<item row="11" column="1">
<widget class="QSpinBox" name="termTransparencyBox">
<property name="suffix">
<string> %</string>
Expand All @@ -326,14 +300,14 @@
</property>
</widget>
</item>
<item row="13" column="0">
<item row="12" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Background image:</string>
</property>
</widget>
</item>
<item row="13" column="1">
<item row="12" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="backgroundImageLineEdit"/>
Expand All @@ -347,14 +321,14 @@
</item>
</layout>
</item>
<item row="14" column="0">
<item row="13" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Background mode:</string>
</property>
</widget>
</item>
<item row="14" column="1">
<item row="13" column="1">
<widget class="QComboBox" name="backgroundModecomboBox">
<item>
<property name="text">
Expand Down Expand Up @@ -383,7 +357,7 @@
</item>
</widget>
</item>
<item row="15" column="0">
<item row="14" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Start with preset:</string>
Expand All @@ -393,7 +367,7 @@
</property>
</widget>
</item>
<item row="15" column="1">
<item row="14" column="1">
<widget class="QComboBox" name="terminalPresetComboBox">
<item>
<property name="text">
Expand All @@ -417,7 +391,7 @@
</item>
</widget>
</item>
<item row="16" column="0">
<item row="15" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Terminal margin</string>
Expand All @@ -427,14 +401,14 @@
</property>
</widget>
</item>
<item row="16" column="1">
<item row="15" column="1">
<widget class="QSpinBox" name="terminalMarginSpinBox">
<property name="suffix">
<string>px</string>
</property>
</widget>
</item>
<item row="17" column="0" colspan="2">
<item row="16" column="0" colspan="2">
<widget class="QGroupBox" name="currentTerminal">
<property name="title">
<string>Current Terminal</string>
Expand Down Expand Up @@ -471,7 +445,7 @@
</layout>
</widget>
</item>
<item row="18" column="0" colspan="2">
<item row="17" column="0" colspan="2">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand Down
1 change: 0 additions & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,6 @@ void MainWindow::propertiesChanged()
rebuildActions();

QApplication::setStyle(Properties::Instance()->guiStyle);
setWindowOpacity(1.0 - Properties::Instance()->appTransparency/100.0);
consoleTabulator->setTabPosition((QTabWidget::TabPosition)Properties::Instance()->tabsPos);
consoleTabulator->propertiesChanged();
setDropShortcut(Properties::Instance()->dropShortCut);
Expand Down
17 changes: 0 additions & 17 deletions src/properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ void Properties::loadSettings()

terminalMargin = m_settings->value(QLatin1String("TerminalMargin"), 0).toInt();

appTransparency = m_settings->value(QLatin1String("MainWindow/ApplicationTransparency"), 0).toInt();
termTransparency = m_settings->value(QLatin1String("TerminalTransparency"), 0).toInt();
backgroundImage = m_settings->value(QLatin1String("TerminalBackgroundImage"), QString()).toString();
backgroundMode = qBound(0, m_settings->value(QLatin1String("TerminalBackgroundMode"), 0).toInt(), 4);
Expand Down Expand Up @@ -237,7 +236,6 @@ void Properties::saveSettings()
}
m_settings->endArray();

m_settings->setValue(QLatin1String("MainWindow/ApplicationTransparency"), appTransparency);
m_settings->setValue(QLatin1String("TerminalMargin"), terminalMargin);
m_settings->setValue(QLatin1String("TerminalTransparency"), termTransparency);
m_settings->setValue(QLatin1String("TerminalBackgroundImage"), backgroundImage);
Expand Down Expand Up @@ -366,21 +364,6 @@ void Properties::migrate_settings()
}
settings.remove(QLatin1String("AlwaysShowTabs"));

// ===== appOpacity -> ApplicationTransparency =====
//
// Note: In 0.6.0 the opacity values had been erroneously
// restricted to [0,99] instead of [1,100]. We fix this here by
// setting the opacity to 100 if it was 99 and to 1 if it was 0.
//
if(!settings.contains(QLatin1String("MainWindow/ApplicationTransparency")))
{
int appOpacityValue = settings.value(QLatin1String("MainWindow/appOpacity"), 100).toInt();
appOpacityValue = appOpacityValue == 99 ? 100 : appOpacityValue;
appOpacityValue = appOpacityValue == 0 ? 1 : appOpacityValue;
settings.setValue(QLatin1String("MainWindow/ApplicationTransparency"), 100 - appOpacityValue);
}
settings.remove(QLatin1String("MainWindow/appOpacity"));

// ===== termOpacity -> TerminalTransparency =====
if(!settings.contains(QLatin1String("TerminalTransparency")))
{
Expand Down
1 change: 0 additions & 1 deletion src/properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class Properties
Sessions sessions;

int terminalMargin;
int appTransparency;
int termTransparency;
QString backgroundImage;
int backgroundMode;
Expand Down
10 changes: 0 additions & 10 deletions src/propertiesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,6 @@ PropertiesDialog::PropertiesDialog(QWidget *parent)

terminalMarginSpinBox->setValue(Properties::Instance()->terminalMargin);

appTransparencyBox->setValue(Properties::Instance()->appTransparency);

termTransparencyBox->setValue(Properties::Instance()->termTransparency);

highlightCurrentCheckBox->setChecked(Properties::Instance()->highlightCurrentTerminal);
Expand Down Expand Up @@ -299,8 +297,6 @@ PropertiesDialog::PropertiesDialog(QWidget *parent)

// show, hide or disable some widgets on Wayland
bool onWayland(QGuiApplication::platformName() == QStringLiteral("wayland"));
appTransparencyLabel->setVisible(!onWayland);
appTransparencyBox->setVisible(!onWayland);
savePosOnExitCheckBox->setVisible(!onWayland);
waylandLabel->setVisible(onWayland);
dropShortCutLabel->setEnabled(!onWayland);
Expand Down Expand Up @@ -335,12 +331,6 @@ void PropertiesDialog::apply()

Properties::Instance()->emulation = emulationComboBox->currentText();

/* do not allow to go above 99 or we lose transparency option */
(appTransparencyBox->value() >= 100) ?
Properties::Instance()->appTransparency = 99
:
Properties::Instance()->appTransparency = appTransparencyBox->value();

Properties::Instance()->terminalMargin = terminalMarginSpinBox->value();
Properties::Instance()->termTransparency = termTransparencyBox->value();
Properties::Instance()->highlightCurrentTerminal = highlightCurrentCheckBox->isChecked();
Expand Down

0 comments on commit b814eb5

Please sign in to comment.