🎉 Make it possible to select window open effects

This commit is contained in:
Simon Schneegans
2022-01-24 20:34:50 +01:00
parent 7875060375
commit ba79b5b611
4 changed files with 192 additions and 2 deletions
+26
View File
@@ -138,6 +138,28 @@ var PreferencesDialog = class PreferencesDialog {
// clang-format on
}
// Populate the open-effects drop-down menu.
{
const menu = this._builder.get_object('open-effect-menu');
const group = Gio.SimpleActionGroup.new();
window.insert_action_group('open-effects', group);
ALL_EFFECTS.forEach(Effect => {
const [minMajor, minMinor] = Effect.getMinShellVersion();
if (utils.shellVersionIsAtLeast(minMajor, minMinor)) {
const nick = Effect.getNick();
const label = Effect.getLabel();
const actionName = nick + '-open-effect';
const fullName = 'open-effects.' + actionName;
const action = this._settings.create_action(actionName);
group.add_action(action);
menu.append_item(Gio.MenuItem.new(label, fullName));
}
});
}
// Populate the close-effects drop-down menu.
{
const menu = this._builder.get_object('close-effect-menu');
@@ -299,8 +321,12 @@ var PreferencesDialog = class PreferencesDialog {
this._button.connect('clicked', () => {
// Set the to-be-previewed effect.
dialog.getSettings().set_string('open-preview-effect', Effect.getNick());
dialog.getSettings().set_string('close-preview-effect', Effect.getNick());
// Make sure that the window.show() firther below "sees" this change.
Gio.Settings.sync();
// Create the preview-window.
const window = new Gtk.Window({
title: `Preview for ${Effect.getLabel()}`,
+66 -1
View File
@@ -3,6 +3,7 @@
<requires lib="gtk" version="3.0" />
<menu id="close-effect-menu"></menu>
<menu id="open-effect-menu"></menu>
<object class="GtkMenuButton" id="menu-button">
<property name="menu-model">main-menu</property>
@@ -68,6 +69,70 @@
<object class="GtkListBox">
<property name="selection-mode">none</property>
<child>
<object class="GtkListBoxRow">
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<property name="spacing">8</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Open Window Animation</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">If multiple are selected, one is chosen randomly.</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<style>
<class name="dim-label" />
<class name="caption" />
</style>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuButton" id="open-effect-button">
<property name="menu-model">open-effect-menu</property>
<child>
<object class="GtkBox">
<property name="spacing">8</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Choose Effects</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="icon-name">pan-down-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="margin-start">10</property>
@@ -144,7 +209,7 @@
<property name="spacing">8</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Also Burn Dialogs</property>
<property name="label" translatable="yes">Also Add Effects to Dialogs</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
+46 -1
View File
@@ -3,6 +3,7 @@
<requires lib="gtk" version="4.0" />
<menu id="close-effect-menu"></menu>
<menu id="open-effect-menu"></menu>
<object class="GtkMenuButton" id="menu-button">
<property name="menu-model">main-menu</property>
@@ -70,6 +71,50 @@
</style>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Open Window Animation</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">If multiple are selected, one is chosen randomly.</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<style>
<class name="dim-label" />
<class name="caption" />
</style>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuButton" id="open-effect-button">
<property name="label">Choose Effects</property>
<property name="menu-model">open-effect-menu</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
@@ -121,7 +166,7 @@
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Also Burn Dialogs</property>
<property name="label" translatable="yes">Also Add Effects to Dialogs</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
@@ -19,6 +19,12 @@
<description>The effect with this nick will be used for the next window-close animation.</description>
</key>
<key name="open-preview-effect" type="s">
<default>""</default>
<summary>Open Preview Effect</summary>
<description>The effect with this nick will be used for the next window-open animation.</description>
</key>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Fire Options -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
@@ -29,6 +35,12 @@
<description>Use the fire effect for window closing.</description>
</key>
<key name="fire-open-effect" type="b">
<default>false</default>
<summary>Fire Open Effect</summary>
<description>Use the fire effect for window opening.</description>
</key>
<key name="fire-animation-time" type="i">
<default>1500</default>
<summary>Fire Animation Time</summary>
@@ -93,6 +105,12 @@
<description>Use the matrix effect for window closing.</description>
</key>
<key name="matrix-open-effect" type="b">
<default>false</default>
<summary>Matrix Open Effect</summary>
<description>Use the matrix effect for window opening.</description>
</key>
<key name="matrix-animation-time" type="i">
<default>3000</default>
<summary>Matrix Animation Time</summary>
@@ -139,6 +157,12 @@
<description>Use the tv effect for window closing.</description>
</key>
<key name="tv-open-effect" type="b">
<default>false</default>
<summary>TV Open Effect</summary>
<description>Use the tv effect for window opening.</description>
</key>
<key name="tv-animation-time" type="i">
<default>400</default>
<summary>TV Animation Time</summary>
@@ -161,6 +185,12 @@
<description>Use the trex effect for window closing.</description>
</key>
<key name="trex-open-effect" type="b">
<default>false</default>
<summary>T-Rex Open Effect</summary>
<description>Use the trex effect for window opening.</description>
</key>
<key name="trex-animation-time" type="i">
<default>1500</default>
<summary>T-Rex Animation Time</summary>
@@ -201,6 +231,12 @@
<description>Use the Energize A effect for window closing.</description>
</key>
<key name="energize-a-open-effect" type="b">
<default>false</default>
<summary>Energize A Open Effect</summary>
<description>Use the Energize A effect for window opening.</description>
</key>
<key name="energize-a-animation-time" type="i">
<default>2000</default>
<summary>Energize A Animation Time</summary>
@@ -229,6 +265,12 @@
<description>Use the Energize B effect for window closing.</description>
</key>
<key name="energize-b-open-effect" type="b">
<default>false</default>
<summary>Energize B Open Effect</summary>
<description>Use the Energize B effect for window opening.</description>
</key>
<key name="energize-b-animation-time" type="i">
<default>2000</default>
<summary>Energize B Animation Time</summary>
@@ -257,6 +299,12 @@
<description>Use the wisps effect for window closing.</description>
</key>
<key name="wisps-open-effect" type="b">
<default>false</default>
<summary>Wisps Open Effect</summary>
<description>Use the wisps effect for window opening.</description>
</key>
<key name="wisps-animation-time" type="i">
<default>2000</default>
<summary>Wisps Animation Time</summary>
@@ -285,6 +333,12 @@
<description>Use the broken glass effect for window closing.</description>
</key>
<key name="broken-glass-open-effect" type="b">
<default>false</default>
<summary>Broken Glass Open Effect</summary>
<description>Use the broken glass effect for window opening.</description>
</key>
<key name="broken-glass-animation-time" type="i">
<default>1500</default>
<summary>Broken Glass Animation Time</summary>