mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-13 15:54:12 +09:00
Add intellihide options to control pointer reveal and hover areas
gh-2302
This commit is contained in:
@@ -355,6 +355,18 @@
|
||||
<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-pointer-limit-size">
|
||||
<default>false</default>
|
||||
<summary>Limit to panel length</summary>
|
||||
</key>
|
||||
<key type="b" name="intellihide-revealed-hover">
|
||||
<default>true</default>
|
||||
<summary>Panel stays revealed when hovered</summary>
|
||||
</key>
|
||||
<key type="b" name="intellihide-revealed-hover-limit-size">
|
||||
<default>false</default>
|
||||
<summary>Limit to panel length</summary>
|
||||
</key>
|
||||
<key type="b" name="intellihide-use-pressure">
|
||||
<default>false</default>
|
||||
<summary>Intellihide pressure</summary>
|
||||
|
||||
@@ -298,7 +298,13 @@ export const Intellihide = class {
|
||||
this._signalsHandler.add([
|
||||
this._pressureBarrier,
|
||||
'trigger',
|
||||
() => this._queueUpdatePanelPosition(true),
|
||||
() => {
|
||||
let [x, y] = global.get_pointer()
|
||||
|
||||
if (this._pointerIn(x, y, 1, 'intellihide-use-pointer-limit-size'))
|
||||
this._queueUpdatePanelPosition(true)
|
||||
else this._pressureBarrier._isTriggered = false
|
||||
},
|
||||
])
|
||||
}
|
||||
|
||||
@@ -352,31 +358,26 @@ export const Intellihide = class {
|
||||
}
|
||||
|
||||
_checkMousePointer(x, y) {
|
||||
let position = this._dtpPanel.geom.position
|
||||
|
||||
let pointerIn = (offset) =>
|
||||
((position == St.Side.TOP && y <= this._monitor.y + offset) ||
|
||||
(position == St.Side.BOTTOM &&
|
||||
y >= this._monitor.y + this._monitor.height - offset) ||
|
||||
(position == St.Side.LEFT && x <= this._monitor.x + offset) ||
|
||||
(position == St.Side.RIGHT &&
|
||||
x >= this._monitor.x + this._monitor.width - offset)) &&
|
||||
x >= this._monitor.x &&
|
||||
x < this._monitor.x + this._monitor.width &&
|
||||
y >= this._monitor.y &&
|
||||
y < this._monitor.y + this._monitor.height
|
||||
|
||||
if (
|
||||
!this._edgeBarrier &&
|
||||
!this._pressureBarrier &&
|
||||
!this._hover &&
|
||||
!Main.overview.visible &&
|
||||
pointerIn(1)
|
||||
this._pointerIn(x, y, 1, 'intellihide-use-pointer-limit-size')
|
||||
) {
|
||||
this._hover = true
|
||||
this._queueUpdatePanelPosition(true)
|
||||
} else if (this._panelBox.visible) {
|
||||
let hover = pointerIn(
|
||||
this._dtpPanel.geom.outerSize + this._dtpPanel.geom.topOffset,
|
||||
let keepRevealedOnHover = SETTINGS.get_boolean(
|
||||
'intellihide-revealed-hover',
|
||||
)
|
||||
let fixedOffset = keepRevealedOnHover
|
||||
? this._dtpPanel.geom.outerSize + this._dtpPanel.geom.topOffset
|
||||
: 1
|
||||
let hover = this._pointerIn(
|
||||
x,
|
||||
y,
|
||||
fixedOffset,
|
||||
'intellihide-revealed-hover-limit-size',
|
||||
)
|
||||
|
||||
if (hover == this._hover) return
|
||||
@@ -387,6 +388,31 @@ export const Intellihide = class {
|
||||
}
|
||||
}
|
||||
|
||||
_pointerIn(x, y, fixedOffset, limitSizeSetting) {
|
||||
let position = this._dtpPanel.geom.position
|
||||
let varOffset = {}
|
||||
|
||||
if (SETTINGS.get_boolean(limitSizeSetting)) {
|
||||
varOffset[this._dtpPanel.varCoord.c1] =
|
||||
this._dtpPanel.allocation[this._dtpPanel.varCoord.c1]
|
||||
varOffset[this._dtpPanel.varCoord.c2] =
|
||||
this._dtpPanel.allocation[this._dtpPanel.varCoord.c2]
|
||||
}
|
||||
|
||||
return (
|
||||
((position == St.Side.TOP && y <= this._monitor.y + fixedOffset) ||
|
||||
(position == St.Side.BOTTOM &&
|
||||
y >= this._monitor.y + this._monitor.height - fixedOffset) ||
|
||||
(position == St.Side.LEFT && x <= this._monitor.x + fixedOffset) ||
|
||||
(position == St.Side.RIGHT &&
|
||||
x >= this._monitor.x + this._monitor.width - fixedOffset)) &&
|
||||
x >= this._monitor.x + (varOffset.x1 || 0) &&
|
||||
x < this._monitor.x + (varOffset.x2 || this._monitor.width) &&
|
||||
y >= this._monitor.y + (varOffset.y1 || 0) &&
|
||||
y < this._monitor.y + (varOffset.y2 || this._monitor.height)
|
||||
)
|
||||
}
|
||||
|
||||
_queueUpdatePanelPosition(fromRevealMechanism) {
|
||||
if (
|
||||
!fromRevealMechanism &&
|
||||
|
||||
79
src/prefs.js
79
src/prefs.js
@@ -1580,11 +1580,72 @@ const Preferences = class {
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
|
||||
this._settings.bind(
|
||||
'intellihide-use-pointer-limit-size',
|
||||
this._builder.get_object('intellihide_use_pointer_limit_button'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
|
||||
this._settings.bind(
|
||||
'intellihide-use-pointer',
|
||||
this._builder.get_object('intellihide_use_pointer_limit_button'),
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
|
||||
this._settings.bind(
|
||||
'intellihide-revealed-hover',
|
||||
this._builder.get_object('intellihide_revealed_hover_switch'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
|
||||
this._settings.bind(
|
||||
'intellihide-use-pointer',
|
||||
this._builder.get_object('intellihide_revealed_hover_switch'),
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
|
||||
this._settings.bind(
|
||||
'intellihide-revealed-hover-limit-size',
|
||||
this._builder.get_object('intellihide_revealed_hover_limit_button'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
|
||||
this._settings.bind(
|
||||
'intellihide-revealed-hover',
|
||||
this._builder.get_object('intellihide_revealed_hover_limit_button'),
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
|
||||
this._settings.connect('changed::intellihide-use-pointer', () => {
|
||||
if (!this._settings.get_boolean('intellihide-use-pointer'))
|
||||
if (!this._settings.get_boolean('intellihide-use-pointer')) {
|
||||
this._settings.set_boolean('intellihide-revealed-hover', false)
|
||||
this._settings.set_boolean('intellihide-use-pointer-limit-size', false)
|
||||
this._settings.set_boolean('intellihide-use-pressure', false)
|
||||
}
|
||||
})
|
||||
|
||||
this._settings.connect('changed::intellihide-revealed-hover', () => {
|
||||
if (!this._settings.get_boolean('intellihide-revealed-hover')) {
|
||||
this._settings.set_boolean(
|
||||
'intellihide-revealed-hover-limit-size',
|
||||
false,
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
this._settings.bind(
|
||||
'intellihide-use-pointer',
|
||||
this._builder.get_object('intellihide_revealed_hover_options'),
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
|
||||
this._settings.bind(
|
||||
'intellihide-use-pointer',
|
||||
this._builder.get_object('intellihide_use_pressure_options'),
|
||||
@@ -1770,6 +1831,22 @@ const Preferences = class {
|
||||
'intellihide-use-pointer',
|
||||
this._settings.get_default_value('intellihide-use-pointer'),
|
||||
)
|
||||
this._settings.set_value(
|
||||
'intellihide-use-pointer-limit-size',
|
||||
this._settings.get_default_value(
|
||||
'intellihide-use-pointer-limit-size',
|
||||
),
|
||||
)
|
||||
this._settings.set_value(
|
||||
'intellihide-revealed-hover',
|
||||
this._settings.get_default_value('intellihide-revealed-hover'),
|
||||
)
|
||||
this._settings.set_value(
|
||||
'intellihide-revealed-hover-limit-size',
|
||||
this._settings.get_default_value(
|
||||
'intellihide-revealed-hover-limit-size',
|
||||
),
|
||||
)
|
||||
this._settings.set_value(
|
||||
'intellihide-use-pressure',
|
||||
this._settings.get_default_value('intellihide-use-pressure'),
|
||||
|
||||
@@ -107,12 +107,56 @@
|
||||
<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>
|
||||
<property name="title" translatable="yes">Touching the monitor's edge with the pointer reveals the panel</property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="intellihide_use_pointer_switch">
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">10</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="intellihide_use_pointer_limit_button">
|
||||
<property name="receives-default">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Limit to panel length</property>
|
||||
<property name="name">4</property>
|
||||
<property name="use-markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwActionRow" id="intellihide_revealed_hover_options">
|
||||
<property name="title" translatable="yes">Hovering the panel area keeps the panel revealed</property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="intellihide_revealed_hover_switch">
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">10</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="intellihide_revealed_hover_limit_button">
|
||||
<property name="receives-default">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Limit to panel length</property>
|
||||
<property name="name">4</property>
|
||||
<property name="use-markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
||||
Reference in New Issue
Block a user