mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Use taskbar property to indicate a full scrollview
This commit is contained in:
@@ -341,8 +341,8 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
}
|
||||
},
|
||||
|
||||
updateTitleWidth: function(forceDynamicTitleWidth) {
|
||||
this._updateWindowTitleStyle(forceDynamicTitleWidth);
|
||||
updateTitleStyle: function() {
|
||||
this._updateWindowTitleStyle();
|
||||
},
|
||||
|
||||
// Update indicator and target for minimization animation
|
||||
@@ -469,9 +469,10 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
this._displayProperIndicator(true);
|
||||
},
|
||||
|
||||
_updateWindowTitleStyle: function(forceDynamicTitleWidth) {
|
||||
_updateWindowTitleStyle: function() {
|
||||
if (this._windowTitle) {
|
||||
let useFixedWidth = Me.settings.get_boolean('group-apps-use-fixed-width');
|
||||
let variableWidth = !useFixedWidth || this.dtpPanel.taskbar.fullScrollView;
|
||||
let fontWeight = Me.settings.get_string('group-apps-label-font-weight');
|
||||
let maxLabelWidth = Me.settings.get_int('group-apps-label-max-width') *
|
||||
St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
@@ -480,7 +481,7 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
|
||||
this._windowTitle.clutter_text.natural_width = useFixedWidth ? maxLabelWidth : 0;
|
||||
this._windowTitle.clutter_text.natural_width_set = useFixedWidth;
|
||||
this._windowTitle.set_width(!useFixedWidth || forceDynamicTitleWidth ? -1 : maxLabelWidth + this._getWindowTitleRightPadding());
|
||||
this._windowTitle.set_width(variableWidth ? -1 : maxLabelWidth + this._getWindowTitleRightPadding());
|
||||
|
||||
this._windowTitle.set_style('font-size: ' + Me.settings.get_int('group-apps-label-font-size') + 'px;' +
|
||||
'font-weight: ' + fontWeight + ';' +
|
||||
|
||||
66
taskbar.js
66
taskbar.js
@@ -175,6 +175,7 @@ var taskbar = Utils.defineClass({
|
||||
this._resetHoverTimeoutId = 0;
|
||||
this._ensureAppIconVisibilityTimeoutId = 0;
|
||||
this._labelShowing = false;
|
||||
this.fullScrollView = 0;
|
||||
|
||||
let isVertical = Panel.checkIfVertical();
|
||||
|
||||
@@ -243,35 +244,7 @@ var taskbar = Utils.defineClass({
|
||||
});
|
||||
|
||||
let adjustment = this._scrollView[orientation[0] + 'scroll'].adjustment;
|
||||
let fullScrollView = 0;
|
||||
|
||||
this._signalsHandler.add([
|
||||
adjustment,
|
||||
'notify::upper',
|
||||
() => {
|
||||
// Update minimization animation target position on scrollview change.
|
||||
this._updateAppIcons();
|
||||
|
||||
// When applications are ungrouped and there is some empty space on the horizontal taskbar,
|
||||
// force a fixed label width to prevent the icons from "wiggling" when an animation runs
|
||||
// (adding or removing an icon). When the taskbar is full, revert to a dynamic label width
|
||||
// to allow them to resize and make room for new icons.
|
||||
if (!isVertical && !this.isGroupApps) {
|
||||
let initial = fullScrollView;
|
||||
|
||||
if (!fullScrollView && Math.floor(adjustment.upper) > adjustment.page_size) {
|
||||
fullScrollView = adjustment.page_size;
|
||||
} else if (adjustment.page_size < fullScrollView) {
|
||||
fullScrollView = 0;
|
||||
}
|
||||
|
||||
if (initial != fullScrollView) {
|
||||
this._getAppIcons().forEach(a => a.updateTitleWidth(fullScrollView));
|
||||
}
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
|
||||
this._workId = Main.initializeDeferredWork(this._box, Lang.bind(this, this._redisplay));
|
||||
|
||||
this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell' });
|
||||
@@ -382,6 +355,32 @@ var taskbar = Utils.defineClass({
|
||||
'changed::taskbar-locked'
|
||||
],
|
||||
() => this.resetAppIcons()
|
||||
],
|
||||
[
|
||||
adjustment,
|
||||
'notify::upper',
|
||||
() => {
|
||||
// Update minimization animation target position on scrollview change.
|
||||
this._updateAppIcons();
|
||||
|
||||
// When applications are ungrouped and there is some empty space on the horizontal taskbar,
|
||||
// force a fixed label width to prevent the icons from "wiggling" when an animation runs
|
||||
// (adding or removing an icon). When the taskbar is full, revert to a dynamic label width
|
||||
// to allow them to resize and make room for new icons.
|
||||
if (!isVertical && !this.isGroupApps) {
|
||||
let initial = this.fullScrollView;
|
||||
|
||||
if (!this.fullScrollView && Math.floor(adjustment.upper) > adjustment.page_size) {
|
||||
this.fullScrollView = adjustment.page_size;
|
||||
} else if (adjustment.page_size < this.fullScrollView) {
|
||||
this.fullScrollView = 0;
|
||||
}
|
||||
|
||||
if (initial != this.fullScrollView) {
|
||||
this._getAppIcons().forEach(a => a.updateTitleStyle());
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
);
|
||||
|
||||
@@ -405,12 +404,7 @@ var taskbar = Utils.defineClass({
|
||||
|
||||
_onScrollEvent: function(actor, event) {
|
||||
|
||||
// Event coordinates are relative to the stage but can be transformed
|
||||
// as the actor will only receive events within his bounds.
|
||||
let stage_x, stage_y, ok, event_x, event_y, actor_w, actor_h;
|
||||
[stage_x, stage_y] = event.get_coords();
|
||||
[ok, event_x, event_y] = actor.transform_stage_point(stage_x, stage_y);
|
||||
[actor_w, actor_h] = actor.get_size();
|
||||
let orientation = Panel.getOrientation();
|
||||
|
||||
// reset timeout to avid conflicts with the mousehover event
|
||||
if (this._ensureAppIconVisibilityTimeoutId>0) {
|
||||
@@ -424,7 +418,7 @@ var taskbar = Utils.defineClass({
|
||||
|
||||
let adjustment, delta;
|
||||
|
||||
adjustment = this._scrollView.get_hscroll_bar().get_adjustment();
|
||||
adjustment = this._scrollView[orientation[0] + 'scroll'].get_adjustment();
|
||||
|
||||
let increment = adjustment.step_increment;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user