mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Add option to persist intellihide state
gh-2242
This commit is contained in:
@@ -391,6 +391,10 @@
|
||||
<summary>Keybinding toggle intellihide</summary>
|
||||
<description>Keybinding to reveal the panel while in intellihide mode</description>
|
||||
</key>
|
||||
<key type="i" name="intellihide-persisted-state">
|
||||
<default>-1</default>
|
||||
<summary>Persisted intellihide hold status. -1 means the option is disabled</summary>
|
||||
</key>
|
||||
<key type="i" name="intellihide-enable-start-delay">
|
||||
<default>2000</default>
|
||||
<summary>Intellihide enable start delay</summary>
|
||||
|
||||
@@ -40,6 +40,7 @@ const MIN_UPDATE_MS = 250
|
||||
const T1 = 'checkGrabTimeout'
|
||||
const T2 = 'limitUpdateTimeout'
|
||||
const T3 = 'postAnimateTimeout'
|
||||
const T4 = 'enableStartTimeout'
|
||||
|
||||
const SIDE_CONTROLS_ANIMATION_TIME =
|
||||
OverviewControls.SIDE_CONTROLS_ANIMATION_TIME /
|
||||
@@ -105,7 +106,26 @@ export const Intellihide = class {
|
||||
}
|
||||
|
||||
this._setRevealMechanism()
|
||||
this._queueUpdatePanelPosition()
|
||||
|
||||
let lastState = SETTINGS.get_int('intellihide-persisted-state')
|
||||
|
||||
if (lastState > -1) {
|
||||
this._holdStatus = lastState
|
||||
|
||||
if (lastState == Hold.NONE && Main.layoutManager._startingUp)
|
||||
this._signalsHandler.add([
|
||||
this._panelBox,
|
||||
'notify::mapped',
|
||||
() => this._hidePanel(true),
|
||||
])
|
||||
else this._queueUpdatePanelPosition()
|
||||
} else
|
||||
// -1 means that the option to persist hold isn't activated, so normal start
|
||||
this._timeoutsHandler.add([
|
||||
T4,
|
||||
SETTINGS.get_int('intellihide-enable-start-delay'),
|
||||
() => this._queueUpdatePanelPosition(),
|
||||
])
|
||||
}
|
||||
|
||||
disable(reset) {
|
||||
@@ -146,12 +166,14 @@ export const Intellihide = class {
|
||||
}
|
||||
|
||||
this._holdStatus |= holdStatus
|
||||
this._maybePersistHoldStatus()
|
||||
}
|
||||
|
||||
release(holdStatus) {
|
||||
this._holdStatus -= holdStatus
|
||||
|
||||
if (this.enabled && !this._holdStatus) {
|
||||
this._maybePersistHoldStatus()
|
||||
this._queueUpdatePanelPosition()
|
||||
}
|
||||
}
|
||||
@@ -171,6 +193,14 @@ export const Intellihide = class {
|
||||
}
|
||||
}
|
||||
|
||||
_maybePersistHoldStatus() {
|
||||
if (SETTINGS.get_int('intellihide-persisted-state') > -1)
|
||||
SETTINGS.set_int(
|
||||
'intellihide-persisted-state',
|
||||
this._holdStatus & Hold.PERMANENT ? Hold.PERMANENT : Hold.NONE,
|
||||
)
|
||||
}
|
||||
|
||||
_bindGeneralSignals() {
|
||||
this._signalsHandler.add(
|
||||
[
|
||||
|
||||
18
src/panel.js
18
src/panel.js
@@ -28,6 +28,7 @@
|
||||
*/
|
||||
|
||||
import Clutter from 'gi://Clutter'
|
||||
import GLib from 'gi://GLib'
|
||||
import GObject from 'gi://GObject'
|
||||
import * as AppIcons from './appIcons.js'
|
||||
import * as Utils from './utils.js'
|
||||
@@ -61,7 +62,6 @@ let tracker = Shell.WindowTracker.get_default()
|
||||
export const panelBoxes = ['_leftBox', '_centerBox', '_rightBox']
|
||||
|
||||
//timeout names
|
||||
const T2 = 'startIntellihideTimeout'
|
||||
const T4 = 'showDesktopTimeout'
|
||||
const T5 = 'trackerFocusAppTimeout'
|
||||
const T6 = 'scrollPanelDelayTimeout'
|
||||
@@ -278,11 +278,7 @@ export const Panel = GObject.registerClass(
|
||||
'dashtopanelMainPanel ' + this.getOrientation(),
|
||||
)
|
||||
|
||||
this._timeoutsHandler.add([
|
||||
T2,
|
||||
SETTINGS.get_int('intellihide-enable-start-delay'),
|
||||
() => (this.intellihide = new Intellihide.Intellihide(this)),
|
||||
])
|
||||
this.intellihide = new Intellihide.Intellihide(this)
|
||||
|
||||
this._signalsHandler.add(
|
||||
// this is to catch changes to the theme or window scale factor
|
||||
@@ -366,7 +362,11 @@ export const Panel = GObject.registerClass(
|
||||
// This saves significant CPU when repainting the screen.
|
||||
this.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS)
|
||||
|
||||
if (!Main.layoutManager._startingUp) this._resetGeometry()
|
||||
if (!Main.layoutManager._startingUp)
|
||||
GLib.idle_add(GLib.PRIORITY_LOW, () => {
|
||||
this._resetGeometry()
|
||||
return GLib.SOURCE_REMOVE
|
||||
})
|
||||
}
|
||||
|
||||
disable() {
|
||||
@@ -696,10 +696,6 @@ export const Panel = GObject.registerClass(
|
||||
this.taskbar.resetAppIcons(true)
|
||||
this.dynamicTransparency.updateExternalStyle()
|
||||
|
||||
if (this.intellihide && this.intellihide.enabled) {
|
||||
this.intellihide.reset()
|
||||
}
|
||||
|
||||
if (this.checkIfVertical()) {
|
||||
this.showAppsIconWrapper.realShowAppsIcon.toggleButton.set_width(
|
||||
this.geom.w,
|
||||
|
||||
54
src/prefs.js
54
src/prefs.js
@@ -1659,6 +1659,30 @@ const Preferences = class {
|
||||
setShortcut(this._settings, 'intellihide-key-toggle'),
|
||||
)
|
||||
|
||||
let intellihidePersistStateSwitch = this._builder.get_object(
|
||||
'intellihide_persist_state_switch',
|
||||
)
|
||||
let intellihideStartDelayButton = this._builder.get_object(
|
||||
'intellihide_enable_start_delay_spinbutton',
|
||||
)
|
||||
|
||||
intellihidePersistStateSwitch.set_active(
|
||||
this._settings.get_int('intellihide-persisted-state') > -1,
|
||||
)
|
||||
|
||||
intellihideStartDelayButton.set_sensitive(
|
||||
this._settings.get_int('intellihide-persisted-state') == -1,
|
||||
)
|
||||
|
||||
intellihidePersistStateSwitch.connect('notify::active', (widget) => {
|
||||
intellihideStartDelayButton.set_sensitive(!widget.get_active())
|
||||
|
||||
this._settings.set_int(
|
||||
'intellihide-persisted-state',
|
||||
widget.get_active() ? 0 : -1,
|
||||
)
|
||||
})
|
||||
|
||||
this._builder
|
||||
.get_object('intellihide_animation_time_spinbutton')
|
||||
.set_value(this._settings.get_int('intellihide-animation-time'))
|
||||
@@ -1677,17 +1701,15 @@ const Preferences = class {
|
||||
this._settings.set_int('intellihide-close-delay', widget.get_value())
|
||||
})
|
||||
|
||||
this._builder
|
||||
.get_object('intellihide_enable_start_delay_spinbutton')
|
||||
.set_value(this._settings.get_int('intellihide-enable-start-delay'))
|
||||
this._builder
|
||||
.get_object('intellihide_enable_start_delay_spinbutton')
|
||||
.connect('value-changed', (widget) => {
|
||||
this._settings.set_int(
|
||||
'intellihide-enable-start-delay',
|
||||
widget.get_value(),
|
||||
)
|
||||
})
|
||||
intellihideStartDelayButton.set_value(
|
||||
this._settings.get_int('intellihide-enable-start-delay'),
|
||||
)
|
||||
intellihideStartDelayButton.connect('value-changed', (widget) => {
|
||||
this._settings.set_int(
|
||||
'intellihide-enable-start-delay',
|
||||
widget.get_value(),
|
||||
)
|
||||
})
|
||||
|
||||
this._builder
|
||||
.get_object('intellihide_options_button')
|
||||
@@ -1747,6 +1769,8 @@ const Preferences = class {
|
||||
this._settings.get_default_value('intellihide-key-toggle-text'),
|
||||
)
|
||||
|
||||
intellihidePersistStateSwitch.set_active(false)
|
||||
|
||||
this._settings.set_value(
|
||||
'intellihide-animation-time',
|
||||
this._settings.get_default_value('intellihide-animation-time'),
|
||||
@@ -1769,11 +1793,9 @@ const Preferences = class {
|
||||
'intellihide-enable-start-delay',
|
||||
),
|
||||
)
|
||||
this._builder
|
||||
.get_object('intellihide_enable_start_delay_spinbutton')
|
||||
.set_value(
|
||||
this._settings.get_int('intellihide-enable-start-delay'),
|
||||
)
|
||||
intellihideStartDelayButton.set_value(
|
||||
this._settings.get_int('intellihide-enable-start-delay'),
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -1,53 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<interface>
|
||||
<!-- interface-name BoxIntellihideOptions.ui -->
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
|
||||
<requires lib="libadwaita" version="1.3"/>
|
||||
<object class="GtkAdjustment" id="intellihide_pressure_threshold_adjustment">
|
||||
<property name="lower">1</property>
|
||||
<property name="page-increment">100</property>
|
||||
<property name="step-increment">10</property>
|
||||
<property name="upper">9990</property>
|
||||
<property name="step_increment">10</property>
|
||||
<property name="page_increment">100</property>
|
||||
</object>
|
||||
|
||||
<object class="GtkAdjustment" id="intellihide_pressure_time_adjustment">
|
||||
<property name="lower">1</property>
|
||||
<property name="page-increment">100</property>
|
||||
<property name="step-increment">10</property>
|
||||
<property name="upper">5000</property>
|
||||
<property name="step_increment">10</property>
|
||||
<property name="page_increment">100</property>
|
||||
</object>
|
||||
|
||||
<object class="GtkAdjustment" id="intellihide_animation_time_adjustment">
|
||||
<property name="lower">10</property>
|
||||
<property name="page-increment">100</property>
|
||||
<property name="step-increment">10</property>
|
||||
<property name="upper">2000</property>
|
||||
<property name="step_increment">10</property>
|
||||
<property name="page_increment">100</property>
|
||||
</object>
|
||||
|
||||
<object class="GtkAdjustment" id="intellihide_close_delay_adjustment">
|
||||
<property name="lower">10</property>
|
||||
<property name="page-increment">100</property>
|
||||
<property name="step-increment">10</property>
|
||||
<property name="upper">4000</property>
|
||||
<property name="step_increment">10</property>
|
||||
<property name="page_increment">100</property>
|
||||
</object>
|
||||
|
||||
<object class="GtkAdjustment" id="intellihide_enable_hide_delay_adjustment">
|
||||
<property name="page-increment">100</property>
|
||||
<property name="step-increment">10</property>
|
||||
<property name="upper">10000</property>
|
||||
<property name="step_increment">10</property>
|
||||
<property name="page_increment">100</property>
|
||||
</object>
|
||||
|
||||
<object class="GtkBox" id="box_intellihide_options">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="width-request">600</property>
|
||||
<property name="spacing">24</property>
|
||||
<property name="margin-top">32</property>
|
||||
<property name="margin-bottom">32</property>
|
||||
<property name="margin-start">32</property>
|
||||
<property name="margin-end">32</property>
|
||||
|
||||
<property name="margin-start">32</property>
|
||||
<property name="margin-top">32</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">24</property>
|
||||
<property name="width-request">600</property>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup">
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Only hide the panel when it is obstructed by windows</property>
|
||||
@@ -58,7 +52,6 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow" id="intellihide_behaviour_options">
|
||||
<property name="title" translatable="yes">The panel hides from</property>
|
||||
@@ -74,13 +67,10 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup">
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Require pressure at the edge of the screen to reveal the panel</property>
|
||||
@@ -91,43 +81,38 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow" id="intellihide_use_pressure_options">
|
||||
<property name="title" translatable="yes">Required pressure threshold (px)</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="intellihide_pressure_threshold_spinbutton">
|
||||
<property name="valign">center</property>
|
||||
<property name="width_chars">4</property>
|
||||
<property name="text">0</property>
|
||||
<property name="adjustment">intellihide_pressure_threshold_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
<property name="text">0</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="width-chars">4</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow" id="intellihide_use_pressure_options2">
|
||||
<property name="title" translatable="yes">Required pressure timeout (ms)</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="intellihide_pressure_time_spinbutton">
|
||||
<property name="valign">center</property>
|
||||
<property name="width_chars">4</property>
|
||||
<property name="text">0</property>
|
||||
<property name="adjustment">intellihide_pressure_time_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
<property name="text">0</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="width-chars">4</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup">
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Allow the panel to be revealed while in fullscreen mode</property>
|
||||
@@ -138,11 +123,10 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow" id="grid_intellihide_only_secondary">
|
||||
<property name="title" translatable="yes">Only hide secondary panels</property>
|
||||
<property name="subtitle" translatable="yes">(requires multi-monitors option)</property>
|
||||
<property name="title" translatable="yes">Only hide secondary panels</property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="intellihide_only_secondary_switch">
|
||||
<property name="valign">center</property>
|
||||
@@ -150,77 +134,78 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Keyboard shortcut to reveal and hold the panel</property>
|
||||
<property name="subtitle" translatable="yes">Syntax: &lt;Shift&gt;, &lt;Ctrl&gt;, &lt;Alt&gt;, &lt;Super&gt;</property>
|
||||
<property name="title" translatable="yes">Keyboard shortcut to reveal and hold the panel</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="intellihide_toggle_entry">
|
||||
<property name="placeholder-text" translatable="yes">e.g. <Super>i</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="width-chars">12</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwActionRow" id="grid_intellihide_persist_state">
|
||||
<property name="title" translatable="yes">Persist state across restarts</property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="intellihide_persist_state_switch">
|
||||
<property name="valign">center</property>
|
||||
<property name="width_chars">12</property>
|
||||
<property name="placeholder_text" translatable="yes">e.g. <Super>i</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup">
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Hide and reveal animation duration (ms)</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="intellihide_animation_time_spinbutton">
|
||||
<property name="valign">center</property>
|
||||
<property name="width_chars">4</property>
|
||||
<property name="text">0</property>
|
||||
<property name="adjustment">intellihide_animation_time_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
<property name="text">0</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="width-chars">4</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Delay before hiding the panel (ms)</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="intellihide_close_delay_spinbutton">
|
||||
<property name="valign">center</property>
|
||||
<property name="width_chars">4</property>
|
||||
<property name="text">10</property>
|
||||
<property name="adjustment">intellihide_close_delay_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
<property name="text">10</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="value">10</property>
|
||||
<property name="width-chars">4</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Delay before enabling intellihide on start (ms)</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="intellihide_enable_start_delay_spinbutton">
|
||||
<property name="valign">center</property>
|
||||
<property name="width_chars">4</property>
|
||||
<property name="text">10</property>
|
||||
<property name="adjustment">intellihide_enable_hide_delay_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
<property name="text">10</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="value">10</property>
|
||||
<property name="width-chars">4</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
|
||||
</interface>
|
||||
</interface>
|
||||
|
||||
Reference in New Issue
Block a user