Display Alt-Tab window thumbnails - #435
Conversation
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.
0925d4f to
1bdd52b
Compare
|
I pushed a cleanup pass on this PR. Summary:
Validation:
The branch is clean locally. |
|
When I attempted your patches, I got the interface to act like it should have thumbnails, but I do not see any. Here's my attempted steps at applying them:
I also wished you had screenshots in your response to #212 or either pr |
jacobgkau
left a comment
There was a problem hiding this comment.
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.
It seems like the thumbnails currently only update when the window title changes. I don't think that heuristic is sufficient.
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 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? |
|
@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. |
|
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:
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. |
|
Thanks @PennyJim for testing it. The two-PR setup is a bit awkward to test manually because For testing, the important pieces are:
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-toplevelThe 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-toplevelFor the blank thumbnails specifically, I would first check whether the patched 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-toplevelIf 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-launcherThen restart the launcher processes: killall cosmic-launcher pop-launcher cosmic-toplevel 2>/dev/null || truePlease double-check the package names on your system before running the reinstall command. |
I used
This just complains about no bin target named In a blind attempt to get it working, I tried adding one to [[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. |


Summary
This updates
cosmic-launcherto 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
launcherPR:Launcher Pull Request
Changes
Testing
cargo fmtcargo checkChecklist