mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-13 09:12:08 -04:00
dankdash: fix triggering when clock widget isnt present on bar
fixes #1601
This commit is contained in:
@@ -251,13 +251,20 @@ Item {
|
|||||||
active: false
|
active: false
|
||||||
asynchronous: false
|
asynchronous: false
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
PopoutService.dankDashPopoutLoader = dankDashPopoutLoader;
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoaded: {
|
||||||
|
if (item) {
|
||||||
|
PopoutService.dankDashPopout = item;
|
||||||
|
PopoutService._onDankDashPopoutLoaded();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sourceComponent: Component {
|
sourceComponent: Component {
|
||||||
DankDashPopout {
|
DankDashPopout {
|
||||||
id: dankDashPopout
|
id: dankDashPopout
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
PopoutService.dankDashPopout = dankDashPopout;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ Singleton {
|
|||||||
property var appDrawerPopout: null
|
property var appDrawerPopout: null
|
||||||
property var processListPopout: null
|
property var processListPopout: null
|
||||||
property var dankDashPopout: null
|
property var dankDashPopout: null
|
||||||
|
property var dankDashPopoutLoader: null
|
||||||
property var batteryPopout: null
|
property var batteryPopout: null
|
||||||
property var vpnPopout: null
|
property var vpnPopout: null
|
||||||
property var systemUpdatePopout: null
|
property var systemUpdatePopout: null
|
||||||
@@ -119,31 +120,87 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property bool _dankDashWantsOpen: false
|
||||||
|
property bool _dankDashWantsToggle: false
|
||||||
|
property int _dankDashPendingTab: 0
|
||||||
|
property real _dankDashPendingX: 0
|
||||||
|
property real _dankDashPendingY: 0
|
||||||
|
property real _dankDashPendingWidth: 0
|
||||||
|
property string _dankDashPendingSection: ""
|
||||||
|
property var _dankDashPendingScreen: null
|
||||||
|
property bool _dankDashHasPosition: false
|
||||||
|
|
||||||
|
function _storeDankDashPosition(x, y, width, section, screen, hasPos) {
|
||||||
|
_dankDashPendingX = x;
|
||||||
|
_dankDashPendingY = y;
|
||||||
|
_dankDashPendingWidth = width;
|
||||||
|
_dankDashPendingSection = section;
|
||||||
|
_dankDashPendingScreen = screen;
|
||||||
|
_dankDashHasPosition = hasPos;
|
||||||
|
}
|
||||||
|
|
||||||
function openDankDash(tabIndex, x, y, width, section, screen) {
|
function openDankDash(tabIndex, x, y, width, section, screen) {
|
||||||
|
_dankDashPendingTab = tabIndex || 0;
|
||||||
if (dankDashPopout) {
|
if (dankDashPopout) {
|
||||||
if (arguments.length >= 6) {
|
if (arguments.length >= 6)
|
||||||
setPosition(dankDashPopout, x, y, width, section, screen);
|
setPosition(dankDashPopout, x, y, width, section, screen);
|
||||||
}
|
dankDashPopout.currentTabIndex = _dankDashPendingTab;
|
||||||
dankDashPopout.currentTabIndex = tabIndex || 0;
|
|
||||||
dankDashPopout.dashVisible = true;
|
dankDashPopout.dashVisible = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
if (!dankDashPopoutLoader)
|
||||||
|
return;
|
||||||
|
_storeDankDashPosition(x, y, width, section, screen, arguments.length >= 6);
|
||||||
|
_dankDashWantsOpen = true;
|
||||||
|
_dankDashWantsToggle = false;
|
||||||
|
dankDashPopoutLoader.active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeDankDash() {
|
function closeDankDash() {
|
||||||
if (dankDashPopout) {
|
if (dankDashPopout)
|
||||||
dankDashPopout.dashVisible = false;
|
dankDashPopout.dashVisible = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleDankDash(tabIndex, x, y, width, section, screen) {
|
function toggleDankDash(tabIndex, x, y, width, section, screen) {
|
||||||
|
_dankDashPendingTab = tabIndex || 0;
|
||||||
if (dankDashPopout) {
|
if (dankDashPopout) {
|
||||||
if (arguments.length >= 6) {
|
if (arguments.length >= 6)
|
||||||
setPosition(dankDashPopout, x, y, width, section, screen);
|
setPosition(dankDashPopout, x, y, width, section, screen);
|
||||||
}
|
|
||||||
if (dankDashPopout.dashVisible) {
|
if (dankDashPopout.dashVisible) {
|
||||||
dankDashPopout.dashVisible = false;
|
dankDashPopout.dashVisible = false;
|
||||||
} else {
|
} else {
|
||||||
dankDashPopout.currentTabIndex = tabIndex || 0;
|
dankDashPopout.currentTabIndex = _dankDashPendingTab;
|
||||||
|
dankDashPopout.dashVisible = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!dankDashPopoutLoader)
|
||||||
|
return;
|
||||||
|
_storeDankDashPosition(x, y, width, section, screen, arguments.length >= 6);
|
||||||
|
_dankDashWantsToggle = true;
|
||||||
|
_dankDashWantsOpen = false;
|
||||||
|
dankDashPopoutLoader.active = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _onDankDashPopoutLoaded() {
|
||||||
|
if (!dankDashPopout)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_dankDashHasPosition)
|
||||||
|
setPosition(dankDashPopout, _dankDashPendingX, _dankDashPendingY, _dankDashPendingWidth, _dankDashPendingSection, _dankDashPendingScreen);
|
||||||
|
|
||||||
|
if (_dankDashWantsOpen) {
|
||||||
|
_dankDashWantsOpen = false;
|
||||||
|
dankDashPopout.currentTabIndex = _dankDashPendingTab;
|
||||||
|
dankDashPopout.dashVisible = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_dankDashWantsToggle) {
|
||||||
|
_dankDashWantsToggle = false;
|
||||||
|
if (dankDashPopout.dashVisible) {
|
||||||
|
dankDashPopout.dashVisible = false;
|
||||||
|
} else {
|
||||||
|
dankDashPopout.currentTabIndex = _dankDashPendingTab;
|
||||||
dankDashPopout.dashVisible = true;
|
dankDashPopout.dashVisible = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user