summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/beep5
-rwxr-xr-xscripts/current-term7
-rwxr-xr-xscripts/goctave (renamed from scripts/steam-oldchat)2
-rwxr-xr-xscripts/gta_lagswitch7
-rwxr-xr-xscripts/gvim5
-rw-r--r--scripts/jeff.oggbin0 -> 21432 bytes
-rwxr-xr-xscripts/maptool31
-rwxr-xr-xscripts/open-image50
-rwxr-xr-xscripts/open-osz14
-rwxr-xr-xscripts/open-url47
-rwxr-xr-xscripts/overwatch-controls6
-rwxr-xr-xscripts/removablectl89
-rwxr-xr-xscripts/renoise-wine11
-rwxr-xr-xscripts/revert-overwatch6
-rwxr-xr-xscripts/rofi-kvmap1
-rwxr-xr-xscripts/rofi-passmenu2
-rwxr-xr-xscripts/show-figlet51
-rwxr-xr-xscripts/shtop5
-rwxr-xr-xscripts/skunst5
-rwxr-xr-xscripts/spms5
-rwxr-xr-xscripts/spot29
-rwxr-xr-xscripts/steam-no-browser7
-rwxr-xr-xscripts/sweechat2
-rwxr-xr-xscripts/switch-ibus-engine37
-rwxr-xr-xscripts/umpv88
-rwxr-xr-xscripts/watch-dir8
-rwxr-xr-xscripts/xyz-upload47
27 files changed, 560 insertions, 7 deletions
diff --git a/scripts/beep b/scripts/beep
new file mode 100755
index 0000000..58a26b7
--- /dev/null
+++ b/scripts/beep
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+paplay --volume=59000 "$HOME/scripts/jeff.ogg" &
+
+# vim: expandtab sw=2 ts=2
diff --git a/scripts/current-term b/scripts/current-term
index 21f9383..a2d12ad 100755
--- a/scripts/current-term
+++ b/scripts/current-term
@@ -9,10 +9,11 @@ if [ "$1" = "--class" ]; then
fi
if [ $set_class -eq 1 ]; then
- #termite --name=$class $@
- alacritty --class "$class" "$@"
+ termite --name=$class "$@" &
+ #alacritty --class "$class" "$@"
else
- termite "$@"
+ termite "$@" &
+ #alacritty "$@"
fi
# vim: expandtab sw=2 ts=2
diff --git a/scripts/steam-oldchat b/scripts/goctave
index 4b2b0cb..f0f5d14 100755
--- a/scripts/steam-oldchat
+++ b/scripts/goctave
@@ -1,5 +1,5 @@
#!/bin/sh
-steam-native -no-browser "$@"
+octave --gui $@
# vim: expandtab sw=2 ts=2
diff --git a/scripts/gta_lagswitch b/scripts/gta_lagswitch
new file mode 100755
index 0000000..3c0765e
--- /dev/null
+++ b/scripts/gta_lagswitch
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+killall -SIGSTOP "GTA5.exe"
+sleep 8
+killall -SIGCONT "GTA5.exe"
+
+# vim: expandtab sw=2 ts=2
diff --git a/scripts/gvim b/scripts/gvim
new file mode 100755
index 0000000..df53fb8
--- /dev/null
+++ b/scripts/gvim
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+current-term --class gvim -e "vim $@"
+
+# vim: expandtab sw=2 ts=2
diff --git a/scripts/jeff.ogg b/scripts/jeff.ogg
new file mode 100644
index 0000000..1efc0e6
--- /dev/null
+++ b/scripts/jeff.ogg
Binary files differ
diff --git a/scripts/maptool b/scripts/maptool
new file mode 100755
index 0000000..a6b8876
--- /dev/null
+++ b/scripts/maptool
@@ -0,0 +1,31 @@
+#!/usr/bin/env scriptisto
+
+// scriptisto-begin
+// script_src: src/main.rs
+// build_cmd: cargo build --release && strip ./target/release/script
+// target_bin: ./target/release/script
+// files:
+// - path: Cargo.toml
+// content: |
+// package = { name = "script", version = "0.1.0", edition = "2018"}
+// [dependencies]
+// scripttools = { path = "/home/jokler/rust/scripttools" }
+// cmd_lib = "*"
+// scriptisto-end
+
+use cmd_lib::*;
+use scripttools::*;
+
+fn main() {
+ if let Err(e) = run() {
+ eprintln!("{}", e);
+ }
+}
+
+fn run() -> Result<()> {
+ run_cmd!("/opt/MapTool/MapTool")?;
+
+ Ok(())
+}
+
+// vim: filetype=rust
diff --git a/scripts/open-image b/scripts/open-image
new file mode 100755
index 0000000..3da4af7
--- /dev/null
+++ b/scripts/open-image
@@ -0,0 +1,50 @@
+#!/bin/sh
+# Compatible with ranger 1.6.0 through 1.7.*
+#
+# This script searches image files in a directory, opens them all with sxiv and
+# sets the first argument to the first image displayed by sxiv.
+#
+# This is supposed to be used in rifle.conf as a workaround for the fact that
+# sxiv takes no file name arguments for the first image, just the number. Copy
+# this file somewhere into your $PATH and add this at the top of rifle.conf:
+#
+# mime ^image, has sxiv, X, flag f = path/to/this/script -- "$@"
+#
+# Implementation notes: this script is quite slow because of POSIX limitations
+# and portability concerns. First calling the shell function 'abspath' is
+# quicker than calling 'realpath' because it would fork a whole process, which
+# is slow. Second, we need to append a file list to sxiv, which can only be done
+# properly in two ways: arrays (which are not POSIX) or \0 sperated
+# strings. Unfortunately, assigning \0 to a variable is not POSIX either (will
+# not work in dash and others), so we cannot store the result of listfiles to a
+# variable.
+
+if [ $# -eq 0 ]; then
+ echo "Usage: ${0##*/} PICTURES"
+ exit
+fi
+
+[ "$1" = '--' ] && shift
+
+abspath () {
+ case "$1" in
+ /*) printf "%s\n" "$1";;
+ *) printf "%s\n" "$PWD/$1";;
+ esac
+}
+
+listfiles () {
+ find -L "$(dirname "$target")" -maxdepth 1 -type f -iregex \
+ '.*\(jpe?g\|bmp\|png\|gif\)$' -print0 | sort -z
+}
+
+target="$(abspath "$1")"
+count="$(listfiles | grep -m 1 -ZznF "$target" | cut -d: -f1)"
+
+if [ -n "$count" ]; then
+ listfiles | xargs -0 sxiv -a -n "$count" --
+else
+ sxiv -a -- "$@" # fallback
+fi
+
+# vim: expandtab sw=2 ts=2
diff --git a/scripts/open-osz b/scripts/open-osz
new file mode 100755
index 0000000..5557751
--- /dev/null
+++ b/scripts/open-osz
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+SONG_DIR="$HOME/Games/osu/drive_c/osu/Songs"
+
+filename=$(basename -- "$1")
+filename="${filename%.*}"
+DEST_DIR="$SONG_DIR/$filename"
+
+mkdir "$DEST_DIR"
+unzip "$1" -d "$DEST_DIR" | exit 1
+
+rm "$1"
+
+# vim: expandtab sw=2 ts=2
diff --git a/scripts/open-url b/scripts/open-url
new file mode 100755
index 0000000..9b67374
--- /dev/null
+++ b/scripts/open-url
@@ -0,0 +1,47 @@
+#!/usr/bin/env scriptisto
+
+// scriptisto-begin
+// script_src: src/main.rs
+// build_cmd: cargo build --release && strip ./target/release/script
+// target_bin: ./target/release/script
+// files:
+// - path: Cargo.toml
+// content: |
+// package = { name = "script", version = "0.1.0", edition = "2018"}
+// [dependencies]
+// scripttools = { path = "/home/jokler/rust/scripttools" }
+// structopt="*"
+// cmd_lib = "*"
+// regex = "*"
+// scriptisto-end
+
+use structopt::StructOpt;
+use cmd_lib::*;
+use scripttools::*;
+
+#[derive(Debug, StructOpt)]
+#[structopt(name = "open-url", about = "Opens urls in their respective programs")]
+struct Opt {
+ /// The url to open
+ url: String,
+}
+
+fn main() {
+ let opt = Opt::from_args();
+ if let Err(e) = run(opt) {
+ eprintln!("{}", e);
+ }
+}
+
+fn run(opt: Opt) -> Result<()> {
+ let url = opt.url;
+
+ let yt_re = regex::Regex::new(r"^https?://(www\.)?(youtube\.com/watch|youtu\.be/)").unwrap();
+ if yt_re.is_match(&url) {
+ Ok(run_cmd!("umpv \"{}\"", url)?)
+ } else {
+ Ok(run_cmd!("firefox \"{}\"", url)?)
+ }
+}
+
+// vim: filetype=rust
diff --git a/scripts/overwatch-controls b/scripts/overwatch-controls
new file mode 100755
index 0000000..dbf3ef3
--- /dev/null
+++ b/scripts/overwatch-controls
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+xmodmap -e "keycode 37 = Control_R"
+xmodmap -e "keycode 105 = Control_L"
+
+# vim: expandtab sw=2 ts=2
diff --git a/scripts/removablectl b/scripts/removablectl
new file mode 100755
index 0000000..926067f
--- /dev/null
+++ b/scripts/removablectl
@@ -0,0 +1,89 @@
+#!/usr/bin/env scriptisto
+
+// scriptisto-begin
+// script_src: src/main.rs
+// build_cmd: cargo build --release && strip ./target/release/script
+// target_bin: ./target/release/script
+// files:
+// - path: Cargo.toml
+// content: |
+// package = { name = "script", version = "0.1.0", edition = "2018"}
+// [dependencies]
+// structopt="*"
+// cmd_lib = "0.7.8"
+// atty = "0.2"
+// scriptisto-end
+
+use structopt::StructOpt;
+use cmd_lib::*;
+
+#[derive(Debug, StructOpt)]
+#[structopt(name = "removablectl", about = "Manages removable drives.")]
+enum Opt {
+ /// Mount a drive
+ Mount,
+ /// Unmount a drive
+ Unmount,
+}
+
+fn main() -> CmdResult {
+ let opt = Opt::from_args();
+ match opt {
+ Opt::Mount => mount(),
+ Opt::Unmount => unmount(),
+ }
+}
+
+fn mount () -> CmdResult {
+ let unmounted = Process::new("lsblk --noheadings --raw -o NAME,MOUNTPOINT")
+ .pipe("awk '$1~/[[:digit:]]/ && $2 == \"\"'")
+ .wait::<FunResult>()?;
+ let filtered = unmounted
+ .split_whitespace()
+ .filter(|s| !s.starts_with("sda"))
+ .filter(|s| !s.starts_with("loop"))
+ .map(|s| format!("/dev/{}", s))
+ .collect::<Vec<_>>();
+
+ if filtered.is_empty() {
+ die!("No unmounted drives were found");
+ }
+
+ let selected = chooser(filtered)?;
+ run_cmd!("udisksctl mount -b {}", selected)
+}
+
+fn unmount () -> CmdResult {
+ let mounted = Process::new("cat /etc/mtab")
+ .pipe("grep ^/")
+ .pipe("awk '{print $1}'")
+ .wait::<FunResult>()?;
+ let filtered = mounted
+ .split_whitespace()
+ .filter(|s| !s.starts_with("/dev/sda"))
+ .map(|s| s.to_owned())
+ .collect::<Vec<_>>();
+
+ if filtered.is_empty() {
+ die!("No mounted drives were found");
+ }
+
+ let selected = chooser(filtered)?;
+ run_cmd!("udisksctl unmount -b {}", selected)
+}
+
+fn chooser(list: Vec<String>) -> FunResult {
+ let selected = if atty::is(atty::Stream::Stdout) {
+ run_fun!("enquirer select -m \"Choose a drive\" {}", list.join(" "))?
+ } else {
+ run_fun!("echo -e \"{}\" | rofi -dmenu -p \"Choose a drive\"", list.join("\\n"))?
+ };
+
+ if selected.is_empty() {
+ die!("Nothing was selected");
+ }
+
+ Ok(selected)
+}
+
+// vim: filetype=rust
diff --git a/scripts/renoise-wine b/scripts/renoise-wine
new file mode 100755
index 0000000..412681d
--- /dev/null
+++ b/scripts/renoise-wine
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+export WINEPREFIX="$HOME"/.local/share/wine/renoise
+export WINEARCH=win64
+export WINEDEBUG=-all
+if [ ! -d "$WINEPREFIX" ] ; then
+ mkdir -p "$WINEPREFIX"
+ wineboot -u
+fi
+
+wine "$WINEPREFIX/drive_c/Program Files/Renoise 3.2.1/Renoise.exe" "$@"
diff --git a/scripts/revert-overwatch b/scripts/revert-overwatch
new file mode 100755
index 0000000..07b208a
--- /dev/null
+++ b/scripts/revert-overwatch
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+xmodmap -e "keycode 37 = Control_L"
+xmodmap -e "keycode 105 = Control_R"
+
+# vim: expandtab sw=2 ts=2
diff --git a/scripts/rofi-kvmap b/scripts/rofi-kvmap
index 2436e78..13bc849 100755
--- a/scripts/rofi-kvmap
+++ b/scripts/rofi-kvmap
@@ -5,7 +5,6 @@ sep=":"
cd "$(dirname "$0")" || exit 1
-
selected_string=$(rofi -dmenu -i -sync -p "key" "$@" < "$character_list")
selected_symbol=$(printf '%s' "$selected_string" | cut -d "$sep" -f 2-)
diff --git a/scripts/rofi-passmenu b/scripts/rofi-passmenu
index 1423685..5e0fe75 100755
--- a/scripts/rofi-passmenu
+++ b/scripts/rofi-passmenu
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/bash
shopt -s nullglob globstar
diff --git a/scripts/show-figlet b/scripts/show-figlet
new file mode 100755
index 0000000..727145f
--- /dev/null
+++ b/scripts/show-figlet
@@ -0,0 +1,51 @@
+#!/usr/bin/env scriptisto
+
+// scriptisto-begin
+// script_src: src/main.rs
+// build_cmd: cargo build --release && strip ./target/release/script
+// target_bin: ./target/release/script
+// files:
+// - path: Cargo.toml
+// content: |
+// package = { name = "script", version = "0.1.0", edition = "2018"}
+// [dependencies]
+// scripttools = { path = "/home/jokler/rust/scripttools" }
+// structopt="*"
+// cmd_lib = "*"
+// atty = "*"
+// walkdir = "*"
+// scriptisto-end
+
+use structopt::StructOpt;
+use walkdir::WalkDir;
+use cmd_lib::*;
+use scripttools::*;
+
+#[derive(Debug, StructOpt)]
+#[structopt(name = "show-figlet", about = "Demos figlet fonts")]
+struct Opt {
+ input: String,
+}
+
+fn main() {
+ let opt = Opt::from_args();
+ if let Err(e) = run(opt) {
+ eprintln!("{}", e);
+ }
+}
+
+fn run(opt: Opt) -> Result<()> {
+ for entry in WalkDir::new("/usr/share/figlet") {
+ let entry = entry.unwrap();
+ let path = entry.path();
+ let ext = path.extension().map(|v| v.to_str().unwrap());
+ if Some("flf") == ext {
+ let font = path.file_name().unwrap();
+ run_cmd!("figlet -f {} {}", font.to_str().unwrap(), opt.input)?;
+ }
+ }
+
+ Ok(())
+}
+
+// vim: filetype=rust
diff --git a/scripts/shtop b/scripts/shtop
new file mode 100755
index 0000000..4fbdb57
--- /dev/null
+++ b/scripts/shtop
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+current-term --class htop -e htop
+
+# vim: expandtab sw=2 ts=2
diff --git a/scripts/skunst b/scripts/skunst
new file mode 100755
index 0000000..82a1091
--- /dev/null
+++ b/scripts/skunst
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+kunst --music_dir $HOME/music/ &
+
+# vim: expandtab sw=2 ts=2
diff --git a/scripts/spms b/scripts/spms
new file mode 100755
index 0000000..e9d0f93
--- /dev/null
+++ b/scripts/spms
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+current-term --class pms -e pms
+
+# vim: expandtab sw=2 ts=2
diff --git a/scripts/spot b/scripts/spot
new file mode 100755
index 0000000..8e6e4b5
--- /dev/null
+++ b/scripts/spot
@@ -0,0 +1,29 @@
+#!/usr/bin/env scriptisto
+
+// scriptisto-begin
+// script_src: src/main.rs
+// build_cmd: cargo build --release && strip ./target/release/script
+// target_bin: ./target/release/script
+// files:
+// - path: Cargo.toml
+// content: |
+// package = { name = "script", version = "0.1.0", edition = "2018"}
+// [dependencies]
+// scripttools = { path = "/home/jokler/rust/scripttools" }
+// cmd_lib = "*"
+// scriptisto-end
+
+use cmd_lib::*;
+use scripttools::*;
+
+fn main() {
+ if let Err(e) = run() {
+ eprintln!("{}", e);
+ }
+}
+
+fn run() -> Result<()> {
+ Ok(run_cmd!("current-term --class spt -e spt")?)
+}
+
+// vim: filetype=rust
diff --git a/scripts/steam-no-browser b/scripts/steam-no-browser
new file mode 100755
index 0000000..f6cd519
--- /dev/null
+++ b/scripts/steam-no-browser
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+#steam-native -noverifyfiles -nobootstrapupdate -skipinitialbootstrap -norepairfiles -overridepackageurl -no-browser "$@"
+steam-native -no-browser "$@"
+#steam-runtime -no-browser "$@"
+
+# vim: expandtab sw=2 ts=2
diff --git a/scripts/sweechat b/scripts/sweechat
index a2f0a70..fd7e20e 100755
--- a/scripts/sweechat
+++ b/scripts/sweechat
@@ -1,5 +1,5 @@
#!/bin/sh
-termite --name=weechat -e weechat
+current-term --class weechat -e weechat
# vim: expandtab sw=2 ts=2
diff --git a/scripts/switch-ibus-engine b/scripts/switch-ibus-engine
new file mode 100755
index 0000000..9ca4975
--- /dev/null
+++ b/scripts/switch-ibus-engine
@@ -0,0 +1,37 @@
+#!/usr/bin/env scriptisto
+
+// scriptisto-begin
+// script_src: src/main.rs
+// build_cmd: cargo build --release && strip ./target/release/script
+// target_bin: ./target/release/script
+// files:
+// - path: Cargo.toml
+// content: |
+// package = { name = "script", version = "0.1.0", edition = "2018"}
+// [dependencies]
+// scripttools = { path = "/home/jokler/rust/scripttools" }
+// cmd_lib = "*"
+// scriptisto-end
+
+use cmd_lib::*;
+use scripttools::*;
+
+fn main() {
+ if let Err(e) = run() {
+ eprintln!("{}", e);
+ }
+}
+
+fn run() -> Result<()> {
+ let current_engine = run_fun!("ibus engine")?;
+
+ match current_engine.as_ref() {
+ "xkb:us::eng" => run_cmd!("ibus engine anthy")?,
+ "anthy" => run_cmd!("ibus engine xkb:us::eng")?,
+ _ => panic!("unknown engine: {}", current_engine),
+ }
+
+ Ok(())
+}
+
+// vim: filetype=rust
diff --git a/scripts/umpv b/scripts/umpv
new file mode 100755
index 0000000..4e15d7f
--- /dev/null
+++ b/scripts/umpv
@@ -0,0 +1,88 @@
+#!/usr/bin/env python3
+
+"""
+This script emulates "unique application" functionality on Linux. When starting
+playback with this script, it will try to reuse an already running instance of
+mpv (but only if that was started with umpv). Other mpv instances (not started
+by umpv) are ignored, and the script doesn't know about them.
+
+This only takes filenames as arguments. Custom options can't be used; the script
+interprets them as filenames. If mpv is already running, the files passed to
+umpv are appended to mpv's internal playlist. If a file does not exist or is
+otherwise not playable, mpv will skip the playlist entry when attempting to
+play it (from the GUI perspective, it's silently ignored).
+
+If mpv isn't running yet, this script will start mpv and let it control the
+current terminal. It will not write output to stdout/stderr, because this
+will typically just fill ~/.xsession-errors with garbage.
+
+mpv will terminate if there are no more files to play, and running the umpv
+script after that will start a new mpv instance.
+
+Note: you can supply custom mpv path and options with the MPV environment
+ variable. The environment variable will be split on whitespace, and the
+ first item is used as path to mpv binary and the rest is passed as options
+ _if_ the script starts mpv. If mpv is not started by the script (i.e. mpv
+ is already running), this will be ignored.
+"""
+
+import sys
+import os
+import socket
+import errno
+import subprocess
+import fcntl
+import stat
+import string
+
+files = sys.argv[1:]
+
+# this is the same method mpv uses to decide this
+def is_url(filename):
+ parts = filename.split("://", 1)
+ if len(parts) < 2:
+ return False
+ # protocol prefix has no special characters => it's an URL
+ allowed_symbols = string.ascii_letters + string.digits + '_'
+ prefix = parts[0]
+ return all(map(lambda c: c in allowed_symbols, prefix))
+
+# make them absolute; also makes them safe against interpretation as options
+def make_abs(filename):
+ if not is_url(filename):
+ return os.path.abspath(filename)
+ return filename
+files = [make_abs(f) for f in files]
+
+SOCK = os.path.join("/tmp/umpv_socket")
+
+sock = None
+try:
+ sock = socket.socket(socket.AF_UNIX)
+ sock.connect(SOCK)
+except socket.error as e:
+ if e.errno == errno.ECONNREFUSED:
+ sock = None
+ pass # abandoned socket
+ elif e.errno == errno.ENOENT:
+ sock = None
+ pass # doesn't exist
+ else:
+ raise e
+
+if sock:
+ # Unhandled race condition: what if mpv is terminating right now?
+ for f in files:
+ # escape: \ \n "
+ f = f.replace("\\", "\\\\").replace("\"", "\\\"").replace("\n", "\\n")
+ f = "\"" + f + "\""
+ sock.send(("raw loadfile " + f + " append-play\n").encode("utf-8"))
+else:
+ # Let mpv recreate socket if it doesn't already exist.
+
+ opts = (os.getenv("MPV") or "mpv").split()
+ opts.extend(["--player-operation-mode=pseudo-gui", "--input-ipc-server=" + SOCK,
+ "--"])
+ opts.extend(files)
+
+ subprocess.check_call(opts)
diff --git a/scripts/watch-dir b/scripts/watch-dir
new file mode 100755
index 0000000..4fb701f
--- /dev/null
+++ b/scripts/watch-dir
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+inotifywait -r -m "$1" -e create -e moved_to |
+ while read -r path action file; do
+ echo "The file '$file' appeared in directory '$path' via '$action'"
+ done
+
+# vim: expandtab sw=2 ts=2
diff --git a/scripts/xyz-upload b/scripts/xyz-upload
new file mode 100755
index 0000000..a72e783
--- /dev/null
+++ b/scripts/xyz-upload
@@ -0,0 +1,47 @@
+#!/usr/bin/env scriptisto
+
+// scriptisto-begin
+// script_src: src/main.rs
+// build_cmd: cargo build --release && strip ./target/release/script
+// target_bin: ./target/release/script
+// files:
+// - path: Cargo.toml
+// content: |
+// package = { name = "script", version = "0.1.0", edition = "2018"}
+// [dependencies]
+// scripttools = { path = "/home/jokler/rust/scripttools" }
+// structopt="*"
+// cmd_lib = "*"
+// atty = "*"
+// scriptisto-end
+
+use structopt::StructOpt;
+use cmd_lib::*;
+use scripttools::*;
+
+use std::path::PathBuf;
+
+#[derive(Debug, StructOpt)]
+#[structopt(name = "xyz-upload", about = "Uploads the specified file to jokler.xyz")]
+struct Opt {
+ /// File to upload
+ path: PathBuf,
+}
+
+fn main() {
+ let opt = Opt::from_args();
+ if let Err(e) = run(opt) {
+ eprintln!("{}", e);
+ }
+}
+
+fn run(opt: Opt) -> Result<()> {
+ let str_path = opt.path.to_str().ok_or("Failed to convert path to str")?;
+ run_cmd!("upf -o /home/jokler/.config/xyz-logs.txt xyz \"{}\" | tee /dev/tty | xsel -i --clipboard", str_path)?;
+ println!();
+ run_cmd!("beep")?;
+
+ Ok(())
+}
+
+// vim: filetype=rust