[anaconda 2/3] Move metacity gsettings overrides into anaconda
David Shea
dshea at redhat.com
Tue Jan 13 22:07:25 UTC 2015
Install the metacity configuration overrides into a directory under
/usr/share/anaconda so that they can be used by downstream projects.
Override $XDG_DATA_DIRS when running metacity to use our modified
settings.
---
anaconda | 11 ++++++
anaconda.spec.in | 5 +++
configure.ac | 2 ++
data/Makefile.am | 2 +-
data/window-manager/Makefile.am | 20 +++++++++++
data/window-manager/config/Makefile.am | 39 ++++++++++++++++++++++
...g.gnome.desktop.wm.keybindings.gschema.override | 35 +++++++++++++++++++
...g.gnome.desktop.wm.preferences.gschema.override | 4 +++
scripts/makeupdates | 25 ++++++++++++--
9 files changed, 140 insertions(+), 3 deletions(-)
create mode 100644 data/window-manager/Makefile.am
create mode 100644 data/window-manager/config/Makefile.am
create mode 100644 data/window-manager/config/org.gnome.desktop.wm.keybindings.gschema.override
create mode 100644 data/window-manager/config/org.gnome.desktop.wm.preferences.gschema.override
diff --git a/anaconda b/anaconda
index 4ded503..59373b2 100755
--- a/anaconda
+++ b/anaconda
@@ -130,13 +130,24 @@ def startX11():
# function to handle X startup special issues for anaconda
def doStartupX11Actions():
"""Start window manager"""
+ from copy import copy
# When metacity actually connects to the X server is unknowable, but
# fortunately it doesn't matter. metacity does not need to be the first
# connection to Xorg, and if anaconda starts up before metacity, metacity
# will just take over and maximize the window and make everything right,
# fingers crossed.
+ # Add XDG_DATA_DIRS to the environment to pull in our overridden schema
+ # files.
+ env_bak = copy(os.environ)
+ if 'XDG_DATA_DIRS' in os.environ:
+ os.environ['XDG_DATA_DIRS'] = '/usr/share/anaconda/window-manager:' + \
+ os.environ['XDG_DATA_DIRS']
+ else:
+ os.environ['XDG_DATA_DIRS'] = '/usr/share/anaconda/window-manager:/usr/share'
+
childproc = iutil.startProgram(["metacity", "--display", ":1", "--sm-disable"])
+ os.environ = env_bak
iutil.watchProcess(childproc, "metacity")
def set_x_resolution(runres):
diff --git a/anaconda.spec.in b/anaconda.spec.in
index fb07cb5..1080b20 100644
--- a/anaconda.spec.in
+++ b/anaconda.spec.in
@@ -82,6 +82,10 @@ BuildRequires: s390utils-devel
%endif
BuildRequires: libtimezonemap-devel >= %{libtimezonemapver}
+# Needed to compile the gsettings files
+BuildRequires: gsettings-desktop-schemas
+BuildRequires: metacity
+
Requires: anaconda-core = %{version}-%{release}
Requires: anaconda-gui = %{version}-%{release}
Requires: anaconda-tui = %{version}-%{release}
@@ -285,6 +289,7 @@ update-desktop-database &> /dev/null || :
%files gui
%{_libdir}/python*/site-packages/pyanaconda/ui/gui/*
+%{_datadir}/anaconda/window-manager/glib-2.0/schemas/*
%files tui
%{_libdir}/python*/site-packages/pyanaconda/rescue.py
diff --git a/configure.ac b/configure.ac
index 7601996..3795534 100644
--- a/configure.ac
+++ b/configure.ac
@@ -140,6 +140,8 @@ AC_CONFIG_FILES([Makefile
data/liveinst/gnome/Makefile
data/liveinst/pam.d/Makefile
data/systemd/Makefile
+ data/window-manager/Makefile
+ data/window-manager/config/Makefile
po/Makefile.in
scripts/Makefile
pyanaconda/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index 4021adb..557016d 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -17,7 +17,7 @@
#
# Author: Martin Sivak <msivak at redhat.com>
-SUBDIRS = command-stubs liveinst systemd post-scripts
+SUBDIRS = command-stubs liveinst systemd post-scripts window-manager
CLEANFILES = *~
diff --git a/data/window-manager/Makefile.am b/data/window-manager/Makefile.am
new file mode 100644
index 0000000..35f39d1
--- /dev/null
+++ b/data/window-manager/Makefile.am
@@ -0,0 +1,20 @@
+# data/window-manager/Makefile.am for anaconda
+#
+# Copyright (C) 2015 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: David Shea <dshea at redhat.com>
+
+SUBDIRS = config
diff --git a/data/window-manager/config/Makefile.am b/data/window-manager/config/Makefile.am
new file mode 100644
index 0000000..6602e4b
--- /dev/null
+++ b/data/window-manager/config/Makefile.am
@@ -0,0 +1,39 @@
+# data/window-manager/config/Makefile.am for anaconda
+#
+# Copyright (C) 2015 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: David Shea <dshea at redhat.com>
+
+schemadir = $(pkgdatadir)/window-manager/glib-2.0/schemas
+
+# These files need to be compiled by glib-compile-schemas. This is handled
+# in the spec file scriptlets.
+dist_schema_DATA = org.gnome.desktop.wm.keybindings.gschema.override \
+ org.gnome.desktop.wm.preferences.gschema.override
+
+# GSettings insists on the override files being in the same directory as the
+# schemas they modify, so pretend that this is the case with symlinks and
+# create the compiled schema.
+install-data-hook:
+ $(MKDIR_P) $(DESTDIR)$(schemadir)
+ $(LN_S) -f /usr/share/glib-2.0/schemas/org.gnome.desktop.wm.keybindings.gschema.xml $(DESTDIR)$(schemadir)
+ $(LN_S) -f /usr/share/glib-2.0/schemas/org.gnome.desktop.wm.preferences.gschema.xml $(DESTDIR)$(schemadir)
+ $(LN_S) -f /usr/share/glib-2.0/schemas/org.gnome.desktop.enums.xml $(DESTDIR)$(schemadir)
+ glib-compile-schemas $(DESTDIR)$(schemadir)
+
+uninstall-local:
+ rm -f $(DESTDIR)$(schemadir)/*.xml
+ rm -f $(DESTDIR)$(schemadir)/gschemas.compiled
diff --git a/data/window-manager/config/org.gnome.desktop.wm.keybindings.gschema.override b/data/window-manager/config/org.gnome.desktop.wm.keybindings.gschema.override
new file mode 100644
index 0000000..e84aaba
--- /dev/null
+++ b/data/window-manager/config/org.gnome.desktop.wm.keybindings.gschema.override
@@ -0,0 +1,35 @@
+[org.gnome.desktop.wm.keybindings]
+ switch-to-workspace-left=[]
+ switch-to-workspace-right=[]
+ switch-to-workspace-up=[]
+ switch-to-workspace-down=[]
+ switch-to-workspace-1=[]
+ switch-to-workspace-last=[]
+ switch-group=[]
+ switch-windows=[]
+ switch-panels=[]
+ cycle-group=[]
+ cycle-windows=[]
+ cycle-panels=[]
+ activate-window-menu=[]
+ toggle-maximized=[]
+ minimize=[]
+ maximize=[]
+ unmaximize=[]
+ begin-move=[]
+ begin-resize=[]
+ move-to-workspace-1=[]
+ move-to-workspace-left=[]
+ move-to-workspace-right=[]
+ move-to-workspace-up=[]
+ move-to-workspace-down=[]
+ move-to-workspace-last=[]
+ move-to-monitor-left=[]
+ move-to-monitor-right=[]
+ move-to-monitor-up=[]
+ move-to-monitor-down=[]
+ close=[]
+ panel-main-menu=[]
+ panel-run-dialog=[]
+ switch-applications=[]
+ switch-input-source=[]
diff --git a/data/window-manager/config/org.gnome.desktop.wm.preferences.gschema.override b/data/window-manager/config/org.gnome.desktop.wm.preferences.gschema.override
new file mode 100644
index 0000000..b499643
--- /dev/null
+++ b/data/window-manager/config/org.gnome.desktop.wm.preferences.gschema.override
@@ -0,0 +1,4 @@
+[org.gnome.desktop.wm.preferences]
+ button-layout=':'
+ action-right-click-titlebar='none'
+ num-workspaces=1
diff --git a/scripts/makeupdates b/scripts/makeupdates
index 14061c6..344ff59 100755
--- a/scripts/makeupdates
+++ b/scripts/makeupdates
@@ -31,6 +31,7 @@ import urllib
import threading
import multiprocessing
import argparse
+import tempfile
from collections import namedtuple
try:
from rpmUtils import miscutils # available from the yum-utils package
@@ -218,7 +219,7 @@ def create_RPM_cache_folder():
if not os.path.exists(RPM_FOLDER_NAME):
os.makedirs(RPM_FOLDER_NAME)
-def copyUpdatedFiles(tag, updates, cwd):
+def copyUpdatedFiles(tag, updates, cwd, builddir):
def install_to_dir(fname, relpath):
sys.stdout.write("Including %s\n" % fname)
outdir = os.path.join(updates, relpath)
@@ -226,6 +227,24 @@ def copyUpdatedFiles(tag, updates, cwd):
os.makedirs(outdir)
shutil.copy2(fname, outdir)
+ def install_gschema():
+ # Run make install to a temp directory and pull the compiled file out
+ # of it
+ tmpdir = tempfile.mkdtemp()
+ try:
+ os.system('make -C %s/data/window-manager/config install DESTDIR=%s' %
+ (builddir,tmpdir))
+ # Find the .compiled file
+ for root, _dirs, files in os.walk(tmpdir):
+ for f in files:
+ if f.endswith('.compiled'):
+ install_to_dir(os.path.join(root, f),
+ 'usr/share/anaconda/window-manager/glib-2.0/schemas')
+ finally:
+ shutil.rmtree(tmpdir)
+
+
+
# Updates get overlaid onto the runtime filesystem. Anaconda expects them
# to be in /run/install/updates, so put them in
# $updatedir/run/install/updates.
@@ -308,6 +327,8 @@ def copyUpdatedFiles(tag, updates, cwd):
install_to_dir(gitfile, "usr/share/anaconda/pixmaps")
elif gitfile.startswith("data/ui/"):
install_to_dir(gitfile, "usr/share/anaconda/ui")
+ elif gitfile.startswith("data/window-manager/config"):
+ install_gschema()
elif gitfile.startswith("data/post-scripts/"):
install_to_dir(gitfile, "usr/share/anaconda/post-scripts")
elif any(gitfile.endswith(libexec_script) for libexec_script in \
@@ -987,7 +1008,7 @@ def main():
if not os.path.isdir(updates):
os.makedirs(updates)
- copyUpdatedFiles(args.tag, updates, cwd)
+ copyUpdatedFiles(args.tag, updates, cwd, builddir)
if args.compile:
if isysChanged(args.tag):
--
2.1.0
More information about the anaconda-patches
mailing list