mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
initialstart: Make scaling option more robust
Currently when the app starts, the scaling of all monitors gets changed to a combobox value. This change makes it so that only the primary monitor is affected, and that it only sets the scaling when the user interacts with the combobox.
This commit is contained in:
parent
ac96c3bf13
commit
a029f18eeb
3 changed files with 10 additions and 3 deletions
|
|
@ -118,8 +118,10 @@ InitialStartModule {
|
||||||
currentIndex: Prepare.PrepareUtil.scalingOptions.indexOf(Prepare.PrepareUtil.scaling.toString() + "%");
|
currentIndex: Prepare.PrepareUtil.scalingOptions.indexOf(Prepare.PrepareUtil.scaling.toString() + "%");
|
||||||
model: Prepare.PrepareUtil.scalingOptions
|
model: Prepare.PrepareUtil.scalingOptions
|
||||||
|
|
||||||
|
onActivated: (index) => {
|
||||||
// remove % suffix
|
// remove % suffix
|
||||||
onCurrentValueChanged: Prepare.PrepareUtil.scaling = parseInt(currentValue.substring(0, currentValue.length - 1));
|
Prepare.PrepareUtil.scaling = parseInt(currentValue.substring(0, currentValue.length - 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ PrepareUtil::PrepareUtil(QObject *parent)
|
||||||
// try to take the primary display's scaling, otherwise use the scaling of any of the displays
|
// try to take the primary display's scaling, otherwise use the scaling of any of the displays
|
||||||
for (KScreen::OutputPtr output : m_config->outputs()) {
|
for (KScreen::OutputPtr output : m_config->outputs()) {
|
||||||
scaling = output->scale() * 100;
|
scaling = output->scale() * 100;
|
||||||
|
m_output = output->id();
|
||||||
if (output->isPrimary()) {
|
if (output->isPrimary()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -53,8 +54,10 @@ void PrepareUtil::setScaling(int scaling)
|
||||||
qreal scalingNum = ((double)scaling) / 100;
|
qreal scalingNum = ((double)scaling) / 100;
|
||||||
|
|
||||||
for (KScreen::OutputPtr output : outputs) {
|
for (KScreen::OutputPtr output : outputs) {
|
||||||
|
if (output->id() == m_output) {
|
||||||
output->setScale(scalingNum);
|
output->setScale(scalingNum);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto setop = new KScreen::SetConfigOperation(m_config, this);
|
auto setop = new KScreen::SetConfigOperation(m_config, this);
|
||||||
setop->exec();
|
setop->exec();
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@ private:
|
||||||
int m_scaling;
|
int m_scaling;
|
||||||
bool m_usingDarkTheme;
|
bool m_usingDarkTheme;
|
||||||
|
|
||||||
|
int m_output{0};
|
||||||
|
|
||||||
ColorsSettings *m_colorsSettings;
|
ColorsSettings *m_colorsSettings;
|
||||||
KScreen::ConfigPtr m_config;
|
KScreen::ConfigPtr m_config;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue