Commit graph

993 commits

Author SHA1 Message Date
11d435770e yoda: add ↑↓ buttons next to drag handle in toolbar editor
DnD source+destination wiring from 1cf17dc builds but the drag-drop
doesn't fire reliably in practice (suspected: either dnd_source's
shell.capture_event() on CursorMoved swallows events the destination
needs to see, or intra-window DnD has a Wayland-specific hiccup on the
current sctk/cosmic-comp pairing).

Adds two plain click-handled buttons per enabled row (↑ go-up-symbolic,
↓ go-down-symbolic, both disabled at list edges) so reorder is
functional regardless of DnD state. Backed by new messages
ToolbarMoveUp / ToolbarMoveDown that swap adjacent positions in the
Vec<ToolbarAction>.

The drag handle + DnD source/destination wrapping stays in place — if
DnD gets fixed upstream or on a future libcosmic it'll Just Work, and
the arrows remain as a keyboard-friendly fallback.
2026-04-24 08:29:07 +02:00
1cf17dcde8 yoda: phase 3 — drag-drop toolbar editor in Settings
Migrates the config model from the phase-2 bag-of-bools (ToolbarItems)
to an ordered Vec<ToolbarAction> so the user can pick BOTH the set of
buttons AND their order in the toolbar.

Config (config.rs):
- new ToolbarAction enum with 11 variants (LocationUp, Reload,
  NewFolder, NewFile, Rename, Delete, Cut, Copy, Paste,
  ToggleShowHidden, OpenTerminal) + to_u8/from_u8 for DnD payload
- Config.toolbar: Vec<ToolbarAction>, default = default_toolbar()
  (NewFolder, Rename, Delete, Cut, Copy, Paste — same 6 as phase 2)

Rendering (view()):
- iterate self.config.toolbar in order and emit a tooltip'd icon button
  per entry via the new toolbar_action_ui(action) helper shared with
  the Settings page. Paste stays disabled when clipboard empty.
- No hardcoded groups or auto-dividers anymore — order is 100% user.

Settings page (toolbar_settings_section):
- two stacked lists:
  * 'Toolbar': currently-enabled actions in their Vec order. Each row
    is wrapped in dnd_source (drags a ToolbarActionPayload carrying
    the enum discriminant) + dnd_destination (accepts drops from other
    rows, fires Message::ToolbarReorder { src, target } to move src
    before target in the Vec). A list-drag-handle icon + a minus button
    (ToolbarRemove) per row.
  * 'Available': actions not yet enabled, each with a plus button
    (ToolbarAdd) that pushes to the end of the Vec.
- 'Reset to defaults' button at the bottom (ToolbarReset).

DnD infra (app.rs top):
- TOOLBAR_MIME constant: 'application/x-cosmic-files-toolbar-action'
- ToolbarActionPayload(u8) with AsMimeTypes + AllowedMimeTypes +
  TryFrom<(Vec<u8>, String)> impls — single-byte wire format matching
  the enum discriminant.

Messages:
- ToolbarAdd(ToolbarAction) — append to toolbar vec if absent
- ToolbarRemove(ToolbarAction)
- ToolbarReorder { src, target } — remove src, reinsert before target
- ToolbarReset — restore default_toolbar()

i18n (en + fr):
- new keys: toolbar-available, toolbar-empty-hint, toolbar-reset

Migration: existing installs with a phase-2 ToolbarItems struct in
their config will error at load time (different shape); cosmic_config
falls back to Self::default() which gives the phase-2 minimal-6 set —
a safe reset rather than a broken partial read.
2026-04-24 08:13:30 +02:00
33a5c8ff99 yoda: phase 2 — customizable toolbar (settings toggles per button)
Phase 1 shipped a fixed 6-button toolbar. Phase 2 moves visibility to
the config so users pick which buttons appear.

