Compare commits

...

37 commits

Author SHA1 Message Date
445467b1b5
tmux/servers
All checks were successful
/ job (push) Successful in 5m36s
2025-06-29 20:00:39 +02:00
ad99117fdc
server/bg 2025-06-29 19:47:44 +02:00
d9a0372c47
fix 2025-06-29 19:43:54 +02:00
06bcd4be91
tmux/server 2025-06-29 19:41:09 +02:00
3ef4d02e10
tmux/session 2025-06-29 19:31:50 +02:00
c87b16f907
fix 2025-06-29 19:28:44 +02:00
d2131d145e
tmux/2 2025-06-29 19:26:57 +02:00
363ead4b4a
tmux/1 2025-06-29 19:23:05 +02:00
6f37337925
rights 2025-06-29 19:11:36 +02:00
e8e67bb502
magenta ↔ red 2025-06-29 18:40:03 +02:00
4a4851721f
tmux/shades 2025-06-29 18:34:43 +02:00
d9857b684e
readability 2025-06-29 18:00:40 +02:00
ec31c46557
shift 2025-06-29 17:55:21 +02:00
b80a0a59e8
sed/nbsp
All checks were successful
/ job (push) Successful in 4m30s
2025-06-29 17:51:26 +02:00
2f4f3a0131
tmux/3 2025-06-29 17:27:57 +02:00
de0371cebc
[] 2025-06-29 14:38:59 +02:00
daa0afd3d8
yellow 2025-06-29 14:33:59 +02:00
31fa93b117
almost 2025-06-29 14:26:13 +02:00
2e6542208d
tmux/server 2025-06-29 11:51:07 +02:00
34ea5a0369
tmux/fix 2025-06-29 10:31:10 +02:00
8726dded45
tmux/windows 2025-06-29 10:28:14 +02:00
79d1879edb
tmux/sessions 2025-06-29 10:20:46 +02:00
3b28e8ed14
tmux/2 2025-06-29 10:19:01 +02:00
77bcdd5aac
tmux/kill-server 2025-06-29 10:11:44 +02:00
f4d3d61cd7
git/compact
All checks were successful
/ job (push) Successful in 5m0s
2025-06-28 15:43:06 +02:00
5fcbfa35e9
log 2025-06-28 14:31:44 +02:00
bbb355ca70
2025-06-28 04:50:53 +02:00
65e9e4b5f7
main/run 2025-06-28 04:45:29 +02:00
3fbeb42835
main/shell 2025-06-28 04:41:33 +02:00
2ad74cc9f7
main/log 2025-06-28 04:40:19 +02:00
88f3ab499d
file 2025-06-28 04:36:16 +02:00
1cad82456e
common link to entry point
All checks were successful
/ job (push) Successful in 4m0s
2025-06-28 03:01:52 +02:00
9e785b7ce1
gnome/proxy/socks 2025-06-25 22:14:46 +02:00
7d18cfa2ce
readme
All checks were successful
/ job (push) Successful in 4m31s
2025-06-22 22:21:26 +02:00
df1d578ed9
tmux/new 2025-06-16 15:25:26 +02:00
affe27cf87
tmux/f6,on 2025-06-16 14:33:48 +02:00
4e6f58b278
tmux/shrink 2025-06-15 18:10:58 +02:00
10 changed files with 283 additions and 167 deletions

View file

