This commit is contained in:
Kirottu
2023-04-11 11:18:12 +03:00
5 changed files with 43 additions and 13 deletions

View File

@@ -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. 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: Here are the libraries you need to have to build & run it:
- `gtk-layer-shell (libgtk-layer-shell)` - `gtk-layer-shell (libgtk-layer-shell)`
- `gtk3 (libgtk-3 libgdk-3)` - `gtk3 (libgtk-3 libgdk-3)`
- `pango (libpango-1.0)` - `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: 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 ```ron
Config( Config(
width: 800, width: 800,
position: Top, position: Top,
hide_icons: false,
hide_plugin_info: false,
plugins: [ plugins: [
"libapplications.so", "libapplications.so",
"libsymbols.so", "libsymbols.so",
@@ -62,7 +66,6 @@ Config(
) )
``` ```
## Plugins ## Plugins
Anyrun requires plugins to function, as they provide the results for input. The list of plugins in this repository is as follows: 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: The config file has the following structure, and as seen in the name uses the `ron` language:
```ron ```ron
Config( Config(
width: 800, // The width of the window width: 800, // The width of the window
position: Top, position: Top,
hide_icons: false,
hide_plugin_info: false,
plugins: [ plugins: [
"libapplications.so", // Relative paths are looked up in the <config dir>/plugins/ directory "libapplications.so", // Relative paths are looked up in the <config dir>/plugins/ directory
"/home/kirottu/Projects/anyrun/target/debug/libsymbols.so", // Absolute paths are well, asbolute and loaded as is. Useful for development. "/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: The plugin API is intentionally very simple to use. This is all you need for a plugin:
`Cargo.toml`: `Cargo.toml`:
```toml ```toml
#[package] omitted #[package] omitted
[lib] [lib]
@@ -153,6 +160,7 @@ abi_stable = "0.11.1"
``` ```
`lib.rs`: `lib.rs`:
```rs ```rs
use abi_stable::std_types::{RString, RVec, ROption}; use abi_stable::std_types::{RString, RVec, ROption};
use anyrun_plugin::{plugin, PluginInfo, Match, HandleResult}; use anyrun_plugin::{plugin, PluginInfo, Match, HandleResult};

View File

@@ -19,6 +19,7 @@ struct Config {
plugins: Vec<PathBuf>, plugins: Vec<PathBuf>,
position: Position, position: Position,
hide_icons: bool, hide_icons: bool,
hide_plugin_info: bool,
} }
/// A "view" of plugin's info and matches /// A "view" of plugin's info and matches
@@ -250,6 +251,7 @@ fn activate(app: &gtk::Application, runtime_data: Rc<RefCell<Option<RuntimeData>
.spacing(10) .spacing(10)
.name(style_names::PLUGIN) .name(style_names::PLUGIN)
.build(); .build();
if !config.hide_plugin_info {
plugin_box.add(&create_info_box(&plugin.info()(), config.hide_icons)); plugin_box.add(&create_info_box(&plugin.info()(), config.hide_icons));
plugin_box.add( plugin_box.add(
&gtk::Separator::builder() &gtk::Separator::builder()
@@ -257,6 +259,7 @@ fn activate(app: &gtk::Application, runtime_data: Rc<RefCell<Option<RuntimeData>
.name(style_names::PLUGIN) .name(style_names::PLUGIN)
.build(), .build(),
); );
}
let list = gtk::ListBox::builder() let list = gtk::ListBox::builder()
.name(style_names::PLUGIN) .name(style_names::PLUGIN)
.hexpand(true) .hexpand(true)

View File

@@ -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:
`<anyrun config directory>/applications.ron`:
```ron
Config(
desktop_actions: true,
)
```

View File

@@ -31,11 +31,15 @@ impl DesktopEntry {
let mut line = None; let mut line = None;
let mut new_sections = Vec::new(); let mut new_sections = Vec::new();
for section in sections.iter() { for (i, section) in sections.iter().enumerate() {
if let Some(line) = line { if let Some(line) = line {
let mut section = section.to_vec(); let mut section = section.to_vec();
section.insert(0, line); section.insert(0, line);
// Only pop the last redundant entry if it isn't the last item
if i < sections.len() - 1 {
section.pop(); section.pop();
}
new_sections.push(section); new_sections.push(section);
} }
line = Some(section.last().unwrap_or(&"")); line = Some(section.last().unwrap_or(&""));

View File

@@ -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: User defined symbols are defined in the `symbols.ron` file inside the anyrun configuration directory. The structure of the file is as follows:
```ron ```ron