mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Dynamically display preview workspace numbers
#gh-2116
This commit is contained in:
@@ -20,7 +20,6 @@ import Meta from 'gi://Meta'
|
||||
import Shell from 'gi://Shell'
|
||||
import St from 'gi://St'
|
||||
|
||||
import * as GrabHelper from 'resource:///org/gnome/shell/ui/grabHelper.js'
|
||||
import * as Layout from 'resource:///org/gnome/shell/ui/layout.js'
|
||||
import * as Main from 'resource:///org/gnome/shell/ui/main.js'
|
||||
import * as OverviewControls from 'resource:///org/gnome/shell/ui/overviewControls.js'
|
||||
@@ -426,11 +425,9 @@ export const Intellihide = class {
|
||||
}
|
||||
|
||||
_checkIfGrab() {
|
||||
let isGrab
|
||||
let grabActor = global.stage.get_grab_actor()
|
||||
let sourceActor = grabActor?._sourceActor || grabActor
|
||||
|
||||
isGrab =
|
||||
let isGrab =
|
||||
sourceActor &&
|
||||
(sourceActor == Main.layoutManager.dummyCursor ||
|
||||
this._dtpPanel.statusArea.quickSettings?.menu.actor.contains(
|
||||
|
||||
@@ -69,6 +69,7 @@ export const PreviewMenu = GObject.registerClass(
|
||||
this.currentAppIcon = null
|
||||
this._focusedPreview = null
|
||||
this._peekedWindow = null
|
||||
this._displayWorkspaces = false
|
||||
this.allowCloseWindow = true
|
||||
this.peekInitialWorkspaceIndex = -1
|
||||
this.opened = false
|
||||
@@ -308,6 +309,10 @@ export const PreviewMenu = GObject.registerClass(
|
||||
return this.currentAppIcon
|
||||
}
|
||||
|
||||
shouldDisplayWorkspaceNumbers() {
|
||||
return this._displayWorkspaces
|
||||
}
|
||||
|
||||
_setReactive(reactive) {
|
||||
this._box.get_children().forEach((c) => (c.reactive = reactive))
|
||||
this.menu.reactive = reactive
|
||||
@@ -345,6 +350,8 @@ export const PreviewMenu = GObject.registerClass(
|
||||
let currentPreviews = this._box.get_children()
|
||||
let l = Math.max(windows.length, currentPreviews.length)
|
||||
|
||||
this._setShouldDisplayWorkspaces(windows)
|
||||
|
||||
for (let i = 0; i < l; ++i) {
|
||||
if (currentPreviews[i] && windows[i]) {
|
||||
currentPreviews[i].assignWindow(windows[i], this.opened)
|
||||
@@ -390,6 +397,19 @@ export const PreviewMenu = GObject.registerClass(
|
||||
preview.assignWindow(window, this.opened)
|
||||
}
|
||||
|
||||
_setShouldDisplayWorkspaces(windows) {
|
||||
if (SETTINGS.get_boolean('isolate-workspaces'))
|
||||
return (this._displayWorkspaces = false)
|
||||
|
||||
let workspaces = {
|
||||
[Utils.getCurrentWorkspace().index()]: 1,
|
||||
}
|
||||
|
||||
windows.forEach((w) => (workspaces[w.get_workspace().index()] = 1))
|
||||
|
||||
this._displayWorkspaces = Object.keys(workspaces).length > 1
|
||||
}
|
||||
|
||||
_addCloseTimeout() {
|
||||
this._timeoutsHandler.add([
|
||||
T2,
|
||||
@@ -1179,7 +1199,7 @@ export const Preview = GObject.registerClass(
|
||||
this._iconBin.destroy_all_children()
|
||||
this._iconBin.add_child(icon)
|
||||
|
||||
if (!SETTINGS.get_boolean('isolate-workspaces')) {
|
||||
if (this._previewMenu.shouldDisplayWorkspaceNumbers()) {
|
||||
workspaceIndex = (this.window.get_workspace().index() + 1).toString()
|
||||
workspaceStyle =
|
||||
'margin: 0 4px 0 ' +
|
||||
|
||||
Reference in New Issue
Block a user