Config (config.rs):
- new ToolbarItems struct (CosmicConfigEntry) with one bool per button
- Config.toolbar: ToolbarItems, default = 'minimal 6' set from phase 1
  (new_folder, rename, delete, cut, copy, paste) + 5 extras off
  (new_file, reload, toggle_show_hidden, open_terminal, location_up)

Rendering (view()):
- iterate through self.config.toolbar fields in fixed logical order
  (location → create/edit → clipboard → view toggles)
- dividers inserted only between non-empty groups
- whole toolbar hidden if every button is off (no empty container)

Settings page (settings()):
- new 'Toolbar' section with one toggler per button, wired through
  Message::SetToolbar(ToolbarItems) which persists via config_set!

i18n (en + fr):
- added 'toolbar' + 'parent-directory' strings
- reused existing new-folder / new-file / rename / delete / cut / copy /
  paste / reload-folder / show-hidden-files / open-in-terminal

All actions dispatch through Action::message so keybindings and toolbar
share one code path.
2026-04-24 07:53:49 +02:00
8b51af1632 yoda: use pencil-symbolic for the Rename toolbar button
document-edit-symbolic isn't in the Cosmic theme (checked Cosmic, Pop,
Adwaita, WhiteSur-dark ship lists) so it rendered empty. The Cosmic
theme ships pencil-symbolic which matches the edit/rename semantics
and is guaranteed to resolve through the current icon theme chain.
2026-04-24 07:48:53 +02:00
4b6d345139 yoda: fix missing rename icon in toolbar
edit-rename-symbolic isn't part of the COSMIC/Pop/Adwaita/WhiteSur-dark
icon sets, so the Rename button rendered empty. Swap to
document-edit-symbolic which is present in Adwaita (the standard fallback
in the freedesktop-icons resolution chain) and semantically fits edit/rename.
2026-04-24 07:43:13 +02:00
0595296609 yoda: Dolphin-style quick actions toolbar under the headerbar
Adds a full-width row of 6 icon buttons between the tab bar and the
tab view: New folder · Rename · Delete | Cut · Copy · Paste. Paste is
disabled when the clipboard is empty (existing self.clipboard_has_content
check). A vertical divider separates file-ops (3 first) from clipboard
ops (3 last).

Implementation reuses Action::message(entity_opt = None) so keybinding
and toolbar dispatch share exactly the same code path — no duplication.
Icons are freedesktop *-symbolic names so they inherit the COSMIC
theme's symbolic color. Tooltips use the existing fl!() strings
(new-folder / rename / delete / cut / copy / paste, EN + FR).

Customization (pick which buttons show up) is deferred to a follow-up
commit — this first pass is fixed at the minimal-6 set per the user's
spec.
2026-04-24 07:38:17 +02:00
e8d62ae43d yoda: add "Always use this app" toggle to OpenWith dialog
The 'Open with...' dialog let you pick an app but never remembered your
choice — you'd see the same dialog again next time. The infrastructure
was already there (MimeAppCache::set_default writes to mimeapps.list),
just never wired to the UI.

Adds a toggler below the app list labelled 'Always use this app for this
file type' (EN) / 'Toujours utiliser cette application pour ce type de
fichier' (FR). When enabled, after spawning the selected app, the
default handler for the file's mime type is persisted via
self.mime_app_cache.set_default(mime, app.id).

Implementation:
- DialogPage::OpenWith gains a set_default: bool field (defaulted false)
- Message::OpenWithToggleDefault(bool) + handler mutates the dialog state
- DialogComplete handler for OpenWith calls set_default after a clean
  spawn when the flag is set
- Dialog rendering adds a .control(widget::row) with label + toggler,
  between the scrollable list and the action buttons
