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
canDisplayRibbonbooleanWhether the platform supports displaying the sidebar ribbon.
canExportPdfbooleanWhether the platform supports exporting to PDF.
canPopoutWindowbooleanWhether the platform supports popping out windows.
canSplitbooleanWhether the platform supports splitting panes.
canStackTabsbooleanWhether the platform supports stacking tabs.
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.
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.
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/).

Links to this page: