diff --git a/README.md b/README.md index 906605d..357dd4c 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A wayland native krunner-like runner, made with customizability in mind. - Hence the name anyrun - Easy to make plugins - You only need 4 functions! - - See [Rink](plugins/rink) for a simple example. More info in the documentation of the [anyrun-plugin](anyrun-plugin) crate. + - See [Rink](plugins/rink) for a simple example. More info in the documentation of the [anyrun-plugin](anyrun-plugin) crate. - Responsive - Asynchronous running of plugin functions - Wayland native @@ -24,6 +24,7 @@ A wayland native krunner-like runner, made with customizability in mind. Anyrun mainly depends various GTK libraries, and rust of course for building the project. Rust you can get with [rustup](https://rustup.rs). The rest are statically linked in the binary. Here are the libraries you need to have to build & run it: + - `gtk-layer-shell (libgtk-layer-shell)` - `gtk3 (libgtk-3 libgdk-3)` - `pango (libpango-1.0)` @@ -49,10 +50,13 @@ cp target/release/*.so ~/.config/anyrun/plugins # Copy all of the built plugins ``` After that you need to create the configuration file and place it in `~/.config/anyrun/config.ron`. A config file with all of the included plugins is as follows: + ```ron Config( width: 800, position: Top, + hide_icons: false, + hide_plugin_info: false, plugins: [ "libapplications.so", "libsymbols.so", @@ -62,7 +66,6 @@ Config( ) ``` - ## Plugins Anyrun requires plugins to function, as they provide the results for input. The list of plugins in this repository is as follows: @@ -94,10 +97,13 @@ The default configuration directory is `$HOME/.config/anyrun` the structure of t ``` The config file has the following structure, and as seen in the name uses the `ron` language: + ```ron Config( width: 800, // The width of the window position: Top, + hide_icons: false, + hide_plugin_info: false, plugins: [ "libapplications.so", // Relative paths are looked up in the /plugins/ directory "/home/kirottu/Projects/anyrun/target/debug/libsymbols.so", // Absolute paths are well, asbolute and loaded as is. Useful for development. @@ -141,6 +147,7 @@ The custom arguments for anyrun are as follows: The plugin API is intentionally very simple to use. This is all you need for a plugin: `Cargo.toml`: + ```toml #[package] omitted [lib] @@ -153,6 +160,7 @@ abi_stable = "0.11.1" ``` `lib.rs`: + ```rs use abi_stable::std_types::{RString, RVec, ROption}; use anyrun_plugin::{plugin, PluginInfo, Match, HandleResult}; @@ -171,7 +179,7 @@ fn info() -> PluginInfo { fn get_matches(input: RString, data: &mut ()) -> RVec { // The logic to get matches from the input text in the `input` argument. - // The `data` is a mutable reference to the shared data type later specified. + // The `data` is a mutable reference to the shared data type later specified. vec![Match { title: "Test match".into(), icon: ROption::RSome("help-about"), diff --git a/anyrun/src/main.rs b/anyrun/src/main.rs index 2be5bdb..7cb1106 100644 --- a/anyrun/src/main.rs +++ b/anyrun/src/main.rs @@ -19,6 +19,7 @@ struct Config { plugins: Vec, position: Position, hide_icons: bool, + hide_plugin_info: bool, } /// A "view" of plugin's info and matches @@ -250,13 +251,15 @@ fn activate(app: >k::Application, runtime_data: Rc .spacing(10) .name(style_names::PLUGIN) .build(); - plugin_box.add(&create_info_box(&plugin.info()(), config.hide_icons)); - plugin_box.add( - >k::Separator::builder() - .orientation(gtk::Orientation::Horizontal) - .name(style_names::PLUGIN) - .build(), - ); + if !config.hide_plugin_info { + plugin_box.add(&create_info_box(&plugin.info()(), config.hide_icons)); + plugin_box.add( + >k::Separator::builder() + .orientation(gtk::Orientation::Horizontal) + .name(style_names::PLUGIN) + .build(), + ); + } let list = gtk::ListBox::builder() .name(style_names::PLUGIN) .hexpand(true) diff --git a/plugins/applications/README.md b/plugins/applications/README.md new file mode 100644 index 0000000..8baa7d2 --- /dev/null +++ b/plugins/applications/README.md @@ -0,0 +1,13 @@ +# Applications + +## Desktop Actions + +To enable desktop actions support, set `desktop_actions` in the applications plugin config +file to `true` like so: + +`/applications.ron`: +```ron +Config( + desktop_actions: true, +) +``` \ No newline at end of file diff --git a/plugins/applications/src/scrubber.rs b/plugins/applications/src/scrubber.rs index df3a626..a2b80fe 100644 --- a/plugins/applications/src/scrubber.rs +++ b/plugins/applications/src/scrubber.rs @@ -31,11 +31,15 @@ impl DesktopEntry { let mut line = None; let mut new_sections = Vec::new(); - for section in sections.iter() { + for (i, section) in sections.iter().enumerate() { if let Some(line) = line { let mut section = section.to_vec(); section.insert(0, line); - section.pop(); + + // Only pop the last redundant entry if it isn't the last item + if i < sections.len() - 1 { + section.pop(); + } new_sections.push(section); } line = Some(section.last().unwrap_or(&"")); diff --git a/plugins/symbols/README.md b/plugins/symbols/README.md index be20a36..beab5f2 100644 --- a/plugins/symbols/README.md +++ b/plugins/symbols/README.md @@ -1,4 +1,6 @@ -# User defined symbols +# Symbols + +## User defined symbols User defined symbols are defined in the `symbols.ron` file inside the anyrun configuration directory. The structure of the file is as follows: ```ron