aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/by-name/fo/foot/module.nix4
-rw-r--r--modules/by-name/i3/i3bar-river/module.nix2
-rw-r--r--modules/by-name/lf/lf/commands/default.nix3
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/trash_restore.sh6
-rw-r--r--pkgs/by-name/no/notify-run/src/main.rs82
5 files changed, 62 insertions, 35 deletions
diff --git a/modules/by-name/fo/foot/module.nix b/modules/by-name/fo/foot/module.nix
index 74273b49..8d5cfe2b 100644
--- a/modules/by-name/fo/foot/module.nix
+++ b/modules/by-name/fo/foot/module.nix
@@ -54,6 +54,10 @@ in {
launch = "ll \${match}";
};
+ colors-dark = {
+ jump-labels = "f2f4f8 484848";
+ };
+
key-bindings = {
regex-launch = [
"[hashes] Control+h"
diff --git a/modules/by-name/i3/i3bar-river/module.nix b/modules/by-name/i3/i3bar-river/module.nix
index 982ec1e3..55ac59e9 100644
--- a/modules/by-name/i3/i3bar-river/module.nix
+++ b/modules/by-name/i3/i3bar-river/module.nix
@@ -186,7 +186,7 @@ in {
};
# The font and various sizes
- font = "SauceCodePro Nerd Font Mono:pixelsize=26";
+ font = "SauceCodePro NFM:pixelsize=26";
height = 24;
margin_top = 10;
margin_bottom = 0;
diff --git a/modules/by-name/lf/lf/commands/default.nix b/modules/by-name/lf/lf/commands/default.nix
index 42dc548e..98b3119f 100644
--- a/modules/by-name/lf/lf/commands/default.nix
+++ b/modules/by-name/lf/lf/commands/default.nix
@@ -169,9 +169,6 @@ in {
dependencies = [
pkgs.conceal
pkgs.fzf
- pkgs.gawk
- pkgs.trashy
- pkgs.gnused
];
};
diff --git a/modules/by-name/lf/lf/commands/scripts/trash_restore.sh b/modules/by-name/lf/lf/commands/scripts/trash_restore.sh
index 7b078c26..789ab59a 100755
--- a/modules/by-name/lf/lf/commands/scripts/trash_restore.sh
+++ b/modules/by-name/lf/lf/commands/scripts/trash_restore.sh
@@ -19,9 +19,5 @@ fs="$fs"
# shellcheck disable=SC2269
id="$id"
-while IFS="$(printf '\n')" read -r file; do
- set -- "$@" "$(pwd)/$file"
-done <"$(conceal list | fzf --multi --ansi | awk '{$1="";$2=""; print $0}' | sed 's/^\s*//' | tmp)"
-
-[ "$#" -ne 0 ] && trash restore --match=exact "$@"
+conceal restore --finder=fzf
# vim: ft=sh
diff --git a/pkgs/by-name/no/notify-run/src/main.rs b/pkgs/by-name/no/notify-run/src/main.rs
index a6a0165a..94f9ad4e 100644
--- a/pkgs/by-name/no/notify-run/src/main.rs
+++ b/pkgs/by-name/no/notify-run/src/main.rs
@@ -8,7 +8,13 @@
// You should have received a copy of the License along with this program.
// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-use std::{env::args, path::PathBuf, process::Command};
+use std::{
+ env::args,
+ io::{BufRead, BufReader, Read, Write},
+ path::PathBuf,
+ process::{Command, Stdio},
+ thread::JoinHandle,
+};
use anyhow::{Context, Result};
@@ -20,18 +26,40 @@ fn main() -> Result<()> {
cmd.args(arguments.split(" ").collect::<Vec<_>>().as_slice());
}
- eprintln!("Spawning {:?}", cmd);
+ eprintln!("notify-run> Spawning {:?}", cmd);
- let output = cmd
- .output()
- .with_context(|| format!("Failed to spawn and await output of {:?}", cmd))?;
+ let mut child = cmd
+ .stderr(Stdio::piped())
+ .stdout(Stdio::piped())
+ .spawn()
+ .with_context(|| format!("Failed to spawn {:?}", cmd))?;
- if !output.status.success() {
+ let (stdout, stderr) = (
+ child.stdout.take().expect("Was piped"),
+ child.stderr.take().expect("Was piped"),
+ );
+
+ let name = PathBuf::from(&args[0])
+ .file_name()
+ .expect("this to be a command, and thus have a file_name")
+ .to_string_lossy()
+ .to_string();
+
+ let stdout_t = write_thread(stdout, name.to_owned());
+ let stderr_t = write_thread(stderr, name.to_owned());
+ stdout_t
+ .join()
+ .unwrap()
+ .context("Failed to join stdout thread")?;
+ stderr_t
+ .join()
+ .unwrap()
+ .context("Failed to join stderr thread")?;
+
+ let status = child.wait().context("Failed to wait for child output")?;
+ if !status.success() {
let mut notify_send = Command::new("notify-send");
- notify_send.args([
- format!("Command {:?} failed", cmd).as_str(),
- &String::from_utf8_lossy(output.stderr.as_slice()),
- ]);
+ notify_send.args([format!("Command {:?} failed", cmd).as_str()]);
notify_send.status().with_context(|| {
format!(
@@ -39,27 +67,29 @@ fn main() -> Result<()> {
cmd
)
})?;
- } else {
- let name = PathBuf::from(&args[0])
- .file_name()
- .expect("this to be a command, and thus have a file_name")
- .to_string_lossy()
- .to_string();
-
- print!("{}", append_name(&name, &output.stdout));
- eprint!("{}", append_name(&name, &output.stderr));
}
Ok(())
}
-fn append_name(name: &str, base: &[u8]) -> String {
- let base = String::from_utf8_lossy(base).to_string();
+fn write_thread<R: Read + Send + 'static>(input: R, name: String) -> JoinHandle<Result<()>> {
+ std::thread::spawn(move || {
+ let mut reader = BufReader::new(input);
- let mut output = String::new();
- for line in base.lines() {
- output.push_str(format!("{name}> {line}\n").as_str());
- }
+ let mut buf = String::new();
+ loop {
+ buf.clear();
+ if reader
+ .read_line(&mut buf)
+ .context("Failed to read from child output")?
+ == 0
+ {
+ break;
+ }
+
+ write!(std::io::stdout(), "{name}> {buf}")?;
+ }
- output
+ Ok(())
+ })
}