Skip to content

PlatformEx

Unofficial

Due to limitations of TypeScript, we cannot extend the obsidian#Platform constant directly.

Import:

import type { PlatformEx } from '@obsidian-typings/obsidian-public-latest';

Example:

import { Platform } from 'obsidian';
import type { PlatformEx } from 'obsidian-typings';
const platformEx = Platform as PlatformEx;
console.log(platformEx.canDisplayRibbon);

Signature:

export interface PlatformEx

Properties

PropertyTypeDescription
buildstringThe version of the installer that shipped this app. It advances independently of PlatformEx.version and determines which Electron version the app runs on.
canDisplayRibbonbooleanWhether the platform supports displaying the sidebar ribbon.
canExportPdfbooleanWhether the platform supports exporting to PDF.
canOpenExternalFilesbooleanWhether the platform supports opening files that live outside the vault. It gates the app:open-file command, dropping files from the OS onto the tab bar, and the external-file fallback in the vault path lookups.
canPinSidebarbooleanWhether the platform supports pinning the sidebar.
canPopoutWindowbooleanWhether the platform supports popping out windows.
canSplitbooleanWhether the platform supports splitting panes.
canStackTabsbooleanWhether the platform supports stacking tabs.
deviceNamestringThe name of the device. On desktop this is the host name of the machine.
hasPhysicalKeyboardbooleanWhether a hardware keyboard is attached. Always true in the desktop app.
isAndroidAppbooleanWe're running the Android app.
isDesktopbooleanThe UI is in desktop mode.
isDesktopAppbooleanWe're running the Electron-based desktop app.
isIosAppbooleanWe're running the iOS app.
isLinuxbooleanWe're on a Linux device.
isMacOSbooleanWe're on a macOS device, or a device that pretends to be one (like iPhones and iPads). Typically used to detect whether to use command-based hotkeys vs ctrl-based hotkeys.
isMobilebooleanThe UI is in mobile mode.
isMobileAppbooleanWe're running the Capacitor mobile app.
isPhonebooleanWe're in a mobile app that has very limited screen space.
isSafaribooleanWe're running in Safari. Typically used to provide workarounds for Safari bugs.
isTabletbooleanWe're in a mobile app that has sufficiently large screen space.
isWinbooleanWe're on a Windows device.
manufacturerstringThe manufacturer of the device. Empty on desktop.
mobileDeviceHeightnumberHeight of the mobile device screen in pixels.
mobileKeyboardHeightnumberHeight of the software keyboard in pixels on mobile.
mobileSoftKeyboardVisiblebooleanWhether the software keyboard is currently visible on mobile.
modelstringThe model of the device. Empty on desktop.
osNamestringThe name of the operating system. On desktop this is the descriptive version string, such as Windows 11 Pro.
osVersionstringThe version of the operating system. On desktop this is the kernel release, such as 10.0.26200.
resourcePathPrefixstringThe path prefix for resolving local files on this platform. This returns: - file:/// on mobile. - app://random-id/ on desktop (Replaces the old format of app://local/).
supportsIndexedDbbooleanWhether IndexedDB is available on this platform. Features that need it are disabled when it is not.
versionstringThe version of the Obsidian app.

Links to this page: