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