Modules

Modules refer to the features provided by mika-shell. This section explains how to use these features within a frontend project. There is a separate chapter covering the capabilities of each module in detail.

Native HTML

You can call modules on the globalThis.mikaShell object:

mikaShell.os.getSystemInfo().then(info => {
  console.log(info);
})

Using TypeScript

In TypeScript, you can still call modules through the globalThis.mikaShell object, but there is a better approach.

Install the @mika-shell/core and optional @mika-shell/extra packages via npm or another package manager:

npm install @mika-shell/core @mika-shell/extra

Since this is still in the testing phase, the npm package may be outdated. Please get the latest version from Releases!!!

npm install https://github.com/MikaShell/mika-shell/releases/download/latest/mika-shell-core-xxx.tgz
npm install https://github.com/MikaShell/mika-shell/releases/download/latest/mika-shell-extra-xxx.tgz
  • @mika-shell/core includes everything in globalThis.mikaShell. In fact, @mika-shell/core mainly provides type definitions.
  • @mika-shell/extra builds on @mika-shell/core and offers additional modules such as hyprland.

What’s Next?

Check the example for more inspiration.

In the example, you may see globalThis.mikaShell or window.mikaShell. If you’re using TypeScript, you can also import modules like this:

import { os } from '@mika-shell/core';

This is equivalent to:

const os = globalThis.mikaShell.os;
// or
const os = window.mikaShell.os;
// or
const os = mikaShell.os;

All module calls provided by mika-shell are asynchronous, so you need to use async/await or .then() to get results. Keep this in mind at all times.