Skip to content

Repository files navigation

MagicDesk

MagicDesk is an open-source, DeX-style desktop environment for RedMagic devices. It turns RedMagic wired and wireless display output into a practical desktop workspace with native Android windows, a taskbar, Start menu, desktop shortcuts, global keyboard controls, notifications, and phone-based touchpad support.

MagicDesk is intended to be the RedMagic counterpart to Samsung DeX. It is not a port of DeX and is not affiliated with Samsung. It builds on Android's own desktop window manager and the external-display services already present in RedMagic firmware.

Development note: MagicDesk is a vibe-coded project, built primarily through iterative AI-assisted development and hands-on testing on real RedMagic hardware. Its Shizuku integration and undocumented vendor interfaces make independent source review especially important.

Project status: MagicDesk is under active development. The current firmware verification is limited to the RedMagic 11 Pro profile listed below.

MagicDesk running terminal and graphical applications in native desktop windows with the calendar panel open

MagicDesk running Termux and Firefox in overlapping native windows with the Hardware panel open

Why MagicDesk

RedMagic phones can drive an external display, but their stock interface does not provide the complete desktop workflow available in Samsung DeX. MagicDesk supplies that missing shell while continuing to use native Android tasks and RedMagic's existing projection stack.

The result is a familiar desktop model:

  • Android applications run in overlapping, resizable system windows with native WMShell decorations.
  • A persistent taskbar tracks real Android tasks and pinned applications.
  • Start, freely positioned desktop shortcuts, a global desktop folder, Android widgets, task switching, and Show Desktop provide normal mouse-driven navigation.
  • DeX-style global shortcuts manage windows without application-specific configuration.
  • The phone can remain available as a touchpad and text-input panel.
  • Fullscreen applications and in-app fullscreen video use the entire external display.

MagicDesk does not emulate Android applications, host them inside custom views, or replace Android's task organizer. Applications remain ordinary Android tasks managed by Android's ActivityTaskManager, WindowOrganizer, and WMShell.

MagicDesk And Samsung DeX

This comparison is deliberately scoped. The MagicDesk column describes behavior verified on a RedMagic 11 Pro (NX809J) running Android 16 and the firmware build listed under Requirements. Other RedMagic devices and OTA versions may behave differently. Samsung DeX capabilities also vary by Galaxy device and One UI version.

Capability MagicDesk on the verified RedMagic 11 Pro Samsung DeX
Wired external desktop Verified through USB-C DisplayPort and RedMagic Console Mode Built into supported Galaxy devices
Wireless desktop Verified through the stock SmartCast/Miracast picker and the common MagicDesk desktop session Supported on compatible Miracast displays
Desktop on the device display Runs the same desktop implementation directly on the phone or a tablet Standalone DeX is limited to selected Galaxy tablets and Z TriFold devices
Native overlapping windows Android freeform tasks with system WMShell captions Native DeX windows
Window management Resize, snap, maximize, minimize, true fullscreen, Show Desktop, and exact task switching Resize, arrange, minimize, maximize, fullscreen, and task switching
Application launch policy Explicit Auto, Windowed, and Fullscreen modes Resizable or fixed-size mode according to application compatibility
Keyboard and mouse Physical layouts, repeat, application right click, hot-plug, and DeX-style global shortcuts Integrated keyboard, mouse, and global shortcut support
Phone touchpad One MagicDesk touchpad for wired and wireless sessions, with drag, right click, scrolling, text input, and built-in gesture help Integrated DeX touchpad
Notifications and settings Desktop notification center plus a MagicDesk System panel; not a complete Android Quick Settings replacement System-integrated notifications and Quick Settings
Android widgets Native widgets with placement, resize, and configuration Desktop widgets are not currently supported
Desktop files A real /storage/emulated/0/Desktop directory with file and folder operations plus application drag-and-drop File workflows are primarily provided through My Files and application drag-and-drop
Capture Screenshots and configurable recording of the selected display with internal audio Samsung system screenshot and screen-recording tools; availability varies by device and software
Display controls Sink-reported output modes, refresh rate, per-monitor DPI, identification, and Fill display System-managed output behavior with device-dependent options
Device controls RedMagic bypass charging, cooling fan, liquid pump, and temperature controls No equivalent RedMagic hardware controls
Multiple workspaces Deliberately not implemented Up to four workspaces on selected Android 16 / One UI 8 devices
Setup and support Open source; requires Shizuku, Device Setup, and one reboot; currently experimental and firmware-specific Proprietary, built into supported Galaxy firmware, and product-supported by Samsung

