mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-31 18:13:38 +01:00
Wallpaper (macOS): add support
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#include "wallpaper.h"
|
||||
#include "common/settings.h"
|
||||
#include "util/apple/osascript.h"
|
||||
|
||||
const char* ffDetectWallpaper(FF_MAYBE_UNUSED const FFinstance* instance, FFstrbuf* result)
|
||||
{
|
||||
// https://stackoverflow.com/questions/301215/getting-desktop-background-on-mac
|
||||
|
||||
#ifdef FF_HAVE_SQLITE3
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY path;
|
||||
ffStrbufInitCopy(&path, &instance->state.platform.homeDir);
|
||||
ffStrbufAppendS(&path, "Library/Application Support/Dock/desktoppicture.db");
|
||||
if (ffSettingsGetSQLite3String(instance, path.chars,
|
||||
"SELECT value\n"
|
||||
"FROM preferences\n"
|
||||
"JOIN data ON preferences.data_id=data.ROWID\n"
|
||||
"JOIN pictures ON preferences.picture_id=pictures.ROWID\n"
|
||||
"JOIN displays ON pictures.display_id=displays.ROWID\n"
|
||||
"JOIN spaces ON pictures.space_id=spaces.ROWID\n"
|
||||
"WHERE display_id=1 AND space_id=1 AND key=1", result)
|
||||
)
|
||||
return NULL;
|
||||
|
||||
#endif
|
||||
|
||||
if (!ffOsascript("tell application \"Finder\" to get POSIX path of (get desktop picture as alias)", result))
|
||||
return "ffOsascript() failed";
|
||||
|
||||
return NULL;
|
||||
}
|
||||
Reference in New Issue
Block a user