Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GTK for the WindowSwitcher #2063

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
19 changes: 19 additions & 0 deletions data/gala.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,23 @@
<description></description>
</key>
</schema>

<schema path="/io/elementary/desktop/window-switcher/" id="io.elementary.desktop.window-switcher">
<key type="as" name="switch-windows">
<default><![CDATA[['<Alt>Tab']]]></default>
<summary>Switch between windows.</summary>
</key>
<key type="as" name="switch-windows-backward">
<default><![CDATA[['<Alt><Shift>Tab']]]></default>
<summary>Switch between windows backwards.</summary>
</key>
<key type="as" name="switch-group">
<default><![CDATA[['<Alt>grave']]]></default>
<summary>Switch between windows of the current application.</summary>
</key>
<key type="as" name="switch-group-backward">
<default><![CDATA[['<Alt><Shift>grave']]]></default>
<summary>Switch between windows of the current application backwards.</summary>
</key>
</schema>
</schemalist>
1 change: 0 additions & 1 deletion lib/Plugin.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
namespace Gala {
public enum PluginFunction {
ADDITION,
WINDOW_SWITCHER,
WORKSPACE_VIEW,
WINDOW_OVERVIEW
}
Expand Down
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ if get_option('documentation')
subdir('docs')
endif
subdir('po')
subdir('windowSwitcher')

vapigen = find_program('vapigen', required: false)
if vapigen.found()
Expand Down
9 changes: 9 additions & 0 deletions src/DBus.vala
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ public class Gala.DBus {
() => {},
() => warning ("Could not acquire name\n") );

Bus.own_name (BusType.SESSION, "io.elementary.desktop.wm", BusNameOwnerFlags.NONE,
(connection) => {
try {
connection.register_object ("/io/elementary/desktop/wm", new DBusGestureProvider ());
} catch (Error e) { warning (e.message); }
},
() => {},
() => warning ("Could not acquire name") );

Bus.own_name (BusType.SESSION, "org.gnome.Shell", BusNameOwnerFlags.NONE,
(connection) => {
try {
Expand Down
19 changes: 19 additions & 0 deletions src/Gestures/DBusGestureProvider.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[DBus (name = "io.elementary.desktop.wm.GestureProvider")]
public class Gala.DBusGestureProvider : Object {
public signal void on_gesture_detected (Gesture gesture);
public signal void on_begin (double percentage);
public signal void on_update (double percentage);
public signal void on_end (double percentage, bool cancel_action, int calculated_duration);

private GestureTracker gesture_tracker;

construct {
gesture_tracker = new GestureTracker (0, 0);
gesture_tracker.enable_touchpad ();

gesture_tracker.on_gesture_detected.connect ((gesture) => on_gesture_detected (gesture));
gesture_tracker.on_begin.connect ((percentage) => on_begin (percentage));
gesture_tracker.on_update.connect ((percentage) => on_update (percentage));
gesture_tracker.on_end.connect ((percentage, cancel_action, calculated_duration) => on_end (percentage, cancel_action, calculated_duration));
}
}
2 changes: 1 addition & 1 deletion src/Gestures/Gesture.vala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace Gala {
OUT = 6,
}

public class Gesture {
public struct Gesture {
public Clutter.EventType type;
public GestureDirection direction;
public int fingers;
Expand Down
8 changes: 0 additions & 8 deletions src/PluginManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ namespace Gala {
return _regions;
}

public string? window_switcher_provider { get; private set; default = null; }
public string? window_overview_provider { get; private set; default = null; }
public string? workspace_view_provider { get; private set; default = null; }

Expand Down Expand Up @@ -155,13 +154,6 @@ namespace Gala {
}
window_overview_provider = name;
return true;
case PluginFunction.WINDOW_SWITCHER:
if (window_switcher_provider != null) {
warning (message, window_switcher_provider, name, "window switcher");
return false;
}
window_switcher_provider = name;
return true;
default:
break;
}
Expand Down
Loading
Loading