Open probonopd opened 3 years ago
The Mac is using .DS_Store
files to save properties of the window including icon size and position. Unfortunately that format is largely undocumented but has been reverse engineered to some extent, see https://metacpan.org/dist/Mac-Finder-DSStore/view/DSStoreFormat.pod. Seems rather complex and not all of it is understood.
helloSystem is using a combination of extended attributes in the file system, and (optionally) .DirInfo
files.
Trying to simplify things, we should possibly do something similar for backgrounds and just make filer use background files if present, similar to how it uses .DirIcon
and .VolumeIcon.icns
already. In Firefox 106.0.dmg
, the file in question is stored in .background/background.png
; however this is not standardized because on macOS, .DS_Store
tells macOS where to load this from. Skype-8.89.0.403.dmg
, for example, uses .hidden/background.tiff
. Argh!
Inserting the following in void MainWindow::updateUIForCurrentPage()
above updateViewMenuForCurrentPage();
almost works as intended:
// Apply background
qDebug() << "probono: tabPage->viewMode():" << tabPage->viewMode();
// FIXME: This always seems to return 1, which is Fm::FolderView::IconMode
if (tabPage->viewMode() == Fm::FolderView::IconMode || tabPage->viewMode() == Fm::FolderView::ThumbnailMode) {
QString backgroundFile = tabPage->pathName() + "/.background/background.png";
qDebug() << "probono: check for background:" << backgroundFile;
if (QFile::exists(backgroundFile)) {
QString ss = "background-image:url(" + backgroundFile +")";
// qDebug() << "probono: ss:" << ss;
tabPage->setStyleSheet(ss);
}
}
But:
tabPage->viewMode()
seems to always return 1
(which means Fm::FolderView::IconMode
). Why?MainWindow::updateUIForCurrentPage()
apparently doesn't get called when the user switches the view mode. So probably this code needs to go elsewehre. Where?.background/background.png
as the location for window backgrounds. We would need to parse those dreaded .DS_Store
files for full Mac background location support; as a stop-gap measure something like strings 'strings .DS_Store' | grep -i Background | grep ^/ | tail -n 1
might be a reasonably intelligent guess?# Skype
FreeBSD% strings '.DS_Store' | grep -i Background | grep ^/
/.background/background.png
# Firefox
FreeBSD% strings '.DS_Store' | grep -i Background | grep ^/
/.hidden/background.tiff
https://github.com/al45tair/ds_store/blob/master/doc/index.rst
On the Mac, this kind of information is stored in
.DS_Store
files, which can be parsed, e.g., using the https://github.com/al45tair/ds_store tool written in Python.