Skip to content

Display Alt-Tab window thumbnails - #435

Open
avainfo wants to merge 2 commits into
pop-os:masterfrom
avainfo:feature/alt-tab-thumbnails
Open

Display Alt-Tab window thumbnails#435
avainfo wants to merge 2 commits into
pop-os:masterfrom
avainfo:feature/alt-tab-thumbnails

Conversation

@avainfo

@avainfo avainfo commented Jun 19, 2026

Copy link
Copy Markdown

Summary

This updates cosmic-launcher to display window thumbnails in the Alt-Tab view.

The launcher now consumes thumbnail data provided by launcher search results, loads RGBA thumbnail data into iced image handles, tracks thumbnail state per window, and renders thumbnails in the Alt-Tab result list.

This PR depends on the companion launcher PR:

Launcher Pull Request

Changes

  • Add thumbnail model, loader, provider, and view modules
  • Track thumbnail loading state per window
  • Convert RGBA thumbnail data into iced image handles
  • Render thumbnails in the Alt-Tab window switcher
  • Keep stable placeholder/loading behavior while thumbnails are loading
  • Invalidate cached thumbnails when the underlying thumbnail content changes

Testing

  • Ran cargo fmt
  • Ran cargo check
  • Tested locally with the companion launcher branch installed
  • Verified that Alt-Tab displays real window thumbnails
  • Verified that thumbnails update when switching browser tabs
  • Verified that the launcher remains stable when thumbnails are unavailable

Checklist

  • I used AI assistance for commit message wording only; the implementation was manually written, reviewed, and tested.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the Developer Certificate of Origin and certify my contribution under its conditions.

Add thumbnail loading, caching, and rendering support for Alt-Tab window results.

Load raw RGBA thumbnail data provided by launcher search results, cache thumbnail states per window, refresh cached thumbnails when source pixels change, and keep unavailable thumbnails represented with a stable placeholder.
@avainfo
avainfo force-pushed the feature/alt-tab-thumbnails branch from 0925d4f to 1bdd52b Compare June 20, 2026 17:35
@avainfo

avainfo commented Jun 20, 2026

Copy link
Copy Markdown
Author

I pushed a cleanup pass on this PR.

Summary:

  • Treat missing thumbnail sources as Unavailable instead of creating synthetic Ready images
  • Keep the Alt-Tab layout stable by rendering Unavailable thumbnails with the neutral placeholder
  • Refresh cached thumbnails when source pixel data changes
  • Clean up thumbnail cache entries for windows that are no longer visible
  • Removed temporary thumbnail debug traces
  • Squashed the branch history into 1 reviewable commit while preserving the final diff

Validation:

  • cargo fmt --check
  • cargo check
  • cargo test
  • git diff --check

The branch is clean locally.

@PennyJim

Copy link
Copy Markdown

When I attempted your patches, I got the interface to act like it should have thumbnails, but I do not see any.
I'm quite new to COSMIC and Rust, so it's not impossible I messed something up

Here's my attempted steps at applying them:

  1. Cloned both cosmic-launcher and launcher
  2. Downloaded the files you get when you put .patch at the end of a pull url and applied them
    Specifically curl -L https://github.com/pop-os/cosmic-launcher/pull/435.patch | git apply
  3. Tweaked the Cargo.toml of cosmic-launcher to point at the local pop-launcher and pop-launcher-service
  4. Finally did just && sudo just install on both
    I might not have needed to do it on pop-launcher, but I did before I realized cosmic-launcher was directly depending on it
image

I also wished you had screenshots in your response to #212 or either pr

@jacobgkau
jacobgkau requested a review from a team June 25, 2026 22:25

@jacobgkau jacobgkau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR will be subject to UX review for the design and engineering review for the implementation. I'll request the latter once the known problems are fixed.

I'm not seeing the same issue as @PennyJim (@PennyJim, can you provide any info about your environment, like what GPU you're using?)

However, I am seeing problems with thumbnails being out-of-date.

  • Firefox seems to have an up-to-date thumbnail.
  • COSMIC Term shows a thumbnail of its initial launch state (not updating with commands/output or resizing), but updates when I change directories.
  • COSMIC Files updates when I change what folder I'm in, but doesn't update if I simply scroll the view or resize it.
Screenshot_2026-06-25_16-31-41

It seems like the thumbnails currently only update when the window title changes. I don't think that heuristic is sufficient.

@jacobgkau
jacobgkau requested a review from a team June 25, 2026 22:35
@PennyJim

Copy link
Copy Markdown

I'm not seeing the same issue as @PennyJim (@PennyJim, can you provide any info about your environment, like what GPU you're using?)

I'm currently away from my computer so I can't collect more info, but just in case it's Nvidia related; I do know my GPU off the top of my head is the Nvidia GeForce GTX 1660 super.

I suspect it might be related to my troubles updating to Pop!_OS 24.04 LTS. It did not automatically install some of the packages, like the cosmic terminal, cosmic file browser, and playerctl. I found the last one when I searched for why my media keys weren't working.