- i18n strings added: en/fr open-with-set-default
2026-04-23 20:18:21 +02:00
a025fd6380 yoda: prefer cosmic-yoterm over upstream cosmic-term in terminal fallback
mime_app::MimeAppCache::terminal() hardcoded "com.system76.CosmicTerm"
as the only non-xdg-default fallback. On a yoda stack the relevant
terminal is our fork cosmic-yoterm (desktop id com.aditua.CosmicYoterm),
so we add it first in preference_order. xdg-mime default still wins
when set — this just covers the case where it isn't.

Fixes "Open in terminal" launching Konsole (or first random terminal in
apps list) instead of cosmic-yoterm when xdg-mime default is unset or
points to something else.
2026-04-23 19:17:26 +02:00
Jeremy Soller
4afacccc8a Fix windows compilation issues 2026-04-17 13:31:55 -06:00
Jeremy Soller
8c57060db2 Only use uzers on unix, do not fork on mac 2026-04-17 12:54:33 -06:00
Jeremy Soller
62bfcc3550 Put libcosmic/desktop behind desktop feature 2026-04-17 12:54:33 -06:00
Jeremy Soller
9c0eb63b82 Refactor trash handling to improve portability 2026-04-17 12:54:33 -06:00
Jeremy Soller
b895b07bb2
Merge pull request #1742 from pop-os/mtp
Fix unsupported errors when copying large files over MTP
2026-04-16 15:51:33 -06:00
Levi Portenier
afca6aef73
Merge pull request #1735 from hojjatabdollahi/hojjat/select-until-last
feat: select file name until the extension in rename and save dialog
2026-04-15 11:14:40 -06:00
Michael Aaron Murphy
1c4ab75814
fix: gate gio file copy fallback with gvfs feature 2026-04-14 17:15:19 +02:00
Michael Aaron Murphy
e21989aaa3
chore: use compio::fs::rename for quick renames 2026-04-14 17:04:53 +02:00
Michael Aaron Murphy
15e40461e5
fix: do not generate thumbnail if file is being written 2026-04-14 17:04:53 +02:00
Michael Aaron Murphy
0bd20e57e7
refactor: use select macro for gio copy futures 2026-04-14 17:04:53 +02:00
Michael Aaron Murphy
e35d5123f0
perf: avoid holding async mutex guards across await points
tokio recommends using a sync mutex with a notifier instead of the
async mutex where possible. Rust forbids holding a sync mutex guard
across await points so we can prevent a potential deadlock this way.

This adds a custom channel based on the tokio mpmc example for
handling gvfs events from callbacks to avoid the async mutex
requirement. Messages are held in a `VecDeque` behind a sync mutex
and the receiver will get notified via the notifier when a message
is added to the queue.

Weak references used in gio callbacks in case the sender is dropped
by the application.
2026-04-14 17:04:48 +02:00
Michael Aaron Murphy
971374f60b
perf: use atomics for controller progress and state 2026-04-14 16:51:51 +02:00
Michael Aaron Murphy
93dd775f3c
perf: get image dimensions from background thread
This caused the tab subscription to block the tokio executor.
Instead store the image dimensions in the `Item`, which is
created on a background thread.
2026-04-14 16:51:51 +02:00
Michael Aaron Murphy
e2bdcf8da4
fix: use gio file copy fallback to fix MTP unsupported I/O errors 2026-04-14 16:51:51 +02:00
Michael Aaron Murphy
b299f1a172
chore: add methods to Controller to pause and unpause futures
- Use `Controller::until_paused` as a signal in a select to pause futures
- Use `Controller::until_unpaused` to block futures in a select loop
2026-04-14 16:51:51 +02:00
Michael Aaron Murphy
c114759c9e
chore: use tracing for structured logs 2026-04-14 16:51:51 +02:00
sandroid
91243b99b5 feat: repeat a key to cycle through items in type-to-select mode 2026-04-13 16:24:28 -04:00
sandroid
da05a85fc5 feat: start type-to-select search from the current focus 2026-04-13 16:24:28 -04:00
Hojjat
fc25260a5f feat: select file name until the extension in rename and save dialog 2026-04-13 12:06:49 -06:00
Ashley Wulber
1c1f8fdf6e fix: retry reading clipboard if data is empty 2026-04-13 11:53:25 -06:00
Ashley Wulber
cf328771c3 fix: handle slight delay in availability of clipboard data
a better fix in the future would probably be an event indicating availability of the data.
2026-04-13 11:53:25 -06:00
Jeremy Soller
175f8ba724
Merge pull request #1728 from darkfated/add-context-actions
Add user-defined context actions
2026-04-10 15:42:42 -06:00
darkfated
ad0e66dceb Fix: remove context actions from open/save dialog 2026-04-10 02:58:20 +03:00
Hojjat
b17f8889a8 chore: update to the latest libcosmic 2026-04-08 15:15:48 -06:00
Ashley Wulber
9547da2b25 fix: reset focus when opening a new tab 2026-04-07 15:39:29 -06:00
Jeremy Soller
781e99d293 Use row, column with_capacity 2026-04-06 18:08:44 -06:00
User
079c82ee43 fix: assign replace dialog button id 2026-04-06 15:12:13 -06:00
darkfated
39281a6336 Add user-defined context actions 2026-04-06 06:16:27 +03:00
Jonatan Pettersson
23b5d98dcc feat: set placeholder for permission dropdowns 2026-04-02 13:43:03 -06:00
Jonatan Pettersson
4c6f2db5f2 feat: join multiple operations
Allow for joining operations into a single Task that
will produce a single Message:PendingResults message such
that multiple Message::PendingComplete and Message::PendingError
messages can be handled together to, for example, show
a single error dialog with multiple errors.
2026-04-02 13:43:03 -06:00
Jonatan Pettersson
41cdf89604 feat: allow setting permissions in multi preview
This adds a Message::ShiftPermissions to handle setting
permissions for user, group or other for either 1 or
more items and a Command::SetMultiplePermissions to
set permissions on multiple items at the same time.

The permission dropdown will only have a selection if
all selected items have the same permission, otherwise it
will be empty but still allow changing.

Up to 5 owners and groups will be displayed for all
selected items with an ellipses if there are more.

The OperationSelection for setting permissions now also
returns the path as selected such that the tab will be re-scanned
and update the dropdown to correctly.
2026-04-02 13:43:03 -06:00
Jonatan Pettersson
17325a5f5a feat: add open-with in multi preview
Adds the ability to set the open-with setting for
multiple selected items. This setting will only appear
if all selected items have the same mime type.
2026-04-02 13:43:03 -06:00
Josh Megnauth
e50c41aa24 fix: Respect show_recents conf in dialog
Closes: #1698
2026-03-27 13:04:03 -06:00
Ashley Wulber
75fe043e73 fix: don't read files if list empty 2026-03-26 16:42:36 +01:00
Levi Portenier
0b7294d4e4
Merge pull request #1699 from jasonrhansen/open-item-location
feat: add 'Open item location' to search
2026-03-24 15:14:12 -06:00
Ashley Wulber
3a88d7fcf7 fix: update cached clipboard 2026-03-24 16:29:56 -04:00
Ashley Wulber
f6ca0cb460 cleanup 2026-03-24 16:29:56 -04:00
Vukašin Vojinović
6e2eafe16c chore: clippy 2026-03-24 11:25:59 -06:00
Vukašin Vojinović
3b1bc4430b refactor: use jiff instead of chrono 2026-03-24 11:25:59 -06:00
Vukašin Vojinović
4414d2f4b2 chore: update dependencies
Also utilizes the `jxl-oxide` image decoding hook.
2026-03-24 11:25:59 -06:00
Jason Rodney Hansen
b041feec48 feat: add 'Open item location' to search 2026-03-20 08:41:19 -06:00
Ashley Wulber
360973175c
feat: rebase libcosmic onto iced 0.14 2026-03-13 21:04:17 +01:00