TermuxC 2.0.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.
- termuxc-2.0.0/LICENSE +9 -0
- termuxc-2.0.0/PKG-INFO +7 -0
- termuxc-2.0.0/README.md +105 -0
- termuxc-2.0.0/pyproject.toml +18 -0
- termuxc-2.0.0/setup.cfg +4 -0
- termuxc-2.0.0/src/TermuxC/__init__.py +72 -0
- termuxc-2.0.0/src/TermuxC.egg-info/PKG-INFO +7 -0
- termuxc-2.0.0/src/TermuxC.egg-info/SOURCES.txt +9 -0
- termuxc-2.0.0/src/TermuxC.egg-info/dependency_links.txt +1 -0
- termuxc-2.0.0/src/TermuxC.egg-info/entry_points.txt +3 -0
- termuxc-2.0.0/src/TermuxC.egg-info/top_level.txt +1 -0
termuxc-2.0.0/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ruizennis
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
termuxc-2.0.0/PKG-INFO
ADDED
termuxc-2.0.0/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# TermuxC
|
|
2
|
+
### Termux copy to clipboard made easy.
|
|
3
|
+
## Also known as TermuxCopy
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.python.org)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
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.
|
|
9
|
+
|
|
10
|
+
## Cli Tool Usage:
|
|
11
|
+
|
|
12
|
+
### Copy text
|
|
13
|
+
```bash
|
|
14
|
+
termux text
|
|
15
|
+
```
|
|
16
|
+
**Or**
|
|
17
|
+
```bash
|
|
18
|
+
echo "test" | termuxc
|
|
19
|
+
```
|
|
20
|
+
### Copy text from file
|
|
21
|
+
```bash
|
|
22
|
+
cat filename | termuxc
|
|
23
|
+
```
|
|
24
|
+
### Copy current working directory
|
|
25
|
+
```bash
|
|
26
|
+
pwd | termuxc
|
|
27
|
+
```
|
|
28
|
+
Also compatable with
|
|
29
|
+
- bat
|
|
30
|
+
- grep
|
|
31
|
+
- curl
|
|
32
|
+
- head
|
|
33
|
+
- tail
|
|
34
|
+
## Pip package Usage:
|
|
35
|
+
|
|
36
|
+
### Copy text
|
|
37
|
+
```python
|
|
38
|
+
from TermuxC import Copy
|
|
39
|
+
Copy("Str")
|
|
40
|
+
Copy(1)
|
|
41
|
+
Copy(1.3)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Copy text from file
|
|
45
|
+
```python
|
|
46
|
+
from TermuxC import Copy
|
|
47
|
+
with open("TermuxC.py", "r") as f:
|
|
48
|
+
content = f.read()
|
|
49
|
+
Copy(content)
|
|
50
|
+
```
|
|
51
|
+
### Copy current working directory
|
|
52
|
+
```python
|
|
53
|
+
from TermuxC import Copy
|
|
54
|
+
import os
|
|
55
|
+
Copy(os.getcwd())
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
Install git
|
|
60
|
+
```bash
|
|
61
|
+
pkg install git
|
|
62
|
+
```
|
|
63
|
+
Clone the repository and move into it
|
|
64
|
+
```bash
|
|
65
|
+
git clone https://github.com/Ruizennis/TermuxC
|
|
66
|
+
cd TermuxC
|
|
67
|
+
```
|
|
68
|
+
Install pip Package
|
|
69
|
+
```bash
|
|
70
|
+
pip install .
|
|
71
|
+
```
|
|
72
|
+
## Uninstallation
|
|
73
|
+
```bash
|
|
74
|
+
pip uninstall TermuxC
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Requirements:
|
|
78
|
+
**Python 3+**
|
|
79
|
+
|
|
80
|
+
Get Python from https://www.python.org!
|
|
81
|
+
|
|
82
|
+
## Aware:
|
|
83
|
+
If using terminal multiplexers such as **Tmux** or **Screen** ensure they allow **OSC 52**.
|
|
84
|
+
|
|
85
|
+
### Tmux support
|
|
86
|
+
run this command to allow tmux to write to device clipboard
|
|
87
|
+
```bash
|
|
88
|
+
CONFIG_FILE=$( [ -d "$HOME/.config/tmux" ] \
|
|
89
|
+
&& echo "$HOME/.config/tmux/tmux.conf" \
|
|
90
|
+
|| echo "$HOME/.tmux.conf" ) ; \
|
|
91
|
+
printf "\n# Enable clipboard and passthrough\nset -s set-clipboard on\nset -g allow-passthrough on\n" >> "$CONFIG_FILE" \
|
|
92
|
+
&& tmux kill-server 2>/dev/null \
|
|
93
|
+
|| true
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Screen support
|
|
97
|
+
run this command to allow Screen to write to clipboard
|
|
98
|
+
```bash
|
|
99
|
+
CONFIG_FILE=$( [ -f "$HOME/.screenrc" ] \
|
|
100
|
+
&& echo "$HOME/.screenrc" \
|
|
101
|
+
|| echo "$HOME/.screenrc" ) ; \
|
|
102
|
+
printf "\n# Enable clipboard and passthrough\nregister [ \"\nbind ] paste [\n" >> "$CONFIG_FILE" \
|
|
103
|
+
&& screen -wipe >/dev/null 2>&1 \
|
|
104
|
+
|| true
|
|
105
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "TermuxC"
|
|
7
|
+
version = "2.0.0"
|
|
8
|
+
description = "A lightweight utility to copy text to the device clipboard using OSC 52."
|
|
9
|
+
authors = [{name = "Ruizennis"}]
|
|
10
|
+
|
|
11
|
+
[project.scripts]
|
|
12
|
+
Termuxc = "TermuxC:main"
|
|
13
|
+
termuxc = "TermuxC:main"
|
|
14
|
+
|
|
15
|
+
[tool.setuptools]
|
|
16
|
+
packages = ["TermuxC"]
|
|
17
|
+
package-dir = {"" = "src"}
|
|
18
|
+
|
termuxc-2.0.0/setup.cfg
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
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)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
TermuxC
|