mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
19
Settings.ui
19
Settings.ui
@@ -1880,6 +1880,7 @@
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1896,6 +1897,24 @@
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="show_appmenu_description">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Top Bar > Show App Menu must be enabled in Tweak Tool</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
31
extension.js
31
extension.js
@@ -23,6 +23,13 @@ const Convenience = Me.imports.convenience;
|
||||
const Panel = Me.imports.panel;
|
||||
const Overview = Me.imports.overview;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const Meta = imports.gi.Meta;
|
||||
const Gio = imports.gi.Gio;
|
||||
const Lang = imports.lang;
|
||||
const Shell = imports.gi.Shell;
|
||||
const WindowManager = imports.ui.windowManager;
|
||||
|
||||
let panel;
|
||||
let overview;
|
||||
let settings;
|
||||
@@ -36,6 +43,20 @@ function enable() {
|
||||
panel.enable();
|
||||
overview = new Overview.dtpOverview(settings);
|
||||
overview.enable(panel.taskbar);
|
||||
|
||||
Main.wm.removeKeybinding('open-application-menu');
|
||||
Main.wm.addKeybinding('open-application-menu',
|
||||
new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }),
|
||||
Meta.KeyBindingFlags.NONE,
|
||||
Shell.ActionMode.NORMAL |
|
||||
Shell.ActionMode.POPUP,
|
||||
Lang.bind(this, function() {
|
||||
if(settings.get_boolean('show-appmenu'))
|
||||
oldToggleAppMenu();
|
||||
else
|
||||
panel.taskbar.popupFocusedAppSecondaryMenu();
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
function disable() {
|
||||
@@ -45,6 +66,12 @@ function disable() {
|
||||
settings = null;
|
||||
overview = null;
|
||||
panel = null;
|
||||
|
||||
Main.wm.removeKeybinding('open-application-menu');
|
||||
Main.wm.addKeybinding('open-application-menu',
|
||||
new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }),
|
||||
Meta.KeyBindingFlags.NONE,
|
||||
Shell.ActionMode.NORMAL |
|
||||
Shell.ActionMode.POPUP,
|
||||
Lang.bind(Main.wm, this._toggleAppMenu));
|
||||
}
|
||||
|
||||
|
||||
|
||||
157
secondaryMenu.js
157
secondaryMenu.js
@@ -27,6 +27,10 @@ const Lang = imports.lang;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const Taskbar = Me.imports.taskbar;
|
||||
const RemoteMenu = imports.ui.remoteMenu;
|
||||
const PopupMenu = imports.ui.popupMenu;
|
||||
const Shell = imports.gi.Shell;
|
||||
const AppFavorites = imports.ui.appFavorites;
|
||||
|
||||
/**
|
||||
* Extend AppIconMenu
|
||||
@@ -62,8 +66,157 @@ const taskbarSecondaryMenu = new Lang.Class({
|
||||
metaWindow.delete(global.get_current_time());
|
||||
},
|
||||
|
||||
_redisplay: function() {
|
||||
this.parent();
|
||||
_redisplay: function() {
|
||||
this.removeAll();
|
||||
|
||||
let windows = this._source.app.get_windows().filter(function(w) {
|
||||
return !w.skip_taskbar;
|
||||
});
|
||||
|
||||
// Display the app windows menu items and the separator between windows
|
||||
// of the current desktop and other windows.
|
||||
let activeWorkspace = global.screen.get_active_workspace();
|
||||
let separatorShown = windows.length > 0 && windows[0].get_workspace() != activeWorkspace;
|
||||
|
||||
for (let i = 0; i < windows.length; i++) {
|
||||
let window = windows[i];
|
||||
if (!separatorShown && window.get_workspace() != activeWorkspace) {
|
||||
this._appendSeparator();
|
||||
separatorShown = true;
|
||||
}
|
||||
let item = this._appendMenuItem(window.title);
|
||||
item.connect('activate', Lang.bind(this, function() {
|
||||
this.emit('activate-window', window);
|
||||
}));
|
||||
}
|
||||
|
||||
if (!this._source.app.is_window_backed()) {
|
||||
this._appendSeparator();
|
||||
|
||||
let appInfo = this._source.app.get_app_info();
|
||||
let actions = appInfo.list_actions();
|
||||
if (this._source.app.can_open_new_window() &&
|
||||
actions.indexOf('new-window') == -1) {
|
||||
this._newWindowMenuItem = this._appendMenuItem(_("New Window"));
|
||||
this._newWindowMenuItem.connect('activate', Lang.bind(this, function() {
|
||||
if (this._source.app.state == Shell.AppState.STOPPED)
|
||||
this._source.animateLaunch();
|
||||
|
||||
this._source.app.open_new_window(-1);
|
||||
this.emit('activate-window', null);
|
||||
}));
|
||||
this._appendSeparator();
|
||||
}
|
||||
|
||||
if (PopupMenu.discreteGpuAvailable &&
|
||||
this._source.app.state == Shell.AppState.STOPPED &&
|
||||
actions.indexOf('activate-discrete-gpu') == -1) {
|
||||
this._onDiscreteGpuMenuItem = this._appendMenuItem(_("Launch using Dedicated Graphics Card"));
|
||||
this._onDiscreteGpuMenuItem.connect('activate', Lang.bind(this, function() {
|
||||
if (this._source.app.state == Shell.AppState.STOPPED)
|
||||
this._source.animateLaunch();
|
||||
|
||||
this._source.app.launch(0, -1, true);
|
||||
this.emit('activate-window', null);
|
||||
}));
|
||||
}
|
||||
|
||||
for (let i = 0; i < actions.length; i++) {
|
||||
let action = actions[i];
|
||||
let item = this._appendMenuItem(appInfo.get_action_name(action));
|
||||
item.connect('activate', Lang.bind(this, function(emitter, event) {
|
||||
this._source.app.launch_action(action, event.get_time(), -1);
|
||||
this.emit('activate-window', null);
|
||||
}));
|
||||
}
|
||||
|
||||
let appMenu = this._source.app.menu;
|
||||
if(appMenu) {
|
||||
this._appendSeparator();
|
||||
this._remoteMenu = new RemoteMenu.RemoteMenu(this._source.actor, this._source.app.menu, this._source.app.action_group);
|
||||
let appMenuItems = this._remoteMenu._getMenuItems();
|
||||
for(let appMenuIdx in appMenuItems){
|
||||
let menuItem = appMenuItems[appMenuIdx];
|
||||
let labelText = menuItem.actor.label_actor.text;
|
||||
if(labelText == _("New Window") || labelText == _("Help") || labelText == _("About") || labelText == _("Quit"))
|
||||
continue;
|
||||
|
||||
if(menuItem instanceof PopupMenu.PopupSeparatorMenuItem)
|
||||
continue;
|
||||
|
||||
// this ends up getting called multiple times, and bombing due to the signal id's being invalid
|
||||
// on a 2nd pass. disconnect the base handler and attach our own that wraps the id's in if statements
|
||||
menuItem.disconnect(menuItem._popupMenuDestroyId)
|
||||
menuItem._popupMenuDestroyId = menuItem.connect('destroy', Lang.bind(this, function(menuItem) {
|
||||
if(menuItem._popupMenuDestroyId) {
|
||||
menuItem.disconnect(menuItem._popupMenuDestroyId);
|
||||
menuItem._popupMenuDestroyId = 0;
|
||||
}
|
||||
if(menuItem._activateId) {
|
||||
menuItem.disconnect(menuItem._activateId);
|
||||
menuItem._activateId = 0;
|
||||
}
|
||||
if(menuItem._activeChangeId) {
|
||||
menuItem.disconnect(menuItem._activeChangeId);
|
||||
menuItem._activeChangeId = 0;
|
||||
}
|
||||
if(menuItem._sensitiveChangeId) {
|
||||
menuItem.disconnect(menuItem._sensitiveChangeId);
|
||||
menuItem._sensitiveChangeId = 0;
|
||||
}
|
||||
this.disconnect(menuItem._parentSensitiveChangeId);
|
||||
if (menuItem == this._activeMenuItem)
|
||||
this._activeMenuItem = null;
|
||||
}));
|
||||
|
||||
menuItem.actor.get_parent().remove_child(menuItem.actor);
|
||||
this.addMenuItem(menuItem);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
let canFavorite = global.settings.is_writable('favorite-apps');
|
||||
|
||||
if (canFavorite) {
|
||||
this._appendSeparator();
|
||||
|
||||
let isFavorite = AppFavorites.getAppFavorites().isFavorite(this._source.app.get_id());
|
||||
|
||||
if (isFavorite) {
|
||||
let item = this._appendMenuItem(_("Remove from Favorites"));
|
||||
item.connect('activate', Lang.bind(this, function() {
|
||||
let favs = AppFavorites.getAppFavorites();
|
||||
favs.removeFavorite(this._source.app.get_id());
|
||||
}));
|
||||
} else {
|
||||
let item = this._appendMenuItem(_("Add to Favorites"));
|
||||
item.connect('activate', Lang.bind(this, function() {
|
||||
let favs = AppFavorites.getAppFavorites();
|
||||
favs.addFavorite(this._source.app.get_id());
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
// if (Shell.AppSystem.get_default().lookup_app('org.gnome.Software.desktop')) {
|
||||
// this._appendSeparator();
|
||||
// let item = this._appendMenuItem(_("Show Details"));
|
||||
// item.connect('activate', Lang.bind(this, function() {
|
||||
// let id = this._source.app.get_id();
|
||||
// let args = GLib.Variant.new('(ss)', [id, '']);
|
||||
// Gio.DBus.get(Gio.BusType.SESSION, null,
|
||||
// function(o, res) {
|
||||
// let bus = Gio.DBus.get_finish(res);
|
||||
// bus.call('org.gnome.Software',
|
||||
// '/org/gnome/Software',
|
||||
// 'org.gtk.Actions', 'Activate',
|
||||
// GLib.Variant.new('(sava{sv})',
|
||||
// ['details', [args], null]),
|
||||
// null, 0, -1, null, null);
|
||||
// Main.overview.hide();
|
||||
// });
|
||||
// }));
|
||||
// }
|
||||
}
|
||||
|
||||
// quit menu
|
||||
let app = this._source.app;
|
||||
|
||||
15
taskbar.js
15
taskbar.js
@@ -1232,6 +1232,20 @@ const taskbar = new Lang.Class({
|
||||
this.showAppsButton.hide();
|
||||
this.showAppsButton.set_width(0);
|
||||
this.showAppsButton.set_height(0);
|
||||
},
|
||||
|
||||
popupFocusedAppSecondaryMenu: function() {
|
||||
let appIcons = this._getAppIcons();
|
||||
for(let i in appIcons) {
|
||||
if(appIcons[i].app == tracker.focus_app) {
|
||||
let appIcon = appIcons[i];
|
||||
if(appIcon._menu && appIcon._menu.isOpen)
|
||||
appIcon._menu.close();
|
||||
else
|
||||
appIcons[i].popupMenu();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
@@ -1555,7 +1569,6 @@ const taskbarAppIcon = new Lang.Class({
|
||||
|
||||
_animateDotDisplay: function (dots, newWidth, otherDots, newOtherOpacity, force) {
|
||||
if((dots.width != newWidth && dots._tweeningToWidth !== newWidth) || force) {
|
||||
log('tweening ' + this._dashItemContainer._labelText + " " + dots.width + " " + newWidth + " " + force);
|
||||
dots._tweeningToWidth = newWidth;
|
||||
Tweener.addTween(dots,
|
||||
{ width: newWidth,
|
||||
|
||||
Reference in New Issue
Block a user