Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icing Task Manager: Update to 4.3.4 #126

Merged
merged 2 commits into from
Feb 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 27 additions & 43 deletions IcingTaskManager@json/files/appGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ var SpecialButtons = AppletDir.specialButtons;
var clog = AppletDir.__init__.clog;
var setTimeout = AppletDir.__init__.setTimeout;

var DEFERRED_APPS = ['spotify', 'libreoffice'];

function AppGroup() {
this._init.apply(this, arguments);
}
Expand Down Expand Up @@ -63,6 +61,7 @@ AppGroup.prototype = {
this.appName = this.app.get_name();
this.autostartIndex = _.findIndex(this._applet.autostartApps, { id: appId });
this.isFavapp = isFavapp;
this.wasFavapp = false;
this.orientation = applet.orientation;

this.metaWindows = this._applet.groupApps ? [] : [window];
Expand Down Expand Up @@ -279,6 +278,7 @@ AppGroup.prototype = {

this._applet._clearDragPlaceholder();
var button = event.get_button();

if (button === 1 && this.isFavapp || button === 2) {
this.app.open_new_window(-1);
this._animate();
Expand All @@ -305,11 +305,10 @@ AppGroup.prototype = {
};

if (button === 1) {

this.hoverMenu.shouldOpen = false;
if (this.rightClickMenu.isOpen) {
this.rightClickMenu.toggle();
}
this.hoverMenu.shouldOpen = false;
if (appWindows.length === 1) {
handleMinimizeToggle(appWindows[0]);
} else {
Expand All @@ -326,13 +325,11 @@ AppGroup.prototype = {
}
}
} else if (button === 3) {
if (this.rightClickMenu.isOpen) {
this.rightClickMenu.mouseEvent = event;
this.rightClickMenu.toggle();
} else {
this.hoverMenu.close();
this.rightClickMenu.open();
}
this.appList._closeAllRightClickMenus(function () {
_this3.appList._closeAllHoverMenus(function () {
_this3.rightClickMenu.open();
});
});
}
},
_onAppButtonPress: function _onAppButtonPress(actor, event) {
Expand Down Expand Up @@ -453,8 +450,6 @@ AppGroup.prototype = {
},

_windowAdded: function _windowAdded(metaWorkspace, metaWindow, metaWindows) {
var _this5 = this;

var recursion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;


Expand All @@ -475,27 +470,6 @@ AppGroup.prototype = {
windowAddArgs = windowAddArgs && this._applet.tracker.is_window_interesting(metaWindow);
}
if (windowAddArgs) {
// Defer apps that behave improperly when being launched.
var handleDeferredApp = false;
for (var i = 0, len = DEFERRED_APPS.length; i < len; i++) {
if (app.get_id().indexOf(DEFERRED_APPS[i]) !== -1 && recursion === 0) {
handleDeferredApp = true;
break;
}
}
if (handleDeferredApp) {
if (this.isFavapp) {
++recursion;
setTimeout(function () {
return _this5._windowAdded(metaWorkspace, metaWindow, metaWindows, recursion);
}, 3000);
return;
} else {
setTimeout(function () {
return _this5._applet.refreshCurrentAppList(_this5.appId);
}, 3000);
}
}
if (metaWindow) {
if (!this._applet.groupApps && this.metaWindows.length >= 1) {
if (this.ungroupedIndex === 0) {
Expand Down Expand Up @@ -540,27 +514,33 @@ AppGroup.prototype = {
}

if (this.isFavapp) {
this._isFavorite(false);
this._isFavorite(!this.isFavapp);
}

this._calcWindowNumber(metaWorkspace);
}
},

_windowRemoved: function _windowRemoved(metaWorkspace, metaWindow) {
var _this5 = this;

var refWindow = _.findIndex(this.metaWindows, function (win) {
return _.isEqual(win.win, metaWindow);
});

if (refWindow !== -1) {
// Clean up all the signals we've connected
for (var i = 0, len = this.metaWindows[refWindow].data.signals.length; i < len; i++) {
this.metaWindows[refWindow].win.disconnect(this.metaWindows[refWindow].data.signals[i]);
}

if (!this._applet.groupApps) {
this.appList._removeApp(this.app, this.timeStamp);
if (!this.wasFavapp) {
this.appList._removeApp(this.app, this.timeStamp);
} else {
this._applet.refreshAppFromCurrentListById(this.appId, { favChange: true, isFavapp: this.wasFavapp });
}
return;
} else {
// Clean up all the signals we've connected
for (var i = 0, len = this.metaWindows[refWindow].data.signals.length; i < len; i++) {
this.metaWindows[refWindow].win.disconnect(this.metaWindows[refWindow].data.signals[i]);
}
}

_.pullAt(this.metaWindows, refWindow);
Expand All @@ -580,8 +560,12 @@ AppGroup.prototype = {
this.rightClickMenu.setMetaWindow(this.lastFocused, this.metaWindows);
}
this._appButton.setMetaWindow(this.lastFocused, this.metaWindows);
} else if (this.isFavapp) {
this._applet.refreshAppFromCurrentListById(this.appId, { favChange: true, isFavapp: this.isFavapp });
} else {
this.appList._onAppWindowsChanged(this.app, function () {
if (_this5.isFavapp) {
_this5._applet.refreshAppFromCurrentListById(_this5.appId, { favChange: true, isFavapp: _this5.isFavapp });
}
});
}

this._calcWindowNumber(metaWorkspace);
Expand Down
36 changes: 28 additions & 8 deletions IcingTaskManager@json/files/appList.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ var App = AppletDir.applet;
var AppGroup = AppletDir.appGroup;
var clog = AppletDir.__init__.clog;
var setTimeout = AppletDir.__init__.setTimeout;
// List of running apps

// List of running apps
function AppList() {
this._init.apply(this, arguments);
}
Expand Down Expand Up @@ -130,10 +130,29 @@ AppList.prototype = {
this._updateSpacing();
}
},

_closeAllHoverMenus: function _closeAllHoverMenus() {
_closeAllHoverMenus: function _closeAllHoverMenus(cb) {
for (var i = 0, len = this.appList.length; i < len; i++) {
this.appList[i].appGroup.hoverMenu.close();
if (this.appList[i].appGroup.hoverMenu.isOpen) {
this.appList[i].appGroup.hoverMenu.close();
}
}
if (typeof cb === 'function') {
cb();
}
},
_closeAllRightClickMenus: function _closeAllRightClickMenus(cb) {
for (var i = 0, len = this.appList.length; i < len; i++) {
if (typeof this.appList[i].appGroup.rightClickMenu !== 'undefined' && this.appList[i].appGroup.rightClickMenu.isOpen) {
this.appList[i].appGroup.rightClickMenu.close();
}
}
if (typeof cb === 'function') {
cb();
}
},
_refreshAllThumbnails: function _refreshAllThumbnails() {
for (var i = 0, len = this.appList.length; i < len; i++) {
this.appList[i].appGroup.hoverMenu.appSwitcherItem._refresh(true);
}
},

Expand Down Expand Up @@ -354,9 +373,7 @@ AppList.prototype = {
var time = Date.now();
var appGroup = new AppGroup.AppGroup(_this3._applet, _this3, app, isFavapp, window, time, index, appId);
appGroup._updateMetaWindows(metaWorkspace, app, window, wsWindows);
appGroup.watchWorkspace(metaWorkspace); // disable for windows to stay persistent across ws'

app.connect_after('windows-changed', Lang.bind(_this3, _this3._onAppWindowsChanged, app));
appGroup.watchWorkspace(metaWorkspace);

_this3.appList.push({
id: appId,
Expand Down Expand Up @@ -398,12 +415,15 @@ AppList.prototype = {
return result;
},

_onAppWindowsChanged: function _onAppWindowsChanged(app) {
_onAppWindowsChanged: function _onAppWindowsChanged(app, cb) {
var numberOfwindows = this._getNumberOfAppWindowsInWorkspace(app, this.metaWorkspace);
if (!numberOfwindows || numberOfwindows === 0) {
this._removeApp(app);
this._calcAllWindowNumbers();
}
if (typeof cb === 'function') {
cb();
}
},

_calcAllWindowNumbers: function _calcAllWindowNumbers() {
Expand Down
62 changes: 16 additions & 46 deletions IcingTaskManager@json/files/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ MyApplet.prototype = {
var _this3 = this;

Applet.Applet.prototype._init.call(this, orientation, panel_height, instance_id);
this.settings = new Settings.AppletSettings(this, 'IcingTaskManager@json', instance_id);
this._uuid = metadata.uuid;
this.settings = new Settings.AppletSettings(this, this._uuid, instance_id);
this.homeDir = GLib.get_home_dir();

this.actor.set_track_hover(false);
Expand All @@ -235,11 +236,10 @@ MyApplet.prototype = {
// We are on Cinnamon < 3.2
}

this._uuid = metadata.uuid;
this.execInstallLanguage();
Gettext.bindtextdomain(this._uuid, GLib.get_home_dir() + '/.local/share/locale');

var settingsProps = [{ key: 'autoUpdate', value: 'autoUpdate', cb: this.handleUpdate }, { key: 'show-pinned', value: 'showPinned', cb: null }, { key: 'show-active', value: 'showActive', cb: this.refreshCurrentAppList }, { key: 'show-alerts', value: 'showAlerts', cb: null }, { key: 'group-apps', value: 'groupApps', cb: this.refreshCurrentAppList }, { key: 'arrange-pinnedApps', value: 'arrangePinned', cb: null }, { key: 'pinned-apps', value: 'pinnedApps', cb: null }, { key: 'show-apps-order-hotkey', value: 'showAppsOrderHotkey', cb: this._bindAppKey }, { key: 'show-apps-order-timeout', value: 'showAppsOrderTimeout', cb: null }, { key: 'cycleMenusHotkey', value: 'cycleMenusHotkey', cb: this._bindAppKey }, { key: 'hoverPseudoClass', value: 'hoverPseudoClass', cb: this.refreshCurrentAppList }, { key: 'focusPseudoClass', value: 'focusPseudoClass', cb: this.refreshCurrentAppList }, { key: 'activePseudoClass', value: 'activePseudoClass', cb: this.refreshCurrentAppList }, { key: 'panelLauncherClass', value: 'panelLauncherClass', cb: this.refreshCurrentAppList }, { key: 'enable-hover-peek', value: 'enablePeek', cb: null }, { key: 'onclick-thumbnails', value: 'onClickThumbs', cb: null }, { key: 'hover-peek-opacity', value: 'peekOpacity', cb: null }, { key: 'hover-peek-time', value: 'peekTime', cb: null }, { key: 'thumbnail-timeout', value: 'thumbTimeout', cb: null }, { key: 'thumbnail-size', value: 'thumbSize', cb: null }, { key: 'sort-thumbnails', value: 'sortThumbs', cb: null }, { key: 'vertical-thumbnails', value: 'verticalThumbs', cb: null }, { key: 'show-thumbnails', value: 'showThumbs', cb: null }, { key: 'animate-thumbnails', value: 'animateThumbs', cb: null }, { key: 'close-button-style', value: 'thumbCloseBtnStyle', cb: this.refreshCurrentAppList }, { key: 'include-all-windows', value: 'includeAllWindows', cb: this.refreshCurrentAppList }, { key: 'number-display', value: 'numDisplay', cb: null }, { key: 'title-display', value: 'titleDisplay', cb: this.refreshCurrentAppList }, { key: 'icon-spacing', value: 'iconSpacing', cb: null }, { key: 'themePadding', value: 'themePadding', cb: this.refreshCurrentAppList }, { key: 'icon-padding', value: 'iconPadding', cb: null }, { key: 'enable-iconSize', value: 'enableIconSize', cb: this.refreshCurrentAppList }, { key: 'icon-size', value: 'iconSize', cb: null }, { key: 'show-recent', value: 'showRecent', cb: this.refreshCurrentAppList }, { key: 'menuItemType', value: 'menuItemType', cb: this.refreshCurrentAppList }, { key: 'firefox-menu', value: 'firefoxMenu', cb: this.refreshCurrentAppList }, { key: 'autostart-menu-item', value: 'autoStart', cb: this.refreshCurrentAppList }, { key: 'monitor-move-all-windows', value: 'monitorMoveAllWindows', cb: this.refreshCurrentAppList }, { key: 'useSystemTooltips', value: 'useSystemTooltips', cb: null }];
var settingsProps = [{ key: 'autoUpdate', value: 'autoUpdate', cb: this.handleUpdate }, { key: 'show-pinned', value: 'showPinned', cb: null }, { key: 'show-active', value: 'showActive', cb: this.refreshCurrentAppList }, { key: 'show-alerts', value: 'showAlerts', cb: null }, { key: 'group-apps', value: 'groupApps', cb: this.refreshCurrentAppList }, { key: 'arrange-pinnedApps', value: 'arrangePinned', cb: null }, { key: 'pinned-apps', value: 'pinnedApps', cb: null }, { key: 'show-apps-order-hotkey', value: 'showAppsOrderHotkey', cb: this._bindAppKey }, { key: 'show-apps-order-timeout', value: 'showAppsOrderTimeout', cb: null }, { key: 'cycleMenusHotkey', value: 'cycleMenusHotkey', cb: this._bindAppKey }, { key: 'hoverPseudoClass', value: 'hoverPseudoClass', cb: this.refreshCurrentAppList }, { key: 'focusPseudoClass', value: 'focusPseudoClass', cb: this.refreshCurrentAppList }, { key: 'activePseudoClass', value: 'activePseudoClass', cb: this.refreshCurrentAppList }, { key: 'panelLauncherClass', value: 'panelLauncherClass', cb: this.refreshCurrentAppList }, { key: 'enable-hover-peek', value: 'enablePeek', cb: null }, { key: 'onclick-thumbnails', value: 'onClickThumbs', cb: null }, { key: 'hover-peek-opacity', value: 'peekOpacity', cb: null }, { key: 'hover-peek-time', value: 'peekTime', cb: null }, { key: 'thumbnail-timeout', value: 'thumbTimeout', cb: null }, { key: 'thumbnail-size', value: 'thumbSize', cb: null }, { key: 'sort-thumbnails', value: 'sortThumbs', cb: null }, { key: 'vertical-thumbnails', value: 'verticalThumbs', cb: null }, { key: 'show-thumbnails', value: 'showThumbs', cb: this.refreshThumbnailsFromCurrentAppList }, { key: 'animate-thumbnails', value: 'animateThumbs', cb: null }, { key: 'close-button-style', value: 'thumbCloseBtnStyle', cb: this.refreshCurrentAppList }, { key: 'include-all-windows', value: 'includeAllWindows', cb: this.refreshCurrentAppList }, { key: 'number-display', value: 'numDisplay', cb: null }, { key: 'title-display', value: 'titleDisplay', cb: this.refreshCurrentAppList }, { key: 'icon-spacing', value: 'iconSpacing', cb: null }, { key: 'themePadding', value: 'themePadding', cb: this.refreshCurrentAppList }, { key: 'icon-padding', value: 'iconPadding', cb: null }, { key: 'enable-iconSize', value: 'enableIconSize', cb: this.refreshCurrentAppList }, { key: 'icon-size', value: 'iconSize', cb: null }, { key: 'show-recent', value: 'showRecent', cb: this.refreshCurrentAppList }, { key: 'menuItemType', value: 'menuItemType', cb: this.refreshCurrentAppList }, { key: 'firefox-menu', value: 'firefoxMenu', cb: this.refreshCurrentAppList }, { key: 'autostart-menu-item', value: 'autoStart', cb: this.refreshCurrentAppList }, { key: 'monitor-move-all-windows', value: 'monitorMoveAllWindows', cb: this.refreshCurrentAppList }, { key: 'useSystemTooltips', value: 'useSystemTooltips', cb: null }];

if (this.c32) {
for (var i = 0, len = settingsProps.length; i < len; i++) {
Expand Down Expand Up @@ -312,6 +312,10 @@ MyApplet.prototype = {
this.signals.disconnectAllSignals();
},

// Override Applet._onButtonPressEvent due to the applet menu being replicated in AppMenuButtonRightClickMenu.
_onButtonPressEvent: function _onButtonPressEvent() {
return false;
},
handleUpdate: function handleUpdate() {
var _this4 = this;

Expand Down Expand Up @@ -407,6 +411,9 @@ MyApplet.prototype = {

this.metaWorkspaces[this.currentWs].appList._refreshAppById(appId, opts);
},
refreshThumbnailsFromCurrentAppList: function refreshThumbnailsFromCurrentAppList() {
this.metaWorkspaces[this.currentWs].appList._refreshAllThumbnails();
},
getAppFromWMClass: function getAppFromWMClass(specialApps, metaWindow) {
var _this7 = this;

Expand Down Expand Up @@ -464,52 +471,15 @@ MyApplet.prototype = {
removeAutostartApp: function removeAutostartApp(autostartIndex) {
_.pullAt(this.autostartApps, autostartIndex);
},


execInstallLanguage: function execInstallLanguage() {
// TBD
try {
var _shareFolder = this.homeDir + '/.local/share/';
var _localeFolder = Gio.file_new_for_path(_shareFolder + 'locale/');
var _moFolder = Gio.file_new_for_path(_shareFolder + 'cinnamon/applets/' + this._uuid + '/locale/mo/');
var children = _moFolder.enumerate_children('standard::name,standard::type,time::modified', Gio.FileQueryInfoFlags.NONE, null);
var info = void 0,
_moFile = void 0,
_moLocale = void 0,
_moPath = void 0,
_src = void 0,
_dest = void 0,
_modified = void 0,
_destModified = void 0;
while ((info = children.next_file(null)) !== null) {
_modified = info.get_modification_time().tv_sec;
if (info.get_file_type() == Gio.FileType.REGULAR) {
_moFile = info.get_name();
if (_moFile.substring(_moFile.lastIndexOf('.')) == '.mo') {
_moLocale = _moFile.substring(0, _moFile.lastIndexOf('.'));
_moPath = _localeFolder.get_path() + '/' + _moLocale + '/LC_MESSAGES/';
_src = Gio.file_new_for_path(String(_moFolder.get_path() + '/' + _moFile));
_dest = Gio.file_new_for_path(String(_moPath + this._uuid + '.mo'));
try {
if (_dest.query_exists(null)) {
_destModified = _dest.query_info('time::modified', Gio.FileQueryInfoFlags.NONE, null).get_modification_time().tv_sec;
if (_modified > _destModified) {
_src.copy(_dest, Gio.FileCopyFlags.OVERWRITE, null, null);
}
} else {
this._makeDirectoy(_dest.get_parent());
_src.copy(_dest, Gio.FileCopyFlags.OVERWRITE, null, null);
}
} catch (e) {
Main.notify('Error', e.message);
global.logError(e);
}
}
}
}
} catch (e) {}
var moPath = this.homeDir + '/.local/share/cinnamon/applets/' + this._uuid + '/generate_mo.sh';
var moFile = Gio.file_new_for_path(this.homeDir + '/.local/share/locale/de/LC_MESSAGES/[email protected]');
if (!moFile.query_exists(null)) {
Util.trySpawnCommandLine('bash -c \'' + moPath + '\'');
}
},


handleDragOver: function handleDragOver(source, actor, x, y, time) {
if (!(source.isDraggableApp || source instanceof DND.LauncherDraggable)) {
return DND.DragMotionResult.NO_DROP;
Expand Down
8 changes: 8 additions & 0 deletions IcingTaskManager@json/files/generate_mo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

langs=( bg de es fr he ru zh_CN pl )

for l in "${langs[@]}"
do
msgfmt -cv -o $HOME/.local/share/locale/$l/LC_MESSAGES/[email protected] $HOME/.local/share/cinnamon/applets/IcingTaskManager@json/po/$l.po
done
37 changes: 0 additions & 37 deletions IcingTaskManager@json/files/locale/localeUpdate.sh

This file was deleted.

Binary file removed IcingTaskManager@json/files/locale/mo/bg.mo
Binary file not shown.
Binary file removed IcingTaskManager@json/files/locale/mo/de.mo
Binary file not shown.
Binary file removed IcingTaskManager@json/files/locale/mo/es.mo
Binary file not shown.
Binary file removed IcingTaskManager@json/files/locale/mo/fr.mo
Binary file not shown.
Binary file removed IcingTaskManager@json/files/locale/mo/he.mo
Binary file not shown.
Binary file removed IcingTaskManager@json/files/locale/mo/ru.mo
Binary file not shown.
Binary file removed IcingTaskManager@json/files/locale/mo/zh_CN.mo
Binary file not shown.
1 change: 1 addition & 0 deletions IcingTaskManager@json/files/lodash.js
Original file line number Diff line number Diff line change
Expand Up @@ -17072,3 +17072,4 @@ var runInContext = (function runInContext(context) {

// Export lodash.
var _ = typeof global.lo !== 'undefined' ? global.lo : runInContext();
global.lo = _;
2 changes: 1 addition & 1 deletion IcingTaskManager@json/files/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"max-instances": -1,
"dangerous": false,
"name": "Icing Task Manager",
"version": "4.3.3",
"version": "4.3.4",
"role": "panellauncher",
"uuid": "IcingTaskManager@json"
}
Loading