Compare commits

...

3 Commits

Author SHA1 Message Date
KK
02cc4698dc Setup sublime 2026-06-25 08:37:05 +02:00
KK
fa6cf37c92 Small updates 2026-06-24 00:10:05 +02:00
KK
a7f6f8a3e0 add docs programs 2026-06-24 00:08:07 +02:00
23 changed files with 266 additions and 156 deletions

View File

@@ -32,6 +32,6 @@ if [ -d "$HOME/.local/bin" ] ; then
fi
if [ -z "$WAYLAND_DISPLAY" ] && [ "$XDG_VTNR" = 1 ]; then
exec sway --unsupported-gpu
exec sway --unsupported-gpu > ~/.sway.log 2>&1
fi

View File

@@ -18,6 +18,7 @@ shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=100000
HISTFILESIZE=200000
HISTTIMEFORMAT='%F %T '
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
@@ -33,7 +34,7 @@ shopt -s autocd
alias ls='ls -lahtr --color=auto'
alias vi='kak'
alias df='/usr/bin/git --git-dir=$HOME/.dotfilesrepo/ --work-tree=$HOME'
alias unpack='dtrx'
alias unpack='bsdtar -xf'
alias imv='imv-wayland'
alias sway='sway --unsupported-gpu'

View File

@@ -16,8 +16,35 @@ map global user / ': comment-line<ret>'
# insert four spaces instead of a tab character while in insert mode.
map global insert <tab> '<space><space><space><space>'
hook global RegisterModified '"' %{ nop %sh{
printf %s "$kak_main_reg_dquote" | wl-copy > /dev/null 2>&1 &
hook global InsertChar j %{ try %{
exec -draft hH <a-k>jj<ret> d
exec -with-hooks <esc>
}}
evaluate-commands %sh{
if [ -n "${WAYLAND_DISPLAY:-}" ] && command -v wl-copy >/dev/null 2>&1 && command -v wl-paste >/dev/null 2>&1; then
printf %s "
hook global RegisterModified '\"' %{ nop %reg{dquote} %sh{
printf %s \"\$kak_main_reg_dquote\" | wl-copy > /dev/null 2>&1 &
}}
define-command -hidden paste-system-after %{
evaluate-commands -save-regs '\"' %{
set-register dquote %sh{ wl-paste --no-newline 2>/dev/null }
execute-keys p
}
}
define-command -hidden paste-system-before %{
evaluate-commands -save-regs '\"' %{
set-register dquote %sh{ wl-paste --no-newline 2>/dev/null }
execute-keys P
}
}
map global normal p ': paste-system-after<ret>'
map global normal P ': paste-system-before<ret>'
"
fi
}
add-highlighter global/ number-lines

View File

@@ -1,5 +1,5 @@
{
"theme": "Merge Dark.sublime-theme",
/*"theme": "Merge Dark.sublime-theme",*/
"side_bar_layout": "tabs",
"diff_algorithm": "match_git",
"visible_carriage_returns_at_eol": true,

View File

@@ -0,0 +1,28 @@
[
{ "keys": ["ctrl+q"], "command": "goto_definition" },
{ "keys": ["alt+q"], "command": "jump_back" },
{ "keys": ["ctrl+e"], "command": "next_result" },
{ "keys": ["alt+e"], "command": "prev_result" },
{ "keys": ["ctrl+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false} },
{ "keys": ["ctrl+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true} },
{ "keys": ["ctrl+shift+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false, "extend": true} },
{ "keys": ["ctrl+shift+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true, "extend": true} },
{ "keys": ["alt+up"], "command": "swap_line_up" },
{ "keys": ["alt+down"], "command": "swap_line_down" },
{ "keys": ["alt+left"], "command": "jump_back" },
{ "keys": ["alt+right"], "command": "jump_forward" },
{ "keys": ["alt+shift+up"], "command": "select_lines", "args": {"forward": false} },
{ "keys": ["alt+shift+down"], "command": "select_lines", "args": {"forward": true} },
{ "keys": ["ctrl+alt+down"], "command": "duplicate_line" },
{ "keys": ["ctrl+alt+up"], "command": "duplicate_line" },
{ "keys": ["ctrl+shift+l"], "command": "split_selection_into_lines" },
{ "keys": ["ctrl+r"], "command": "goto_symbol_in_project" },
{ "keys": ["ctrl+m"], "command": "toggle_record_macro" },
{ "keys": ["alt+m"], "command": "run_macro" },
]

View File

@@ -0,0 +1,13 @@
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"A File Icon",
"ayu",
"gruvbox",
"Package Control",
],
}

View File

@@ -31,5 +31,8 @@
// "line_numbers": false,
// "gutter": false,
// "margin": 0,
"color_scheme": "gruvbox (Dark) (Hard).sublime-color-scheme",
// "color_scheme": "gruvbox (Dark) (Hard).sublime-color-scheme",
"color_scheme": "auto",
"dark_color_scheme": "Mariana.sublime-color-scheme",
"light_color_scheme": "Breakers.sublime-color-scheme",
}

View File

@@ -91,6 +91,7 @@ input "1267:12734:ELAN06FA:00_04F3:31BE_Touchpad" {
# Start your launcher
bindsym $mod+p exec $menu
bindsym $mod+d exec /home/kk/bin/docs-list.c
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.

View File

@@ -15,12 +15,21 @@ set -g renumber-windows on
set -g default-terminal "tmux-256color"
set -as terminal-features ",*:RGB"
# Allow terminal escape passthrough for apps such as opencode that use OSC 52
# clipboard sequences from inside tmux.
set -g allow-passthrough on
# Keep a large scrollback history.
set -g history-limit 1000000
# Reload config with prefix + r.
bind-key r source-file ~/.config/tmux/tmux.conf \; display-message "tmux config reloaded"
# Open new panes/windows in the currently focused pane's directory.
bind-key % split-window -h -c "#{pane_current_path}"
bind-key '"' split-window -v -c "#{pane_current_path}"
bind-key c new-window -c "#{pane_current_path}"
# Pane navigation with Vim-style keys
bind-key h select-pane -L
bind-key j select-pane -D

View File

@@ -1,150 +0,0 @@
#!/bin/bash
set -euo pipefail
username=kk
core_packages=(
tmux
kakoune
man-db
man-pages
clang
make
tcc
ripgrep
curl
plocate
fzf
gdb
)
network_packages=(
openssh
sshfs
)
desktop_packages=(
sway
swayidle
swaybg
swaylock
foot
wmenu
xorg-xwayland
wl-clipboard
xdg-desktop-portal-wlr
xdg-user-dirs
grim
)
media_packages=(
pipewire
pipewire-pulse
pipewire-alsa
pipewire-jack
wireplumber
pavucontrol
ffmpeg
imv
mpv
)
font_packages=(
ttf-fira-code
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
noto-fonts-extra
ttf-liberation
ttf-dejavu
ttf-roboto
)
app_packages=(
firefox
)
machine_packages=(
nvidia-open
)
if [[ ${EUID} -ne 0 ]]; then
printf 'Run this script as root inside arch-chroot.\n' >&2
exit 1
fi
ln -sf /usr/share/zoneinfo/Europe/Warsaw /etc/localtime
hwclock --systohc
sed -i 's/^#\(en_US.UTF-8 UTF-8\)/\1/' /etc/locale.gen
sed -i 's/^#\(pl_PL.UTF-8 UTF-8\)/\1/' /etc/locale.gen
locale-gen
cat >/etc/locale.conf <<'EOF'
LANG=en_US.UTF-8
EOF
cat >/etc/vconsole.conf <<'EOF'
KEYMAP=pl2
EOF
bootctl install
cat >/boot/loader/loader.conf <<'EOF'
default arch.conf
timeout 0
console-mode max
editor no
EOF
root_uuid=$(findmnt -no UUID /)
if [[ -z ${root_uuid} ]]; then
printf 'Could not detect root filesystem UUID. Check findmnt/blkid manually.\n' >&2
exit 1
fi
cat >/boot/loader/entries/arch.conf <<EOF
title Arch Linux
linux /vmlinuz-linux
initrd /amd-ucode.img
initrd /initramfs-linux.img
options root=UUID=${root_uuid} rw
EOF
bootctl status
systemctl enable systemd-networkd.service
systemctl enable systemd-resolved.service
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
install -d /etc/systemd/network
ln -sf /usr/lib/systemd/network/89-ethernet.network.example /etc/systemd/network/89-ethernet.network
if ! id -u "${username}" >/dev/null 2>&1; then
useradd -m -s /bin/bash -G wheel,video,render "${username}"
fi
install -m 0750 -d /etc/sudoers.d
cat >/etc/sudoers.d/00-wheel <<'EOF'
%wheel ALL=(ALL:ALL) ALL
EOF
chmod 0440 /etc/sudoers.d/00-wheel
visudo -cf /etc/sudoers.d/00-wheel
passwd "${username}"
pacman -Syu --needed \
"${core_packages[@]}" \
"${network_packages[@]}" \
"${desktop_packages[@]}" \
"${media_packages[@]}" \
"${font_packages[@]}" \
"${app_packages[@]}" \
"${machine_packages[@]}"
updatedb
systemctl enable sshd.service
printf '\nChroot setup complete. Exit, unmount /mnt, reboot, then log in as %s.\n' "${username}"
printf 'After first login, run: xdg-user-dirs-update\n'
printf 'After first login, run: systemctl --user enable --now pipewire pipewire-pulse wireplumber\n'
printf 'Generate SSH key after first login with: ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519\n'

View File

@@ -12,6 +12,8 @@ base_packages=(
amd-ucode # AMD CPU microcode updates loaded by the boot loader
sudo # Run commands as root from the user account
git # Version control and cloning dotfiles
which
base-devel
)
pacstrap -K /mnt "${base_packages[@]}"

165
bin/docs-list.c Executable file
View File

@@ -0,0 +1,165 @@
#!/usr/bin/tcc -run
#include <ctype.h>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <unistd.h>
void print_man_dir(FILE *menu, const char *dir) {
DIR *d = opendir(dir);
if (!d) {
return;
}
struct dirent *ent;
while ((ent = readdir(d))) {
if (ent->d_name[0] == '.') {
continue;
}
char file[512];
snprintf(file, sizeof(file), "%s", ent->d_name);
const char *suffixes[] = {".gz", ".bz2", ".xz", ".lzma", ".zst"};
for (size_t i = 0; i < sizeof(suffixes) / sizeof(suffixes[0]); i++) {
size_t flen = strlen(file);
size_t slen = strlen(suffixes[i]);
if (flen > slen && strcmp(file + flen - slen, suffixes[i]) == 0) {
file[flen - slen] = '\0';
break;
}
}
char *dot = strrchr(file, '.');
if (!dot || dot == file || !dot[1]) {
continue;
}
*dot++ = '\0';
fprintf(menu, "%s (%s)\tman\n", file, dot);
}
closedir(d);
}
void print_man_pages(FILE *menu, const char *root) {
DIR *d = opendir(root);
if (!d) {
return;
}
struct dirent *ent;
char path[4096];
while ((ent = readdir(d))) {
if (strncmp(ent->d_name, "man", 3) != 0) {
continue;
}
snprintf(path, sizeof(path), "%s/%s", root, ent->d_name);
print_man_dir(menu, path);
}
closedir(d);
}
int main(void) {
char path[] = "/tmp/docs-list.XXXXXX";
int fd = mkstemp(path);
if (fd < 0) {
perror("mkstemp");
return 1;
}
FILE *menu = fdopen(fd, "w");
if (!menu) {
perror("fdopen");
unlink(path);
return 1;
}
char line[8192];
FILE *manpath = popen("manpath 2>/dev/null", "r");
if (manpath && fgets(line, sizeof(line), manpath)) {
line[strcspn(line, "\n")] = '\0';
for (char *dir = strtok(line, ":"); dir; dir = strtok(NULL, ":")) {
print_man_pages(menu, dir);
}
}
if (manpath) {
pclose(manpath);
}
FILE *pydoc = popen("python -c 'import pkgutil; [print(m) for m in sorted({m.name for m in pkgutil.iter_modules()})]'", "r");
if (pydoc) {
while (fgets(line, sizeof(line), pydoc)) {
line[strcspn(line, "\n")] = '\0';
fprintf(menu, "%s\tpydoc\n", line);
}
pclose(pydoc);
}
fclose(menu);
char command[1024];
snprintf(command, sizeof(command), "wmenu -i -l 20 < '%s'", path);
FILE *wmenu = popen(command, "r");
if (!wmenu) {
perror("wmenu");
unlink(path);
return 1;
}
if (!fgets(line, sizeof(line), wmenu)) {
pclose(wmenu);
unlink(path);
return 0;
}
int status = pclose(wmenu);
unlink(path);
if (status != 0) {
return WIFEXITED(status) ? WEXITSTATUS(status) : 1;
}
line[strcspn(line, "\n")] = '\0';
char *kind = strrchr(line, '\t');
if (!kind) {
return 0;
}
*kind++ = '\0';
if (strcmp(kind, "man") == 0) {
char *s = line;
char name[256] = {0};
char section[64] = {0};
size_t i = 0;
while (*s && !isspace((unsigned char)*s) && *s != '(' && i < sizeof(name) - 1) {
name[i++] = *s++;
}
char *open = strchr(s, '(');
char *close = open ? strchr(open + 1, ')') : NULL;
if (open && close && close > open + 1) {
size_t len = close - open - 1;
if (len >= sizeof(section)) {
len = sizeof(section) - 1;
}
memcpy(section, open + 1, len);
}
if (name[0] && section[0]) {
execlp("foot", "foot", "-e", "man", section, name, NULL);
} else if (name[0]) {
execlp("foot", "foot", "-e", "man", name, NULL);
}
} else if (strcmp(kind, "pydoc") == 0 && line[0]) {
execlp("foot", "foot", "-e", "python", "-m", "pydoc", line, NULL);
}
perror("foot");
return 1;
}

2
bin/man-list Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
man -k . | wmenu -i -l 20 | awk '{print $1}' | xargs -r man

9
bin/pydoc-list Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/sh
module="$(
python - <<'PY' | wmenu -i -l 20
import pkgutil
for m in sorted({m.name for m in pkgutil.iter_modules()}):
print(m)
PY
)"
[ -n "$module" ] && foot -e python -m pydoc "$module"