Samsung documents its current wired, wireless, and standalone DeX modes, keyboard and mouse shortcuts, and desktop widget limitation. MagicDesk aims for the same everyday Android desktop workflow, not a claim of complete product parity: DeX remains more mature and deeply integrated, while MagicDesk adds RedMagic-specific controls, desktop files, widgets, diagnostics, and selected-display recording.

Highlights

Desktop workspace

  • Launch applications in Windowed or Fullscreen mode.
  • Keep multiple overlapping windows visible and switch exact tasks from the taskbar or with Alt+Tab.
  • Minimize windowed applications without pausing them, so media and background work can continue behind the desktop.
  • Send an existing task between the phone and active external desktop from its context menu without restarting the application.
  • Snap windows left or right, maximize them above the taskbar, or enter true fullscreen.
  • Pin applications to the taskbar or place shortcuts on the desktop.
  • Use /storage/emulated/0/Desktop as the normal desktop filesystem: create, open, rename, and delete files or folders directly from the desktop, and drag files between the desktop and application windows that support Android's global drag-and-drop protocol.
  • Add native Android widgets, move them on the desktop, and resize supported providers from their context menu.
  • Preserve the last visible freeform window layout across Show Desktop.
  • Keep desktop files, widgets, pins, shortcuts, and recent applications global across displays. Desktop-item and application-window positions use relative coordinates so the layout adapts to each display, while output mode, Fill display, and DPI remain per-monitor settings.
  • Remember an application's explicit Windowed or Fullscreen choice and its last freeform position for subsequent Auto launches.
  • Use the phone's current static wallpaper or choose a custom desktop wallpaper, center-cropped for the active display.

Desktop configuration is stored as an atomic, human-readable file at /storage/emulated/0/Desktop/.magicdesk/desktop.json; an optional custom wallpaper is stored beside it. The hidden directory is not shown as a desktop item. Runtime state, diagnostics, and Recent history remain private to the app. Android widget bindings remain system-managed and scoped to the installed app and Android user; neither kind of state is written into the desktop folder.

Desktop controls

  • Start menu with application search and keyboard navigation.
  • Open Tasks view with exact-task focus and close controls.
  • Right-click context menus in MagicDesk and ordinary applications.
  • Notification center with unread state, actions, dismissal, and transient notification popups.
  • Calendar panel, battery state, active keyboard-layout indicator, phone-screen control, screenshots, and configurable external-display recording with internal audio.
  • Connected-display identification, output resolution and refresh-rate selection, and an optional Fill display mode for sinks that otherwise add letterboxing.
  • Media-volume, connected audio-output, and phone-touchpad controls.
  • Stock RedMagic bypass-charging, cooling-fan, liquid-pump, and temperature controls through the vendor's own policy services.
  • Automatic external-desktop startup and window-layout restoration through Win+D.

Physical input

  • Native key repeat and physical keyboard layouts on the external display.
  • Ctrl+Space cycles through layouts exposed to Android by the active input method as enabled keyboard subtypes, in system order. An IME that exposes only one subtype cannot provide system-wide physical-keyboard switching.
  • Alt+Tab bypasses RedMagic's broken system Recents path while ordinary Tab, Shift+Tab, and Ctrl+Tab remain normal application input.
  • Right click reaches Chrome, Firefox, MagicDesk, and other applications instead of being converted to Android Back by RedMagic firmware.
  • Mouse hot-plug and multiple external keyboard or touchpad devices are handled without recreating the virtual devices or restarting applications.

Requirements

MagicDesk is intentionally RedMagic/ZTE-specific and requires:

  • a ZTE, nubia, or RedMagic device running Android 16 / API 36 or newer;
  • the official Shizuku application with its server running;
  • a one-time Device Setup and reboot to enable Android desktop windowing.

An external desktop requires either:

  • USB-C DisplayPort output and RedMagic external-display support; or
  • the stock RedMagic SmartCast/Miracast interface and a compatible wireless display receiver.

USB-C DisplayPort output is therefore not mandatory. Availability of wired and wireless projection depends on the phone model and firmware. Open desktop here runs the same desktop implementation on the device display without an external display.

MagicDesk does not run in a reduced fallback mode when Shizuku is stopped or permission is denied. All privileged operations use the same Shizuku UserService path, keeping runtime behavior predictable and reviewable.

Currently verified:

  • RedMagic 11 Pro (NX809J)
  • Android 16
  • Firmware fingerprint: REDMAGIC/NX809J-EEA/NX809J:16/BQ2A.250705.001-BP2A.250605.031.A3/20260204.221845:user/release-keys

Other models and OTA versions are treated as unverified. They can continue after an explicit warning so compatibility reports can identify missing or changed vendor hooks. Passing the baseline check does not guarantee every feature works on different firmware.

See Compatibility and issue reports before reporting a device-specific failure.

Install and start Shizuku

  1. Install Shizuku from the official GitHub Releases.
  2. Start its server using one of the methods supported by the official app.
  3. For the standard wireless-debugging method, enable Developer options: open Settings > About phone and tap Build number seven times, then enable Wireless debugging. In Shizuku, select pairing through Wireless debugging. In Android's Wireless debugging screen, choose Pair device with pairing code, enter that code through the Shizuku notification, then press Start in Shizuku.
  4. Confirm that Shizuku reports a running server before opening MagicDesk. Wireless-debugging and ADB startup must be repeated after every reboot; root-started Shizuku follows its own startup configuration.

Use the official Shizuku setup guide for device-specific pairing and startup details.

Getting Started

  1. Complete Install and start Shizuku above and confirm that its server is running. Starting it from a computer through ADB is also supported.
  2. Install MagicDesk from a tagged GitHub Release or build it from source.
  3. Launch MagicDesk on the phone and allow it through Shizuku.
  4. Press Prepare device. MagicDesk applies its app-specific permission and desktop-windowing configuration through Shizuku.
  5. Reboot when requested. Android and WMShell cache part of the desktop configuration during startup.
  6. Launch MagicDesk manually after reboot. It has no boot receiver and starts no service until the user opens it.

Notification access is optional. Grant it from Android settings to enable the MagicDesk notification center and notification popups.

Uninstalling

Before uninstalling MagicDesk, open Device Setup > Restore defaults, then restart the phone. Android does not allow MagicDesk to perform this cleanup automatically while it is being uninstalled.

If MagicDesk has already been removed, reinstall it, grant Shizuku access, run Restore defaults, and restart. The action does not depend on saved setup history. It removes the desktop-windowing overrides and resets the primary display size, density, and scaling to the defaults supplied by nubia.

Typical workflow

  1. Optionally connect a physical keyboard, mouse, or combined touchpad device.
  2. Launch MagicDesk on the phone.
  3. For a wired session, connect a USB-C display. If needed, select an Output mode reported by the display and enable Fill display to remove letterboxing, then select Start external desktop or press Win+D.
  4. For a wireless session with no display connected, select Start external desktop, then choose a Miracast receiver in the stock SmartCast interface. MagicDesk starts the desktop when Android reports the wireless display.
  5. Select Close desktop to return a wired display to screen mirroring or to disconnect a wireless display. Select Exit MagicDesk to stop MagicDesk and its background services completely.

The initial external-display DPI is selected from the display resolution; for 1920-pixel-wide displays the recommendation is 160. The DPI can be adjusted in the System panel, opened from the taskbar battery indicator or with Win+Q, and is remembered per monitor. Reset removes the MagicDesk density override.

Phone notification

MagicDesk keeps a persistent notification while it is running. It is useful when no physical keyboard or mouse is connected:

  • Tap the notification itself to perform the same context-sensitive action as Win+D: start the external desktop, show it, or restore the previous layout.
  • Tap Open touchpad to launch or reopen the MagicDesk phone-side touchpad for the active wired or wireless desktop.

The full desktop can also run on display 0 through Open desktop here, which supports tablets and allows development without an external monitor.

Keyboard Shortcuts

Shortcut Action
Win+D Start the external desktop, show it, or restore the previous window layout
Win+Up Move the active task to true fullscreen
Win+Down Restore fullscreen/maximized task to a window; press again to minimize
Win+Left / Win+Right Snap the active task to either half of the desktop
Alt+Tab / Alt+Shift+Tab Switch forward or backward through real Android tasks
Alt+F4 Close the active task
Win+Backspace Send Android Back to the active display
Win+L Lock the phone
Win+N Toggle the notification center
Win+Q Toggle the System panel
Win+Print Screen Save the active display under Pictures/Screenshots
Win+Shift+Print Screen Start or stop desktop recording with internal audio; save under Movies/MagicDesk
Ctrl+Space Select the next configured physical-keyboard layout
Win+/ Show all MagicDesk shortcuts
Escape Act as normal Escape in the active app and dismiss transient cross-application UI

The unmodified Win key is deliberately unused. The taskbar language indicator cycles the same configured layouts as Ctrl+Space.

Privileges And Trust

MagicDesk uses the official dev.rikka.shizuku UserService API for external desktop sessions, native task control, display density, screenshots, phone-screen dimming, locking, wallpaper access, vendor cooling and bypass charging, and physical input routing. MagicDesk does not independently acquire elevated privileges.

The trust boundaries are deliberately narrow:

  • The complete source and CI workflow are reviewable under the MIT license.
  • The main APK declares no Internet permission and contains no independent privilege-escalation path, kernel module, or kernel-module loader.
  • Shizuku is never downloaded, installed, or started by MagicDesk. The user controls the official manager and grants MagicDesk separately.
  • The connected UserService identity is included in Diagnostics; every supported Shizuku startup method uses the same commands and feature set.
  • The diagnostic Console executes only commands entered and confirmed by the user. Those commands are not restricted to MagicDesk's internal allowlists and have the effective privileges displayed by the Console.
  • MagicDesk changes only the four desktop settings documented under Device Setup. Restore defaults removes those overrides instead of guessing firmware values. The RedMagic property writer accepts only two hardcoded boolean/absent desktop properties.
  • The system ShellTaskOrganizer remains the only task organizer.
  • libmagicdesk_uinput_bridge.so and libmagicdesk_keyboard_bridge.so are rebuilt from their C sources in every build; no prebuilt input helper is checked in.
  • Lifecycle-bound streams make input and display guards fail open: losing the APK or Shizuku releases grabbed devices and restores display power.
  • Device and firmware mismatches are reported through structured Diagnostics codes instead of silently assuming compatibility.

Implementation details are in Architecture, the runtime and display contract is in Shizuku and display modes, and verified firmware behavior is recorded in the Nubia vendor interface audit.

Diagnostics And Issues

Open Tools > Diagnostics to generate a copyable compatibility report. It contains device and firmware identity, display/input information, desktop settings, capability probes, recent structured MagicDesk errors, and MagicDesk-only logcat entries. It excludes user files, accounts, notification contents, and the installed-application list.

Run desktop self-test is a manual black-box check for contributors and compatibility reports. With all desktop sessions closed (the external display may remain connected), it temporarily creates a simulated 1920x1080 display and exercises the production desktop, freeform, fullscreen, minimize/restore, taskbar geometry, native caption structure, native caption/resize input windows, and targeted application input, including recreation of the desktop Activity. It also checks the hidden Android and RedMagic APIs that can be inspected without connected hardware. Physical DisplayPort/EDID, Miracast transport, keyboards, mice, and Touch Panel remain explicitly marked NOT TESTED until those devices are present. Native mouse resize-cursor selection is checked when WMShell exposes its transition trace; otherwise it remains explicitly NOT TESTED because Android overlay displays do not render a readable hardware cursor. The test launches its window through the temporary task display area used for simulated displays. A one-shot shell task observer records the new window's first front-state and reports any transient fullscreen launch. It also moves an existing fullscreen phone task through the same path and verifies that its first state on the external display is already freeform. The eventual corrected state is never mistaken for the initial one. The simulated-display setting is owned by a lifecycle-bound Shizuku stream and restored when the test finishes or its process disconnects.

Debug builds expose the same lifecycle check as an instrumentation regression:

am instrument -w --user 0 \
  io.github.mekhontsev.magicdesk/.DesktopLifecycleInstrumentation

Diagnostics > Console runs one-off shell commands through the authorized Shizuku service. It shows the effective UID, requires confirmation before its first command, and does not retain command history.

Include the report, exact reproduction steps, and whether the problem survives a reboot when filing an issue.

Build

Install JDK 17, Android SDK platform/build-tools 37, and Android NDK r27 or newer. If Gradle cannot locate the SDK, create an untracked local.properties:

sdk.dir=/absolute/path/to/android-sdk

Build the debug APK:

./gradlew :app:assembleDebug

On Termux, install clang; the build uses $PREFIX/bin/clang. On conventional Linux, set ANDROID_NDK_HOME. The native input helpers are compiled from native/magicdesk_uinput_bridge.c and native/magicdesk_keyboard_bridge.c.

Releases And Signing

GitHub Actions lints and builds MagicDesk on every change. A v* tag runs the signed release workflow, verifies the APK contents and certificate, publishes its SHA-256 checksum, and creates a GitHub Release.

Official release APKs use this certificate SHA-256 fingerprint:

3A:F3:FE:F8:95:AC:BC:9C:B7:7B:FD:BB:7E:91:79:42:
95:70:72:14:97:E3:6E:C1:E4:19:68:C9:4B:52:99:50

Maintainer signing setup and encrypted CI secret names are described in Architecture.

Technical Documentation

Project

  • Author: Dmitry Mekhontsev
  • Main package: io.github.mekhontsev.magicdesk
  • Minimum SDK: 36
  • Target SDK: 36
  • License: MIT

Samsung DeX is a trademark of Samsung Electronics. Its name is used here only to describe the desktop-product category and interaction model.

About

Open-source DeX-style desktop environment for REDMAGIC devices, built on Android desktop windowing and Console Mode.

Topics

Resources

Stars

23 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages