summarylogtreecommitdiffstats
path: root/0001-Global-install.patch
blob: c47b8c427e7256720bf6fe6b8b1a2a68b2ec1f58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
From 02ef06f34e702cb6c728d102ccca7817bc189392 Mon Sep 17 00:00:00 2001
From: "Daniel M. Capella" <polyzen@archlinux.org>
Date: Tue, 4 Aug 2020 18:30:54 -0400
Subject: [PATCH] Global install

---
 src/swapper.rs   | 10 +---------
 tmux-thumbs.sh   |  6 ++----
 tmux-thumbs.tmux | 10 +---------
 3 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/src/swapper.rs b/src/swapper.rs
index cce19e0..e2fc3d8 100644
--- a/src/swapper.rs
+++ b/src/swapper.rs
@@ -57,7 +57,6 @@ fn dbg(msg: &str) {
 
 pub struct Swapper<'a> {
   executor: Box<&'a mut dyn Executor>,
-  dir: String,
   command: String,
   upcase_command: String,
   multi_command: String,
@@ -74,7 +73,6 @@ pub struct Swapper<'a> {
 impl<'a> Swapper<'a> {
   fn new(
     executor: Box<&'a mut dyn Executor>,
-    dir: String,
     command: String,
     upcase_command: String,
     multi_command: String,
@@ -87,7 +85,6 @@ impl<'a> Swapper<'a> {
 
     Swapper {
       executor,
-      dir,
       command,
       upcase_command,
       multi_command,
@@ -213,11 +210,10 @@ impl<'a> Swapper<'a> {
     };
 
     let pane_command = format!(
-        "tmux capture-pane -t {active_pane_id} -p{scroll_params} | tail -n {height} | {dir}/target/release/thumbs -f '%U:%H' -t {tmp} {args}; tmux swap-pane -t {active_pane_id}; {zoom_command} tmux wait-for -S {signal}",
+        "tmux capture-pane -t {active_pane_id} -p{scroll_params} | tail -n {height} | thumbs -f '%U:%H' -t {tmp} {args}; tmux swap-pane -t {active_pane_id}; {zoom_command} tmux wait-for -S {signal}",
         active_pane_id = active_pane_id,
         scroll_params = scroll_params,
         height = self.active_pane_height.unwrap_or(i32::MAX),
-        dir = self.dir,
         tmp = TMP_FILE,
         args = args.join(" "),
         zoom_command = zoom_command,
@@ -447,7 +443,6 @@ mod tests {
       "".to_string(),
       "".to_string(),
       "".to_string(),
-      "".to_string(),
       false,
     );
 
@@ -470,7 +465,6 @@ mod tests {
       "".to_string(),
       "".to_string(),
       "".to_string(),
-      "".to_string(),
       false,
     );
 
@@ -493,7 +487,6 @@ mod tests {
     let multi_command = "open \"{}\"".to_string();
     let mut swapper = Swapper::new(
       Box::new(&mut executor),
-      "".to_string(),
       user_command,
       upcase_command,
       multi_command,
@@ -578,7 +571,6 @@ fn main() -> std::io::Result<()> {
   let mut executor = RealShell::new();
   let mut swapper = Swapper::new(
     Box::new(&mut executor),
-    dir.to_string(),
     command.to_string(),
     upcase_command.to_string(),
     multi_command.to_string(),
diff --git a/tmux-thumbs.sh b/tmux-thumbs.sh
index 92d5625..f1e0a26 100755
--- a/tmux-thumbs.sh
+++ b/tmux-thumbs.sh
@@ -1,8 +1,6 @@
 #!/usr/bin/env bash
 set -Eeu -o pipefail
 
-CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
 function get-opt-value() {
   tmux show -vg "@thumbs-${1}" 2> /dev/null
 }
@@ -21,7 +19,7 @@ function get-opt-arg() {
   fi
 }
 
-PARAMS=(--dir "${CURRENT_DIR}")
+PARAMS=(--dir /usr/share/thumbs)
 
 function add-param() {
   local type opt arg
@@ -35,4 +33,4 @@ add-param command        string
 add-param upcase-command string
 add-param osc52          boolean
 
-"${CURRENT_DIR}/target/release/tmux-thumbs" "${PARAMS[@]}" || true
+tmux-thumbs "${PARAMS[@]}" || true
diff --git a/tmux-thumbs.tmux b/tmux-thumbs.tmux
index 4fc9355..dc03d1d 100755
--- a/tmux-thumbs.tmux
+++ b/tmux-thumbs.tmux
@@ -1,16 +1,8 @@
 #!/usr/bin/env bash
 
-CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
 DEFAULT_THUMBS_KEY=space
 
 THUMBS_KEY="$(tmux show-option -gqv @thumbs-key)"
 THUMBS_KEY=${THUMBS_KEY:-$DEFAULT_THUMBS_KEY}
 
-tmux bind-key "${THUMBS_KEY}" run-shell -b "${CURRENT_DIR}/tmux-thumbs.sh"
-
-BINARY="${CURRENT_DIR}/target/release/thumbs"
-
-if [ ! -f "$BINARY" ]; then
-  tmux split-window "cd ${CURRENT_DIR} && cargo build --release --target-dir=target && echo 'Press any key to continue...' && read -k1"
-fi
+tmux bind-key "${THUMBS_KEY}" run-shell -b /usr/share/thumbs/tmux-thumbs.sh
-- 
2.32.0