@ -1,55 +1,96 @@
# Read Write eXecute
A tiny framework to read, write & execute things.
One project to rule them all.
---
## Why
## Table Of Contents {#toc}
* 1 [Why](#why)
* 2 [How](#how)
* 2.1 [Shell](#how-shell)
* 2.2 [Python](#how-python)
* 3 [What](#what)
* 3.1 [Features](#what-features)
* 3.2 [Environment variables](#what-variables)
* 4 [Who](#who)
* 5 [Where](#where)
* 5.1 [Chat](#where-chat)
* 5.2 [Repo](#where-repo)
* 5.3 [Site](#where-site)
* 6 [When](#when)
* 6.1 [Release tasks](#when-release)
* 6.2 [Further tasks](#when-further)
---
## How
## 1 [Why](#toc) {#why}
---
## What
## 2 [How](#toc) {#how}
Two interpreted languages for flexibility.
### 2.1 [Shell](#how) {#how-shell}
* [X] functions to
* [X] alias
* [X] lint
* [X] Git
* [X] Python
* [X] Shell
* [X] log
* [X] rescue
* [X] Hetzner
* [X] OVH
* [X] profiles
* [X] ffmpeg
* [X] tmux
### 2.2 [Python](#how) {#how-python}
---
## Who
## 3 [What](#toc) {#what}
### By
### 3.1 [Features](#what) {#what-features}
* [Marc Beninca](https://marc.beninca.link)
* [ ] self
* [ ] install modules
### For
* myself
### 3.2 [Environment variables](#what) {#what-variables}
---
## Where
## 4 [Who](#toc) {#who}
### Chat
* Author: [Marc Beninca](https://forge.rwx.work/marc.beninca)
---
## 5 [Where](#toc) {#where}
### 5.1 [Chat](#where) {#where-chat}
* [Discord](https://discord.com/channels/983145051985154108/1255894474895134761)
* [IRC](ircs://irc.libera.chat/##rwx)
### Forge
### 5.2 [Repo](#where) {#where-repo}
* [Repository](https://forge.rwx.work/rwx.work/rwx)
* [RSS](https://forge.rwx.work/rwx.work/rwx.rss)
* [Workflows](https://forge.rwx.work/rwx.work/rwx/actions)
* [Code](https://forge.rwx.work/rwx.work/rwx)
* [Feed](https://forge.rwx.work/rwx.work/rwx.rss)
* [Actions](https://forge.rwx.work/rwx.work/rwx/actions)
### Deployment
### 5.3 [Site](#where) {#where-site}
* [Site](https://rwx.rwx.work)
* [Web](https://rwx.rwx.work)
---
## When
## 6 [When](#toc) {#when}
### Task stack
### 6.1 [Release tasks](#when) {#when-release}
#### Python
@ -72,3 +113,5 @@ A tiny framework to read, write & execute things.
* apt
* apt-file search | grep
* ffmpeg
### 6.2 [Further tasks](#when) {#when-further}

View file

@ -1,10 +1,8 @@
RWX_GIT_LOG_FORMAT="\
%C(auto)%h%d
S %C(red)%GS
A %C(green)%an %ae
%C(green)%ai
C %C(blue)%cn %ce
%C(blue)%ci
A %C(green)%ai %an %ae
C %C(blue)%ci %cn %ce
%B"
# add to index

26
sh/file.sh Normal file
View file

@ -0,0 +1,26 @@
# ╭──────╮
# │ file │
# ╰──────╯
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
}

View file

@ -1,3 +1,7 @@
# ╭────╮
# │ fs │
# ╰────╯
rwx_fs_make_btrfs() {
local device="${1}"
local label="${2}"

View file

@ -23,12 +23,18 @@ rwx_gnome_background_win3() {
# ╰───────┴───────╯
rwx_gnome_proxy() {
local value
case "${1}" in
"on") value="manual" ;;
*) value="none" ;;
local port="${1}"
local prefix="org.gnome.system.proxy"
case "${port}" in
"")
gsettings set "${prefix}" "mode" "none"
;;
*)
gsettings set "${prefix}" "mode" "manual"
gsettings set "${prefix}.socks" "host" "localhost"
gsettings set "${prefix}.socks" "port" "${port}"
;;
esac
gsettings set "org.gnome.system.proxy" "mode" "${value}"
}
# ╭───────┬─────╮

View file

@ -1,3 +1,11 @@
# ╭─────╮
# │ log │
# ╰─────╯
# ╭─────┬───────────╮
# │ log │ constants │
# ╰─────┴───────────╯
RWX_LOG_LEVEL_FATAL=0
RWX_LOG_LEVEL_ERROR=1
RWX_LOG_LEVEL_WARN=2
@ -5,8 +13,16 @@ RWX_LOG_LEVEL_INFO=3
RWX_LOG_LEVEL_DEBUG=4
RWX_LOG_LEVEL_TRACE=5
# ╭─────┬───────────╮
# │ log │ variables │
# ╰─────┴───────────╯
RWX_LOG_LEVEL=${RWX_LOG_LEVEL_INFO}
# ╭─────┬─────╮
# │ log │ log │
# ╰─────┴─────╯
rwx_log() { rwx_log_info "${@}"; }
rwx_log_debug() {

View file

@ -1,5 +1,9 @@
#! /usr/bin/env sh
# ╭──────╮
# │ main │
# ╰──────╯
# ╭──────┬───────────╮
# │ main │ constants │
# ╰──────┴───────────╯
@ -27,16 +31,50 @@ RWX_SELF_USER="${HOME}/${RWX_SELF_NAME}"
RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}"
# ╭──────┬──────
# │ main │ shell
# ╰──────┴──────
# ╭──────┬──────
# │ main │ main
# ╰──────┴──────
# test if active shell is in interactive mode
rwx_shell_interactive() {
case "${-}" in
*i*) ;;
*) return 1 ;;
esac
# run initial steps
rwx_main() {
# source system root
if ! rwx_source "${RWX_ROOT_SYSTEM}"; then
__rwx_log "Not a directory: ${RWX_ROOT_SYSTEM}"
return 1
fi
# source user root
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
}
# ╭──────┬────────╮
# │ main │ source │
# ╰──────┴────────╯
# source code from file path
rwx_source() {
local path="${1}"
[ -d "${path}" ] ||
return 1
local count module
count=0
__rwx_log "" \
". ${path}"
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}"
# shellcheck disable=SC1090
. "${module}"
done
rwx_ifs_unset
}
# ╭──────┬─────╮
@ -53,6 +91,35 @@ __rwx_log() {
fi
}
# ╭──────┬───────╮
# │ main │ shell │
# ╰──────┴───────╯
# test if active shell is in interactive mode
rwx_shell_interactive() {
case "${-}" in
*i*) ;;
*) return 1 ;;
esac
}
# ╭──────┬─────╮
# │ main │ ifs │
# ╰──────┴─────╯
# set internal field separator to line feed
rwx_ifs_set() {
_RWX_IFS="${IFS}"
IFS="
"
}
# unset internal field separator
rwx_ifs_unset() {
IFS="${_RWX_IFS}"
unset RWX_IFS
}
# ╭──────┬──────╮
# │ main │ find │
# ╰──────┴──────╯
@ -81,64 +148,8 @@ rwx_find_shell() {
}
# ╭──────┬─────╮
# │ main │ ifs
# │ main │ run
# ╰──────┴─────╯
rwx_ifs_set() {
_RWX_IFS="${IFS}"
IFS="
"
}
rwx_ifs_unset() {
IFS="${_RWX_IFS}"
unset RWX_IFS
}
# ╭──────┬────────╮
# │ main │ source │
# ╰──────┴────────╯
rwx_source() {
local path="${1}"
[ -d "${path}" ] ||
return 1
local count module
count=0
__rwx_log "" \
". ${path}"
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}"
# shellcheck disable=SC1090
. "${module}"
done
rwx_ifs_unset
}
# ╭──────╮
# │ main │
# ╰──────╯
# run initial steps
rwx_main() {
# system root
if ! rwx_source "${RWX_ROOT_SYSTEM}"; then
__rwx_log "Not a directory: ${RWX_ROOT_SYSTEM}"
return 1
fi
# user root
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 "${@}"

View file

@ -92,7 +92,7 @@ rwx_self_init() {
_rwx_cmd_rwx_install() { rwx_self_install "${@}"; }
rwx_self_install() {
local target="${1}"
local command file root
local command file name root
# code
if [ -n "${target}" ]; then
root="${target}${RWX_ROOT_SYSTEM}"
@ -101,10 +101,14 @@ rwx_self_install() {
fi
# commands
root="${target}/usr/local/bin"
name="${RWX_SELF_NAME}.sh"
file="${root}/${name}"
rwx_remove "${file}"
rwx_link "${file}" "${RWX_MAIN_PATH}"
for command in $(rwx_self_commands); do
file="${root}/${command}"
rwx_remove "${file}"
rwx_link "${file}" "${RWX_MAIN_PATH}"
rwx_link "${file}" "${name}"
done
# sh
file="${target}/etc/profile.d/${RWX_SELF_NAME}.sh"

View file

@ -1,3 +1,7 @@
# ╭──────╮
# │ tmux │
# ╰──────╯
# ╭──────┬───────╮
# │ tmux │ setup │
# ╰──────┴───────╯
@ -47,6 +51,8 @@ set-option -g set-titles on
# set title to working directory
set-option -g set-titles-string '\
#(basename \"\${TMUX}\" | cut --delimiter \",\" --fields \"1\")\
- \
#{session_name}\
- \
#{window_index}∕#{session_windows} #{window_name}\
@ -76,10 +82,10 @@ set-option -g pane-border-style fg=blue
# ╰────────┴────────╯
# status lines
set-option -g status 3
set-option -g status 2
# background color
set-option -g status-bg '#0D0D0D'
set-option -g status-bg '#080808'
# foreground color
set-option -g status-fg white
@ -87,83 +93,99 @@ 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] \
#{?window_activity_flag,#[fg=red],#[fg=yellow]}}\
#[bg=##181818]#{?window_zoomed_flag,#[fg=magenta][, }\
#[bg=##282828]#{window_name}\
#[bg=##181818]#{?window_zoomed_flag,#[fg=magenta]], }\
#[fg=default]\
#[bg=default] \
}\
#[align=right]\
#[bg=##202020] #[bg=##303030] \
#[fg=yellow]%H:%M:%S\
#[bg=##303030] #[bg=##202020]\
#{?client_prefix,#[fg=green]p, }\
#[fg=yellow]\
#[bg=##181818] \
#[bg=##282828]%H:%M:%S\
#[bg=##181818]#{?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] \
#{?session_many_attached,#[fg=magenta],\
#{?session_attached,#[fg=red],#[fg=yellow]}}\
#[bg=##181818] \
#[bg=##282828]#{session_name}\
#[bg=##181818] \
#[fg=default]\
#[bg=default] \
}\
#[fg=yellow]→ #[fg=green]#{session_name} \
#[fg=yellow]→\
#[fg=default] \
#[fg=green]\
#[bg=##181818] \
#[bg=##282828]#{session_name}\
#[bg=##181818] \
#[align=right]\
#[bg=##202020] #[bg=##303030] \
#[fg=yellow]%Y-%m-%d\
#[bg=##303030] #[bg=##202020] \
#[fg=yellow]\
#[bg=##181818] \
#[bg=##282828]%Y-%m-%d\
#[bg=##181818] \
'
# line 3
set-option -g status-format[2] '\
#[fg=cyan]#{pane_current_path}\
#[fg=yellow]\
#(lsof -U \
| awk \"/^tmux:.*\\(LISTEN\\)$/ {print \\\$9}\" \
| xargs -n \"1\" basename \
| sed \"s/^/#[fg=yellow]#[bg=##181818] #[bg=##282828]/\
;s/\$/#[bg=##181818] #[fg=default]#[bg=default] /\" \
| xargs echo \
)\
#[fg=default] \
#[fg=yellow]→\
#[fg=default] \
#[fg=green]\
#[bg=##181818] \
#[bg=##282828]#(basename \"\${TMUX}\" \
| cut --delimiter \",\" --fields \"1\")\
#[bg=##181818] \
#[align=right]\
#[bg=##202020] #[bg=##303030] \
#[fg=yellow]#{host}\
#[bg=##303030] #[bg=##202020] \
#[fg=yellow]\
#[bg=##181818] \
#[bg=##282828]#{host}\
#[bg=##181818] \
'
# line 4
set-option -g status-format[3] '\
#{P:\
#[bg=##202020] #[bg=##303030] \
#[fg=yellow]#{pane_index}\
\
#{?pane_active,#[fg=green],#[fg=blue]}\
#[bg=##181818] #[bg=##282828]\
#{?pane_active,#[fg=green],#[fg=yellow]}\
#{pane_current_command}\
#[bg=##303030] #[bg=##202020] \
#[bg=##181818] \
#[bg=default] \
}\
#[align=right]\
#[bg=##202020] #[bg=##303030] \
#[bg=##181818] #[bg=##282828]\
#{?uid,#[fg=green],#[fg=red]}\
#{user}\
#[bg=##303030] #[bg=##202020] \
#[bg=##181818] \
'
# line 5
set-option -g status-format[4] '\
#{P:\
#[bg=##202020] #[bg=##303030] \
#[fg=yellow]#{pane_index}\
\
#{?pane_active,#[fg=green],#[fg=blue]}\
#[bg=##181818] #[bg=##282828]\
#{?pane_active,#[fg=green],#[fg=yellow]}\
#{pane_width}×#{pane_height}\
#[bg=##303030] #[bg=##202020] \
#[bg=##181818] \
#[bg=default] \
}\
#[align=right]\
#[bg=##202020] #[bg=##303030] \
#[bg=##181818] #[bg=##282828]\
#[fg=green]#{window_width}×#{window_height}\
#[bg=##303030] #[bg=##202020] \
#[bg=##181818] \
'
# refresh period
@ -179,8 +201,9 @@ set-option -g status-position bottom
# detach client
bind-key -n F6 detach-client
# new window
bind-key -n F2 new-window
# new
bind-key -n S-M-Down new-session
bind-key -n S-M-Right new-window
# select pane
bind-key -n C-S-Down select-pane -D
@ -189,7 +212,7 @@ 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-F6 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
@ -216,12 +239,15 @@ bind-key C-w command-prompt { rename-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}'
# kill server
bind-key k kill-server
# reload configuration
bind-key r source-file ${file} \\; display-message 'source-file ${file}'
# toggle mouse
bind-key t set-option -g mouse \\; display-message 'mouse = #{mouse}'
# swap window
bind-key M-Left swap-window -t -1
bind-key M-Right swap-window -t +1
@ -233,7 +259,8 @@ bind-key M-Right swap-window -t +1
# ╭───────────────────┼───────────┼─────────┼─────┼───────┤
# │ command-prompt │ │ │ │ : │
# │ copy-mode │ │ │ │ PPage │
# │ detach-client │ │ │ │ d │
# │ detach-client │ F6 │ │ │ d │
# │ kill-server │ │ k │ │ │
# │ new-session │ │ │ │ │
# │ new-window │ F2 │ │ │ c │
# │ next-window │ M-Right │ │ │ n │
@ -246,7 +273,7 @@ bind-key M-Right swap-window -t +1
# │ 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 off │ C-F6 │ │ │ │
# │ set -g status on │ C-F1 │ │ │ │
# │ set -g status 2 │ C-F2 │ │ │ │
# │ set -g status 3 │ C-F3 │ │ │ │

View file

@ -1,25 +1,6 @@
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
}
# ╭──────╮
# │ util │
# ╰──────╯
rwx_link() {
local link="${1}"