docs(mkdocs): add komorebi-bar to getting started

This commit adds instructions for komorebi-bar to the Getting Started
section of the documentation website, adds an example komorebi.bar.json
configuration file, integrates that file with the quickstart command,
and updates the start and stop commands to take --bar flags similar to
the --whkd flags.

In updating the documentation I also decided to rename in the internal
tag for the KomobarTheme and KomorebiTheme enums to "palette" instead of
the previous generic "type" tag which was copied from the serde docs.
This commit is contained in:
LGUG2Z
2024-09-17 18:44:41 -07:00
parent 6addfed1ce
commit 21a2138330
8 changed files with 173 additions and 22 deletions

View File

@@ -16,16 +16,17 @@ the example files have been downloaded. For most new users this will be in the
komorebic quickstart
```
With the example configurations downloaded, you can now start `komorebi` and `whkd.
With the example configurations downloaded, you can now start `komorebi`,
`komorebi-bar` and `whkd`.
```powershell
komorebic start --whkd
komorebic start --whkd --bar
```
## komorebi.json
The example window manager configuration sets some sane defaults and provides
five preconfigured workspaces on the primary monitor each with a different
seven preconfigured workspaces on the primary monitor each with a different
layout.
```json
@@ -213,3 +214,24 @@ reference.
If you want to use one of those key codes, put them into lower case and remove
the `VK_` prefix. For example, the keycode `VK_OEM_PLUS` becomes `oem_plus` in
the sample configuration above.
## komorebi.bar.json
The example status bar configuration sets some sane defaults and provides
a number of pre-configured widgets on the primary monitor.
```json
{% include "./komorebi.bar.example.json" %}
```
### Themes
Themes can be set in either `komorebi.json` or `komorebi.bar.json`. If set
in `komorebi.json`, the theme will be applied to both komorebi's borders and
stackbars as well as the status bar.
If set in `komorebi.bar.json`, the theme will only be applied to the status bar.
All [Catppuccin palette variants](https://catppuccin.com/)
and [most Base16 palette variants](https://tinted-theming.github.io/base16-gallery/)
are available as themes.

View File

@@ -1,6 +1,6 @@
# Getting started
`komorebi` is a tiling window manager for Windows that is comprised of two
`komorebi` is a tiling window manager for Windows that is comprised of two
main binaries, `komorebi.exe`, which contains the window manager itself,
and `komorebic.exe`, which is the main way to send commands to the tiling
window manager.
@@ -23,6 +23,10 @@ suggest that once you are familiar with the main `komorebic.exe` commands used
to manipulate the window manager, you use
[AutoHotKey](https://www.autohotkey.com/) to handle your key bindings.
`komorebi` also includes `komorebi-bar.exe`, a simple and reliable status bar which
is deeply integrated with the tiling window manager, and can be customized with
various widgets and themes.
## Installation
`komorebi` is available pre-built to install via
@@ -115,6 +119,7 @@ cargo +stable install --path komorebi --locked
cargo +stable install --path komorebic --locked
cargo +stable install --path komorebic-no-console --locked
cargo +stable install --path komorebi-gui --locked
cargo +stable install --path komorebi-bar --locked
```
If the binaries have been built and added to your `$PATH` correctly, you should
@@ -131,8 +136,8 @@ first-time set up and running komorebi require an internet connection).
## Uninstallation
Before uninstalling, first run `komorebic stop --whkd` to make sure that both
the `komorebi` and `whkd` processes have been stopped.
Before uninstalling, first run `komorebic stop --whkd --bar` to make sure that
the `komorebi`, `komorebi-bar` and `whkd` processes have been stopped.
Then, depending on whether you installed with Scoop or WinGet, run `scoop
uninstall komorebi whkd` or `winget uninstall LGUG2Z.komorebi LGUG2Z.whkd`.

View File

@@ -0,0 +1,76 @@
{
"$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi/master/schema.bar.json",
"monitor": {
"index": 0,
"work_area_offset": {
"left": 0,
"top": 40,
"right": 0,
"bottom": 40
}
},
"font_family": "JetBrains Mono",
"theme": {
"palette": "Base16",
"name": "Ashes",
"accent": "Base0D"
},
"left_widgets": [
{
"Komorebi": {
"workspaces": {
"enable": true,
"hide_empty_workspaces": false
},
"layout": {
"enable": true
},
"focused_window": {
"enable": true,
"show_icon": true
}
}
}
],
"right_widgets": [
{
"Media": {
"enable": true
}
},
{
"Storage": {
"enable": true
}
},
{
"Memory": {
"enable": true
}
},
{
"Network": {
"enable": true,
"show_total_data_transmitted": true,
"show_network_activity": true
}
},
{
"Date": {
"enable": true,
"format": "DayDateMonthYear"
}
},
{
"Time": {
"enable": true,
"format": "TwentyFourHour"
}
},
{
"Battery": {
"enable": true
}
}
]
}

View File

