improve doc

This commit is contained in:
Alexander Mohr 2025-05-01 17:56:35 +02:00
parent 0ca65cae81
commit cde9951101
7 changed files with 94 additions and 80 deletions

View file

@ -3,8 +3,22 @@
Worf is yet another style launcher, heavily inspired by wofi, rofi and walker. Worf is yet another style launcher, heavily inspired by wofi, rofi and walker.
Worf is written in Rust on top of GTK4. Worf is written in Rust on top of GTK4.
It aims to be a drop in replacement for wofi in most part, so it is (almost) compatible with its It started out as a drop in replacement for wofi, so styles and config in most part (should) be compatible,
configuration and css files. See below for differences with a few exception documented below.
Worf has more features than wofi though, so there won't be 100% compatibility.
It supports various modes:
* Math
* DRun
* File
* Ssh
* // WebSearch
* // Emoji
* // Run
* Auto
Auto mode tries to detect the desired mode automatically, i.e. `ssh`, `?` (for web search), `emoji`, `/` or `~` (for file).
## Not finished ## Not finished
* [ ] run * [ ] run
@ -15,37 +29,6 @@ configuration and css files. See below for differences
* [ ] publish library * [ ] publish library
## Showcases
You will find all showcases in the styles folder with a corresponding subfolder.
### Compact
Please note that the car in the background is just my wallpaper at the time and this project is not endorsed or affiliated with my employer.
![](styles/compact/example.png)
### Fullscreen / Launcher
Only difference is that one is fullscreen the other is not
![](styles/fullscreen/example.png)
### Relaxed
![](styles/relaxed/example.png)
## Setup
### Hyprland
Allow blur for Worf
```
layerrule = blur, worf
```
## Additional functionality compared to Wofi ## Additional functionality compared to Wofi
* Support passing 'hidden' parameters that are not visible in the launcher but will be returned to the application * Support passing 'hidden' parameters that are not visible in the launcher but will be returned to the application
* Window switcher for hyprland * Window switcher for hyprland
@ -57,25 +40,56 @@ layerrule = blur, worf
* configurable animation time * configurable animation time
### New Styling options ### New Styling options
* `label`: Allows styling the label
* `row`: Allows styling to row, mainly used to disable hover effects ## Styling
Styling names and classes are inspired by wofi, so most of the documentation and styling is the same
### Selectors
|name|description|
window|Entire main window|
|outer-box|A box that everything else sits inside of|
|input|Text box for filtering items|
|scroll|Scroll window containing inner-box|
|inner-box|Box containing the menu entries|
|entry|Box containing the text and optionally the image of an entry|
|text|Name of the program/option inserted|
|img|Images displayed in entries|
|row|The row containing the entry, i.e. used to control hover effects|
Checkout more showcases in the styles directory of this repo.
![](styles/compact/example.png)
## Setup
### Hyprland
Allow blur for Worf
```
layerrule = blur, worf
```
## Library ## Library
The launcher and UI can be used to build any launcher, as the ui, config and run logic is available as a separate crate. The launcher and UI can be used to build any launcher, as the ui, config and run logic is available as a separate crate.
This library is not available publicly yet as the interface is not stable enough. This library is not available publicly yet as the interface is not stable enough.
## Wofi compatibility
## Breaking changes to Wofi ### Breaking changes
* Runtime behaviour is not guaranteed to be the same and won't ever be, this includes error messages and themes. * Runtime behaviour is not guaranteed to be the same and won't ever be, this includes error messages and themes.
* Themes in general are mostly compatible. Worf is using the same entity ids, * Themes in general are mostly compatible. Worf is using the same entity ids,
because worf is build on GTK4 instead of GTK3 there will be differences in the look and feel. because worf is build on GTK4 instead of GTK3 there will be differences in the look and feel.
* Configuration files are not 100% compatible, Worf is using toml files instead, for most part this only means strings have to be quoted * Configuration files are not 100% compatible, Worf is using toml files instead, for most part this only means strings have to be quoted
* Color files are not supported * Color files are not supported
* `line_wrap` is now called `line-wrap` * `line_wrap` is now called `line-wrap`
* Wofi has a C-API, that is not and won't be supported. * Wofi has a C-API, that is not and won't be supported, but Worf can be used as a rust library.
## Dropped arguments ### Dropped arguments
* `mode`, use show * `mode`, use show
* `dmenu`, use show * `dmenu`, use show
* `D`, arguments are the same as config in worf, no need to have this flag. * `D`, arguments are the same as config in worf, no need to have this flag.

View file

@ -174,10 +174,10 @@ pub struct Config {
prompt: Option<String>, prompt: Option<String>,
#[clap(short = 'x', long = "xoffset")] #[clap(short = 'x', long = "xoffset")]
xoffset: Option<i32>, xoffset: Option<i32>, // todo support this
#[clap(short = 'y', long = "yoffset")] #[clap(short = 'y', long = "yoffset")]
yoffset: Option<i32>, yoffset: Option<i32>, // todo support this
/// If true a normal window instead of a layer shell will be used /// If true a normal window instead of a layer shell will be used
#[clap(short = 'n', long = "normal-window")] #[clap(short = 'n', long = "normal-window")]
@ -188,10 +188,10 @@ pub struct Config {
allow_images: Option<bool>, allow_images: Option<bool>,
#[clap(short = 'm', long = "allow-markup")] #[clap(short = 'm', long = "allow-markup")]
allow_markup: Option<bool>, allow_markup: Option<bool>, // todo support this
#[clap(short = 'k', long = "cache-file")] #[clap(short = 'k', long = "cache-file")]
cache_file: Option<String>, cache_file: Option<String>, // todo support this
/// Defines which terminal to use. defaults to the first one found: /// Defines which terminal to use. defaults to the first one found:
/// * kitty /// * kitty
@ -209,10 +209,10 @@ pub struct Config {
term: Option<String>, term: Option<String>,
#[clap(short = 'P', long = "password")] #[clap(short = 'P', long = "password")]
password: Option<String>, password: Option<String>, // todo support this
#[clap(short = 'e', long = "exec-search")] #[clap(short = 'e', long = "exec-search")]
exec_search: Option<bool>, exec_search: Option<bool>, // todo support this
/// Defines whether the scrollbar is visible /// Defines whether the scrollbar is visible
#[clap(short = 'b', long = "hide-scroll")] #[clap(short = 'b', long = "hide-scroll")]
@ -223,41 +223,41 @@ pub struct Config {
matching: Option<MatchMethod>, matching: Option<MatchMethod>,
#[clap(short = 'i', long = "insensitive")] #[clap(short = 'i', long = "insensitive")]
insensitive: Option<bool>, insensitive: Option<bool>, // todo support this
#[clap(short = 'q', long = "parse-search")] #[clap(short = 'q', long = "parse-search")]
parse_search: Option<bool>, parse_search: Option<bool>, // todo support this
/// set where the window is displayed. /// set where the window is displayed.
/// can be used to anchor a window to an edge by /// can be used to anchor a window to an edge by
/// setting top,left for example /// setting top,left for example
#[clap(short = 'l', long = "location", value_delimiter = ',', value_parser = clap::builder::ValueParser::new(Anchor::from_str) #[clap(short = 'l', long = "location", value_delimiter = ',', value_parser = clap::builder::ValueParser::new(Anchor::from_str)
)] )]
location: Option<Vec<Anchor>>, location: Option<Vec<Anchor>>,
#[clap(short = 'a', long = "no-actions")] #[clap(short = 'a', long = "no-actions")]
no_actions: Option<bool>, no_actions: Option<bool>, // todo support this
#[clap(short = 'L', long = "lines")] #[clap(short = 'L', long = "lines")]
lines: Option<u32>, lines: Option<u32>, // todo support this
#[clap(short = 'w', long = "columns")] #[clap(short = 'w', long = "columns")]
columns: Option<u32>, columns: Option<u32>,
#[clap(short = 'O', long = "sort-order")] #[clap(short = 'O', long = "sort-order")] // todo support this
sort_order: Option<String>, sort_order: Option<String>,
#[clap(short = 'G', long = "gtk-dark")] #[clap(short = 'G', long = "gtk-dark")]
gtk_dark: Option<bool>, gtk_dark: Option<bool>, // todo support this
#[clap(short = 'Q', long = "search")] #[clap(short = 'Q', long = "search")]
search: Option<String>, search: Option<String>, // todo support this
#[clap(short = 'o', long = "monitor")] #[clap(short = 'o', long = "monitor")]
monitor: Option<String>, monitor: Option<String>, // todo support this
#[clap(short = 'r', long = "pre-display-cmd")] #[clap(short = 'r', long = "pre-display-cmd")]
pre_display_cmd: Option<String>, pre_display_cmd: Option<String>, // todo support this
#[clap(long = "orientation")] #[clap(long = "orientation")]
orientation: Option<Orientation>, orientation: Option<Orientation>,
@ -274,36 +274,36 @@ pub struct Config {
#[clap(long = "valign")] #[clap(long = "valign")]
valign: Option<Align>, valign: Option<Align>,
filter_rate: Option<u32>, filter_rate: Option<u32>, // todo support this
/// Defines the image size in pixels /// Defines the image size in pixels
#[clap(long = "image-size")] #[clap(long = "image-size")]
image_size: Option<i32>, image_size: Option<i32>,
key_up: Option<String>, key_up: Option<String>, // todo support this
key_down: Option<String>, key_down: Option<String>, // todo support this
key_left: Option<String>, key_left: Option<String>, // todo support this
key_right: Option<String>, key_right: Option<String>, // todo support this
key_forward: Option<String>, key_forward: Option<String>, // todo support this
key_backward: Option<String>, key_backward: Option<String>, // todo support this
key_submit: Option<String>, key_submit: Option<String>, // todo support this
key_exit: Option<String>, key_exit: Option<String>, // todo support this
key_pgup: Option<String>, key_pgup: Option<String>, // todo support this
key_pgdn: Option<String>, key_pgdn: Option<String>, // todo support this
key_expand: Option<String>, key_expand: Option<String>, // todo support this
key_hide_search: Option<String>, key_hide_search: Option<String>, // todo support this
key_copy: Option<String>, key_copy: Option<String>, // todo support this
// todo re-add this // todo re-add this
// #[serde(flatten)] // #[serde(flatten)]
// key_custom: Option<HashMap<String, String>>, // key_custom: Option<HashMap<String, String>>,
global_coords: Option<bool>, global_coords: Option<bool>, // todo support this
hide_search: Option<bool>, hide_search: Option<bool>, // todo support this
dynamic_lines: Option<bool>, dynamic_lines: Option<bool>,// todo support this
layer: Option<String>, layer: Option<String>, // todo support this
copy_exec: Option<String>, copy_exec: Option<String>,// todo support this
single_click: Option<bool>, single_click: Option<bool>,// todo support this
pre_display_exec: Option<bool>, pre_display_exec: Option<bool>,// todo support this
/// Minimum score for a fuzzy search to be shown /// Minimum score for a fuzzy search to be shown
#[clap(long = "fuzzy-min-score")] #[clap(long = "fuzzy-min-score")]

View file

@ -787,7 +787,7 @@ fn create_menu_row<T: Clone + 'static>(
label.set_natural_wrap_mode(meta.config.line_wrap().into()); label.set_natural_wrap_mode(meta.config.line_wrap().into());
label.set_hexpand(true); label.set_hexpand(true);
label.set_widget_name("label"); label.set_widget_name("text");
label.set_wrap(true); label.set_wrap(true);
row_box.append(&label); row_box.append(&label);

View file

@ -62,7 +62,7 @@
outline: inherit; outline: inherit;
} }
#label { #text {
margin-top: 1rem; margin-top: 1rem;
margin-bottom: 0; margin-bottom: 0;
} }

View file

@ -64,7 +64,7 @@
outline: inherit; outline: inherit;
} }
#label { #text {
margin-top: 1rem; margin-top: 1rem;
margin-bottom: 0; margin-bottom: 0;
} }

View file

@ -62,7 +62,7 @@
outline: inherit; outline: inherit;
} }
#label { #text {
margin-top: 1rem; margin-top: 1rem;
margin-bottom: 0; margin-bottom: 0;
} }

View file

@ -62,7 +62,7 @@
outline: inherit; outline: inherit;
} }
#label { #text {
margin-top: 1rem; margin-top: 1rem;
margin-bottom: 0; margin-bottom: 0;
} }