Skip to content

Commit

Permalink
build: add flatpak feature
Browse files Browse the repository at this point in the history
  • Loading branch information
theHamsta committed Oct 28, 2023
1 parent 955913b commit 61a84b7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ container-images-uris.txt
container-images.txt
cached-container-images.tar

# Flatpak
.flatpak-builder

# vim: tw=100 colorcolumn=100
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ build = "build.rs"
edition = "2018"
license = "GPLv3"

[features]
default = []
flatpak = []

[dependencies]
clap = { version = "4.0", features = ["color", "help", "std", "usage", "error-context", "suggestions", "wrap_help", "derive"] }
glib = "0.18.0"
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ test:
RUST_BACKTRACE=1 cargo test

run:
RUST_LOG=warn RUST_BACKTRACE=1 cargo run -- --no-fork
RUST_LOG=warn RUST_BACKTRACE=1 cargo run $(CARGO_ARGS) -- --no-fork

install: install-resources
cargo install --path . --force --root $(DESTDIR)$(PREFIX)
cargo install $(CARGO_ARGS) --path . --force --root $(DESTDIR)$(PREFIX)

install-debug: install-resources
cargo install --debug --path . --force --root $(DESTDIR)$(PREFIX)
cargo install $(CARGO_ARGS) --debug --path . --force --root $(DESTDIR)$(PREFIX)

install-resources:
mkdir -p $(DESTDIR)$(PREFIX)/share/nvim-gtk/
Expand Down
12 changes: 7 additions & 5 deletions src/nvim/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,13 @@ pub fn start<'a>(
timeout: Option<Duration>,
args_for_neovim: Vec<String>,
) -> result::Result<(NvimSession, IoFuture<'a>), NvimInitError> {
let mut cmd = if let Some(path) = nvim_bin_path {
Command::new(path)
} else {
Command::new("nvim")
};
let nvim_cmd = nvim_bin_path.unwrap_or_else(|| "nvim".into());
#[cfg(not(feature = "flatpak"))]
let mut cmd = Command::new(nvim_cmd);
#[cfg(feature = "flatpak")]
let mut cmd = Command::new("flatpak-spawn");
#[cfg(feature = "flatpak")]
cmd.arg("--host").arg(nvim_cmd);

cmd.arg("--embed")
.arg("--cmd")
Expand Down

0 comments on commit 61a84b7

Please sign in to comment.