Skip to content

Commit

Permalink
Appearance: add reduce motion option (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit authored Apr 12, 2023
1 parent 8411a3d commit 55a8726
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
Binary file modified data/screenshot-appearance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/screenshot-multitasking.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/Plug.vala
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,14 @@ public class PantheonShell.Plug : Switchboard.Plug {
search_results.set ("%s%s".printf (display_name, _("Appearance")), "appearance");
search_results.set ("%s%s%s".printf (display_name, _("Appearance"), _("Dark style")), "appearance");
search_results.set ("%s%s%s".printf (display_name, _("Appearance"), _("Accent color")), "appearance");
search_results.set ("%s%s%s".printf (display_name, _("Appearance"), _("Reduce motion")), "appearance");
search_results.set ("%s%s%s".printf (display_name, _("Appearance"), _("Window animations")), "appearance");
search_results.set ("%s%s".printf (display_name, _("Text")), "text");
search_results.set ("%s%s%s".printf (display_name, _("Text"), _("Size")), "text");
search_results.set ("%s%s%s".printf (display_name, _("Text"), _("Dyslexia-friendly")), "text");
search_results.set ("%s%s".printf (display_name, _("Multitasking")), "multitasking");
search_results.set ("%s%s%s".printf (display_name, _("Multitasking"), _("Hot Corners")), "multitasking");
search_results.set ("%s%s%s".printf (display_name, _("Multitasking"), _("Move windows to a new workspace")), "multitasking");
search_results.set ("%s%s%s".printf (display_name, _("Multitasking"), _("Window animations")), "multitasking");
return search_results;
}
}
Expand Down
28 changes: 28 additions & 0 deletions src/Views/Appearance.vala
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,38 @@ public class PantheonShell.Appearance : Gtk.Box {
grid.attach (accent_grid, 0, 9, 2);
}

var animations_label = new Granite.HeaderLabel (_("Reduce Motion")) {
margin_top = 18
};

var animations_description = new Gtk.Label (_("Disable animations in the window manager and some other interface elements.")) {
wrap = true,
xalign = 0
};
animations_description.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL);

var animations_switch = new Gtk.Switch () {
halign = Gtk.Align.END,
hexpand = true,
valign = Gtk.Align.CENTER
};

var animations_grid = new Gtk.Grid () {
column_spacing = 12
};
animations_grid.attach (animations_label, 0, 0);
animations_grid.attach (animations_description, 0, 1);
animations_grid.attach (animations_switch, 1, 0, 1, 2);

grid.attach (animations_grid, 0, 10, 2);

var clamp = new Hdy.Clamp ();
clamp.add (grid);

add (clamp);

var animations_settings = new Settings ("org.pantheon.desktop.gala.animations");
animations_settings.bind ("enable-animations", animations_switch, "active", SettingsBindFlags.INVERT_BOOLEAN);
}

private class PrefersAccentColorButton : Gtk.RadioButton {
Expand Down
16 changes: 0 additions & 16 deletions src/Views/Multitasking.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

public class PantheonShell.Multitasking : Gtk.Box {
private GLib.Settings behavior_settings;
private const string ANIMATIONS_SCHEMA = "org.pantheon.desktop.gala.animations";
private const string ANIMATIONS_KEY = "enable-animations";

construct {
var hotcorner_title = new Gtk.Label (_("When the pointer enters a display corner")) {
Expand Down Expand Up @@ -51,15 +49,6 @@ public class PantheonShell.Multitasking : Gtk.Box {
checkbutton_grid.add (fullscreen_checkbutton);
checkbutton_grid.add (maximize_checkbutton);

var animations_label = new Gtk.Label (_("Window animations:")) {
halign = Gtk.Align.END
};

var animations_switch = new Gtk.Switch () {
halign = Gtk.Align.START,
hexpand = true
};

var grid = new Gtk.Grid () {
column_spacing = 12,
row_spacing = 6,
Expand All @@ -74,8 +63,6 @@ public class PantheonShell.Multitasking : Gtk.Box {
grid.attach (bottomright, 0, 4, 2);
grid.attach (workspaces_label, 0, 6, 2);
grid.attach (checkbutton_grid, 0, 7, 2);
grid.attach (animations_label, 0, 8);
grid.attach (animations_switch, 1, 8);

var clamp = new Hdy.Clamp ();
clamp.add (grid);
Expand All @@ -87,9 +74,6 @@ public class PantheonShell.Multitasking : Gtk.Box {

add (scrolled);

var animations_settings = new GLib.Settings (ANIMATIONS_SCHEMA);
animations_settings.bind (ANIMATIONS_KEY, animations_switch, "active", SettingsBindFlags.DEFAULT);

behavior_settings = new GLib.Settings ("org.pantheon.desktop.gala.behavior");
behavior_settings.bind ("move-fullscreened-workspace", fullscreen_checkbutton, "active", GLib.SettingsBindFlags.DEFAULT);
behavior_settings.bind ("move-maximized-workspace", maximize_checkbutton, "active", GLib.SettingsBindFlags.DEFAULT);
Expand Down

0 comments on commit 55a8726

Please sign in to comment.