No description
The generic dnd_source+dnd_destination pairing didn't reliably fire
on intra-window reorders in this setup, while segmented_button's
built-in drag (same primitive powering tab_bar, which does work) is
proven. Switched the toolbar rendering to segmented_button::horizontal
with drag enabled — each segment carries its ToolbarAction as data.
App state:
- new toolbar_model: segmented_button::Model<SingleSelect>
- rebuild_toolbar_model() mirrors config.toolbar into the model on
every update_config (including the initial app.update_config at
startup)
- sync_toolbar_config_from_model() is the reverse: walk the model's
entity order after a reorder, write the new Vec<ToolbarAction>
directly via config.set_toolbar (without calling update_config so
we don't rebuild the model and wipe the reorder the user just did)
Messages:
- ToolbarTabActivate(Entity): look up action via model.data(), clear
the model's active selection (segmented_button single-select would
keep the last click highlighted; we don't want that for action
buttons), dispatch the action's message.
- ToolbarTabReorder(ReorderEvent): model.reorder then sync.
View:
- replaces the row-of-dnd-wrapped-icon-buttons with
segmented_button::horizontal(&self.toolbar_model)
.enable_tab_drag("x-cosmic-files/toolbar-dnd") .on_reorder(...) .on_activate(...)
- fixed 36-px square buttons so it still looks toolbar-y rather than
stretched pill-segmented-control
Kept: Settings panel ↑↓/add/remove UI (no regression).
Removed: dnd_source/dnd_destination wrappers from the toolbar (but
the ToolbarActionPayload + MIME constant remain in case Settings DnD
gets unstuck later).
|
||
|---|---|---|
| .github | ||
| cosmic-files-applet | ||
| debian | ||
| examples | ||
| i18n | ||
| res | ||
| samples | ||
| scripts | ||
| src | ||
| .gitignore | ||
| build.rs | ||
| Cargo.lock | ||
| Cargo.toml | ||
| i18n.toml | ||
| justfile | ||
| LICENSE | ||
| README.md | ||
| TESTING.md | ||
cosmic-files
File manager for the COSMIC desktop environment
Build the project from source
# Clone the project using `git`
git clone https://github.com/pop-os/cosmic-files
# Change to the directory that was created by `git`
cd cosmic-files
# Build an optimized version using `cargo`, this may take a while
cargo build --release
# Run the optimized version using `cargo`
cargo run --release
Community and Contributing
The COSMIC desktop environment is maintained by System76 for use in Pop!_OS. A list of all COSMIC projects can be found in the cosmic-epoch project's README. If you would like to discuss COSMIC and Pop!_OS, please consider joining the Pop!_OS Chat. More information and links can be found on the Pop!_OS Website.
License
This project is licensed under GPLv3