I am trying to fix the power button on gnome 3 not shutting down the system and as don_crissti said in this thread (Gnome 3: how to set power button to shutdown instead of suspend?) that options was removed.

He also mentions that you can fix it

if you're willing to patch and rebuild gnome-settings-daemon

so how would I go about doing that?

  • What OS are you using? – styrofoam fly Jun 22 '17 at 16:34
  • I am using Ubuntu Gnome – user237284 Jun 22 '17 at 16:46

Make a directory build and download patch there, saving it as d.patch.

Follow this script (I have saved whole session, so you know from which directories you should cast these spells).

[user@MACHINE build]$ git clone git://git.gnome.org/gnome-settings-daemon #download GSD source
[user@MACHINE build]$ git clone git://git.gnome.org/libgnome-volume-control #download dependency
[user@MACHINE build]$ cd gnome-settings-daemon/
[user@MACHINE gnome-settings-daemon]$ git checkout GNOME_SETTINGS_DAEMON_3_18_2 #get the version for which the script was prepared
[user@MACHINE gnome-settings-daemon]$ git submodule init #download more dependencies
[user@MACHINE gnome-settings-daemon]$ git config --local submodule.panels/media-keys/gvc.url ../libgnome-volume-control
[user@MACHINE gnome-settings-daemon]$ git submodule update
[user@MACHINE gnome-settings-daemon]$ cd ..
[user@MACHINE build]$ wget https://launchpad.net/ubuntu/+archive/primary/+files/gnome-settings-daemon_3.18.2-0ubuntu2.debian.tar.xz #download Ubuntu patches - that's why I asked you about your OS
[user@MACHINE build]$ tar -xf gnome-settings-daemon_3.18.2-0ubuntu2.debian.tar.xz 
[user@MACHINE build]$ cd gnome-settings-daemon/
[user@MACHINE gnome-settings-daemon]$ patch -p1 -i ../debian/patches/64_restore_terminal_keyboard_shortcut_schema.patch #apply Ubuntu patches if you want Ubuntu version of GSD
[user@MACHINE gnome-settings-daemon]$ patch -p1 -i ../debian/patches/ubuntu-lid-close-suspend.patch
[user@MACHINE gnome-settings-daemon]$ patch -p1 -i ../debian/patches/revert_background_dropping.patch
[user@MACHINE gnome-settings-daemon]$ patch -p1 -i ../debian/patches/revert-gsettings-removals.patch
[user@MACHINE gnome-settings-daemon]$ cd ..
[user@MACHINE build]$ mv gnome-settings-daemon gnome-settings-daemon-3.18.2
[user@MACHINE build]$ patch -p0 <d.patch #patch with downloaded patch
[user@MACHINE build]$ cd gnome-settings-daemon-3.18.2/
[user@MACHINE gnome-settings-daemon-3.18.2]$ NOCONFIGURE=1 ./autogen.sh #generate config script - would fail if we wouldn't download those dependencies before
[user@MACHINE gnome-settings-daemon-3.18.2]$ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libexecdir=/usr/lib/gnome-settings-daemon --disable-static #configure - will check for dependencies  - you might need to download some packages
[user@MACHINE gnome-settings-daemon-3.18.2]$ sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool #see https://bugzilla.gnome.org/show_bug.cgi?id=656231
[user@MACHINE gnome-settings-daemon-3.18.2]$ make
[user@MACHINE gnome-settings-daemon-3.18.2]$ make install

The script was adapted from here. You can see there roughly the dependencies you need for configuring it.

TL;DR The only magic there is getting all the sources together: git submodules, Ubuntu patches from launchpad and libgnome-volume-control. It would work without applying sed. The whole rest is a standard procedure.

| improve this answer | |
  • @drewbeen I use ArchLinux and I don't know apt so well. This solution is much more portable. – styrofoam fly Jun 22 '17 at 19:14
  • @Novian3002 you might need gsettings-desktop-schemas-dev (and possibly a few more -dev packages) on your system to compile the program. – styrofoam fly Jun 23 '17 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy