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

New feature: minimize (hide) on focus-out #14

Merged
merged 2 commits into from
Jun 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions quake-mode@repsac-by.github.com/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ const QuakeModePrefsWidget
this.attach(label(_('Icon')), 0, ++r, 1, 1);
this.attach(switchTray, 1, r, 1, 1);

// Minimize on Focus Out
const switchFocusOut = new Gtk.Switch({ halign: Gtk.Align.START });

settings.bind('quake-mode-focusout', switchFocusOut, 'state', Gio.SettingsBindFlags.DEFAULT);

this.attach(label(_('Minimize on focus out')), 0, ++r, 1, 1);
this.attach(switchFocusOut, 1, r, 1, 1);

// Width
const spinWidth = new Gtk.SpinButton();
spinWidth.set_range(0, 100);
Expand Down
9 changes: 8 additions & 1 deletion quake-mode@repsac-by.github.com/quakemodeapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ var QuakeModeApp = class {

get height() { return this.settings.get_int('quake-mode-height'); }

get focusout() { return this.settings.get_boolean('quake-mode-focusout'); }

get ainmation_time() { return this.settings.get_double('quake-mode-animation-time'); }

get monitor() {
Expand Down Expand Up @@ -175,14 +177,16 @@ var QuakeModeApp = class {
}

show() {
const { actor } = this;
const { actor, focusout } = this;

if ( this.state !== state.RUNNING )
return;

if ( Tweener.isTweening(actor) )
return;

const quake = this;

Tweener.addTween(actor, {
translation_y: 0,
clip_y: 0,
Expand All @@ -197,6 +201,9 @@ var QuakeModeApp = class {
this.remove_clip();
Main.wm.skipNextEffect(this);
Main.activateWindow(this.meta_window);
if ( focusout )
once(global.display, 'notify::focus-window')
.then(() => quake.hide());
},
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
<default>true</default>
</key>

<key name="quake-mode-focusout" type="b">
<default>false</default>
</key>

</schema>

</schemalist>
Binary file modified quake-mode@repsac-by.github.com/schemas/gschemas.compiled
Binary file not shown.