-
Notifications
You must be signed in to change notification settings - Fork 461
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
Draft: Update show apps icon for GNOME 42 changes #1759
Open
ewlsh
wants to merge
1
commit into
master
Choose a base branch
from
ewlsh/gnome-42-show-apps-icon
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1225,77 +1225,65 @@ function getInterestingWindows(windows, monitorIndex) { | |
} | ||
|
||
/** | ||
* A ShowAppsIcon improved class. | ||
* | ||
* - set label position based on dash orientation (Note, I am reusing most machinery of the appIcon class) | ||
* - implement a popupMenu based on the AppIcon code (Note, I am reusing most machinery of the appIcon class) | ||
* | ||
* Use AppIcon to handle the menu for the dock icon | ||
*/ | ||
|
||
var DockShowAppsIcon = GObject.registerClass({ | ||
Signals: { | ||
'menu-state-changed': { param_types: [GObject.TYPE_BOOLEAN] }, | ||
'sync-tooltip': {} | ||
} | ||
} | ||
, class DockShowAppsIcon extends Dash.ShowAppsIcon { | ||
_init() { | ||
super._init(); | ||
|
||
// Re-use appIcon methods | ||
let appIconPrototype = AppDisplay.AppIcon.prototype; | ||
this.toggleButton.y_expand = false; | ||
this.toggleButton.connect('popup-menu', | ||
appIconPrototype._onKeyboardPopupMenu.bind(this)); | ||
this.toggleButton.connect('clicked', | ||
this._removeMenuTimeout.bind(this)); | ||
|
||
this.reactive = true; | ||
this.toggleButton.popupMenu = () => this.popupMenu.call(this); | ||
this.toggleButton._removeMenuTimeout = () => this._removeMenuTimeout.call(this); | ||
'sync-tooltip': {}, | ||
}, | ||
}, class DockShowAppsIcon extends AppDisplay.AppIcon { | ||
_init(source) { | ||
// Skip AppIcon._init to avoid the app handling logic | ||
AppDisplay.AppViewItem.prototype._init.call(this, {}, false, false); | ||
|
||
// Keep a reference to the container | ||
this.source = source; | ||
|
||
this._iconActor = null; | ||
|
||
// Create the icon | ||
this.icon = new IconGrid.BaseIcon(_('Show Applications'), { | ||
setSizeManually: true, | ||
showLabel: false, | ||
createIcon: this._createIcon.bind(this), | ||
}); | ||
this.icon.y_align = Clutter.ActorAlign.CENTER; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have my dock in left panel mode, and I believe this (I'm here because Fedora applied your patch to its package.) |
||
|
||
this._menu = null; | ||
this._menuManager = new PopupMenu.PopupMenuManager(this); | ||
this._menuTimeoutId = 0; | ||
} | ||
this._iconContainer = new St.Widget({ | ||
layout_manager: new Clutter.BinLayout(), | ||
x_expand: true, | ||
y_expand: true, | ||
}); | ||
|
||
vfunc_leave_event(leaveEvent) | ||
{ | ||
return AppDisplay.AppIcon.prototype.vfunc_leave_event.call( | ||
this.toggleButton, leaveEvent); | ||
} | ||
this.set_child(this._iconContainer); | ||
|
||
vfunc_button_press_event(buttonPressEvent) | ||
{ | ||
return AppDisplay.AppIcon.prototype.vfunc_button_press_event.call( | ||
this.toggleButton, buttonPressEvent); | ||
} | ||
this._iconContainer.add_child(this.icon); | ||
|
||
vfunc_touch_event(touchEvent) | ||
{ | ||
return AppDisplay.AppIcon.prototype.vfunc_touch_event.call( | ||
this.toggleButton, touchEvent); | ||
} | ||
// Setup the menu events | ||
this.connect('popup-menu', this._onKeyboardPopupMenu.bind(this)); | ||
|
||
showLabel() { | ||
itemShowLabel.call(this); | ||
} | ||
this._menu = null; | ||
this._menuManager = new PopupMenu.PopupMenuManager(this); | ||
|
||
_onMenuPoppedDown() { | ||
AppDisplay.AppIcon.prototype._onMenuPoppedDown.apply(this, arguments); | ||
this._menuTimeoutId = 0; | ||
} | ||
|
||
_setPopupTimeout() { | ||
AppDisplay.AppIcon.prototype._setPopupTimeout.apply(this, arguments); | ||
_createIcon(iconSize) { | ||
// Use ShowAppsIcon to create the icon itself | ||
return Dash.ShowAppsIcon.prototype._createIcon.call(this, iconSize); | ||
} | ||
|
||
_removeMenuTimeout() { | ||
AppDisplay.AppIcon.prototype._removeMenuTimeout.apply(this, arguments); | ||
activate() { | ||
// Toggle the toggle button as the primary action | ||
// This overrides the logic to "launch" an app | ||
this.source.toggleButton.checked = !this.source.toggleButton.checked; | ||
} | ||
|
||
popupMenu() { | ||
this._removeMenuTimeout(); | ||
this.toggleButton.fake_release(); | ||
this.source.toggleButton.fake_release(); | ||
|
||
if (!this._menu) { | ||
this._menu = new DockShowAppsIconMenu(this); | ||
|
@@ -1314,7 +1302,7 @@ var DockShowAppsIcon = GObject.registerClass({ | |
|
||
this.emit('menu-state-changed', true); | ||
|
||
this.toggleButton.set_hover(true); | ||
this.source.toggleButton.set_hover(true); | ||
this._menu.popup(); | ||
this._menuManager.ignoreRelease(); | ||
this.emit('sync-tooltip'); | ||
|
@@ -1323,6 +1311,41 @@ var DockShowAppsIcon = GObject.registerClass({ | |
} | ||
}); | ||
|
||
/** | ||
* A ShowAppsIcon improved class. | ||
* | ||
* - set label position based on dash orientation (Note, I am reusing most machinery of the appIcon class) | ||
* - implement a popupMenu based on the AppIcon code (Note, I am reusing most machinery of the appIcon class) | ||
*/ | ||
var DockShowAppsIconContainer = GObject.registerClass(class DockShowAppsIconContainer extends Dash.ShowAppsIcon { | ||
_init() { | ||
Dash.DashItemContainer.prototype._init.call(this); | ||
|
||
this.toggleButton = new St.Button({ | ||
style_class: 'show-apps', | ||
track_hover: true, | ||
can_focus: true, | ||
toggle_mode: true, | ||
}); | ||
|
||
this.appIcon = new DockShowAppsIcon(this); | ||
|
||
this.toggleButton.add_actor(this.appIcon); | ||
this.toggleButton._delegate = this; | ||
|
||
this.setChild(this.toggleButton); | ||
this.setDragApp(null); | ||
} | ||
|
||
get icon() { | ||
return this.appIcon.icon; | ||
} | ||
|
||
showLabel() { | ||
itemShowLabel.call(this); | ||
} | ||
}); | ||
|
||
|
||
/** | ||
* A menu for the showAppsIcon | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block makes the dot always visible, seems like debug leftover