__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
import {Gio} from './dependencies/gi.js';
import {DBusMenuUtils} from './imports.js';
const DBusMenu = await DBusMenuUtils.haveDBusMenu();
export class LauncherEntryRemoteModel {
constructor() {
this._entrySourceStacks = new Map();
this._remoteMaps = new Map();
this._launcher_entry_dbus_signal_id =
Gio.DBus.session.signal_subscribe(null, // sender
'com.canonical.Unity.LauncherEntry', // iface
'Update', // member
null, // path
null, // arg0
Gio.DBusSignalFlags.NONE,
(_connection, senderName, _objectPath, _interfaceName, _signalName, parameters) =>
this._onUpdate(senderName, ...parameters.deep_unpack()));
this._dbus_name_owner_changed_signal_id =
Gio.DBus.session.signal_subscribe('org.freedesktop.DBus', // sender
'org.freedesktop.DBus', // interface
'NameOwnerChanged', // member
'/org/freedesktop/DBus', // path
null, // arg0
Gio.DBusSignalFlags.NONE,
(connection, _senderName, _objectPath, _interfaceName, _signalName, parameters) =>
this._onDBusNameChange(...parameters.deep_unpack().slice(1)));
this._acquireUnityDBus();
}
destroy() {
if (this._launcher_entry_dbus_signal_id)
Gio.DBus.session.signal_unsubscribe(this._launcher_entry_dbus_signal_id);
if (this._dbus_name_owner_changed_signal_id)
Gio.DBus.session.signal_unsubscribe(this._dbus_name_owner_changed_signal_id);
this._releaseUnityDBus();
}
_lookupStackById(appId) {
let sourceStack = this._entrySourceStacks.get(appId);
if (!sourceStack) {
sourceStack = new PropertySourceStack(new LauncherEntry(),
launcherEntryDefaults);
this._entrySourceStacks.set(appId, sourceStack);
}
return sourceStack;
}
lookupById(appId) {
return this._lookupStackById(appId).target;
}
_acquireUnityDBus() {
if (!this._unity_bus_id) {
this._unity_bus_id = Gio.DBus.session.own_name('com.canonical.Unity',
Gio.BusNameOwnerFlags.ALLOW_REPLACEMENT | Gio.BusNameOwnerFlags.REPLACE,
null, () => (this._unity_bus_id = 0));
}
}
_releaseUnityDBus() {
if (this._unity_bus_id) {
Gio.DBus.session.unown_name(this._unity_bus_id);
this._unity_bus_id = 0;
}
}
_onDBusNameChange(before, after) {
if (!before || !this._remoteMaps.size)
return;
const remoteMap = this._remoteMaps.get(before);
if (!remoteMap)
return;
this._remoteMaps.delete(before);
if (after && !this._remoteMaps.has(after)) {
this._remoteMaps.set(after, remoteMap);
} else {
for (const [appId, remote] of remoteMap) {
const sourceStack = this._entrySourceStacks.get(appId);
const changed = sourceStack.remove(remote);
if (changed)
sourceStack.target._emitChangedEvents(changed);
}
}
}
_onUpdate(senderName, appUri, properties) {
if (!senderName)
return;
const appId = appUri.replace(/(^\w+:|^)\/\//, '');
if (!appId)
return;
let remoteMap = this._remoteMaps.get(senderName);
if (!remoteMap)
this._remoteMaps.set(senderName, remoteMap = new Map());
let remote = remoteMap.get(appId);
if (!remote)
remoteMap.set(appId, remote = Object.assign({}, launcherEntryDefaults));
for (const name in properties) {
if (name === 'quicklist' && DBusMenu) {
const quicklistPath = properties[name].unpack();
if (quicklistPath &&
(!remote._quicklistMenuClient ||
remote._quicklistMenuClient.dbus_object !== quicklistPath)) {
remote.quicklist = null;
let menuClient = remote._quicklistMenuClient;
if (menuClient) {
menuClient.dbus_object = quicklistPath;
} else {
// This property should not be enumerable
Object.defineProperty(remote, '_quicklistMenuClient', {
writable: true,
value: menuClient = new DBusMenu.Client({
dbus_name: senderName,
dbus_object: quicklistPath,
}),
});
}
const handler = () => {
const root = menuClient.get_root();
if (remote.quicklist !== root) {
remote.quicklist = root;
if (sourceStack.isTop(remote)) {
sourceStack.target.quicklist = root;
sourceStack.target._emitChangedEvents(['quicklist']);
}
}
};
menuClient.connect(DBusMenu.CLIENT_SIGNAL_ROOT_CHANGED, handler);
}
} else {
remote[name] = properties[name].unpack();
}
}
const sourceStack = this._lookupStackById(appId);
sourceStack.target._emitChangedEvents(sourceStack.update(remote));
}
}
const launcherEntryDefaults = Object.freeze({
count: 0,
progress: 0,
urgent: false,
updating: false,
quicklist: null,
'count-visible': false,
'progress-visible': false,
});
const LauncherEntry = class DashToDockLauncherEntry {
constructor() {
this._connections = new Map();
this._handlers = new Map();
this._nextId = 0;
}
connect(eventNames, callback) {
if (typeof eventNames === 'string')
eventNames = [eventNames];
callback(this, this);
const id = this._nextId++;
const handler = {id, callback};
eventNames.forEach(name => {
let handlerList = this._handlers.get(name);
if (!handlerList)
this._handlers.set(name, handlerList = []);
handlerList.push(handler);
});
this._connections.set(id, eventNames);
return id;
}
disconnect(id) {
const eventNames = this._connections.get(id);
if (!eventNames)
return;
this._connections.delete(id);
eventNames.forEach(name => {
const handlerList = this._handlers.get(name);
if (handlerList) {
for (let i = 0, iMax = handlerList.length; i < iMax; i++) {
if (handlerList[i].id === id) {
handlerList.splice(i, 1);
break;
}
}
}
});
}
_emitChangedEvents(propertyNames) {
const handlers = new Set();
propertyNames.forEach(name => {
const handlerList = this._handlers.get(`${name}-changed`);
if (handlerList) {
for (let i = 0, iMax = handlerList.length; i < iMax; i++)
handlers.add(handlerList[i]);
}
});
Array.from(handlers).sort((x, y) => x.id - y.id).forEach(handler => handler.callback(this, this));
}
};
for (const [name, defaultValue] of Object.entries(launcherEntryDefaults)) {
const jsName = name.replaceAll('-', '_');
LauncherEntry.prototype[jsName] = defaultValue;
if (jsName !== name) {
Object.defineProperty(LauncherEntry.prototype, name, {
get() {
return this[jsName];
},
set(value) {
this[jsName] = value;
},
});
}
}
const PropertySourceStack = class DashToDockPropertySourceStack {
constructor(target, bottom) {
this.target = target;
this._bottom = bottom;
this._stack = [];
}
isTop(source) {
return this._stack.length > 0 && this._stack[this._stack.length - 1] === source;
}
update(source) {
if (!this.isTop(source)) {
this.remove(source);
this._stack.push(source);
}
return this._assignFrom(source);
}
remove(source) {
const stack = this._stack;
const top = stack[stack.length - 1];
if (top === source) {
stack.length--;
return this._assignFrom(stack.length > 0 ? stack[stack.length - 1] : this._bottom);
}
for (let i = 0, iMax = stack.length; i < iMax; i++) {
if (stack[i] === source) {
stack.splice(i, 1);
break;
}
}
return null;
}
_assignFrom(source) {
const changedProperties = [];
for (const name in source) {
if (this.target[name] !== source[name]) {
this.target[name] = source[name];
changedProperties.push(name);
}
}
return changedProperties;
}
};
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| dependencies | Folder | 0755 |
|
|
| media | Folder | 0755 |
|
|
| README.md | File | 2.4 KB | 0644 |
|
| Settings.ui | File | 163.97 KB | 0644 |
|
| appIconIndicators.js | File | 44.14 KB | 0644 |
|
| appIcons.js | File | 57.69 KB | 0644 |
|
| appIconsDecorator.js | File | 5.74 KB | 0644 |
|
| appSpread.js | File | 7.06 KB | 0644 |
|
| dash.js | File | 41.15 KB | 0644 |
|
| dbusmenuUtils.js | File | 10.63 KB | 0644 |
|
| desktopIconsIntegration.js | File | 6.39 KB | 0644 |
|
| docking.js | File | 95.61 KB | 0644 |
|
| extension.js | File | 1.18 KB | 0644 |
|
| fileManager1API.js | File | 6.66 KB | 0644 |
|
| imports.js | File | 859 B | 0644 |
|
| intellihide.js | File | 11.11 KB | 0644 |
|
| launcherAPI.js | File | 9.22 KB | 0644 |
|
| locations.js | File | 48.36 KB | 0644 |
|
| locationsWorker.js | File | 2.69 KB | 0644 |
|
| metadata.json | File | 509 B | 0644 |
|
| notificationsMonitor.js | File | 3.86 KB | 0644 |
|
| prefs.js | File | 47.03 KB | 0644 |
|
| stylesheet.css | File | 75.26 KB | 0644 |
|
| theming.js | File | 19.89 KB | 0644 |
|
| ubuntu.css | File | 0 B | 0644 |
|
| utils.js | File | 20.27 KB | 0644 |
|
| windowPreview.js | File | 21.99 KB | 0644 |
|