Just in case it's not Nvidia related, do you have a list of packages I should probably have installed that I can compare against when I get back to my computer?

@jacobgkau

Copy link
Copy Markdown
Member

@PennyJim I tried on an NVIDIA-only system (RTX 20-series), and still didn't see blank rectangles like you did.

Here's a package list from a fresh installation of the most recent NVIDIA ISO, if that would help with your troubleshooting: installed-packages-pop-2404-nvidia-iso25.txt

If this PR starts to move forward (with UX approval, addressing of my initial QA feedback, etc), then I'll try to locate a GTX 16-series card to test with.

@avainfo

avainfo commented Jun 29, 2026

Copy link
Copy Markdown
Author

Thanks for testing @jacobgkau and for the feedback.

You are right: the current implementation only refreshes thumbnails when the toplevel title changes. I chose that as an initial conservative strategy to avoid triggering screencopy updates too aggressively, especially for lower-end or resource-constrained systems.

The title-change heuristic works for some common cases, such as browser tab changes, but I agree it is not sufficient for the overall UX. It misses cases where the window content changes without a title update, such as terminal output, scrolling, resizing, or file manager updates.

I’ll rework this. My current plan is to add a simple refresh setting with at least two modes for now:

  • a conservative mode that refreshes thumbnails only when the window title changes
  • a more up-to-date mode that refreshes thumbnails when Alt-Tab is opened

After that, I can also investigate a throttled refresh while the switcher is active, likely limited to visible/focused entries. This could be optimized with timing controls such as a minimum refresh interval or debounce logic, but I’d like to measure the performance impact before making any continuous refresh behavior the default.

@avainfo

avainfo commented Jun 29, 2026

Copy link
Copy Markdown
Author

Thanks @PennyJim for testing it.

The two-PR setup is a bit awkward to test manually because cosmic-launcher needs to be built against the matching local launcher changes, and the installed cosmic-toplevel plugin also needs to be the patched one.

For testing, the important pieces are:

  • build cosmic-launcher from this PR branch;
  • build pop-launcher-bin from the companion launcher PR branch;
  • build the cosmic-toplevel plugin from the companion launcher PR branch;
  • make sure the runtime pop-launcher and cosmic-toplevel are the ones from those local builds.

The rough local build commands I used were:

# cosmic-launcher PR branch
cd /path/to/cosmic-launcher
cargo build --release

# launcher PR branch
cd /path/to/launcher
cargo build --release -p pop-launcher-bin
cargo build --release -p pop-launcher-plugins --bin cosmic-toplevel

The binaries to check are roughly:

/path/to/cosmic-launcher/target/release/cosmic-launcher
/path/to/launcher/target/release/pop-launcher-bin
/path/to/launcher/target/release/cosmic-toplevel

For the blank thumbnails specifically, I would first check whether the patched cosmic-toplevel plugin is actually the one being used at runtime, since that is the part responsible for producing the thumbnail data.

You can check the currently used binaries with:

readlink -f /usr/bin/cosmic-launcher
readlink -f /usr/bin/pop-launcher
readlink -f /usr/lib/pop-launcher/plugins/cosmic_toplevel/cosmic-toplevel

If any of those point to a local build directory, they are still using a test build.

I have a local install script that wires those pieces together with symlinks, but I do not want to recommend it as-is because it replaces system launcher binaries/plugins. I can clean it up into a safer helper with path checks and a restore mode if that would help.

To reset back to packaged versions after manual testing, reinstalling the packages should restore the system binaries:

sudo apt install --reinstall cosmic-launcher pop-launcher

Then restart the launcher processes:

killall cosmic-launcher pop-launcher cosmic-toplevel 2>/dev/null || true

Please double-check the package names on your system before running the reinstall command.

@PennyJim

Copy link
Copy Markdown

For the blank thumbnails specifically, I would first check whether the patched cosmic-toplevel plugin is actually the one being used at runtime, since that is the part responsible for producing the thumbnail data.

I used just which I think directly overwrites those files, so I can't really confirm if it's using a locally modified copy. I suspect not since I can't see any binary called cosmic-toplevel in my launcher folder.

cargo build --release -p pop-launcher-plugins --bin cosmic-toplevel

This just complains about no bin target named cosmic-toplevel

In a blind attempt to get it working, I tried adding one to plugins/Cargo.toml.

[[bin]]
name = "cosmic-toplevel"
path = "src/cosmic_toplevel/mod.rs"

This just had compile errors thrown at me, so I haven't a clue what I'm dong. I am new to Rust and haven't written a single line of it. Thank you for trying to help me.

Because I was worried just applying the patch might've somehow missed things, I added your fork as a remote and have checked out the branch, so I should have the same exact files.

@PennyJim

Copy link
Copy Markdown

Okay more fiddling with just install and I somehow got it to work for me.
Not fully sure what I did, all I know is I passed a couple environment variables into it.

I can only suspect it might've been the HOME=$HOME because the other one I did was PATH so just could be recognized since it's installed for my user and not the system.

That or it was doing your command to kill specifically the relevant processes instead of re-logging entirely.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants