TermuxC 2.0.9__tar.gz → 2.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TermuxC
3
- Version: 2.0.9
3
+ Version: 2.2.0
4
4
  Summary: A lightweight utility to copy text to the device clipboard using OSC 52.
5
5
  Author: Ruizennis
6
6
  License: MIT
@@ -25,13 +25,13 @@ Dynamic: license-file
25
25
  [![PyPI downloads](https://img.shields.io/pypi/dm/TermuxC.svg)](https://pypi.org/project/TermuxC/)
26
26
 
27
27
 
28
- This dual function pip package/cli tool was made to solve an issue with Termux, not allowing copying to device clipboard easily without their companion app. This package solves that.
28
+ This dual function pip package & cli tool was made to solve an issue with Termux, not allowing copying to device clipboard easily without their companion app; This package solves that.
29
29
 
30
30
  ## Cli Tool Usage:
31
31
 
32
32
  ### Copy text
33
33
  ```bash
34
- termux text
34
+ termuxc text
35
35
  ```
36
36
  **Or**
37
37
  ```bash
@@ -45,7 +45,7 @@ cat filename | termuxc
45
45
  ```bash
46
46
  pwd | termuxc
47
47
  ```
48
- Also compatable with
48
+ Also compatible with
49
49
  - bat
50
50
  - grep
51
51
  - curl
@@ -78,7 +78,7 @@ Copy(os.getcwd())
78
78
  ## Installation
79
79
  Install pip package
80
80
  ```bash
81
- pkg install TermuxC
81
+ pip install TermuxC
82
82
  ```
83
83
 
84
84
  ## Uninstallation
@@ -91,29 +91,8 @@ pip uninstall TermuxC
91
91
 
92
92
  Get Python from https://www.python.org!
93
93
 
94
- View Package here https://pypi.org/project/TermuxC/
94
+ View Package here! https://pypi.org/project/TermuxC/
95
95
 
96
- ## Aware:
97
- If using terminal multiplexers such as **Tmux** or **Screen** ensure they allow **OSC 52**.
98
96
 
99
97
  ### Tmux support
100
- run this command to allow tmux to write to device clipboard
101
- ```bash
102
- CONFIG_FILE=$( [ -d "$HOME/.config/tmux" ] \
103
- && echo "$HOME/.config/tmux/tmux.conf" \
104
- || echo "$HOME/.tmux.conf" ) ; \
105
- printf "\n# Enable clipboard and passthrough\nset -s set-clipboard on\nset -g allow-passthrough on\n" >> "$CONFIG_FILE" \
106
- && tmux kill-server 2>/dev/null \
107
- || true
108
- ```
109
-
110
- ### Screen support
111
- run this command to allow Screen to write to clipboard
112
- ```bash
113
- CONFIG_FILE=$( [ -f "$HOME/.screenrc" ] \
114
- && echo "$HOME/.screenrc" \
115
- || echo "$HOME/.screenrc" ) ; \
116
- printf "\n# Enable clipboard and passthrough\nregister [ \"\nbind ] paste [\n" >> "$CONFIG_FILE" \
117
- && screen -wipe >/dev/null 2>&1 \
118
- || true
119
- ```
98
+ As of version **2.2.0** TermuxC has native tmux support!
@@ -7,13 +7,13 @@
7
7
  [![PyPI downloads](https://img.shields.io/pypi/dm/TermuxC.svg)](https://pypi.org/project/TermuxC/)
8
8
 
9
9
 
10
- This dual function pip package/cli tool was made to solve an issue with Termux, not allowing copying to device clipboard easily without their companion app. This package solves that.
10
+ This dual function pip package & cli tool was made to solve an issue with Termux, not allowing copying to device clipboard easily without their companion app; This package solves that.
11
11
 
12
12
  ## Cli Tool Usage:
13
13
 
14
14
  ### Copy text
15
15
  ```bash
16
- termux text
16
+ termuxc text
17
17
  ```
18
18
  **Or**
19
19
  ```bash
@@ -27,7 +27,7 @@ cat filename | termuxc
27
27
  ```bash
28
28
  pwd | termuxc
29
29
  ```
30
- Also compatable with
30
+ Also compatible with
31
31
  - bat
32
32
  - grep
33
33
  - curl
@@ -60,7 +60,7 @@ Copy(os.getcwd())
60
60
  ## Installation
61
61
  Install pip package
62
62
  ```bash
63
- pkg install TermuxC
63
+ pip install TermuxC
64
64
  ```
65
65
 
66
66
  ## Uninstallation
@@ -73,29 +73,8 @@ pip uninstall TermuxC
73
73
 
74
74
  Get Python from https://www.python.org!
75
75
 
76
- View Package here https://pypi.org/project/TermuxC/
76
+ View Package here! https://pypi.org/project/TermuxC/
77
77
 
78
- ## Aware:
79
- If using terminal multiplexers such as **Tmux** or **Screen** ensure they allow **OSC 52**.
80
78
 
81
79
  ### Tmux support
82
- run this command to allow tmux to write to device clipboard
83
- ```bash
84
- CONFIG_FILE=$( [ -d "$HOME/.config/tmux" ] \
85
- && echo "$HOME/.config/tmux/tmux.conf" \
86
- || echo "$HOME/.tmux.conf" ) ; \
87
- printf "\n# Enable clipboard and passthrough\nset -s set-clipboard on\nset -g allow-passthrough on\n" >> "$CONFIG_FILE" \
88
- && tmux kill-server 2>/dev/null \
89
- || true
90
- ```
91
-
92
- ### Screen support
93
- run this command to allow Screen to write to clipboard
94
- ```bash
95
- CONFIG_FILE=$( [ -f "$HOME/.screenrc" ] \
96
- && echo "$HOME/.screenrc" \
97
- || echo "$HOME/.screenrc" ) ; \
98
- printf "\n# Enable clipboard and passthrough\nregister [ \"\nbind ] paste [\n" >> "$CONFIG_FILE" \
99
- && screen -wipe >/dev/null 2>&1 \
100
- || true
101
- ```
80
+ As of version **2.2.0** TermuxC has native tmux support!
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "TermuxC"
7
- version = "2.0.9"
7
+ version = "2.2.0"
8
8
  description = "A lightweight utility to copy text to the device clipboard using OSC 52."
9
9
  authors = [{name = "Ruizennis"}]
10
10
  requires-python = ">=3.7"
@@ -0,0 +1,95 @@
1
+ # TermuxC aka Termux copy, view README.md for more info
2
+ # Copyright (c) 2026 Ruizennis
3
+ # This software is licensed under the MIT License.
4
+ # See the LICENSE file or https://opensource.org/licenses/MIT for full terms.
5
+ import base64
6
+ import sys
7
+ import os
8
+ from time import sleep
9
+ from threading import Lock
10
+ # configuration
11
+ Sleeptime = 0.5
12
+ help = {'-h', '--help', '-help'}
13
+ help_message = '''
14
+ Usage:
15
+
16
+ Copying text with cli
17
+ termuxc Test!
18
+ OR
19
+ echo "<text>" | Termuxc
20
+
21
+ Copying a number with cli
22
+ termuxc <number>
23
+
24
+ Copying filecontents with cli
25
+ cat <file> | Termuxc
26
+ (replace <file> with desired file path)
27
+
28
+ Using pip package to copy text
29
+ from TermuxC import Copy
30
+ Copy('<text>')
31
+
32
+ Using pip package to copy number
33
+ from TermuxC import Copy
34
+ Copy(<number>)
35
+
36
+ Using Pip package to text copy from file
37
+ from TermuxC import Copy
38
+ with open(filename, 'r') as F:
39
+ C = F.read()
40
+ Copy(C)
41
+
42
+ for more help see https://github.com/Ruizennis/TermuxC
43
+ '''
44
+ #New: added tmux support natively
45
+ def check_for_tmux():
46
+ if "TMUX" in os.environ:
47
+ return True #using tmux
48
+ else:
49
+ return False #normal code
50
+
51
+
52
+ lock = Lock()
53
+
54
+ def Copy(string):
55
+ with lock:
56
+ content = str(string)
57
+ b64 = base64.b64encode(content.encode('utf-8')).decode('ascii')
58
+ multiplexor = check_for_tmux()
59
+ if multiplexor:
60
+ tmuxpath = os.path.expanduser('~/.tmux.conf')
61
+ content = ''
62
+ if os.path.exists(tmuxpath):
63
+ with open(tmuxpath, 'r') as file_read:
64
+ content = file_read.read()
65
+ if not "allow-passthrough" in content:
66
+ with open(tmuxpath, 'a') as file:
67
+ file.write("\nset -g allow-passthrough on\n")
68
+ os.system(f"tmux source-file {tmuxpath} >/dev/null 2>&1")
69
+ write_code = f"\033Ptmux;\033\033]52;c;{b64}\a\033\\" # special tmux osc command
70
+ else:
71
+ write_code = f"\033]52;c;{b64}\a"
72
+ sys.stdout.write(write_code)
73
+ sys.stdout.flush()
74
+ sleep(Sleeptime)
75
+
76
+ def main():
77
+ if not sys.stdin.isatty():
78
+ readstdin = sys.stdin.read()
79
+ if readstdin.endswith('\n'):
80
+ readstdin = readstdin[:-1]
81
+ if readstdin:
82
+ Copy(readstdin)
83
+ sys.exit(0)
84
+ else:
85
+ print('Please provide an input', file=sys.stderr)
86
+ sys.exit(1)
87
+ elif help.intersection(sys.argv):
88
+ print(help_message)
89
+ sys.exit(0)
90
+ elif len(sys.argv) > 1:
91
+ Copy(' '.join(sys.argv[1:]))
92
+ sys.exit(0)
93
+ else:
94
+ print('Please provide at least 1 argument or run termuxc --help for help.', file=sys.stderr)
95
+ sys.exit(1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TermuxC
3
- Version: 2.0.9
3
+ Version: 2.2.0
4
4
  Summary: A lightweight utility to copy text to the device clipboard using OSC 52.
5
5
  Author: Ruizennis
6
6
  License: MIT
@@ -25,13 +25,13 @@ Dynamic: license-file
25
25
  [![PyPI downloads](https://img.shields.io/pypi/dm/TermuxC.svg)](https://pypi.org/project/TermuxC/)
26
26
 
27
27
 
28
- This dual function pip package/cli tool was made to solve an issue with Termux, not allowing copying to device clipboard easily without their companion app. This package solves that.
28
+ This dual function pip package & cli tool was made to solve an issue with Termux, not allowing copying to device clipboard easily without their companion app; This package solves that.
29
29
 
30
30
  ## Cli Tool Usage:
31
31
 
32
32
  ### Copy text
33
33
  ```bash
34
- termux text
34
+ termuxc text
35
35
  ```
36
36
  **Or**
37
37
  ```bash
@@ -45,7 +45,7 @@ cat filename | termuxc
45
45
  ```bash
46
46
  pwd | termuxc
47
47
  ```
48
- Also compatable with
48
+ Also compatible with
49
49
  - bat
50
50
  - grep
51
51
  - curl
@@ -78,7 +78,7 @@ Copy(os.getcwd())
78
78
  ## Installation
79
79
  Install pip package
80
80
  ```bash
81
- pkg install TermuxC
81
+ pip install TermuxC
82
82
  ```
83
83
 
84
84
  ## Uninstallation
@@ -91,29 +91,8 @@ pip uninstall TermuxC
91
91
 
92
92
  Get Python from https://www.python.org!
93
93
 
94
- View Package here https://pypi.org/project/TermuxC/
94
+ View Package here! https://pypi.org/project/TermuxC/
95
95
 
96
- ## Aware:
97
- If using terminal multiplexers such as **Tmux** or **Screen** ensure they allow **OSC 52**.
98
96
 
99
97
  ### Tmux support
100
- run this command to allow tmux to write to device clipboard
101
- ```bash
102
- CONFIG_FILE=$( [ -d "$HOME/.config/tmux" ] \
103
- && echo "$HOME/.config/tmux/tmux.conf" \
104
- || echo "$HOME/.tmux.conf" ) ; \
105
- printf "\n# Enable clipboard and passthrough\nset -s set-clipboard on\nset -g allow-passthrough on\n" >> "$CONFIG_FILE" \
106
- && tmux kill-server 2>/dev/null \
107
- || true
108
- ```
109
-
110
- ### Screen support
111
- run this command to allow Screen to write to clipboard
112
- ```bash
113
- CONFIG_FILE=$( [ -f "$HOME/.screenrc" ] \
114
- && echo "$HOME/.screenrc" \
115
- || echo "$HOME/.screenrc" ) ; \
116
- printf "\n# Enable clipboard and passthrough\nregister [ \"\nbind ] paste [\n" >> "$CONFIG_FILE" \
117
- && screen -wipe >/dev/null 2>&1 \
118
- || true
119
- ```
98
+ As of version **2.2.0** TermuxC has native tmux support!
@@ -1,72 +0,0 @@
1
- # TermuxC aka Termux copy, view README.md for more info
2
- # Copyright (c) 2026 Ruizennis
3
- # This software is licensed under the MIT License.
4
- # See the root LICENSE file or https://opensource.org/licenses/MIT for full terms.
5
- import base64
6
- import sys
7
- from time import sleep
8
- from threading import Lock
9
- # configuration
10
- Sleeptime = 0.5
11
- help = {'-h', '--help', '-help'}
12
- help_message = '''
13
- Usage:
14
-
15
- Copying text with cli
16
- termuxc Test!
17
- OR
18
- echo "test" | Termuxc
19
-
20
- Copying a number with cli
21
- termuxc 1
22
-
23
- Copying filecontents with cli
24
- cat Filename | Termuxc
25
- (replace filename with desired file path)
26
-
27
- Using pip package to copy text
28
- from TermuxC import Copy
29
- Copy('test')
30
-
31
- Using pip package to copy number
32
- from TermuxC import Copy
33
- Copy(1)
34
-
35
- Using Pip package to text copy from file
36
- from TermuxC import Copy
37
- with open(filename, 'r') as F:
38
- C = F.read()
39
- Copy(C)
40
-
41
- for more help see https://github.com/Ruizennis/TermuxC
42
- '''
43
- lock = Lock()
44
-
45
- def Copy(string):
46
- with lock:
47
- content = str(string)
48
- b64 = base64.b64encode(content.encode('utf-8')).decode('ascii')
49
- sys.stdout.write(f"\033]52;c;{b64}\a")
50
- sys.stdout.flush()
51
- sleep(Sleeptime)
52
-
53
- def main():
54
- if not sys.stdin.isatty():
55
- readstdin = sys.stdin.read()
56
- if readstdin.endswith('\n'):
57
- readstdin = readstdin[:-1]
58
- if readstdin:
59
- Copy(readstdin)
60
- sys.exit(0)
61
- else:
62
- print('Please provide an input')
63
- sys.exit(0)
64
- elif help.intersection(sys.argv):
65
- print(help_message)
66
- sys.exit(0)
67
- elif len(sys.argv) > 1:
68
- Copy(' '.join(sys.argv[1:]))
69
- sys.exit(0)
70
- else:
71
- print('Please provide atleast 1 argument or run termuxc --help for help.')
72
- sys.exit(0)
File without changes
File without changes