Table of Contents
- 1. Change action via power button to shutdown
- 2. Check dialog for killing SSH connection will disturb shutdown
1 Change action via power button to shutdown
There are GUI way and GUI way for changing action.
1.1 Change action with GUI
Open “Power Management” dialog as below.
Application -> Configure Desktop -> Hardware -> Power Management
Change action at “Button events handling” of “Energy Saving” to “Shutdown”.
1.2 Change action with CUI
Change ${HOME}/.kde4/share/config/powermanagementprofilesrc as below.
> patch -p1 <<EOFdiff -uprN a b— a/.kde4/share/config/powermanagementprofilesrc 2016-12-11 20:37:20.989520207 +0900+++ b/.kde4/share/config/powermanagementprofilesrc 2016-12-11 20:38:06.505098605 +0900@@ -9,7 +9,7 @@ idleTime=300000 [AC][HandleButtonEvents] lidAction=1-powerButtonAction=16+powerButtonAction=8 [Battery] icon=battery-060EOF
2 Check dialog for killing SSH connection will disturb shutdown
When there is SSH connection to machine, pressing power button will display “Turn Off computer” dialog. And shutdown will not be done till pressing OK.
The kdm package provides this dialog. Changing source code is needed to disable this dialog. This article will describe changing source code and disabling this dialog. kdebase4-workspace has source code of kdm package.
Install rpm-build for rpmbuild.
> sudo zypper -n in rpm-build
Install kdebase4-workspace and copy to ~/rpmbuild.
> sudo zypper -n si kdebase4-workspace> mkdir ~/rpmbuild> cp -a /usr/src/packages/* ~/rpmbuild> cd ~/rpmbuild
Create a patch for disabling dialog.
> cat <<EOF > SOURCES/kdm-force-shutdown.patchdiff -uprN kde-workspace-4.11.20.org/kdm/kfrontend/kdmshutdown.cpp kde-workspace-4.11.20/kdm/kfrontend/kdmshutdown.cpp— kde-workspace-4.11.20.org/kdm/kfrontend/kdmshutdown.cpp 2015-05-29 10:30:26.000000000 +0900+++ kde-workspace-4.11.20/kdm/kfrontend/kdmshutdown.cpp 2016-12-18 12:47:02.930448162 +0900@@ -570,6 +570,7 @@ KDMSlimShutdown::checkShutdown(int type, void KDMSlimShutdown::externShutdown(int type, const QString &os, int uid, bool ask) {+#if 0 /* Force shutdown */ QList<DpySpec> sess = fetchSessions(lstRemote | lstTTY); if (ask || !sess.isEmpty() || (uid && _allowShutdown == SHUT_ROOT)) { int ret = KDMConfShutdown(uid, sess, type, os).exec();@@ -580,6 +581,7 @@ KDMSlimShutdown::externShutdown(int type return; } }+#endif doShutdown(type, os); }EOF
Apply this patch in SPEC file.
> patch -p1 <<EOFdiff -uprN a/SPECS/kdebase4-workspace.spec b/SPECS/kdebase4-workspace.spec— a/SPECS/kdebase4-workspace.spec 2015-06-13 09:16:13.000000000 +0900+++ b/SPECS/kdebase4-workspace.spec 2016-12-18 05:07:56.014437504 +0900@@ -147,6 +147,7 @@ Patch71: kde-workspace-4.11.0-kdm Patch72: much-more-plasma-debug.patch # PATCH-FIX-OPENSUSE systemsettings-desktop-kde4.diff — Changes name of System Settings to Configure KDE 4 Applications Patch73: systemsettings-desktop-kde4.diff+Patch1000: kdm-force-shutdown.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build Requires: %{name}-branding = %{_kde_branding_version} Requires: %{name}-ksysguardd = %{version}@@ -403,6 +404,7 @@ This package contains the KDE Workspace %if %suse_version > 1320 %patch73 %endif+%patch1000 -p1 cp %{SOURCE3} kwin/effects/cube/data/cubecap.pngEOF
Create kdm package with rpmbuild.
> rpmbuild -ba SPECS/kdebase4-workspace.spec
Install kdm package and reboot system. This dialog will not be displayed after reboot.
> sudo zypper -n in RPMS/x86_64/kdm-4.11.20-29.5.x86_64.rpm> sudo reboot