Compare commits

...

253 commits

Author SHA1 Message Date
e511ffa7f7
python/venv
Some checks failed
/ job (push) Failing after 3s
2025-02-07 21:39:13 +01:00
7668ef8f47
lint/clean 2025-02-03 19:42:09 +01:00
aaba7cbcc6
2025-02-03 19:38:50 +01:00
3ef93255e9
ffmpeg 2025-02-03 19:29:02 +01:00
024172af9d
members 2025-02-03 19:21:15 +01:00
bd35b13f73
future 2025-02-03 19:15:34 +01:00
2c0d6050ef
log/"" 2025-02-01 01:47:12 +01:00
459e85de92
tasks/after 2025-02-01 01:38:15 +01:00
a98294a65e
fix 2025-02-01 01:32:33 +01:00
5a88d127d6
lint/return 2025-02-01 01:30:54 +01:00
486b7cea1d
lint/clean 2025-02-01 01:29:47 +01:00
7cea09aedc
lint/py3clean 2025-02-01 01:27:04 +01:00
bec792d29a
lint/clean 2025-02-01 01:18:13 +01:00
086222afd2
tasks/path 2025-02-01 01:02:10 +01:00
029d4ca10a
lint/tasks 2025-02-01 00:58:14 +01:00
ce62a934d8
−pyproject/tool 2025-02-01 00:45:13 +01:00
75628cac57
lint/import 2025-02-01 00:37:30 +01:00
b41fe30bf3
check/isolated 2025-02-01 00:33:21 +01:00
e2b8bdbc0a
format/isolated 2025-02-01 00:31:29 +01:00
2635d74f91
ruff/check↔format 2025-02-01 00:23:47 +01:00
98adf0b2a1
gitlint 2025-01-31 23:51:48 +01:00
be49eab2f4
lint 2025-01-31 23:37:33 +01:00
9d45c0285c
lint/shell 2025-01-31 23:34:44 +01:00
dca2637f81
mv 2025-01-31 23:32:49 +01:00
98aff4baa8
python/lint 2025-01-31 23:31:44 +01:00
0d5d3aa5ba
pylint 2025-01-31 23:28:06 +01:00
007994bfea
ruff/check 2025-01-31 23:03:03 +01:00
1bba63ac14
pyproject 2025-01-31 22:58:09 +01:00
3a2d8d9d4f
ruff/com812 2025-01-31 22:44:26 +01:00
0dd0c5fd8f
ruff/format 2025-01-31 22:38:28 +01:00
e4178bda5d
python/ruff 2025-01-31 18:42:58 +01:00
5a89616f5c
lint python 2025-01-31 18:31:24 +01:00
a5d8c67260
pydoclint 2025-01-31 18:26:00 +01:00
2ce78087c4
mypy 2025-01-31 18:01:41 +01:00
657636b9c4
ffmpeg/precision 2025-01-28 09:38:27 +01:00
3ba4859231
ffmpeg/hdmi 2025-01-28 09:21:42 +01:00
a273d2ea43
tmux/zoom,prefix 2025-01-26 14:41:08 +01:00
1d5bf4474f
tmux/prefix,zoom 2025-01-26 14:29:51 +01:00
0151ba035b
tmux/zoom 2025-01-25 12:30:19 +01:00
302890f00d
tmux/prefix 2025-01-25 12:24:31 +01:00
6d78413418
tmux/shrink 2025-01-23 14:41:58 +01:00
1dc78a4842
tmux/prompts 2025-01-23 14:11:23 +01:00
37c4f1b0c2
tmux/session 2025-01-23 14:05:41 +01:00
14e1c8d5e6
tmux/fix 2025-01-23 13:55:25 +01:00
7414ba7b7e
tmux/align 2025-01-23 13:53:10 +01:00
7ab5f521c8
tmux/prompts 2025-01-23 12:41:51 +01:00
2227b2cb3e
tmux/recap 2025-01-23 11:54:39 +01:00
6bd27737ac
tmux/arrow 2025-01-22 16:48:35 +01:00
5bc65bbab1
tmux/end 2025-01-22 16:42:20 +01:00
c26d5b8bcb
tmux/d 2025-01-22 16:34:23 +01:00
0140f4e756
tmux/others 2025-01-22 16:33:40 +01:00
92478cfaf3
tmux/1,2 2025-01-22 16:24:48 +01:00
84ece74f43
tmux/↕ 2025-01-22 14:07:37 +01:00
a347eb7b77
tmux/3 2025-01-20 15:07:00 +01:00
74b7009ce8
tmux/magenta 2025-01-20 14:47:05 +01:00
b359b4e5ff
tmux/→ 2025-01-20 14:45:17 +01:00
3606ce807f
tmux/× 2025-01-20 14:40:02 +01:00
a4ca1beb40
tmux/space 2025-01-20 14:35:18 +01:00
7dced222cf
tmux/sessions 2025-01-20 14:33:45 +01:00
61ab59e270
tmux/→ 2025-01-20 14:26:41 +01:00
c0dbae1fdc
tmux/space 2025-01-20 14:25:15 +01:00
ada0aac3d7
tmux/space 2025-01-20 14:15:25 +01:00
df3f5a6a28
tmux/→ 2025-01-20 14:12:31 +01:00
e55847358d
tmux/fixes 2025-01-20 13:57:49 +01:00
7cc6025fa7
tmux/bg 2025-01-20 13:41:16 +01:00
d7491af2b6
tmux/session 2025-01-20 12:30:11 +01:00
90f61d1cd2
tmux/many 2025-01-20 12:17:42 +01:00
d3c967c657
tmux/shrink 2025-01-20 12:11:45 +01:00
d789a16ef3
tmux/↕ 2025-01-20 12:09:42 +01:00
9d5dbbb8bc
tmux/uid 2025-01-20 11:57:54 +01:00
154558a411
tmux/↕ 2025-01-20 11:52:50 +01:00
731f2088a8
tmux/↕ 2025-01-20 11:44:52 +01:00
a416f6d958
tmux/sessions 2025-01-20 11:39:43 +01:00
ea166159a1
tmux/fixes 2025-01-20 00:23:18 +01:00
b97c43a33d
tmux/fixes 2025-01-20 00:14:14 +01:00
08dc6fe80b
tmux/fixes 2025-01-20 00:10:19 +01:00
c3a168894a
tmux/↕ 2025-01-20 00:04:36 +01:00
f342081d83
tmux/fixes 2025-01-20 00:03:45 +01:00
fceb980388
tmux/↕ 2025-01-19 23:58:12 +01:00
ffb8616718
tmux/cut 2025-01-19 23:20:01 +01:00
848500fd1b
tmux/cut 2025-01-19 23:18:25 +01:00
1aa0e8f805
tmux/date 2025-01-19 23:13:12 +01:00
8402241834
tmux/over 2025-01-19 22:58:47 +01:00
1b9f943ce7
tmux/shrink 2025-01-19 22:51:29 +01:00
fbe59cd376
tmux/time 2025-01-19 22:48:40 +01:00
4a33cd0ac8
prompt/path 2025-01-19 22:39:42 +01:00
c943d59132
prompt/round 2025-01-19 22:38:40 +01:00
f08bbdb671
tmux/2 2025-01-19 22:35:11 +01:00
4bf4c5d9d4
tmux/grounds 2025-01-19 21:47:56 +01:00
6d06e5f974
tmux/shrink 2025-01-19 21:33:13 +01:00
032ba1976c
tmux/window 2025-01-19 21:08:18 +01:00
5ead655410
tmux/window 2025-01-19 20:46:07 +01:00
79151b9d9a
tmux/▸ 2025-01-19 20:31:02 +01:00
72fdd9cfee
tmux/user 2025-01-19 20:20:44 +01:00
bc8e3b1974
tmux/split 2025-01-19 19:50:58 +01:00
67803f31b8
tmux/↕ 2025-01-19 19:40:45 +01:00
2f93d1b777
tmux/borders 2025-01-19 19:36:44 +01:00
9e3f73f24f
tmux/5 2025-01-19 19:34:27 +01:00
c3df0b05e9
tmux/fix 2025-01-19 19:15:42 +01:00
e99d519e8d
tmux/spaces 2025-01-19 19:13:46 +01:00
758be9009e
tmux/2 2025-01-19 18:46:49 +01:00
c244535921
tmux/spaces 2025-01-19 18:37:09 +01:00
3a50aafa49
tmux/space 2025-01-19 18:01:19 +01:00
2057407cfc
tmux/user 2025-01-19 17:52:59 +01:00
5772a22808
tmux/right 2025-01-19 17:39:54 +01:00
94ab314119
tmux/right 2025-01-19 17:20:05 +01:00
1dadea118c
tmux/default 2025-01-19 17:02:06 +01:00
ace049b56f
tmux/frame 2025-01-19 16:55:58 +01:00
d0ffe4dc47
tmux/host 2025-01-19 16:52:02 +01:00
a98d5d07ef
tmux/sessions 2025-01-19 15:20:07 +01:00
3de6061069
tmux/flags 2025-01-19 15:12:47 +01:00
4b18b0fb9b
tmux/panes 2025-01-19 14:46:46 +01:00
7555ee6ad6
tmux/command 2025-01-19 13:46:29 +01:00
e7cd60b298
tmux/0 2025-01-19 13:33:56 +01:00
e94efa4f3b
tmux/5 2025-01-19 13:32:45 +01:00
a3289780bd
tmux/bg 2025-01-19 03:15:13 +01:00
afdb8184b7
tmux/f 2025-01-19 02:21:05 +01:00
b85142783b
tmux/lineshift 2025-01-19 01:16:16 +01:00
cca3019283
tmux/lines 2025-01-19 01:07:34 +01:00
a93940fa31
tmux/3,4 2025-01-19 00:50:00 +01:00
8d6d3356a5
tmux/green 2025-01-19 00:24:49 +01:00
f4bafb9a9c
tmux/bottom 2025-01-19 00:23:07 +01:00
09f4ffe21b
tmux/4 2025-01-18 23:59:56 +01:00
f0de127e46
tmux/lines 2025-01-18 23:39:55 +01:00
c8507eb520
tmux/− 2025-01-18 23:30:41 +01:00
b4f6f80ae4
tmux/↕ 2025-01-18 23:27:15 +01:00
3eb82bd515
tmux/window 2025-01-18 23:23:56 +01:00
6c17ad8001
tmux/× 2025-01-18 23:20:56 +01:00
e24c782e83
tmux/- 2025-01-18 23:13:48 +01:00
709563005a
tmux/⋅ 2025-01-18 23:13:03 +01:00
f7a02f2974
tmux∕ 2025-01-18 23:10:25 +01:00
7f6a29e8eb
tmux/space 2025-01-18 23:05:52 +01:00
dfae2ba121
tmux/title 2025-01-18 23:03:43 +01:00
6f396db454
tmux/↕ 2025-01-18 22:38:40 +01:00
e9e12b6b64
tmux/wip 2025-01-18 22:27:50 +01:00
6adea4a46d
tmux/− 2025-01-18 22:00:11 +01:00
aec1770994
tmux/centre 2025-01-18 21:52:29 +01:00
3a036fd754
tmux/blue 2025-01-18 21:51:27 +01:00
083b68ab25
tmux/align 2025-01-18 21:26:17 +01:00
73e94d28ac
tmux/date 2025-01-18 21:18:16 +01:00
ba74eaf333
tmux/path 2025-01-18 21:10:57 +01:00
ea18907da1
tmux/title 2025-01-18 21:04:26 +01:00
717ec7b41d
tmux/fix 2025-01-18 20:23:31 +01:00
874b11884f
tmux/flags 2025-01-18 20:22:29 +01:00
59322ac449
tmux/activity 2025-01-18 20:20:21 +01:00
f0f0bb5bc9
tmux/1 2025-01-18 20:15:55 +01:00
0c64af1eab
tmux/2 2025-01-18 20:11:16 +01:00
b303ae8a3f
tmux/formats 2025-01-18 19:53:26 +01:00
75ccb1ed3c
tmux/fix 2025-01-18 17:36:14 +01:00
ad891b1819
tmux/3 2025-01-18 17:35:14 +01:00
ccbb794b7b
tmux/windows 2025-01-18 17:33:45 +01:00
e93eea8906
tmux/panes 2025-01-18 17:04:45 +01:00
0b67159bca
tmux/lines 2025-01-18 17:00:59 +01:00
c09919ed48
tmux/command 2025-01-18 16:49:05 +01:00
4008eea496
tmux/path 2025-01-18 16:05:52 +01:00
1094c40bc7
tmux/colors 2025-01-18 16:01:37 +01:00
5f10f8617c
tmux/command 2025-01-18 15:49:40 +01:00
8e13ac778f
tmux/space 2025-01-18 15:41:26 +01:00
1b2cf00547
tmux/status 2025-01-18 15:39:19 +01:00
72ee0ad3d5
tmux/justify 2025-01-18 15:23:38 +01:00
335ae41004
tmux/index 2025-01-18 14:39:03 +01:00
5f5e2b8a5b
tmux/history 2025-01-18 00:42:26 +01:00
fa9405e29f
tmux/long 2025-01-18 00:37:58 +01:00
2eb9e5388f
tmux/bind 2025-01-18 00:21:06 +01:00
08aed79ee6
tmux/file 2025-01-18 00:19:15 +01:00
48a9f2c458
tmux/display,mouse 2025-01-18 00:15:17 +01:00
e83384d511
swap/alt 2025-01-17 19:55:07 +01:00
ac4c473ecd
tmux/swap 2025-01-17 19:51:17 +01:00
3f001d8886
swap 2025-01-17 15:39:07 +01:00
51d3a00b6a
tmux/sessions 2025-01-17 15:37:37 +01:00
c651ad0c78
- 2025-01-17 15:22:47 +01:00
129430fe64
tmux/empty 2025-01-17 14:44:23 +01:00
edb937d015
tmux/title 2025-01-17 14:33:35 +01:00
aadbbee3ed
tmux/panes 2025-01-17 14:25:25 +01:00
ecc96e8dad
tmux/windows 2025-01-17 14:19:50 +01:00
329b1313c8
split/h,v 2025-01-17 13:53:35 +01:00
930113879e
tmux/monitoring,separator 2025-01-17 13:50:06 +01:00
101e11535b
tmux/styles 2025-01-17 12:40:51 +01:00
89b4110c44
tmux/status 2025-01-17 12:35:21 +01:00
8b69b41d17
tmux/windows 2025-01-17 12:27:55 +01:00
b39f04ac2f
tmux/prefix 2025-01-17 12:21:37 +01:00
2859d3d09c
tmux/detach 2025-01-17 12:17:51 +01:00
749bb2daf7
tmux/mouse,renumber 2025-01-17 12:15:11 +01:00
dd91874301
.sh 2025-01-17 11:43:56 +01:00
dc514e8280
first only 2025-01-17 10:30:48 +01:00
9a1bb4f469
tmux/setup 2025-01-17 10:27:59 +01:00
6d9f366e8a
shfmt 2025-01-13 07:44:14 +01:00
53f8c5d91c
doc 2025-01-13 07:02:35 +01:00
149cc47894
ffmpeg/wip 2025-01-13 04:49:31 +01:00
22fa109aac
gnome/frames 2025-01-13 04:46:57 +01:00
07fc4c6eb4
gsettings/draft 2025-01-13 04:32:30 +01:00
006abeb31c
ffmpeg/draft 2025-01-13 00:14:47 +01:00
3e0459b85c
ffmpeg/formats 2025-01-12 17:26:29 +01:00
da4ec33554
install/code 2025-01-12 17:04:28 +01:00
3b2f1447f9
install/return 2025-01-12 16:54:01 +01:00
4f085af44e
ffmpeg/devices/reset 2025-01-12 16:26:56 +01:00
4482928678
self/check 2024-12-22 23:51:32 +01:00
2c3167178e
self/install/code 2024-12-08 22:37:36 +01:00
6d33252ea4
lf 2024-12-08 21:57:14 +01:00
f2ae14fe23
self/install/target 2024-12-08 21:51:24 +01:00
01e6165788
self/init
All checks were successful
/ job (push) Successful in 1m15s
2024-12-02 15:24:27 +01:00
1eb130320e
context/command,shell 2024-12-02 15:07:55 +01:00
68ec08871c
command/argument,name 2024-12-02 04:02:26 +01:00
e60e72d1da
main 2024-12-02 03:22:30 +01:00
1681e1567f
2024-12-02 03:05:07 +01:00
3495d35051
modules 2024-12-02 01:53:34 +01:00
93d1cef6e3
step/box 2024-12-02 01:44:01 +01:00
8ad9ebc602
step/__ 2024-12-02 01:41:08 +01:00
240c0533ec
mv 2024-12-02 01:18:40 +01:00
aa2c6df97e
shellcheck/file
All checks were successful
/ job (push) Successful in 1m16s
2024-12-02 00:46:30 +01:00
45d93964e5
remove 2024-12-02 00:42:35 +01:00
0dfe86a970
target/shfmt 2024-12-02 00:39:16 +01:00
f3851dbc88
fixes 2024-12-02 00:30:01 +01:00
7dbf581191
self/subset,write 2024-12-02 00:06:42 +01:00
ce872d4ecb
file/append,empty 2024-12-01 23:40:54 +01:00
9f705e6af8
arg 2024-12-01 23:21:14 +01:00
8e2cd2a867
arg0 2024-12-01 23:20:05 +01:00
76176ae49f
cmd/install 2024-12-01 22:28:22 +01:00
3b11f3b459
rwx/shell 2024-12-01 22:13:16 +01:00
77a53428e1
rwx/shell 2024-12-01 22:11:52 +01:00
05e5d00a95
self/user 2024-12-01 22:10:05 +01:00
dc1fdbace7
−arg 2024-12-01 22:06:18 +01:00
a8f4ad7097
${0} 2024-12-01 22:01:38 +01:00
52b6c06cb1
self/command 2024-12-01 21:48:04 +01:00
b61ec7044d
fix 2024-12-01 21:39:41 +01:00
0818e81038
install/commands 2024-12-01 21:37:55 +01:00
f588882b1f
lib 2024-12-01 21:28:42 +01:00
ea8be45789
self/commands 2024-12-01 21:22:35 +01:00
bf10fd4a05
cs 2024-12-01 21:13:45 +01:00
1e1954ce9b
prefix 2024-12-01 21:03:57 +01:00
163ff926cd
fmt 2024-12-01 20:25:19 +01:00
b85e5768a8
unindent 2024-12-01 20:23:52 +01:00
527b2d2a67
rwx/shell 2024-12-01 20:15:05 +01:00
b67107c737
self/user 2024-12-01 20:03:28 +01:00
30b002c31e
git/rwx 2024-12-01 19:53:12 +01:00
2054f48931
main/shebang 2024-12-01 19:51:06 +01:00
46e14ebf32
+x 2024-12-01 19:50:30 +01:00
ba7a51e1b1
main/cmd 2024-12-01 19:49:14 +01:00
d94880bb75
main/shell 2024-12-01 19:40:52 +01:00
52a43b0e60
self/install 2024-12-01 19:06:44 +01:00
f06d1e2bce
rwx/link 2024-12-01 19:04:23 +01:00
a9c98b2853
rwx/remove 2024-12-01 19:01:05 +01:00
aec586aa2c
self/install 2024-12-01 18:58:27 +01:00
9b0b4ecb80
setup/main 2024-12-01 18:35:33 +01:00
428ea3e9e5
-n 2024-12-01 18:11:09 +01:00
6ed3cb83a6
gau/gf 2024-12-01 18:07:54 +01:00
c69c10684e
gau/git,gpg 2024-12-01 18:06:02 +01:00
01eb1bebd3
rwx/gau 2024-12-01 18:04:13 +01:00
81cb56bd11
ref/head 2024-12-01 17:59:08 +01:00
038853e4bb
shfmt 2024-12-01 17:47:06 +01:00
d549d03c99
shellcheck/write 2024-12-01 16:41:48 +01:00
482ba47dd9
file/write 2024-12-01 16:39:55 +01:00
48d7236451
mv 2024-12-01 16:23:53 +01:00
28 changed files with 980 additions and 85 deletions

