Skip to content

Commit

Permalink
Adding mdBook documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jzbor committed Nov 7, 2023
1 parent 8aebf52 commit b577e1e
Show file tree
Hide file tree
Showing 20 changed files with 194 additions and 100 deletions.
32 changes: 27 additions & 5 deletions .github/workflows/docs-github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: 'latest'
- run: mdbook build .
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './target/book'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

- name: Install X11 dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
Expand All @@ -25,21 +38,30 @@ jobs:
with:
command: doc
args: --no-deps
- name: Create forwarding to actual index.html
run: echo '<meta http-equiv="refresh" content="0; url=marswm">' > ./target/doc/index.html
# - name: Create forwarding to actual index.html
# run: echo '<meta http-equiv="refresh" content="0; url=marswm">' > ./target/doc/index.html
- name: Fix file permissions
shell: sh
run: |
chmod -c -R +rX "target/doc" |
while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Copy stuff around
shell: sh
run:
mkdir output
cp -r target/book output/
cp -r target/doc output/crate

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './target/doc'
path: './output'
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

13 changes: 13 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[book]
authors = ["jzbor"]
language = "en"
multilingual = false
src = "docs"
title = "MARSWM Documentation"

[build]
build-dir = "target/book"

[output.html]
default-theme = "rust"
preferred-dark-theme = "ayu"
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book
12 changes: 12 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Summary
- [Introduction](introduction.md)
- [Installation](./installation.md)
- [Quick Start](./quickstart.md)
- [Configuration](./configuration.md)
- [marswm](./marswm.md)
- [marsbar](./marswm.md)
- [Examples](./examples.md)
- [mars-status.sh](examples/mars-status.md)
- [touchegg.conf](examples/touchegg.md)
- [wallpaper-daemon.sh](examples/wallpaper-daemon.md)
- [xdg-xmenu.py](examples/xdg-xmenu.md)
1 change: 1 addition & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Configuration
19 changes: 19 additions & 0 deletions docs/examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Examples
This chapter contains a couple of example scripts and configurations.
All examples are available on [Github](https://github.com/jzbor/marswm/tree/master/examples).

## Installing Configurations
Most config files go into `~/.config/<program>/<program>.<suffix>`.
For example marswm's main config goes into `~/.config/marswm/marswm.yaml`.

## Installing Scripts
To install a script you will first need to install all of its dependencies.

Then place the script into a directory that is listed in your `$PATH`.
It is suggested to use `~/.local/bin/` to store all of your personal scripts.
You can check if that is in your path with `echo $PATH` and add it to your `~/.profile` otherwise.

You will also have to make the script executable:
```sh
chmod +x <script>
```
13 changes: 13 additions & 0 deletions docs/examples/mars-status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# `mars-status.sh`

Dependencies:
* `canberra-gtk-play` ([`libcanberra-gtk3`](https://pkgs.org/search/?q=libcanberra-gtk3))
* `notify-send` ([`libnotify`](https://pkgs.org/search/?q=libnotify))
* `powerprofilesctl` ([`power-profiles-daemon`](https://pkgs.org/search/?q=power-profiles-daemon))
* `pactl` ([`pulseaudio`](https://pkgs.org/search/?q=pulseaudio))
* `xmenu` ([`xmenu`](https://github.com/phillbush/xmenu))

```sh
{{#include ../../examples/mars-status.sh}}
```

5 changes: 5 additions & 0 deletions docs/examples/touchegg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# `touchegg.conf`

```xml
{{#include ../../examples/touchegg.xml}}
```
9 changes: 9 additions & 0 deletions docs/examples/wallpaper-daemon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# `wallpaper-daemon`

Dependencies:
* `xev`
* `xwallpaper`

```sh
{{#include ../../examples/wallpaper-daemon.sh}}
```
9 changes: 9 additions & 0 deletions docs/examples/xdg-xmenu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# `xdg-xmenu.py`

Dependencies:
* `python3`
* `imagemagick`

```py
{{#include ../../examples/xdg-xmenu.py}}
```
File renamed without changes.
3 changes: 3 additions & 0 deletions docs/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Introduction

{{#include ../marswm/README.md}}
71 changes: 71 additions & 0 deletions docs/marsbar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
The configuration should be stored in the [YAML](https://yaml.org/) format at `~/.config/marswm/marsbar.yaml`
You can get the default configuration with `marsbar --print-default-config`.

## The Status Script
You can set the status on the right side of the bar with a custom skript or program.
On X11 it uses the custom property `_MARS_STATUS` on the root window.
You can use any program to set it, but `mars-relay` also supports the `set-status` command:
```sh
mars-relay set-status "Today is $(date +%F)"
```

You also have the possibility to use multiple **modules** for different metrics.
They are separated by a special character, the default is currently `0x1f`.
In a shell script you could use it like so:
```sh
load="$(cut -d' ' -f1 /proc/load)"
date="$(date +%F)"
status="$(printf "%s\x1f%s" "load: $load" "date: $date")"
mars-relay set-status "$status"
```

The script/program is expected to update the status on its own.
It can either be started by your own startup scripts/systemd/etc. or by `marsbar` itself.
To launch the script with `marsbar` you have to make sure the script is executable (`chmod +x`).
Then you can add it to the config file under the option `status_cmd`.

### Button Actions
`marsbar` also lets you handle button clicks for those status blocks.
These are handled by a script/program which can be a different executable or just the same as used for status updates.
Place the path to the executable under the `action_cmd` option in the config file.

When a button is pressed that executable is called with the environment variables `BLOCK` and `BUTTON` are set:
* `$BLOCK` contains the index of the status block that was clicked
* `$BUTTON` contains the index number of the mouse button that generated the event


## Theming
Theming is available under the `style` subsection in the configuration file.

This section might look something like this:
```yaml
style:
background: 0x262626 # background color of the bar
expand_workspace_widgets: false # make all workspace widgets the same width
height: 31 # height of the whole bar
font: FiraCode:size=12 # font of text surfaces (as xft name)
workspaces:
foreground: 0x262626 # foreground (text) color of the workspace widget
inner_background: 0x5F87AF # background of the individual workspaces
outer_background: 0x262626 # background *around* the individual workspaces
padding_horz: 0 # horizontal padding around the workspaces
padding_vert: 0 # vertical padding around the workspaces
text_padding_horz: 10 # horizontal padding around the text
text_padding_vert: 4 # vertical padding around the text
spacing: 0 # spacing between the individual workspaces
title:
foreground: 0xBCBCBC # foreground (text) color
background: 0x262626 # background color of the text widget
status:
foreground: 0x262626 # foreground (text) color
inner_background: 0xAF5F5F # background of the individual blocks
outer_background: 0x262626 # background *around* the individual blocks
padding_horz: 4 # horizontal padding around the blocks
padding_vert: 4 # vertical padding around the blocks
text_padding_horz: 5 # horizontal padding around the text
text_padding_vert: 0 # vertical padding around the text
spacing: 4 # spacing between the individual blocks
```
*Note: Although they may look very weird in the output of `marsbar --print-default-config` colors can simply be written as hex values (like `0x1a2b3c`).*

File renamed without changes.
25 changes: 9 additions & 16 deletions marswm/src/docs/QUICKSTART.md → docs/quickstart.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Quick Start Guide
This guide shows you how to build a fully functional desktop environment with marswm.


## Assumptions
There are a few assumptions made in these scripts with regards to your system in this guide and in the scripts:
* `marswm`, `marsbar` and `mars-relay` are already installed (see [`INSTALLATION.md`](./INSTALLATION.md))
* `marswm`, `marsbar` and `mars-relay` are already installed (see ["Installation"](/installation.html))
* You use either [PulseAudio](https://www.freedesktop.org/wiki/Software/PulseAudio/) or [pipewire](https://pipewire.org/) with `pactl` installed (probably in the `pulseaudio` package)
* Your distro uses [systemd](https://systemd.io/)

Expand Down Expand Up @@ -36,14 +35,8 @@ We will add further lines to this script later on.
## Status Script
`marsbar` can use scripts to display status information and generate menus.

An example script is provided in the marswm repo to get you started.
You can simply install the [`mars-status`](examples/mars-status.sh) script into your `$PATH` (e.g. `~/.local/bin/mars-status`) and make it executable (`chmod +x mars-status`).
You will also have to make sure to have the following dependencies installed:
* `canberra-gtk-play` ([`libcanberra-gtk3`](https://pkgs.org/search/?q=libcanberra-gtk3))
* `notify-send` ([`libnotify`](https://pkgs.org/search/?q=libnotify))
* `powerprofilesctl` ([`power-profiles-daemon`](https://pkgs.org/search/?q=power-profiles-daemon))
* `pactl` ([`pulseaudio`](https://pkgs.org/search/?q=pulseaudio))
* `xmenu` ([`xmenu`](https://github.com/phillbush/xmenu))
You can find an example script [`mars-status`](/examples/mars-status.html) in examples section.
Read [Examples/Installing Scripts](examples.html#installing-scripts) for more information on how to install it.

Now you can add the script to your `marsbar` config in `~/.config/marswm/marsbar.yaml`:
```yaml
Expand All @@ -53,10 +46,10 @@ action_cmd: "mars-status action"
## Wallpaper
This repo also contains a simple script to set your wallpaper: [`wallpaper-daemon`](examples/wallpaper-daemon.sh).
This repo also contains a simple script to set your wallpaper: [`wallpaper-daemon`](examples/wallpaper-daemon.md).
It automatically adjusts your wallpaper whenever your screen configuration changes.
Make sure to install its dependencies `xev` and `xwallpaper`.
Add it to your `$PATH` (e.g. `~/.local/bin/wallpaper-daemon`) and make it executable (`chmod +x wallpaper-daemon`).
Read [Examples/Installing Scripts](examples.html#installing-scripts) for more information on how to install it.


Now we can add it to our autostart script:
```sh
Expand All @@ -67,8 +60,8 @@ It will load whatever wallpaper you put in `~/.background-image`.


## Application Menu(s)
Another script provided in `examples/` is [`xdg-xmenu.py`](examples/xdg-xmenu.py).
Put it in your `$PATH` (e.g. `~/.local/bin/xdg-xmenu`) and make it executable.
Another script provided in `examples/` is [`xdg-xmenu.py`](examples/xdg-xmenu.md).
Read [Examples/Installing Scripts](examples.html#installing-scripts) for more information on how to install it.

Now we can add it to our button bindings.
It is suggested to put it in `~/.config/marswm/buttonbindings_ext.yaml` as this way it does not interfere with other default bindings:
Expand Down Expand Up @@ -143,7 +136,7 @@ You may want to test this once to make sure everything works.


## Touch Gestures
There is an [example config](examples/touchegg.xml) for [Touchégg](https://github.com/JoseExposito/touchegg) provided along with this repo.
There is an [example config](examples/touchegg.md) for [Touchégg](https://github.com/JoseExposito/touchegg) provided along with this repo.
Copy the file to `~/.config/touchegg/touchegg.conf`.
Then [install and setup](https://github.com/JoseExposito/touchegg#installation) touchegg (it requires a server daemon to run, as well as a client).

Expand Down
71 changes: 0 additions & 71 deletions marsbar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,3 @@

`marsbar` is a minimalist status bar for `marswm` and other X11/EWMH Window Managers.

The configuration should be stored in the [YAML](https://yaml.org/) format at `~/.config/marswm/marsbar.yaml`
You can get the default configuration with `marsbar --print-default-config`.

## The Status Script
You can set the status on the right side of the bar with a custom skript or program.
On X11 it uses the custom property `_MARS_STATUS` on the root window.
You can use any program to set it, but `mars-relay` also supports the `set-status` command:
```sh
mars-relay set-status "Today is $(date +%F)"
```

You also have the possibility to use multiple **modules** for different metrics.
They are separated by a special character, the default is currently `0x1f`.
In a shell script you could use it like so:
```sh
load="$(cut -d' ' -f1 /proc/load)"
date="$(date +%F)"
status="$(printf "%s\x1f%s" "load: $load" "date: $date")"
mars-relay set-status "$status"
```

The script/program is expected to update the status on its own.
It can either be started by your own startup scripts/systemd/etc. or by `marsbar` itself.
To launch the script with `marsbar` you have to make sure the script is executable (`chmod +x`).
Then you can add it to the config file under the option `status_cmd`.

### Button Actions
`marsbar` also lets you handle button clicks for those status blocks.
These are handled by a script/program which can be a different executable or just the same as used for status updates.
Place the path to the executable under the `action_cmd` option in the config file.

When a button is pressed that executable is called with the environment variables `BLOCK` and `BUTTON` are set:
* `$BLOCK` contains the index of the status block that was clicked
* `$BUTTON` contains the index number of the mouse button that generated the event


## Theming
Theming is available under the `style` subsection in the configuration file.

This section might look something like this:
```yaml
style:
background: 0x262626 # background color of the bar
expand_workspace_widgets: false # make all workspace widgets the same width
height: 31 # height of the whole bar
font: FiraCode:size=12 # font of text surfaces (as xft name)
workspaces:
foreground: 0x262626 # foreground (text) color of the workspace widget
inner_background: 0x5F87AF # background of the individual workspaces
outer_background: 0x262626 # background *around* the individual workspaces
padding_horz: 0 # horizontal padding around the workspaces
padding_vert: 0 # vertical padding around the workspaces
text_padding_horz: 10 # horizontal padding around the text
text_padding_vert: 4 # vertical padding around the text
spacing: 0 # spacing between the individual workspaces
title:
foreground: 0xBCBCBC # foreground (text) color
background: 0x262626 # background color of the text widget
status:
foreground: 0x262626 # foreground (text) color
inner_background: 0xAF5F5F # background of the individual blocks
outer_background: 0x262626 # background *around* the individual blocks
padding_horz: 4 # horizontal padding around the blocks
padding_vert: 4 # vertical padding around the blocks
text_padding_horz: 5 # horizontal padding around the text
text_padding_vert: 0 # vertical padding around the text
spacing: 4 # spacing between the individual blocks
```
*Note: Although they may look very weird in the output of `marsbar --print-default-config` colors can simply be written as hex values (like `0x1a2b3c`).*

4 changes: 2 additions & 2 deletions marswm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The [YAML](https://yaml.org/) format is used for configuration with the default
You can get the default configuration with `marswm --print-default-config`.

## Documentation
[https://jzbor.de/marswm/marswm/docs/index.html]
[You can find the documentation here](https://jzbor.de/marswm/marswm/docs/index.html)

## Quick Start Guide
[https://jzbor.de/marswm/marswm/docs/quick_start/index.html]
[You can find the documentation here](https://jzbor.de/marswm/marswm/docs/index.html)
3 changes: 0 additions & 3 deletions marswm/src/docs/mod.rs

This file was deleted.

1 change: 0 additions & 1 deletion marswm/src/docs/quick_start.rs

This file was deleted.

2 changes: 0 additions & 2 deletions marswm/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![doc = include_str!("../README.md")]


use clap::Parser;
use libmars::utils::configuration::*;
use libmars::wm::*;
Expand All @@ -17,7 +16,6 @@ use crate::marswm::*;
mod attributes;
mod bindings;
mod config;
mod docs;
mod layouts;
mod macros;
mod marswm;
Expand Down

0 comments on commit b577e1e

Please sign in to comment.