mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Add option to show hotkeys overlay on secondary monitors
gh-2237
This commit is contained in:
@@ -871,6 +871,10 @@
|
||||
<summary>Prefix to use for hotkeys</summary>
|
||||
<description>You can choose between Super or SuperAlt as the prefix for hotkeys.</description>
|
||||
</key>
|
||||
<key type="b" name="overlay-on-secondary-switch">
|
||||
<default>false</default>
|
||||
<summary>Show overlay on secondary monitors</summary>
|
||||
</key>
|
||||
<key type="b" name="shortcut-previews">
|
||||
<default>false</default>
|
||||
<summary>Show window previews</summary>
|
||||
|
||||
@@ -46,9 +46,10 @@ const T1 = 'swipeEndTimeout'
|
||||
const T2 = 'numberOverlayTimeout'
|
||||
|
||||
export const Overview = class {
|
||||
constructor() {
|
||||
constructor(panelManager) {
|
||||
this._injectionManager = new InjectionManager()
|
||||
this._numHotkeys = 10
|
||||
this._panelManager = panelManager
|
||||
}
|
||||
|
||||
enable(primaryPanel) {
|
||||
@@ -373,7 +374,7 @@ export const Overview = class {
|
||||
this._hotKeysEnabled = true
|
||||
|
||||
if (SETTINGS.get_string('hotkeys-overlay-combo') === 'ALWAYS')
|
||||
this.taskbar.toggleHotkeysNumberOverlay(true)
|
||||
this._toggleHotkeysNumberOverlay(true)
|
||||
}
|
||||
|
||||
_disableHotKeys() {
|
||||
@@ -418,7 +419,7 @@ export const Overview = class {
|
||||
|
||||
this._hotKeysEnabled = false
|
||||
|
||||
this.taskbar.toggleHotkeysNumberOverlay(false)
|
||||
this._toggleHotkeysNumberOverlay(false)
|
||||
}
|
||||
|
||||
_optionalNumberOverlay() {
|
||||
@@ -435,8 +436,8 @@ export const Overview = class {
|
||||
SETTINGS.get_boolean('hot-keys') &&
|
||||
SETTINGS.get_string('hotkeys-overlay-combo') === 'ALWAYS'
|
||||
)
|
||||
this.taskbar.toggleHotkeysNumberOverlay(true)
|
||||
else this.taskbar.toggleHotkeysNumberOverlay(false)
|
||||
this._toggleHotkeysNumberOverlay(true)
|
||||
else this._toggleHotkeysNumberOverlay(false)
|
||||
},
|
||||
],
|
||||
[SETTINGS, 'changed::shortcut-num-keys', () => this._resetHotkeys()],
|
||||
@@ -468,7 +469,7 @@ export const Overview = class {
|
||||
if (hotkey_option === 'NEVER') return
|
||||
|
||||
if (hotkey_option === 'TEMPORARILY' || overlayFromShortcut)
|
||||
this.taskbar.toggleHotkeysNumberOverlay(true)
|
||||
this._toggleHotkeysNumberOverlay(true)
|
||||
|
||||
this._panel.intellihide.revealAndHold(Intellihide.Hold.TEMPORARY)
|
||||
|
||||
@@ -484,7 +485,7 @@ export const Overview = class {
|
||||
timeout,
|
||||
() => {
|
||||
if (hotkey_option != 'ALWAYS') {
|
||||
this.taskbar.toggleHotkeysNumberOverlay(false)
|
||||
this._toggleHotkeysNumberOverlay(false)
|
||||
}
|
||||
|
||||
this._panel.intellihide.release(Intellihide.Hold.TEMPORARY)
|
||||
@@ -492,6 +493,21 @@ export const Overview = class {
|
||||
])
|
||||
}
|
||||
|
||||
_toggleHotkeysNumberOverlay(show) {
|
||||
// this.taskbar is the primary taskbar
|
||||
this.taskbar.toggleHotkeysNumberOverlay(show)
|
||||
|
||||
if (SETTINGS.get_boolean('overlay-on-secondary-switch')) {
|
||||
// on secondary panels, show the overlay on icons matching the ones
|
||||
// found on the primary panel (see Taksbar.hotkeyAppNumbers)
|
||||
this._panelManager.allPanels.forEach((p) => {
|
||||
if (p.isPrimary) return
|
||||
|
||||
p.taskbar.toggleHotkeysNumberOverlay(show)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
_optionalClickToExit() {
|
||||
this._clickToExitEnabled = false
|
||||
if (SETTINGS.get_boolean('overview-click-to-exit'))
|
||||
|
||||
@@ -59,7 +59,7 @@ let tracker = Shell.WindowTracker.get_default()
|
||||
|
||||
export const PanelManager = class {
|
||||
constructor() {
|
||||
this.overview = new Overview.Overview()
|
||||
this.overview = new Overview.Overview(this)
|
||||
this._injectionManager = new InjectionManager()
|
||||
}
|
||||
|
||||
|
||||
@@ -2788,6 +2788,13 @@ const Preferences = class {
|
||||
this._settings.set_string('hotkeys-overlay-combo', widget.get_active_id())
|
||||
})
|
||||
|
||||
this._settings.bind(
|
||||
'overlay-on-secondary-switch',
|
||||
this._builder.get_object('overlay_on_secondary_switch'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
|
||||
this._settings.bind(
|
||||
'shortcut-previews',
|
||||
this._builder.get_object('shortcut_preview_switch'),
|
||||
|
||||
@@ -46,6 +46,8 @@ import { DTP_EXTENSION, SETTINGS } from './extension.js'
|
||||
|
||||
const SearchController = Main.overview.searchController
|
||||
|
||||
export var hotkeyAppNumbers = {}
|
||||
|
||||
export const DASH_ANIMATION_TIME = 0.2 // Dash.DASH_ANIMATION_TIME is now private
|
||||
const DASH_ITEM_HOVER_TIMEOUT = 0.3 // Dash.DASH_ITEM_HOVER_TIMEOUT is now private
|
||||
export const MIN_ICON_SIZE = 4
|
||||
@@ -1276,17 +1278,22 @@ export const Taskbar = class extends EventEmitter {
|
||||
}
|
||||
|
||||
_updateHotkeysNumberOverlay() {
|
||||
let seenApps = {}
|
||||
let counter = 0
|
||||
|
||||
if (this.dtpPanel.isPrimary) hotkeyAppNumbers = {}
|
||||
|
||||
this._getAppIcons().forEach((icon) => {
|
||||
if (!seenApps[icon.app] || this.allowSplitApps) {
|
||||
seenApps[icon.app] = 1
|
||||
counter++
|
||||
if (
|
||||
this.dtpPanel.isPrimary &&
|
||||
(!hotkeyAppNumbers[icon.app] || this.allowSplitApps)
|
||||
) {
|
||||
hotkeyAppNumbers[icon.app] = ++counter
|
||||
}
|
||||
|
||||
if (counter <= 10) {
|
||||
icon.setHotkeysNumberOverlayLabel(counter == 10 ? 0 : counter)
|
||||
let label = hotkeyAppNumbers[icon.app]
|
||||
|
||||
if (label <= 10) {
|
||||
icon.setHotkeysNumberOverlayLabel(label == 10 ? 0 : label)
|
||||
} else {
|
||||
// No overlay after 10
|
||||
icon.setHotkeysNumberOverlayLabel(-1)
|
||||
|
||||
@@ -1,29 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<interface>
|
||||
<!-- interface-name BoxOverlayShortcut.ui -->
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
|
||||
<requires lib="libadwaita" version="1.3"/>
|
||||
<object class="GtkAdjustment" id="shortcut_time_adjustment">
|
||||
<property name="page-increment">1000</property>
|
||||
<property name="step-increment">250</property>
|
||||
<property name="upper">10000</property>
|
||||
<property name="step_increment">250</property>
|
||||
<property name="page_increment">1000</property>
|
||||
</object>
|
||||
|
||||
<object class="GtkBox" id="box_overlay_shortcut">
|
||||
<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">Hotkeys prefix</property>
|
||||
<property name="subtitle" translatable="yes">Hotkeys will either be Super+Number or Super+Alt+Num</property>
|
||||
<property name="title" translatable="yes">Hotkeys prefix</property>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="hotkey_prefix_combo">
|
||||
<property name="valign">center</property>
|
||||
@@ -35,11 +33,10 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Number overlay</property>
|
||||
<property name="subtitle" translatable="yes">Temporarily show the application numbers over the icons when using the hotkeys.</property>
|
||||
<property name="title" translatable="yes">Number overlay</property>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="overlay_combo">
|
||||
<property name="valign">center</property>
|
||||
@@ -52,37 +49,45 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Hide timeout (ms)</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="timeout_spinbutton">
|
||||
<property name="valign">center</property>
|
||||
<property name="adjustment">shortcut_time_adjustment</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Shortcut to show the overlay for 2 seconds</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">Shortcut to show the overlay for 2 seconds</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="shortcut_entry">
|
||||
<property name="placeholder-text" translatable="yes">e.g. <Super>q</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="width-chars">12</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="subtitle" translatable="yes">On secondary monitors, show the overlay on icons matching the primary monitor</property>
|
||||
<property name="title" translatable="yes">Show the overlay on all monitors</property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="overlay_on_secondary_switch">
|
||||
<property name="valign">center</property>
|
||||
<property name="width_chars">12</property>
|
||||
<property name="placeholder_text" translatable="yes">e.g. <Super>q</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Show window previews on hotkey</property>
|
||||
<property name="subtitle" translatable="yes">Show previews when the application have multiple instances</property>
|
||||
<property name="title" translatable="yes">Show window previews on hotkey</property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="shortcut_preview_switch">
|
||||
<property name="valign">center</property>
|
||||
@@ -90,11 +95,10 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Hotkeys are activated with</property>
|
||||
<property name="subtitle" translatable="yes">Select which keyboard number keys are used to activate the hotkeys</property>
|
||||
<property name="title" translatable="yes">Hotkeys are activated with</property>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="shortcut_num_keys_combo">
|
||||
<property name="valign">center</property>
|
||||
@@ -107,9 +111,7 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
</interface>
|
||||
Reference in New Issue
Block a user