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-catalyst-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

Property Type Description
canDisplayRibbon boolean Whether the platform supports displaying the sidebar ribbon.
canExportPdf boolean Whether the platform supports exporting to PDF.
canPopoutWindow boolean Whether the platform supports popping out windows.
canSplit boolean Whether the platform supports splitting panes.
canStackTabs boolean Whether the platform supports stacking tabs.
isAndroidApp boolean We're running the Android app.
isDesktop boolean The UI is in desktop mode.
isDesktopApp boolean We're running the Electron-based desktop app.
isIosApp boolean We're running the iOS app.
isLinux boolean We're on a Linux device.
isMacOS boolean We'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.
isMobile boolean The UI is in mobile mode.
isMobileApp boolean We're running the Capacitor mobile app.
isPhone boolean We're in a mobile app that has very limited screen space.
isSafari boolean We're running in Safari. Typically used to provide workarounds for Safari bugs.
isTablet boolean We're in a mobile app that has sufficiently large screen space.
isWin boolean We're on a Windows device.
mobileDeviceHeight number Height of the mobile device screen in pixels.
mobileKeyboardHeight number Height of the software keyboard in pixels on mobile.
mobileSoftKeyboardVisible boolean Whether the software keyboard is currently visible on mobile.
resourcePathPrefix string The 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: