Files tab counts (technical)

Patch for COSMIC Files. Each file manager writes its window title, tab count and the item count of the active tab to a file, so the taskbar can show “N tabs” or “M items” for file manager windows. COSMIC Files does not expose its tabs otherwise. User overview: files-tabs/README.md.

How it works

Folder icons from .directory

A second patch adds src/dir_icon.rs: a folder with a .directory file (the KDE/Dolphin convention) shows the icon named there instead of folder or the XDG special-folder icon.

COSMIC Files on the home folder: projects shows folder-development in the grid and folder-development-symbolic in the sidebar

[Desktop Entry]
Icon=folder-development

Installed files

files-tabs/build.sh (run by ./install.sh files-tabs) installs:

Path What
~/.local/bin/cosmic-files-tabs The patched file manager
~/.local/bin/cosmic-files Link to it. “Show in folder” in other apps (org.freedesktop.FileManager1, served by cosmic-files-applet) and other launches by name start cosmic-files from the session PATH, which has ~/.local/bin first.
~/.local/share/applications/com.system76.CosmicFiles.desktop Copy of the system entry pointing at the patched file manager (launcher, dock, folders opened through the inode/directory type)
~/.local/share/icons/hicolor/scalable/places/folder-development{,-symbolic}.svg The code folder icon for Icon=folder-development in a .directory file (COSMIC has none)
~/.local/state/files-tabs/built-commit Upstream commit it was built from
~/.cache/files-tabs/cosmic-files Upstream source clone

No D-Bus service override: no package ships an activatable org.freedesktop.FileManager1 service; cosmic-files-applet (desktop icons, started by the session) owns the name and starts cosmic-files by name. The desktop icons themselves stay the system cosmic-files-applet.

Commands

./install.sh files-tabs               build the installed cosmic-files version + patches, install per user
./install.sh --uninstall files-tabs   back to the system file manager
files-tabs/build.sh [--uninstall]     the same steps without the installer

Needs the same Rust toolchain as the taskbar, see taskbar. build.sh does not restart the panel and does not close file manager windows.

Configuration

None.

Limits