This file is indexed.

/usr/share/cinnamon/cinnamon-desktop-migrate-mediakeys is in cinnamon-desktop-data 3.2.4-4.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
#!/usr/bin/python2

from gi.repository import Gio
import os

OLD_MEDIA_KEYS_PATH = "/org/cinnamon/settings-daemon/plugins/media-keys/"
OLD_MEDIA_KEYS_SCHEMA = "org.cinnamon.settings-daemon.plugins.media-keys"
NEW_MEDIA_KEYS_SCHEMA = "org.cinnamon.desktop.keybindings.media-keys"

OLD_WM_KEYBINDINGS_PATH = "/org/cinnamon/muffin/keybindings/"
OLD_WM_KEYBINDINGS_SCHEMA = "org.cinnamon.muffin.keybindings"
NEW_WM_KEYBINDINGS_SCHEMA = "org.cinnamon.desktop.keybindings.wm"

OLD_CUSTOM_KEYS_PARENT_SCHEMA = "org.cinnamon.keybindings"
OLD_CUSTOM_KEYS_BASENAME = "/org/cinnamon/keybindings/custom-keybindings"
OLD_CUSTOM_KEYS_SCHEMA = "org.cinnamon.keybindings.custom-keybinding"

NEW_CUSTOM_KEYS_PARENT_SCHEMA = "org.cinnamon.desktop.keybindings"
NEW_CUSTOM_KEYS_BASENAME = "/org/cinnamon/desktop/keybindings/custom-keybindings"
NEW_CUSTOM_KEYS_SCHEMA = "org.cinnamon.desktop.keybindings.custom-keybinding"

def migrate(old, new, array):
    old_settings = Gio.Settings.new(old)
    new_settings = Gio.Settings.new(new)

    old_list = old_settings.list_keys()
    new_list = new_settings.list_keys()

    for k in new_list:
        try:
            try:
                if k in old_list and old_settings.get_user_value(k) is not None:
                    if array:
                        new_settings.set_value(k, old_settings.get_value(k))
                    else:
                        ov = old_settings.get_string(k)
                        new_settings.set_strv(k, (ov,))
            except:
                if k in old_list:
                    if array:
                        if len(old_settings.get_strv(k)) > 0:
                            new_settings.set_value(k, old_settings.get_value(k))
                    else:
                        ov = old_settings.get_string(k)
                        if ov != "":
                            new_settings.set_strv(k, (ov,))
        except:
            print "Problem migrating key %s from %s to %s, skipping it" % (k, old, new)
    Gio.Settings.sync()

def migrate_custom_keys():
    old_parent = Gio.Settings.new(OLD_CUSTOM_KEYS_PARENT_SCHEMA)
    new_parent = Gio.Settings.new(NEW_CUSTOM_KEYS_PARENT_SCHEMA)

    custom_list = old_parent.get_strv("custom-list")
    new_parent.set_strv("custom-list", custom_list)
    old_parent.set_strv("custom-list", None)

    for entry in custom_list:
        old_custom_path = OLD_CUSTOM_KEYS_BASENAME + "/" + entry + "/"
        old_schema = Gio.Settings.new_with_path(OLD_CUSTOM_KEYS_SCHEMA, old_custom_path)

        new_custom_path = NEW_CUSTOM_KEYS_BASENAME + "/" + entry + "/"
        new_schema = Gio.Settings.new_with_path(NEW_CUSTOM_KEYS_SCHEMA, new_custom_path)

        new_schema.set_string("name", old_schema.get_string("name"))
        new_schema.set_string("command", old_schema.get_string("command"))
        new_schema.set_strv("binding", (old_schema.get_string("binding"),))

        old_schema.delay()
        old_schema.reset("name")
        old_schema.reset("command")
        old_schema.reset("binding")
        old_schema.apply()
        Gio.Settings.sync()

if os.path.exists(os.path.expanduser("~/.cinnamon/.keybindings-migration-2.4-complete-do-not-erase")):
    print "Migration has been performed already for this user."
    exit(0)

print "Migrating keybindings from previous release..."

try:
    source = Gio.SettingsSchemaSource.get_default()

    if source.lookup(OLD_MEDIA_KEYS_SCHEMA, True) != None:
        migrate(OLD_MEDIA_KEYS_SCHEMA, NEW_MEDIA_KEYS_SCHEMA, False)
        print "  ... media keybindings: done."

    if source.lookup(OLD_WM_KEYBINDINGS_SCHEMA, True) != None:
        migrate(OLD_WM_KEYBINDINGS_SCHEMA, NEW_WM_KEYBINDINGS_SCHEMA, True)
        print "  ... wm keybindings: done."

    if source.lookup(OLD_CUSTOM_KEYS_PARENT_SCHEMA, True) != None:
        migrate_custom_keys()
        print "  ... custom keybindings: done."

    Gio.Settings.sync()

    open(os.path.expanduser("~/.cinnamon/.keybindings-migration-2.4-complete-do-not-erase"), "w").close()

except Exception, detail:
    print "  !! %s" % detail

print "  Done."

exit(0)