View file

@ -18,7 +18,7 @@ dependencies = []
description = "Read Write eXecute"
dynamic = ["version"]
keywords = []
license-files = { paths = ["license.md"] }
license-files = ["license.md"]
name = "rwx"
readme = "readme.md"
requires-python = ">= 3.11"
@ -30,16 +30,3 @@ requires-python = ">= 3.11"
[tool.hatch.version]
path = "rwx/__init__.py"
[tool.pydoclint]
allow-init-docstring = true
quiet = true
skip-checking-short-docstrings = false
style = "sphinx"
[tool.ruff]
line-length = 80
[tool.ruff.lint]
ignore = ["COM812", "D203", "D213", "ISC001"]
select = ["ALL"]

View file

@ -2,9 +2,10 @@
import os
import shutil
import tomllib
from pathlib import Path
import tomllib
from rwx import ps
CHARSET = "UTF-8"
@ -61,7 +62,7 @@ def get_path_mount(path: Path) -> Path:
"stat",
("--format", "%m"),
str(path),
)
),
)

View file

@ -1,5 +1,7 @@
"""Wrap GRUB commands."""
from __future__ import annotations
from rwx import cmd, ps
cmd.need("grub-mkimage")

View file

@ -1,5 +1,7 @@
"""Handle processes."""
from __future__ import annotations
import subprocess
from rwx import Object, txt
@ -43,7 +45,9 @@ def run(*items: str | tuple[str, ...]) -> subprocess.CompletedProcess:
:rtype: subprocess.CompletedProcess
"""
return subprocess.run(
get_tuples_args(*items), capture_output=False, check=True
get_tuples_args(*items),
capture_output=False,
check=True,
)
@ -61,7 +65,8 @@ def run_line(*items: str | tuple[str, ...], charset: str = txt.CHARSET) -> str:
def run_lines(
*items: str | tuple[str, ...], charset: str = txt.CHARSET
*items: str | tuple[str, ...],
charset: str = txt.CHARSET,
) -> list[str]:
"""Run and return output lines.
@ -72,7 +77,9 @@ def run_lines(
:rtype: list[str]
"""
process = subprocess.run(
get_tuples_args(*items), capture_output=True, check=True
get_tuples_args(*items),
capture_output=True,
check=True,
)
string = process.stdout.decode(charset)
return string.rstrip().splitlines()

View file

@ -1,4 +1,4 @@
SH_GIT_LOG_FORMAT="\
RWX_GIT_LOG_FORMAT="\
%C(auto)%h%d
S %C(red)%GS
A %C(green)%an %ae
@ -240,11 +240,12 @@ a__git_diff_word() {
# fetch from the remote repository
gf() { a__git_fetch "${@}"; }
a__git_fetch() {
git \
fetch \
--tags \
--verbose \
"${@}"
rwx_gpg_agent_update &&
git \
fetch \
--tags \
--verbose \
"${@}"
}
# fetch from remote repository and prune local orphan branches
@ -293,7 +294,7 @@ a__git_log() {
log \
--abbrev=8 \
--abbrev-commit \
--format="${SH_GIT_LOG_FORMAT}" \
--format="${RWX_GIT_LOG_FORMAT}" \
--graph \
"${@}"
}
@ -371,11 +372,12 @@ a__git_merge_tool() {
# push to the remote repository
gp() { a__git_push "${@}"; }
a__git_push() {
git \
push \
--tags \
--verbose \
"${@}"
rwx_gpg_agent_update &&
git \
push \
--tags \
--verbose \
"${@}"
}
# delete from the remote repository
@ -533,3 +535,14 @@ a__git_tag_delete() {
--delete \
"${@}"
}
# update head ref
gurh() { a__git_update_ref_head "${@}"; }
a__git_update_ref_head() {
if [ -n "${2}" ]; then
git \
update-ref \
"refs/heads/${1}" \
"${2}"
fi
}

View file

@ -8,7 +8,5 @@ a__gpg_agent_kill() {
# bind gpg agent to current tty
gau() { a__gpg_agent_update "${@}"; }
a__gpg_agent_update() {
gpg-connect-agent \
updatestartuptty \
/bye
rwx_gpg_agent_update
}

6
sh/cryptsetup.sh Normal file
View file

@ -0,0 +1,6 @@
_rwx_cmd_cs() { rwx_crypt_setup "${@}"; }
rwx_crypt_setup() {
local action="${1}"
echo "cs: ${action}"
}

194
sh/ffmpeg.sh Normal file
View file

@ -0,0 +1,194 @@
# ╭────────┬─────────┬───────╮
# │ ffmpeg │ devices │ reset │
# ╰────────┴─────────┴───────╯
_rwx_cmd_rwx_ffmpeg_devices_reset() { rwx_ffmpeg_devices_reset "${@}"; }
rwx_ffmpeg_devices_reset() {
local module="uvcvideo"
modprobe --remove "${module}" &&
modprobe "${module}"
}
# ╭────────┬────────┬─────────╮
# │ ffmpeg │ device │ formats │
# ╰────────┴────────┴─────────╯
rwx_ffmpeg_device_formats() {
local device="${1}"
[ -n "${device}" ] || device="/dev/video0"
ffmpeg \
-f "v4l2" \
-list_formats "all" \
-i "${device}"
}
# ╭────────┬───────╮
# │ ffmpeg │ input │
# ╰────────┴───────╯
rwx_ffmpeg_input_blue_yeti() {
local device="alsa_input.\
usb-Generic_Blue_Microphones_2051BAB04XY8-00.analog-stereo"
set -- \
-f "pulse" \
-i "${device}" \
-ac "2" \
-ar "48000"
local argument
for argument in "${@}"; do echo "${argument}"; done
}
rwx_ffmpeg_input_dell_precision() {
local device="alsa_input.\
pci-0000_00_1f.3.analog-stereo"
set -- \
-f "pulse" \
-i "${device}" \
-ac "2" \
-ar "48000"
local argument
for argument in "${@}"; do echo "${argument}"; done
}
rwx_ffmpeg_input_file() {
local file="${1}"
local from="${2}"
local to="${3}"
[ -n "${file}" ] || return
set -- \
-i "${file}"
if [ -n "${to}" ]; then
set -- "${@}" \
-ss "${from}" \
-to "${to}"
fi
local argument
for argument in "${@}"; do echo "${argument}"; done
}
rwx_ffmpeg_input_hdmi() {
local device="${1}"
[ -n "${device}" ] || device="/dev/video0"
set -- \
-f "v4l2" \
-video_size "1920x1080" \
-framerate "60" \
-input_format "yuyv422" \
-i "${device}"
local argument
for argument in "${@}"; do echo "${argument}"; done
}
# ╭────────┬────────╮
# │ ffmpeg │ output │
# ╰────────┴────────╯
rwx_ffmpeg_output_audio_fast() {
set -- \
-codec:a "flac" \
-compression_level "0"
local argument
for argument in "${@}"; do echo "${argument}"; done
}
rwx_ffmpeg_output_audio_slow() {
set -- \
-codec:a "libopus" \
-b:a "128k"
local argument
for argument in "${@}"; do echo "${argument}"; done
}
rwx_ffmpeg_output_file() {
local file="${1}"
[ -n "${file}" ] || return
set -- \
-y "${file}"
local argument
for argument in "${@}"; do echo "${argument}"; done
}
rwx_ffmpeg_output_video_fast() {
set -- \
-codec:v "libx264" \
-preset "ultrafast" \
-crf "0"
local argument
for argument in "${@}"; do echo "${argument}"; done
}
rwx_ffmpeg_output_video_slow() {
local crf="${1}"
local codec="${2}"
[ -n "${codec}" ] || codec="libx264"
if [ -z "${crm}" ]; then
case "${codec}" in
"libx264") crf="23" ;;
"libx265") crf="28" ;;
*) ;;
esac
fi
set -- \
-codec:v "${codec}" \
-preset "veryslow" \
-crf "${crf}" \
-movflags "+faststart" \
-pix_fmt "yuv420p"
local argument
for argument in "${@}"; do echo "${argument}"; done
}
# ╭────────┬────────╮
# │ ffmpeg │ record │
# ╰────────┴────────╯
rwx_ffmpeg_record_hdmi_precision() {
local file="${1}"
[ -n "${file}" ] || return
# LATER alternative
# shellcheck disable=SC2046,SC2312
set -- \
$(rwx_ffmpeg_input_hdmi) \
$(rwx_ffmpeg_input_dell_precision) \
$(rwx_ffmpeg_output_video_fast) \
$(rwx_ffmpeg_output_audio_fast) \
$(rwx_ffmpeg_output_file "${file}")
echo "${@}"
ffmpeg "${@}"
}
rwx_ffmpeg_record_hdmi_yeti() {
local file="${1}"
[ -n "${file}" ] || return
# LATER alternative
# shellcheck disable=SC2046,SC2312
set -- \
$(rwx_ffmpeg_input_hdmi) \
$(rwx_ffmpeg_input_blue_yeti) \
$(rwx_ffmpeg_output_video_fast) \
$(rwx_ffmpeg_output_audio_fast) \
$(rwx_ffmpeg_output_file "${file}")
echo "${@}"
ffmpeg "${@}"
}
# ╭────────┬────────╮
# │ ffmpeg │ reduce │
# ╰────────┴────────╯
rwx_ffmpeg_reduce() {
local input="${1}"
local output="${2}"
local from="${3}"
local to="${4}"
[ -n "${output}" ] || return
# LATER alternative
# shellcheck disable=SC2046,SC2312
set -- \
$(rwx_ffmpeg_input_file "${input}" "${from}" "${to}") \
$(rwx_ffmpeg_output_video_slow) \
$(rwx_ffmpeg_output_audio_slow) \
$(rwx_ffmpeg_output_file "${output}")
echo "${@}"
ffmpeg "${@}"
}

View file

@ -1,3 +1,27 @@
# ╭───────┬────────────╮
# │ gnome │ background │
# ╰───────┴────────────╯
rwx_gnome_background_black() {
rwx_gnome_set_background "color-shading-type" "solid"
rwx_gnome_set_background "primary-color" "#000000"
}
rwx_gnome_background_white() {
rwx_gnome_set_background "color-shading-type" "solid"
rwx_gnome_set_background "primary-color" "#ffffff"
}
rwx_gnome_background_win3() {
rwx_gnome_set_background "color-shading-type" "vertical"
rwx_gnome_set_background "primary-color" "#000000"
rwx_gnome_set_background "secondary-color" "#0000ff"
}
# ╭───────┬───────╮
# │ gnome │ proxy │
# ╰───────┴───────╯
rwx_gnome_proxy() {
local value
case "${1}" in
@ -7,6 +31,29 @@ rwx_gnome_proxy() {
gsettings set "org.gnome.system.proxy" "mode" "${value}"
}
# ╭───────┬─────╮
# │ gnome │ set │
# ╰───────┴─────╯
rwx_gnome_set() {
local group="${1}"
local key="${2}"
local value="${3}"
[ -n "${value}" ] || return
gsettings set "${group}" "${key}" "${value}"
}
rwx_gnome_set_background() {
local key="${1}"
local value="${2}"
[ -n "${value}" ] || return
rwx_gnome_set "org.gnome.desktop.background" "${key}" "${value}"
}
# ╭───────┬────────────╮
# │ gnome │ workspaces │
# ╰───────┴────────────╯
rwx_gnome_workspaces_primary() {
local bool
local group="org.gnome.mutter"

View file

@ -1,3 +1,10 @@
# bind gpg agent to current tty
rwx_gpg_agent_update() {
gpg-connect-agent \
updatestartuptty \
/bye
}
rwx_gpg_ssh_auth_sock() {
local user_id
user_id=$(id --user)

6
sh/lint/gitlint.sh Normal file
View file

@ -0,0 +1,6 @@
rwx_gitlint() {
local path="${1}"
gitlint \
--target "${path}" \
"lint"
}

78
sh/lint/lint.sh Normal file
View file

@ -0,0 +1,78 @@
# lint code
rwx_lint() {
local path="${1}"
[ -n "${path}" ] || return 1
rwx_lint_clean "${path}"
rwx_lint_tasks "${path}"
set \
"python" \
"shell"
local code
for code in "${@}"; do
rwx_log "" "${code}"
"rwx_lint_${code}" "${path}"
done
rwx_lint_clean "${path}"
}
# clean
rwx_lint_clean() {
local path="${1}"
[ -n "${path}" ] || return 1
rwx_log "" "clean" ""
py3clean "${path}"
set \
"mypy" \
"ruff"
local tool
for tool in "${@}"; do
rwx_remove "${path}/.${tool}_cache"
done
}
# lint python code
rwx_lint_python() {
local path="${1}"
local action
set \
"pylint" \
"pydoclint" \
"mypy" \
"ruff"
for action in "${@}"; do
rwx_log "" "${action}"
"rwx_${action}" "${path}"
done
}
# lint shell code
rwx_lint_shell() {
local path="${1}"
local action
set \
"shellcheck" \
"shfmt"
for action in "${@}"; do
rwx_log "" "${action}"
"rwx_${action}" "${path}"
done
}
# lint code tasks
rwx_lint_tasks() {
local path="${1}"
local type
set \
"LATER" \
"TODO" \
"FIXME"
for type in "${@}"; do
rwx_log "" "${type}"
grep \
--after "1" \
--directories "recurse" \
--line-number \
" ${type}" \
"${path}"
done
}

4
sh/lint/mypy.sh Normal file
View file

@ -0,0 +1,4 @@
rwx_mypy() {
local path="${1}"
mypy "${path}"
}

9
sh/lint/pydoclint.sh Normal file
View file

@ -0,0 +1,9 @@
rwx_pydoclint() {
local path="${1}"
pydoclint \
--allow-init-docstring True \
--quiet \
--skip-checking-short-docstrings False \
--style "sphinx" \
"${path}"
}

6
sh/lint/pylint.sh Normal file
View file

@ -0,0 +1,6 @@
rwx_pylint() {
local path="${1}"
pylint \
--enable-all-extensions \
"${path}/**/*.py"
}

28
sh/lint/ruff.sh Normal file
View file

@ -0,0 +1,28 @@
rwx_ruff() {
local path="${1}"
local action
set \
"check" \
"format"
for action in "${@}"; do
"rwx_ruff_${action}" "${path}"
done
}
rwx_ruff_check() {
local path="${1}"
ruff check \
--ignore "D203,D213" \
--isolated \
--select "ALL" \
"${path}"
}
rwx_ruff_format() {
local path="${1}"
ruff format \
--diff \
--isolated \
--line-length "80" \
"${path}"
}

View file

@ -9,6 +9,12 @@ rwx_shellcheck() {
echo ". \"${path}\"" >>"${file}"
done
rwx_ifs_unset
rwx_shellcheck_file "${file}"
rwx_remove "${file}"
}
rwx_shellcheck_file() {
local file="${1}"
shellcheck \
--check-sourced \
--enable "all" \
@ -16,5 +22,13 @@ rwx_shellcheck() {
--external-sources \
--shell "dash" \
"${file}"
rm "${file}"
}
rwx_shellcheck_write() {
rwx_file_write ".shellcheckrc" "\
disable=3043
enable=all
external-sources=true
shell=sh
"
}

View file

@ -1,4 +1,4 @@
rwx_shfmt() {
local root="${1}"
shfmt --diff "${root}"
local path="${1}"
shfmt --diff "${path}"
}

25
sh/log/step.sh Normal file
View file

@ -0,0 +1,25 @@
# ╭───────────────╮
# │ __ = internal │
# ╰───────────────╯
# __RWX_BAR_TOP
# __RWX_BAR_MIDDLE
# __RWX_BAR_BOTTOM
# __RWX_STEP_LEVEL
# __RWX_STEP_level_INDEX
# __RWX_STEP_level_LABEL
# ╭─────────────╮
# │ _ = private │
# ╰─────────────╯
_RWX_BOX_DOWN_AND_HORIZONTAL="┬"
_RWX_BOX_DOWN_AND_LEFT="╮"
_RWX_BOX_DOWN_AND_RIGHT="╭"
_RWX_BOX_HORIZONTAL="─"
_RWX_BOX_LEFT="╴"
_RWX_BOX_UP_AND_HORIZONTAL="┴"
_RWX_BOX_UP_AND_LEFT="╯"
_RWX_BOX_UP_AND_RIGHT="╰"
_RWX_BOX_VERTICAL="│"

77
sh/main.sh Normal file → Executable file
View file

@ -1,24 +1,35 @@
# ╭───────────╮
# │ constants │
# ╰───────────╯
#! /usr/bin/env sh
# ╭──────┬───────────╮
# │ main │ constants │
# ╰──────┴───────────╯
RWX_MAIN_NAME="main.sh"
RWX_SELF_NAME="rwx"
# ╭───────────╮
# │ variables │
# ╰───────────╯
RWX_SELF_COMMAND="_${RWX_SELF_NAME}_cmd_"
RWX_ROOT_USER="${HOME}/${RWX_SELF_NAME}"
# ╭──────┬───────────╮
# │ main │ variables │
# ╰──────┴───────────╯
RWX_COMMAND_ARGUMENT="${0}"
RWX_SHELL="$(cat "/proc/${$}/comm")"
RWX_SYSTEM_ROOT="/usr/local/lib"
RWX_COMMAND_NAME="$(basename "${RWX_COMMAND_ARGUMENT}" |
sed "s|^-||")"
case "${RWX_COMMAND_NAME}" in
"bash" | "dash" | "sh") unset RWX_COMMAND_NAME ;;
*) ;;
esac
RWX_ROOT_SYSTEM="/usr/local/lib/${RWX_SELF_NAME}"
RWX_SELF_USER="${HOME}/${RWX_SELF_NAME}"
RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}"
RWX_ROOT_SYSTEM="${RWX_SYSTEM_ROOT}/${RWX_SELF_NAME}"
# ╭──────╮
# │ core │
# ╰──────╯
# ╭──────┬───────
# │ main │ shell
# ╰──────┴───────
# test if active shell is in interactive mode
rwx_shell_interactive() {
@ -29,7 +40,7 @@ rwx_shell_interactive() {
}
# ╭──────┬─────╮
# │ core │ log │
# │ main │ log │
# ╰──────┴─────╯
__rwx_log() {
@ -43,7 +54,7 @@ __rwx_log() {
}
# ╭──────┬──────╮
# │ core │ find │
# │ main │ find │
# ╰──────┴──────╯
# find directory’s files by extension
@ -70,7 +81,7 @@ rwx_find_shell() {
}
# ╭──────┬─────╮
# │ core │ ifs │
# │ main │ ifs │
# ╰──────┴─────╯
rwx_ifs_set() {
@ -85,20 +96,19 @@ rwx_ifs_unset() {
}
# ╭──────┬────────╮
# │ core │ source │
# │ main │ source │
# ╰──────┴────────╯
rwx_source() {
local path="${1}"
[ -d "${path}" ] ||
return 1
local count module modules
modules="$(rwx_find_shell "${path}" "${RWX_MAIN_NAME}")"
rwx_ifs_set
local count module
count=0
__rwx_log "" \
". ${path}"
for module in ${modules}; do
rwx_ifs_set
for module in $(rwx_find_shell "${path}" "${RWX_MAIN_NAME}"); do
count=$((count + 1))
__rwx_log "$(printf "%02d" "${count}") ${module%.sh}"
module="${path}/${module}"
@ -108,9 +118,9 @@ rwx_source() {
rwx_ifs_unset
}
# ╭──────┬──────
# │ core │ main │
# ╰──────┴──────
# ╭──────
# │ main │
# ╰──────
# run initial steps
rwx_main() {
@ -120,20 +130,15 @@ rwx_main() {
return 1
fi
# user root
rwx_source "${RWX_ROOT_USER}"
# run interactive extras
if rwx_shell_interactive; then
# check format
rwx_log
rwx_shfmt "${RWX_ROOT_SYSTEM}"
# check syntax
rwx_log
rwx_shellcheck "${RWX_ROOT_SYSTEM}"
# help
rwx_log
rwx_self_help
rwx_source "${RWX_SELF_USER}"
# context / command
if [ -n "${RWX_COMMAND_NAME}" ]; then
"${RWX_SELF_COMMAND}${RWX_COMMAND_NAME}" "${@}"
# context / shell
else
rwx_self_init
fi
}
# run main function
rwx_main
rwx_main "${@}"

14
sh/python.sh Normal file
View file

@ -0,0 +1,14 @@
# ╭────────╮
# │ python │
# ╰────────╯
# ╭────────┬──────╮
# │ python │ venv │
# ╰────────┴──────╯
rwx_python_venv() {
local path="${1}"
[ -d "${path}" ] || return 1
export VIRTUAL_ENV="${path}" && \
export PATH="${VIRTUAL_ENV}/bin:${PATH}"
}

View file

@ -63,6 +63,8 @@ rwx_rescue_wipe_0_init_hetzner_8_8() {
for device in "${@}"; do
members="${members} ${device}2"
done
# LATER alternative
# shellcheck disable=SC2086
rwx_fs_raid_create \
"boot" "00000000:00000000:00000000:00000002" ${members}
#
@ -87,6 +89,8 @@ rwx_rescue_wipe_0_init_hetzner_8_8() {
for device in "${@}"; do
members="${members} ${device}1"
done
# LATER alternative
# shellcheck disable=SC2086
rwx_fs_raid_create \
"crypt" "00000000:00000000:00000000:00000001" ${members}
# encrypt

View file

@ -1,4 +1,57 @@
# get functions from file
# meta doc
rwx_doc() {
local name="${1}"
[ -n "${name}" ] || return
local doc line module
rwx_ifs_set
for module in $(rwx_find_shell "${RWX_ROOT_SYSTEM}"); do
while read -r line; do
case "${line}" in
"#"*) doc="${doc}${line}" ;;
"${name}() {")
echo "${doc}"
return
;;
*) doc="" ;;
esac
done <"${RWX_ROOT_SYSTEM}/${module}"
done
rwx_ifs_unset
}
# ╭──────┬───────╮
# │ self │ check │
# ╰──────┴───────╯
# check source code
rwx_self_check() {
# check format
rwx_log
rwx_shfmt "${RWX_ROOT_SYSTEM}"
# check syntax
rwx_log
rwx_shellcheck "${RWX_ROOT_SYSTEM}"
}
# ╭──────┬──────────╮
# │ self │ commands │
# ╰──────┴──────────╯
# get commands from root
rwx_self_commands() {
grep \
--directories "recurse" \
--no-filename \
"^${RWX_SELF_COMMAND}" "${RWX_ROOT_SYSTEM}" |
cut --delimiter "(" --fields 1 |
sed "s|^${RWX_SELF_COMMAND}||"
}
# ╭──────┬───────────╮
# │ self │ functions │
# ╰──────┴───────────╯
# get functions from root
rwx_self_functions() {
grep \
--directories "recurse" \
@ -7,6 +60,10 @@ rwx_self_functions() {
cut --delimiter "(" --fields 1
}
# ╭──────┬──────╮
# │ self │ help │
# ╰──────┴──────╯
# output help message
rwx_self_help() {
rwx_log \
@ -14,3 +71,92 @@ rwx_self_help() {
" a__… = aliases" \
" u__… = user"
}
# ╭──────┬──────╮
# │ self │ init │
# ╰──────┴──────╯
rwx_self_init() {
# run interactive extras
if rwx_shell_interactive; then
# help
rwx_log
rwx_self_help
fi
}
# ╭──────┬─────────╮
# │ self │ install │
# ╰──────┴─────────╯
_rwx_cmd_rwx_install() { rwx_self_install "${@}"; }
rwx_self_install() {
local target="${1}"
local command file root
# code
if [ -n "${target}" ]; then
root="${target}${RWX_ROOT_SYSTEM}"
rwx_remove "${root}"
cp --recursive "${RWX_ROOT_SYSTEM}" "${root}"
fi
# commands
root="${target}/usr/local/bin"
for command in $(rwx_self_commands); do
file="${root}/${command}"
rwx_remove "${file}"
rwx_link "${file}" "${RWX_MAIN_PATH}"
done
# sh
file="${target}/etc/profile.d/${RWX_SELF_NAME}.sh"
rwx_remove "${file}"
rwx_file_write "${file}" "\
export ENV=\"${RWX_MAIN_PATH}\"
"
# bash
file="${target}/etc/bash.bashrc"
rwx_remove "${file}"
rwx_link "${file}" "${RWX_MAIN_PATH}"
}
# ╭──────┬────────╮
# │ self │ subset │
# ╰──────┴────────╯
rwx_self_subset() {
local argument path
for argument in "${@}"; do
path="${RWX_ROOT_SYSTEM}/${argument}"
if [ -d "${path}" ]; then
local file
for file in $(rwx_find_shell "${path}"); do
echo "${argument}/${file}"
done
elif [ -f "${path}" ]; then
echo "${argument}"
fi
done
}
# ╭──────┬───────╮
# │ self │ write │
# ╰──────┴───────╯
rwx_self_write() {
local target="${1}"
if [ -n "${target}" ]; then
shift
local file text
text="#! /usr/bin/env sh
"
rwx_ifs_set
for file in $(rwx_self_subset "${@}"); do
text="${text}
$(cat "${RWX_ROOT_SYSTEM}/${file}")
"
done
rwx_ifs_unset
rwx_file_write "${target}" "${text}"
rwx_shfmt "${target}"
rwx_shellcheck_file "${target}"
fi
}

View file

@ -71,7 +71,7 @@ rwx_shell_prompt() {
id="$(id --user)"
local path="${PWD}"
local user="${USER}"
local view=" "
local view=" "
# code
if [ "${code}" -ne 0 ]; then
view="${view}${RWX_COLOR_GREEN}"
@ -96,7 +96,7 @@ rwx_shell_prompt() {
# new
view="${view}\\n"
# frame
view="${view}${RWX_COLOR_DEFAULT} "
view="${view}${RWX_COLOR_DEFAULT} "
# user
if [ "${id}" -eq 0 ]; then
view="${view}${RWX_COLOR_GREEN}"
@ -114,12 +114,3 @@ rwx_shell_prompt() {
# print
printf "%b" "${view}"
}
rwx_shell_setup() {
# shell
echo "export ENV=\"${ENV}\"" >"/etc/profile.d/${RWX_SELF_NAME}.sh"
# bash
local file="/etc/bash.bashrc"
rm --force --recursive "${file}"
ln --symbolic "${ENV}" "${file}"
}

264
sh/tmux.sh Normal file
View file

@ -0,0 +1,264 @@
# ╭──────┬───────╮
# │ tmux │ setup │
# ╰──────┴───────╯
rwx_tmux_setup() {
local file
file="${HOME}/.tmux.conf"
rwx_file_write "${file}" "\
# ╭────────╮
# │ option │
# ╰────────╯
# empty name for windows
set-option -g automatic-rename-format '#{pane_current_command}'
set-option -g automatic-rename on
# first index number
set-option -g base-index 1
# display duration
set-option -g display-time 1536
# extend history limit
set-option -g history-limit 1048576
# style for messages
set-option -g message-style bg=red,fg=white
# activity monitoring
set-window-option -g monitor-activity on
# silence monitoring
set-window-option -g monitor-silence 0
# enable mouse actions
set-option -g mouse on
# prefix with ^B or F12
set-option -g prefix C-b
set-option -g prefix2 F12
# renumber windows after closing one
set-option -g renumber-windows on
# enable title
set-option -g set-titles on
# set title to working directory
set-option -g set-titles-string '\
#{session_name}\
- \
#{window_index}∕#{session_windows} #{window_name}\
- \
#{pane_index}∕#{window_panes} #{pane_current_command}\
'
# ╭────────┬──────╮
# │ option │ pane │
# ╰────────┴──────╯
# first index number
set-option -g pane-base-index 1
# ╭────────┬──────┬────────╮
# │ option │ pane │ border │
# ╰────────┴──────┴────────╯
# active style
set-option -g pane-active-border-style fg=green
# regular style
set-option -g pane-border-style fg=blue
# ╭────────┬────────╮
# │ option │ status │
# ╰────────┴────────╯
# status lines
set-option -g status 3
# background color
set-option -g status-bg '#0D0D0D'
# foreground color
set-option -g status-fg white
# line 1
set-option -g status-format[0] '\
#{W:\
#[bg=##202020] #[bg=##303030]\
#{?window_zoomed_flag,#[fg=magenta][, }\
#[fg=yellow]#{window_index}\
#{?window_zoomed_flag,#[fg=magenta]], }\
\
#{?window_active,#[fg=green],\
#{?window_activity_flag,#[fg=red],#[fg=blue]}}\
#{window_name}\
#[bg=##303030] #[bg=##202020] \
#[bg=default] \
}\
#[align=right]\
#[bg=##202020] #[bg=##303030] \
#[fg=yellow]%H:%M:%S\
#[bg=##303030] #[bg=##202020]\
#{?client_prefix,#[fg=green]p, }\
'
# line 2
set-option -g status-format[1] '\
#{S:\
#[bg=##202020] #[bg=##303030] \
#{?session_many_attached,#[fg=red],\
#{?session_attached,#[fg=magenta],#[fg=blue]}}\
#{session_name}\
#[bg=##303030] #[bg=##202020] \
#[bg=default] \
}\
#[fg=yellow]→ #[fg=green]#{session_name} \
#[align=right]\
#[bg=##202020] #[bg=##303030] \
#[fg=yellow]%Y-%m-%d\
#[bg=##303030] #[bg=##202020] \
'
# line 3
set-option -g status-format[2] '\
#[fg=cyan]#{pane_current_path}\
#[align=right]\
#[bg=##202020] #[bg=##303030] \
#[fg=yellow]#{host}\
#[bg=##303030] #[bg=##202020] \
'
# line 4
set-option -g status-format[3] '\
#{P:\
#[bg=##202020] #[bg=##303030] \
#[fg=yellow]#{pane_index}\
\
#{?pane_active,#[fg=green],#[fg=blue]}\
#{pane_current_command}\
#[bg=##303030] #[bg=##202020] \
#[bg=default] \
}\
#[align=right]\
#[bg=##202020] #[bg=##303030] \
#{?uid,#[fg=green],#[fg=red]}\
#{user}\
#[bg=##303030] #[bg=##202020] \
'
# line 5
set-option -g status-format[4] '\
#{P:\
#[bg=##202020] #[bg=##303030] \
#[fg=yellow]#{pane_index}\
\
#{?pane_active,#[fg=green],#[fg=blue]}\
#{pane_width}×#{pane_height}\
#[bg=##303030] #[bg=##202020] \
#[bg=default] \
}\
#[align=right]\
#[bg=##202020] #[bg=##303030] \
#[fg=green]#{window_width}×#{window_height}\
#[bg=##303030] #[bg=##202020] \
'
# refresh period
set-option -g status-interval 1
# bar location
set-option -g status-position bottom
# ╭─────╮
# │ key │
# ╰─────╯
# detach client
bind-key -n F6 detach-client
# new window
bind-key -n F2 new-window
# select pane
bind-key -n C-S-Down select-pane -D
bind-key -n C-S-Left select-pane -L
bind-key -n C-S-Right select-pane -R
bind-key -n C-S-Up select-pane -U
# status lines
bind-key -n C-F10 set-option -g status off
bind-key -n C-F1 set-option -g status on
bind-key -n C-F2 set-option -g status 2
bind-key -n C-F3 set-option -g status 3
bind-key -n C-F4 set-option -g status 4
bind-key -n C-F5 set-option -g status 5
# switch session
bind-key -n M-Down switch-client -n
bind-key -n M-Up switch-client -p
# switch window
bind-key -n M-Left previous-window
bind-key -n M-Right next-window
# ╭─────┬────────╮
# │ key │ prefix │
# ╰─────┴────────╯
# rename
bind-key C-s command-prompt { rename-session '%%' }
bind-key C-w command-prompt { rename-window '%%' }
# split window
bind-key h split-window -h
bind-key v split-window -v
# toggle mouse
bind-key t set-option -g mouse \\; display-message 'mouse = #{mouse}'
# reload configuration
bind-key r source-file ${file} \\; display-message 'source-file ${file}'
# swap window
bind-key M-Left swap-window -t -1
bind-key M-Right swap-window -t +1
# ╭─────────────╮
# │ default │
# ╭───────────┬─────────┼─────┬───────┤
# │ -n │ F12 │ -n │ C-b │
# ╭───────────────────┼───────────┼─────────┼─────┼───────┤
# │ command-prompt │ │ │ │ : │
# │ copy-mode │ │ │ │ PPage │
# │ detach-client │ │ │ │ d │
# │ new-session │ │ │ │ │
# │ new-window │ F2 │ │ │ c │
# │ next-window │ M-Right │ │ │ n │
# │ previous-window │ M-Left │ │ │ p │
# │ rename-session │ │ C-s │ │ │
# │ rename-window │ │ C-w │ │ │
# │ resize-pane -Z │ │ │ │ z │
# │ select-pane -D │ C-S-Down │ │ │ │
# │ select-pane -L │ C-S-Left │ │ │ │
# │ select-pane -R │ C-S-Right │ │ │ │
# │ select-pane -U │ C-S-Up │ │ │ │
# │ set -g mouse │ │ t │ │ │
# │ set -g status off │ C-F10 │ │ │ │
# │ set -g status on │ C-F1 │ │ │ │
# │ set -g status 2 │ C-F2 │ │ │ │
# │ set -g status 3 │ C-F3 │ │ │ │
# │ set -g status 4 │ C-F4 │ │ │ │
# │ set -g status 5 │ C-F5 │ │ │ │
# │ source-file │ │ r │ │ │
# │ split-window -h │ │ h │ │ % │
# │ split-window -v │ │ v │ │ \" │
# │ swap-window -t -1 │ │ M-Left │ │ │
# │ swap-window -t +1 │ │ M-Right │ │ │
# │ switch-client -n │ M-Down │ │ │ │
# │ switch-client -p │ M-Up │ │ │ │
# ╰───────────────────┴───────────┴─────────┴─────┴───────╯
"
}

View file

@ -1,3 +1,35 @@
rwx_file_append() {
local file="${1}"
local text="${2}"
if [ -n "${file}" ]; then
printf "%s" "${text}" >>"${file}"
fi
}
rwx_file_empty() {
local file="${1}"
if [ -n "${file}" ]; then
rwx_file_write "${file}" ""
fi
}
rwx_file_write() {
local file="${1}"
local text="${2}"
if [ -n "${file}" ]; then
printf "%s" "${text}" >"${file}"
fi
}
rwx_link() {
local link="${1}"
local target="${2}"
ln \
--symbolic \
"${target}" \
"${link}"
}
rwx_list_block_devices() {
lsblk \
--noempty \
@ -28,6 +60,13 @@ rwx_read_secret() {
unset secret
}
rwx_remove() {
rm \
--force \
--recursive \
"${@}"
}
rwx_warn_wipe() {
local tmp
rwx_list_block_devices