mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
@@ -382,8 +382,10 @@ export const Panel = GObject.registerClass(
|
||||
this.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS)
|
||||
|
||||
if (!Main.layoutManager._startingUp)
|
||||
GLib.idle_add(GLib.PRIORITY_LOW, () => {
|
||||
this._waitResetGeomId = GLib.idle_add(GLib.PRIORITY_LOW, () => {
|
||||
this._waitResetGeomId = 0
|
||||
this._resetGeometry()
|
||||
|
||||
return GLib.SOURCE_REMOVE
|
||||
})
|
||||
}
|
||||
@@ -394,6 +396,11 @@ export const Panel = GObject.registerClass(
|
||||
this._timeoutsHandler.destroy()
|
||||
this._signalsHandler.destroy()
|
||||
|
||||
if (this._waitResetGeomId) {
|
||||
GLib.remove_source(this._waitResetGeomId)
|
||||
this._waitResetGeomId = 0
|
||||
}
|
||||
|
||||
this.panel.remove_child(this.taskbar.actor)
|
||||
|
||||
if (this.intellihide) {
|
||||
|
||||
@@ -278,7 +278,9 @@ export const PanelManager = class {
|
||||
'monitors-changed',
|
||||
async () => {
|
||||
if (Main.layoutManager.primaryMonitor) {
|
||||
await PanelSettings.setMonitorsInfo(SETTINGS)
|
||||
await PanelSettings.setMonitorsInfo(SETTINGS).catch((e) =>
|
||||
console.log(e),
|
||||
)
|
||||
this._reset()
|
||||
}
|
||||
},
|
||||
|
||||
@@ -221,7 +221,7 @@ export function getPrimaryIndex(dtpPrimaryId) {
|
||||
return availableMonitors.findIndex((am) => am.primary)
|
||||
}
|
||||
|
||||
export async function setMonitorsInfo(settings) {
|
||||
export function setMonitorsInfo(settings) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
let monitorInfos = []
|
||||
@@ -229,7 +229,6 @@ export async function setMonitorsInfo(settings) {
|
||||
proxy.GetCurrentStateRemote((displayInfo, e) => {
|
||||
if (e) return reject(`Error getting display state: ${e}`)
|
||||
|
||||
let gsPrimaryIndex = 0
|
||||
let ids = {}
|
||||
|
||||
//https://gitlab.gnome.org/GNOME/mutter/-/blob/main/data/dbus-interfaces/org.gnome.Mutter.DisplayConfig.xml#L347
|
||||
@@ -245,8 +244,6 @@ export async function setMonitorsInfo(settings) {
|
||||
|
||||
if (ids[id]) id = connector && !ids[connector] ? connector : i
|
||||
|
||||
if (primary) gsPrimaryIndex = i
|
||||
|
||||
monitorInfos.push({
|
||||
id,
|
||||
product,
|
||||
@@ -258,7 +255,7 @@ export async function setMonitorsInfo(settings) {
|
||||
ids[id] = 1
|
||||
})
|
||||
|
||||
_saveMonitors(settings, monitorInfos, gsPrimaryIndex)
|
||||
_saveMonitors(settings, monitorInfos)
|
||||
|
||||
resolve()
|
||||
})
|
||||
@@ -282,19 +279,14 @@ export async function setMonitorsInfo(settings) {
|
||||
})
|
||||
}
|
||||
|
||||
function _saveMonitors(settings, monitorInfos, gsPrimaryIndex) {
|
||||
function _saveMonitors(settings, monitorInfos) {
|
||||
let keyPrimary = 'primary-monitor'
|
||||
let dtpPrimaryMonitor = settings.get_string(keyPrimary)
|
||||
|
||||
// convert previously saved index to monitor id
|
||||
if (dtpPrimaryMonitor.match(/^\d{1,2}$/) && monitorInfos[dtpPrimaryMonitor])
|
||||
dtpPrimaryMonitor = monitorInfos[dtpPrimaryMonitor].id
|
||||
settings.set_string(keyPrimary, monitorInfos[dtpPrimaryMonitor].id)
|
||||
|
||||
// default to gnome-shell primary monitor
|
||||
if (!dtpPrimaryMonitor)
|
||||
dtpPrimaryMonitor = monitorInfos[gsPrimaryIndex]?.id || 0
|
||||
|
||||
settings.set_string(keyPrimary, dtpPrimaryMonitor)
|
||||
availableMonitors = Object.freeze(monitorInfos)
|
||||
}
|
||||
|
||||
|
||||
@@ -802,8 +802,10 @@ const Preferences = class {
|
||||
panelOptionsMonitorCombo.append_text(label)
|
||||
}
|
||||
|
||||
this._ignorePrimaryMonitorChange = true
|
||||
primaryCombo.set_active(dtpPrimaryMonitorIndex)
|
||||
panelOptionsMonitorCombo.set_active(dtpPrimaryMonitorIndex)
|
||||
this._ignorePrimaryMonitorChange = false
|
||||
}
|
||||
|
||||
_bindSettings() {
|
||||
@@ -1168,7 +1170,10 @@ const Preferences = class {
|
||||
this._builder
|
||||
.get_object('multimon_primary_combo')
|
||||
.connect('changed', (widget) => {
|
||||
if (this.monitors[widget.get_active()])
|
||||
if (
|
||||
this.monitors[widget.get_active()] &&
|
||||
!this._ignorePrimaryMonitorChange
|
||||
)
|
||||
this._settings.set_string(
|
||||
'primary-monitor',
|
||||
this.monitors[widget.get_active()].id,
|
||||
|
||||
Reference in New Issue
Block a user