// To find the corresponding schema for a dconf path, e.g. /desktop/ibus/general/preload-engines: // $ gsettings list-schemas | grep desktop.ibus.general // org.freedesktop.ibus.general // org.freedesktop.ibus.general.hotkey // $ gsettings list-keys org.freedesktop.ibus.general | grep preload-engines // preload-engines protected virtual string[] GetMyKeyboards(IntPtr settingsGeneral) { // This is the proper path for the combined keyboard handling on Cinnamon with IBus. var sources = Unmanaged.g_settings_get_value(settingsGeneral, "preload-engines"); if (sources == IntPtr.Zero) { return(null); } var list = KeyboardRetrievingHelper.GetStringArrayFromGVariantArray(sources); Unmanaged.g_variant_unref(sources); // Call these only once per run of the program. if (CombinedIbusKeyboardSwitchingAdaptor.DefaultLayout == null) { LoadDefaultXkbSettings(); } if (CombinedIbusKeyboardSwitchingAdaptor.LatinLayouts == null) { LoadLatinLayouts(settingsGeneral); } return(list); }
/// <summary> /// Returns the list of keyboards or <c>null</c> if we can't get the combined keyboards /// list. /// </summary> private string[] GetMyKeyboards() { // This is the proper path for the combined keyboard handling, not the path // given in the IBus reference documentation. const string schema = "org.gnome.desktop.input-sources"; if (!KeyboardRetrievingHelper.SchemaIsInstalled(schema)) { return(null); } var settings = Unmanaged.g_settings_new(schema); if (settings == IntPtr.Zero) { return(null); } var sources = Unmanaged.g_settings_get_value(settings, "sources"); if (sources == IntPtr.Zero) { return(null); } var list = KeyboardRetrievingHelper.GetStringArrayFromGVariantListArray(sources); Unmanaged.g_variant_unref(sources); Unmanaged.g_object_unref(settings); return(list); }
internal static void SelectKeyboard(uint index) { const string schema = "org.gnome.desktop.input-sources"; bool okay = true; try { okay &= KeyboardRetrievingHelper.SchemaIsInstalled(schema); if (!okay) { return; } var settings = Unmanaged.g_settings_new(schema); okay &= settings != IntPtr.Zero; if (!okay) { return; } okay &= Unmanaged.g_settings_set_uint(settings, "current", index); } finally { if (!okay) { Console.WriteLine("UnityIbusKeyboardAdaptor.SelectKeyboard({0}) failed", index); Logger.WriteEvent("UnityIbusKeyboardAdaptor.SelectKeyboard({0}) failed", index); } } }
public override void Initialize() { // We come here twice, for both KeyboardType.System and KeyboardType.OtherIm. // We want to create a new switching adaptor only the first time otherwise we're // getting into trouble if (SwitchingAdaptor == null) { SwitchingAdaptor = new CombinedIbusKeyboardSwitchingAdaptor(IbusCommunicator); KeyboardRetrievingHelper.AddIbusVersionAsErrorReportProperty(); InitKeyboards(); } }
/// <summary> /// Load a couple of settings from the GNOME settings system. /// </summary> private static void LoadLatinLayouts(IntPtr settingsGeneral) { IntPtr value = Unmanaged.g_settings_get_value(settingsGeneral, "xkb-latin-layouts"); CombinedIbusKeyboardSwitchingAdaptor.LatinLayouts = KeyboardRetrievingHelper.GetStringArrayFromGVariantArray(value); Unmanaged.g_variant_unref(value); CombinedIbusKeyboardSwitchingAdaptor.UseXmodmap = Unmanaged.g_settings_get_boolean( settingsGeneral, "use-xmodmap"); //Console.WriteLine("DEBUG use-xmodmap = {0}", _use_xmodmap); //Console.Write("DEBUG xkb-latin-layouts ="); //for (int i = 0; i < _latinLayouts.Length; ++i) // Console.Write(" '{0}'", _latinLayouts[i]); //Console.WriteLine(); }
public override void Initialize() { SwitchingAdaptor = new UnityIbusKeyboardSwitchingAdaptor(IbusCommunicator); KeyboardRetrievingHelper.AddIbusVersionAsErrorReportProperty(); InitKeyboards(); }
protected virtual string GetKeyboardSetupApplication(out string arguments) { return(KeyboardRetrievingHelper.GetKeyboardSetupApplication(out arguments)); }
public CombinedIbusKeyboardRetrievingAdaptor() { KeyboardRetrievingHelper.InitGlib(); }
public UnityKeyboardRetrievingHelper() { KeyboardRetrievingHelper.InitGlib(); }
public override void Initialize() { SwitchingAdaptor = CreateSwitchingAdaptor(); KeyboardRetrievingHelper.AddIbusVersionAsErrorReportProperty(); InitKeyboards(); }