@@ -8,20 +8,17 @@
"border": true,
"border_width": 8,
"border_offset": -1,
"border_colours": {
"single": "#42a5f5",
"stack": "#00a542",
"monocle": "#ff3399",
"unfocused": "#808080"
"theme": {
"palette": "Base16",
"name": "Ashes",
"unfocused_border": "Base03",
"bar_accent": "Base0D"
},
"stackbar": {
"height": 40,
"mode": "OnStack",
"tabs": {
"width": 300,
"focused_text": "#00a542",
"unfocused_text": "#b3b3b3",
"background": "#141414"
"width": 300
}
},
"monitors": [

View File

@@ -95,7 +95,7 @@ impl From<Position> for Pos2 {
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema)]
#[serde(tag = "type")]
#[serde(tag = "palette")]
pub enum KomobarTheme {
/// A theme from catppuccin-egui
Catppuccin {

View File

@@ -375,7 +375,7 @@ pub struct AnimationsConfig {
fps: Option<u64>,
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema)]
#[serde(tag = "type")]
#[serde(tag = "palette")]
pub enum KomorebiTheme {
/// A theme from catppuccin-egui
Catppuccin {

View File

@@ -760,6 +760,9 @@ struct Start {
/// Start autohotkey configuration file
#[clap(long)]
ahk: bool,
/// Start komorebi-bar in a background process
#[clap(long)]
bar: bool,
}
#[derive(Parser)]
@@ -767,6 +770,9 @@ struct Stop {
/// Stop whkd if it is running as a background process
#[clap(long)]
whkd: bool,
/// Stop komorebi-bar if it is running as a background process
#[clap(long)]
bar: bool,
}
#[derive(Parser)]
@@ -877,6 +883,9 @@ enum SubCommand {
/// Show the path to komorebi.json
#[clap(alias = "config")]
Configuration,
#[clap(alias = "bar-config")]
#[clap(alias = "bconfig")]
BarConfiguration,
/// Show the path to whkdrc
#[clap(alias = "whkd")]
Whkdrc,
@@ -1372,12 +1381,16 @@ fn main() -> Result<()> {
std::fs::create_dir_all(data_dir)?;
let mut komorebi_json = include_str!("../../docs/komorebi.example.json").to_string();
let komorebi_bar_json =
include_str!("../../docs/komorebi.bar.example.json").to_string();
if std::env::var("KOMOREBI_CONFIG_HOME").is_ok() {
komorebi_json =
komorebi_json.replace("Env:USERPROFILE", "Env:KOMOREBI_CONFIG_HOME");
}
std::fs::write(HOME_DIR.join("komorebi.json"), komorebi_json)?;
std::fs::write(HOME_DIR.join("komorebi.bar.json"), komorebi_bar_json)?;
let applications_yaml = include_str!("../applications.yaml");
std::fs::write(HOME_DIR.join("applications.yaml"), applications_yaml)?;
@@ -1385,7 +1398,7 @@ fn main() -> Result<()> {
let whkdrc = include_str!("../../docs/whkdrc.sample");
std::fs::write(WHKD_CONFIG_DIR.join("whkdrc"), whkdrc)?;
println!("Example ~/komorebi.json, ~/.config/whkdrc and latest ~/applications.yaml files downloaded");
println!("Example komorebi.json, komorebi.bar.json, whkdrc and latest applications.yaml files created");
println!("You can now run komorebic start --whkd");
}
SubCommand::EnableAutostart(args) => {
@@ -1536,6 +1549,13 @@ fn main() -> Result<()> {
println!("{}", static_config.display());
}
}
SubCommand::BarConfiguration => {
let static_config = HOME_DIR.join("komorebi.bar.json");
if static_config.exists() {
println!("{}", static_config.display());
}
}
SubCommand::Whkdrc => {
let whkdrc = WHKD_CONFIG_DIR.join("whkdrc");
@@ -1975,6 +1995,23 @@ if (!(Get-Process whkd -ErrorAction SilentlyContinue))
}
}
if arg.bar {
let script = r"
if (!(Get-Process komorebi-bar -ErrorAction SilentlyContinue))
{
Start-Process komorebi-bar -WindowStyle hidden
}
";
match powershell_script::run(script) {
Ok(_) => {
println!("{script}");
}
Err(error) => {
println!("Error: {error}");
}
}
}
println!("\nThank you for using komorebi!\n");
println!("* Become a sponsor https://github.com/sponsors/LGUG2Z - Even $1/month makes a big difference");
println!(
@@ -2017,6 +2054,20 @@ Stop-Process -Name:whkd -ErrorAction SilentlyContinue
}
}
if arg.bar {
let script = r"
Stop-Process -Name:komorebi-bar -ErrorAction SilentlyContinue
";
match powershell_script::run(script) {
Ok(_) => {
println!("{script}");
}
Err(error) => {
println!("Error: {error}");
}
}
}
send_message(&SocketMessage::Stop)?;
let mut system = sysinfo::System::new_all();
system.refresh_processes();

View File

@@ -782,7 +782,7 @@
"type": "object",
"required": [
"name",
"type"
"palette"
],
"properties": {
"accent": {
@@ -825,7 +825,7 @@
"Mocha"
]
},
"type": {
"palette": {
"type": "string",
"enum": [
"Catppuccin"
@@ -838,7 +838,7 @@
"type": "object",
"required": [
"name",
"type"
"palette"
],
"properties": {
"accent": {
@@ -1136,7 +1136,7 @@
"Zenburn"
]
},
"type": {
"palette": {
"type": "string",
"enum": [
"Base16"