[plasmalnf] Try to get back to the live user before changing themes

This commit is contained in:
Adriaan de Groot 2017-12-04 09:37:34 -05:00
parent b10b19e9ee
commit e628ddfdbf
3 changed files with 16 additions and 1 deletions

View File

@ -125,6 +125,11 @@ PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap )
if ( m_lnfPath.isEmpty() )
cDebug() << "WARNING: no lnftool given for plasmalnf module.";
QString liveUser;
if ( configurationMap.contains( "liveuser" ) && configurationMap.value( "liveuser" ).type() == QVariant::String )
liveUser = configurationMap.value( "liveuser" ).toString();
m_liveUser = liveUser;
}
void
@ -133,7 +138,10 @@ PlasmaLnfViewStep::themeSelected( const QString& id )
m_themeId = id;
QProcess lnftool;
lnftool.start( m_lnfPath, {"--resetLayout", "--apply", id} );
if ( !m_liveUser.isEmpty() )
lnftool.start( "sudo", {"-E", "-H", "-u", m_liveUser, m_lnfPath, "--resetLayout", "--apply", id} );
else
lnftool.start( m_lnfPath, {"--resetLayout", "--apply", id} );
if ( !lnftool.waitForStarted( 1000 ) )
{

View File

@ -63,6 +63,7 @@ private:
PlasmaLnfPage* m_widget;
QString m_lnfPath;
QString m_themeId;
QString m_liveUser;
};
CALAMARES_PLUGIN_FACTORY_DECLARATION( PlasmaLnfViewStepFactory )

View File

@ -2,3 +2,9 @@
# Full path to the Plasma look-and-feel tool (CLI program
# for querying and applying Plasma themes).
lnftool: "/usr/bin/lookandfeeltool"
# For systems where the user Calamares runs as (usually root,
# via either sudo or pkexec) has a clean environment, set this
# to the originating username; the lnftool will be run through
# "sudo -H -u <liveuser>" instead of directly.
liveuser: "live"