Skip to content
Open
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
1 change: 1 addition & 0 deletions animator.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ export let Animator = class {
animateIcons.forEach((icon) => {
if (!icon._icon) return;
// dock.renderArea.opacity = 100;
dock.extension.services?.updateIconState(icon);
{
let icon_name = icon._icon.icon_name;
let app_name =
Expand Down
11 changes: 10 additions & 1 deletion apps/empty-trash.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
#!/usr/bin/sh
rm -rf ~/.local/share/Trash/*
# gio emits proper trash:// change events (raw rm can miss the monitor);
# fall back to rm where gio is unavailable
if command -v gio >/dev/null 2>&1; then
# gvfs discovers mounted-volume .Trash-$UID dirs lazily; enumerate first
# so --empty reaches volume trash too, not just the home trash
gio list trash:// >/dev/null 2>&1
gio trash --empty
else
rm -rf ~/.local/share/Trash/*
fi
3 changes: 2 additions & 1 deletion dockItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class DockItemMenu extends PopupMenu.PopupMenu {

popup() {
this.open(BoxPointer.PopupAnimation.FULL);
this._menuManager.ignoreRelease();
// removed in GNOME 50's PopupMenuManager
this._menuManager.ignoreRelease?.();
}
}

Expand Down
30 changes: 17 additions & 13 deletions services.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,8 @@ export const Services = class {
let open_app = 'nautilus --select';

let trash_action = `${extension_path}/apps/empty-trash.sh`;
{
let fn = Gio.File.new_for_path('.local/share/Trash');
trash_action = `rm -rf "${fn.get_path()}"`;
}

let content = `[Desktop Entry]\nVersion=1.0\nTerminal=false\nType=Application\nName=Trash\nExec=${open_app} trash:///\nIcon=user-trash\nStartupWMClass=trash-dash2dock-lite\nActions=trash\n\n[Desktop Action trash]\nName=Empty Trash\nExec=${trash_action}\nTerminal=true\n`;
let content = `[Desktop Entry]\nVersion=1.0\nTerminal=false\nType=Application\nName=Trash\nExec=${open_app} trash:///\nIcon=user-trash\nStartupWMClass=trash-dash2dock-lite\nActions=trash\n\n[Desktop Action trash]\nName=Empty Trash\nExec=${trash_action}\nTerminal=false\n`;
const [, etag] = fn.replace_contents(
content,
null,
Expand Down Expand Up @@ -683,6 +679,22 @@ export const Services = class {
}

//! this is out of place - services should only do background process - no rendering
// Resolve state-dependent icon names (trash full/empty) — must run BEFORE
// the renderer reads icon_name so the same frame paints the new state;
// updateIcon() runs after paint and would lag one animation tick.
updateIconState(item) {
let icon = item?._icon;
if (!icon || !icon.icon_name) {
return;
}
if (this.extension.trash_icon && icon.icon_name.startsWith('user-trash')) {
let new_icon = this.trashFull ? 'user-trash-full' : 'user-trash';
if (new_icon != icon.icon_name) {
icon.icon_name = new_icon;
}
}
}

updateIcon(item, settings) {
if (!item) {
return;
Expand All @@ -696,14 +708,6 @@ export const Services = class {

// todo move dots and badges here?

// the trash
if (this.extension.trash_icon && icon.icon_name.startsWith('user-trash')) {
let new_icon = this.trashFull ? 'user-trash-full' : 'user-trash';
if (new_icon != icon.icon_name) {
icon.icon_name = new_icon;
}
}

// clock
if (icon.icon_name == 'org.gnome.clocks') {
if (this.extension.clock_icon) {
Expand Down