diff options
author | Aylur <[email protected]> | 2024-09-07 18:13:54 +0000 |
---|---|---|
committer | Aylur <[email protected]> | 2024-09-07 18:13:54 +0000 |
commit | 191d5e538d7eb2b57cd93919284200d049bc9c0e (patch) | |
tree | f0dbdf92afe4b3ff7d1736c9ae70379328db1ee0 | |
parent | e06ae737ef0a29e98363d6453ae3049aed164a64 (diff) |
docs: apps page
also add icons
-rw-r--r-- | docs/.vitepress/theme/index.ts | 5 | ||||
-rw-r--r-- | docs/README.md | 2 | ||||
-rw-r--r-- | docs/ags/installation.md | 14 | ||||
-rw-r--r-- | docs/getting-started/installation.md | 18 | ||||
-rw-r--r-- | docs/libraries/apps.md | 95 | ||||
-rw-r--r-- | docs/libraries/libastal.md | 1 | ||||
-rw-r--r-- | docs/package-lock.json | 8 | ||||
-rw-r--r-- | docs/package.json | 3 | ||||
-rw-r--r-- | docs/vitepress.config.ts | 50 |
9 files changed, 143 insertions, 53 deletions
diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index 603dd29..a2ca770 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -1,4 +1,5 @@ -import DefaultTheme from 'vitepress/theme' -import '../../vitepress.theme.css' +import DefaultTheme from "vitepress/theme" +import "../../vitepress.theme.css" +import "devicon/devicon.min.css" export default DefaultTheme diff --git a/docs/README.md b/docs/README.md index 6592cf4..6a2f6c5 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,7 +8,7 @@ Hosted at [aylur.github.io/astal](https://aylur.github.io/astal/) and [aylur.git | Command | Action | | :---------------- | :------------------------------------------ | | `npm install` | Installs dependencies | -| `npm run dev` | Starts local dev server at `localhost:4321` | +| `npm run dev` | Starts local dev server at `localhost:5173` | | `npm run build` | Build your production site to `./dist/` | | `npm run preview` | Preview your build locally | diff --git a/docs/ags/installation.md b/docs/ags/installation.md index 5653cd1..974d4f1 100644 --- a/docs/ags/installation.md +++ b/docs/ags/installation.md @@ -21,26 +21,18 @@ nix run github:aylur/ags/v2 -- --help :::code-group -```sh [Arch] +```sh [<i class="devicon-archlinux-plain"></i> Arch] sudo pacman -Syu go npm gjs ``` -```sh [Fedora] +```sh [<i class="devicon-fedora-plain"></i> Fedora] sudo dnf install golang npm gjs ``` -```sh [Alpine] -sudo apk add go npm gjs -``` - -```sh [Ubuntu] +```sh [<i class="devicon-ubuntu-plain"></i> Ubuntu] sudo apt install golang-go npm gjs ``` -```sh [openSUSE] -sudo zypper install go npm gjs -``` - ::: 3. Clone the repo and Install diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 945e70b..bbdced9 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -35,26 +35,18 @@ cd astal/core :::code-group -```sh [Arch] +```sh [<i class="devicon-archlinux-plain"></i> Arch] sudo pacman -Syu meson vala gtk3 gtk-layer-shell gobject-introspection ``` -```sh [Fedora] -sudo dnf install meson gcc valac gtk3-devel gtk-layer-shell-devel +```sh [<i class="devicon-fedora-plain"></i> Fedora] +sudo dnf install meson gcc valac gtk3-devel gtk-layer-shell-devel gobject-introspection-devel ``` -```sh [Alpine] -sudo apk add meson g++ vala gtk+3.0-dev gtk-layer-shell-dev gobject-introspection-dev -``` - -```sh [Ubuntu] +```sh [<i class="devicon-ubuntu-plain"></i> Ubuntu] sudo apt install meson valac libgtk3-dev libgtk-layer-shell-dev gobject-introspection ``` -```sh [openSUSE] -sudo zypper install gcc meson vala gtk3-devel gtk-layer-shell-devel gobject-introspection-devel -``` - ::: 3. Build and install with `meson` @@ -64,7 +56,7 @@ meson setup build meson install -C build ``` -:::info +:::tip Most distros recommend manual installs in `/usr/local`, which is what `meson` defaults to. If you want to install to `/usr` instead which most package managers do, set the `prefix` option: diff --git a/docs/libraries/apps.md b/docs/libraries/apps.md index a5c617f..85aa8ae 100644 --- a/docs/libraries/apps.md +++ b/docs/libraries/apps.md @@ -1 +1,96 @@ # Apps + +Library and CLI tool for querying and launching +applications that have a corresponding `.desktop` file. + +## Installation + +1. install dependencies + +:::code-group + +```sh [<i class="devicon-archlinux-plain"></i> Arch] +sudo pacman -Syu meson vala json-glib gobject-introspection +``` + +```sh [<i class="devicon-fedora-plain"></i> Fedora] +sudo dnf install meson gcc valac json-glib-devel gobject-introspection-devel +``` + +```sh [<i class="devicon-ubuntu-plain"></i> Ubuntu] +sudo apt install meson valac libjson-glib-dev gobject-introspection +``` + +::: + +2. clone repo + +```sh +git clone https://github.com/aylur/astal.git +cd astal/lib/apps +``` + +3. clone repo + +```sh +meson setup build +meson install -C build +``` + +:::tip +Most distros recommend manual installs in `/usr/local`, +which is what `meson` defaults to. If you want to install to `/usr` +instead which most package managers do, set the `prefix` option: + +```sh +meson setup --prefix /usr build +meson install -C build +``` + +::: + +## Usage + +You can browse the [Apps reference](https://aylur.github.io/libastal/apps). + +### CLI + +```sh +astal-apps --help +``` + +### Library + +:::code-group + +```js [<i class="devicon-javascript-plain"></i> JavaScript] +import Apps from "gi://AstalApps" + +const apps = new Apps.Apps({ + includeEntry: true, + includeExecutable: true, +}) + +print(apps.fuzzy_query("spotify") + .map(app => app.name) + .join("\n")) +``` + +```py [<i class="devicon-python-plain"></i> Python] +# Not yet documented, contributions are appreciated +``` + +```lua [<i class="devicon-lua-plain"></i> Lua] +-- Not yet documented, contributions are appreciated +``` + +```vala [<i class="devicon-vala-plain"></i> Vala] +// Not yet documented, contributions are appreciated +``` + +::: + +:::info +The fuzzy query uses [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance). I am not a mathematician, but if you know how to reimplement +the logic of [fzf](https://github.com/junegunn/fzf) to make it better feel free to open PRs. +::: diff --git a/docs/libraries/libastal.md b/docs/libraries/libastal.md deleted file mode 100644 index b89f702..0000000 --- a/docs/libraries/libastal.md +++ /dev/null @@ -1 +0,0 @@ -# Astal diff --git a/docs/package-lock.json b/docs/package-lock.json index 3dc0cd8..0fe63a0 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -5,6 +5,9 @@ "packages": { "": { "name": "docs", + "dependencies": { + "devicon": "^2.16.0" + }, "devDependencies": { "vitepress": "^1.3.4", "vitepress-plugin-auto-sidebar": "^1.2.0", @@ -1485,6 +1488,11 @@ "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", "dev": true }, + "node_modules/devicon": { + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/devicon/-/devicon-2.16.0.tgz", + "integrity": "sha512-PE5a2HBNeN4av+Iu975OiiWEwS8LJPw5HAvlv0JUHb62jZTdYxTpz4ga+cQyvdtb3x1side2P9Sr1mmOmUkO/g==" + }, "node_modules/entities": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", diff --git a/docs/package.json b/docs/package.json index 170a709..173f230 100644 --- a/docs/package.json +++ b/docs/package.json @@ -11,5 +11,8 @@ "build": "vitepress build", "preview": "vitepress preview", "vitepress": "vitepress" + }, + "dependencies": { + "devicon": "^2.16.0" } } diff --git a/docs/vitepress.config.ts b/docs/vitepress.config.ts index 4e2529b..455020f 100644 --- a/docs/vitepress.config.ts +++ b/docs/vitepress.config.ts @@ -1,4 +1,4 @@ -import { defineConfig } from 'vitepress' +import { defineConfig } from "vitepress" function github(url = "") { return `https://github.com/aylur/astal${url}` @@ -16,7 +16,7 @@ export default defineConfig({ ignoreDeadLinks: true, // FIXME: head: [ - ['link', { rel: 'icon', href: '/astal/favicon.ico' }], + ["link", { rel: "icon", href: "/astal/favicon.ico" }], ], themeConfig: { @@ -24,45 +24,45 @@ export default defineConfig({ // nav: [{ - text: '0.1.0', + text: "0.1.0", items: [ - { text: 'Contributing', link: github("/blob/main/CONTRIBUTING.md") }, - { text: 'Changelog', link: github("/blob/main/CHANGELOG.md") }, + { text: "Contributing", link: github("/blob/main/CONTRIBUTING.md") }, + { text: "Changelog", link: github("/blob/main/CHANGELOG.md") }, ], }], sidebar: [ { - text: 'Getting Started', + text: "Getting Started", base: "/getting-started", collapsed: false, items: [ - { text: 'Introduction', link: '/introduction' }, - { text: 'Installation', link: '/installation' }, - { text: 'Supported Languages', link: '/supported-languages' }, + { text: "Introduction", link: "/introduction" }, + { text: "Installation", link: "/installation" }, + { text: "Supported Languages", link: "/supported-languages" }, ], }, { - text: 'AGS', + text: "AGS", base: "/ags", collapsed: false, items: [ - { text: 'Installation', link: '/installation' }, - { text: 'First Widgets', link: '/first-widgets' }, - { text: 'Theming', link: '/theming' }, - { text: 'CLI and App', link: '/cli-app' }, - { text: 'Widget', link: '/widget' }, - { text: 'Utilities', link: '/utilities' }, - { text: 'Variable', link: '/variable' }, - { text: 'FAQ', link: '/faq' }, + { text: "Installation", link: "/installation" }, + { text: "First Widgets", link: "/first-widgets" }, + { text: "Theming", link: "/theming" }, + { text: "CLI and App", link: "/cli-app" }, + { text: "Widget", link: "/widget" }, + { text: "Utilities", link: "/utilities" }, + { text: "Variable", link: "/variable" }, + { text: "FAQ", link: "/faq" }, ], }, { - text: 'Libraries', + text: "Libraries", collapsed: true, items: [ - { text: 'References', link: '/libraries/references' }, - { text: "Astal", link: "/libraries/libastal" }, + { text: "References", link: "/libraries/references" }, + { text: "Astal", link: "https://aylur.github.io/libastal" }, { text: "Apps", link: "/libraries/apps" }, { text: "Auth", link: "/libraries/auth" }, { text: "Battery", link: "/libraries/battery" }, @@ -80,17 +80,17 @@ export default defineConfig({ ], socialLinks: [ - { icon: 'github', link: github() }, - { icon: 'discord', link: '"https://discord.gg/CXQpHwDuhY"' }, + { icon: "github", link: github() }, + { icon: "discord", link: "https://discord.gg/CXQpHwDuhY" }, ], editLink: { pattern: github("/edit/main/docs/:path"), - text: 'Edit this page on GitHub', + text: "Edit this page on GitHub", }, lastUpdated: { - text: 'Last updated', + text: "Last updated", }, search: { |