Add intellihide option to disable panel reveal with the pointer

gh-2123
This commit is contained in:
Charles Gagnon
2025-04-09 23:37:37 -04:00
parent 7a54518746
commit f0af17687f
4 changed files with 50 additions and 7 deletions

View File

@@ -350,10 +350,15 @@
<summary>Intellihide behaviour</summary>
<description>Dictates how to intelligently hide the panel</description>
</key>
<key type="b" name="intellihide-use-pointer">
<default>true</default>
<summary>Intellihide mouse pointer</summary>
<description>The mouse pointer next to the edge of the screen reveals the panel</description>
</key>
<key type="b" name="intellihide-use-pressure">
<default>false</default>
<summary>Intellihide pressure</summary>
<description>To reveal the panel, pressure needs to be applied to the edege of the screen</description>
<description>To reveal the panel, pressure needs to be applied to the edge of the screen</description>
</key>
<key type="i" name="intellihide-pressure-threshold">
<default>100</default>

View File

@@ -116,6 +116,7 @@ export const Intellihide = class {
)
}
if (SETTINGS.get_boolean('intellihide-use-pointer'))
this._setRevealMechanism()
let lastState = SETTINGS.get_int('intellihide-persisted-state')
@@ -238,6 +239,7 @@ export const Intellihide = class {
[
SETTINGS,
[
'changed::intellihide-use-pointer',
'changed::intellihide-use-pressure',
'changed::intellihide-hide-from-windows',
'changed::intellihide-hide-from-monitor-windows',
@@ -307,7 +309,10 @@ export const Intellihide = class {
}
_removeRevealMechanism() {
if (this._pointerWatch) {
PointerWatcher.getPointerWatcher()._removeWatch(this._pointerWatch)
this._pointerWatch = 0
}
if (this._pressureBarrier) {
this._pressureBarrier.destroy()

View File

@@ -1592,6 +1592,25 @@ const Preferences = class {
Gio.SettingsBindFlags.DEFAULT,
)
this._settings.bind(
'intellihide-use-pointer',
this._builder.get_object('intellihide_use_pointer_switch'),
'active',
Gio.SettingsBindFlags.DEFAULT,
)
this._settings.connect('changed::intellihide-use-pointer', () => {
if (!this._settings.get_boolean('intellihide-use-pointer'))
this._settings.set_boolean('intellihide-use-pressure', false)
})
this._settings.bind(
'intellihide-use-pointer',
this._builder.get_object('intellihide_use_pressure_options'),
'sensitive',
Gio.SettingsBindFlags.DEFAULT,
)
this._settings.bind(
'intellihide-use-pressure',
this._builder.get_object('intellihide_use_pressure_switch'),
@@ -1601,14 +1620,14 @@ const Preferences = class {
this._settings.bind(
'intellihide-use-pressure',
this._builder.get_object('intellihide_use_pressure_options'),
this._builder.get_object('intellihide_use_pressure_options2'),
'sensitive',
Gio.SettingsBindFlags.DEFAULT,
)
this._settings.bind(
'intellihide-use-pressure',
this._builder.get_object('intellihide_use_pressure_options2'),
this._builder.get_object('intellihide_use_pressure_options3'),
'sensitive',
Gio.SettingsBindFlags.DEFAULT,
)
@@ -1766,6 +1785,10 @@ const Preferences = class {
'intellihide-behaviour',
this._settings.get_default_value('intellihide-behaviour'),
)
this._settings.set_value(
'intellihide-use-pointer',
this._settings.get_default_value('intellihide-use-pointer'),
)
this._settings.set_value(
'intellihide-use-pressure',
this._settings.get_default_value('intellihide-use-pressure'),

View File

@@ -107,6 +107,16 @@
<object class="AdwPreferencesGroup">
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Touching the edge of the monitor with the pointer reveals the panel</property>
<child>
<object class="GtkSwitch" id="intellihide_use_pointer_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow" id="intellihide_use_pressure_options">
<property name="title" translatable="yes">Require pressure at the edge of the monitor to reveal the panel</property>
<child>
<object class="GtkSwitch" id="intellihide_use_pressure_switch">
@@ -116,7 +126,7 @@
</object>
</child>
<child>
<object class="AdwActionRow" id="intellihide_use_pressure_options">
<object class="AdwActionRow" id="intellihide_use_pressure_options2">
<property name="title" translatable="yes">Required pressure threshold (px)</property>
<child>
<object class="GtkSpinButton" id="intellihide_pressure_threshold_spinbutton">
@@ -130,7 +140,7 @@
</object>
</child>
<child>
<object class="AdwActionRow" id="intellihide_use_pressure_options2">
<object class="AdwActionRow" id="intellihide_use_pressure_options3">
<property name="title" translatable="yes">Required pressure timeout (ms)</property>
<child>
<object class="GtkSpinButton" id="intellihide_pressure_time_spinbutton">