Merge branch 'master' of ssh://git.roodletoof.org:2222/roodletoof/dotfiles

This commit is contained in:
Ivar Fatland
2026-08-10 09:47:22 +02:00
24 changed files with 7109 additions and 59 deletions
+2
View File
@@ -9,3 +9,5 @@ st-0.9.2/x.o
karabiner-ts-config/node_modules
__pycache__
tags
vim/.vim/view
vim/.vim/.netrwhist
Binary file not shown.
Binary file not shown.
+6814
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -0,0 +1,2 @@
tag:
ctags --langmap=c:.c.h --languages=c -R .
+9
View File
@@ -0,0 +1,9 @@
// Opens a fuzzy finding window with the given array of strings.
// Returns the index of the picked element.
// Returns -1 on no selection.
int picker(char const *strings, int strings_len, char const *prompt) {
}
+66
View File
@@ -0,0 +1,66 @@
#ifndef PLATFORM
#define PLATFORM
#include <stdint.h>
#include <stdbool.h>
#include "utf.h"
typedef struct Color {
uint8_t r, g, b;
} Color;
#define WHITE ((Color){255,255,255})
#define BLACK ((Color){0,0,0})
typedef enum Key {
Key_backspace,
Key_ctrl,
Key_enter,
Key_h,
Key_n,
Key_p,
Key_y,
Count_Key
} Key;
bool KeyPressed(Key key);
bool InputGetNextPrintable(CodePoint const *out_key);
typedef struct Cell {
CodePoint character;
Color foreground;
Color background;
} Cell;
typedef struct Window {
int width;
int height;
Cell *cells;
} Window;
typedef struct PlatformState {
Window *prev;
Window *curr;
} PlatformState;
// Options for the backend. These options don't necessarily apply for all platforms.
typedef struct PlatformOpts {
float window_width_fraction; // decide the width of the window as a fraction of the total resolution. for gui backends
float window_height_fraction; // decide the height of the window as a fraction of the total resolution. for gui backends
} PlatformOpts;
PlatformOpts WindowCreateOptsDefault();
Window *WindowCreate(PlatformOpts opts);
void WindowClear(Window *window, Color color);
void WindowFlip(Window *window);
void PlatformInit(PlatformOpts opts);
int PlatformGetWidth();
int PlatformGetHeight();
// TODO: the platform layer would really update the keys being pressed, and
// receive a diff in the form of actions. print this line from here and change
// colors at these points.
#endif /* PLATFORM */
View File
+43
View File
@@ -0,0 +1,43 @@
#include <stddef.h>
#include "str.h"
static bool intToIndex(String string, int i, size_t *out_index) {
int val = 0;
bool is_ok = true;
if (i >= 0) {
val = i;
} else {
val = string.size + 1 + i;
}
if (val < 0) {
val = 0;
is_ok = false;
} else if (val > string.size) {
val = string.size;
is_ok = false;
}
*out_index = val;
return is_ok;
}
bool StringSub(String string, int start, int end, String *out_substr) {
size_t start_index = 0;
bool start_ok = intToIndex(string, start, &start_index);
size_t end_index = 0;
bool end_ok = intToIndex(string, end, &end_index);
if (string.size == 0 || start_index >= end_index) {
out_substr->size=0;
out_substr->buffer=NULL;
return false;
}
out_substr->buffer = &string.buffer[start_index];
out_substr->size = end_index - start_index;
return start_ok && end_ok;
}
+10
View File
@@ -0,0 +1,10 @@
#include <stddef.h>
typedef struct String {
unsigned char const *buffer;
size_t size;
} String;
#define STRING(content) ((String){.buffer=#content, .size=sizeof(#content)-1})
bool StringSub(String string, int start, int end, String *out_substr);
+65
View File
@@ -0,0 +1,65 @@
#include <stddef.h>
#include "utf.h"
#include "str.h"
typedef struct Utf8Parser {
String str;
} Utf8Parser;
bool Utf8ParserNextCodePoint(Utf8Parser *this, CodePoint *out_codepoint) {
uitn8_t const flag_1_bytes = 0;
uint8_t const mask_1_bytes = 1 << 7;
uint8_t const flag_continuation = mask_1_bytes;
uint8_t const mask_continuation = (1 << 7) | (1 << 6);
uint8_t const flag_2_bytes = mask_continuation;
uint8_t const mask_2_bytes = (1 << 7) | (1 << 6) | (1 << 5);
uint8_t const flag_3_bytes = mask_2_bytes;
uint8_t const mask_3_bytes = (1 << 7) | (1 << 6) | (1 << 5) | (1 << 4);
uint8_t const flag_4_bytes = mask_3_bytes;
uint8_t const mask_4_bytes = (1 << 7) | (1 << 6) | (1 << 5) | (1 << 4) | (1 << 3);
if (this->str.size == 0) {
*out_codepoint = 0;
return false;
}
if ((this->str.buffer[0] & mask_1_bytes) == flag_1_bytes) {
*out_codepoint = (CodePoint) str[0];
bool ok = StringSub(this->str, 1, -1, &this->str);
assert(ok && "has to be ok since the size is not 0");
return ok;
} else
}
// max must be less than or equal to the capacity of target.
bool CodePointsFromUtf8String(
uint8_t const *str,
CodePoint *target,
int max
) {
for (size_t i = 0; str[i] != '\0' && max > 0;) {
if ((str[i] & mask_1_bytes) == flag_1_bytes) {
*target = (CodePoint) str[i];
target += 1;
max -= 1;
i += 1;
} else
if ((str[i] & mask_2_bytes) == flag_2_bytes) {
} else
if ((str[i] & mask_3_bytes) == flag_3_bytes) {
} else
if ((str[i] & mask_4_bytes) == flag_4_bytes) {
} else {
false;
}
}
return true;
}
+9
View File
@@ -0,0 +1,9 @@
#ifndef UTF
#define UTF
typedef uint32_t CodePoint;
int CodePointsFromUtf8String(char const *str, CodePoint *target, unsigned int max);
#endif // UTF
+11 -3
View File
@@ -4,11 +4,9 @@ set $left h
set $down j
set $up k
set $right l
set $term alacritty
set $term kitty
set $just just --justfile ~/.config/i3/justfile
for_window [class=".*"] fullscreen disable
for_window [class=".*"] floating disable
floating_minimum_size -1 x -1
floating_maximum_size -1 x -1
@@ -135,7 +133,17 @@ bindsym --release XF86MonBrightnessUp exec --no-startup-id brightnessctl set 5%+
# Screenshot (use scrot instead of grim)
bindsym Print exec scrot ~/Pictures/screenshot-%Y-%m-%d-%H%M%S.png
#class border background text indicator child_border
client.focused #ffffff #ffffff #000000 #ffffff #ffffff
# Status bar (use i3bar + i3status)
bar {
status_command i3status
colors {
#class border background text
focused_workspace #ffffff #ffffff #000000
inactive_workspace #333333 #333333 #ffffff
}
}
+1 -1
View File
@@ -3,7 +3,7 @@ choose-monitor:
just reset-wallpaper
reset-wallpaper:
feh --bg-fill ~/.wallpaper/
xsetroot -solid black
program-picker:
dmenu_run -p 'start program'
+4
View File
@@ -5,6 +5,7 @@
)
(defsrc ;;{{{1
f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
caps a s d f g h j k l ; ' ret
@@ -13,6 +14,7 @@
)
(deflayer default ;;{{{1
brdn brup bldn blup f5 f6 prev pp next mute vold volu
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
@cap a s d f g h j k l ; ' ret
@@ -21,6 +23,7 @@
)
(deflayer gaming ;;{{{1
f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
esc 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
XX a s d f g h j k l ; ' ret
@@ -29,6 +32,7 @@
)
(deflayer symbols ;;{{{1
f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
grv @1 @2 @3 @4 @5 @6 @7 @8 @9 @0 _ _ bspc
tab @` @m[ @m] @& @| @^ @_ @m- @+ @m= @nor _ lrld
@cap @~ @bl @br @* @m\ bspc ret @? tab @: S-' ret
@@ -35,24 +35,24 @@
"type": "basic"
}
]
},
{
"description": "swap alt and cmd",
"manipulators": [
{
"from": { "key_code": "left_option" },
"to": [{ "key_code": "left_command" }],
"type": "basic"
},
{
"from": { "key_code": "left_command" },
"to": [{ "key_code": "left_option" }],
"type": "basic"
}
]
}
]
},
"devices": [
{
"identifiers": {
"is_keyboard": true,
"product_id": 21042,
"vendor_id": 1155
},
"simple_modifications": [
{
"from": { "key_code": "grave_accent_and_tilde" },
"to": [{ "key_code": "non_us_backslash" }]
}
]
}
],
"name": "KarabinerTS",
"selected": true,
"virtual_hid_keyboard": { "keyboard_type_v2": "iso" }
@@ -35,24 +35,24 @@
"type": "basic"
}
]
},
{
"description": "swap alt and cmd",
"manipulators": [
{
"from": { "key_code": "left_option" },
"to": [{ "key_code": "left_command" }],
"type": "basic"
},
{
"from": { "key_code": "left_command" },
"to": [{ "key_code": "left_option" }],
"type": "basic"
}
]
}
]
},
"devices": [
{
"identifiers": {
"is_keyboard": true,
"product_id": 21042,
"vendor_id": 1155
},
"simple_modifications": [
{
"from": { "key_code": "grave_accent_and_tilde" },
"to": [{ "key_code": "non_us_backslash" }]
}
]
}
],
"name": "KarabinerTS",
"selected": true,
"virtual_hid_keyboard": { "keyboard_type_v2": "iso" }
@@ -35,25 +35,24 @@
"type": "basic"
}
]
},
{
"description": "swap alt and cmd",
"enabled": false,
"manipulators": [
{
"from": { "key_code": "left_option" },
"to": [{ "key_code": "left_command" }],
"type": "basic"
},
{
"from": { "key_code": "left_command" },
"to": [{ "key_code": "left_option" }],
"type": "basic"
}
]
}
]
},
"devices": [
{
"identifiers": {
"is_keyboard": true,
"product_id": 21042,
"vendor_id": 1155
},
"simple_modifications": [
{
"from": { "key_code": "grave_accent_and_tilde" },
"to": [{ "key_code": "non_us_backslash" }]
}
]
}
],
"name": "KarabinerTS",
"selected": true,
"virtual_hid_keyboard": { "keyboard_type_v2": "iso" }
+3
View File
@@ -2,6 +2,9 @@
# BEGIN_KITTY_FONTS
font_family family="GohuFont 11 Nerd Font Mono"
enable_audio_bell no
visual_bell_duration 0.0
confirm_os_window_close 0
bold_font auto
italic_font auto
bold_italic_font auto
+5 -1
View File
@@ -47,6 +47,7 @@ vim.cmd [=[
nnoremap ,x <C-x>
nnoremap ,rl :checktime<CR>
nnoremap ,m :wa<CR>:make<CR>
inoremap <c-k> <c-x>
nnoremap ,cD :call setqflist(filter(getqflist(), 'v:val != getqflist()[getqflist({"idx": 0}).idx - 1]'))<CR>
@@ -597,7 +598,10 @@ require'lazy'.setup{ --{{{1
'williamboman/mason.nvim',
},
cond = function()
local mason_registry = require'mason-registry'
local ok, mason_registry = pcall(require, 'mason-registry')
if not ok then
return false
end
return mason_registry.is_installed('roslyn')
end,
opts = {
+1 -1
View File
@@ -166,7 +166,7 @@ func Picker(options []string, pickerOptions ...PickerOption) (choiceIdx int, ok
func initialize(nOptions int) {
rl.SetTraceLogLevel(rl.LogError)
rl.InitWindow(0, 0, "raymenu")
rl.SetWindowState(rl.FlagWindowUndecorated)
rl.SetWindowState(rl.FlagWindowUndecorated | rl.FlagWindowTopmost)
rl.SetTargetFPS(
int32(
rl.GetMonitorRefreshRate(
+10
View File
@@ -92,6 +92,12 @@ func main() {
}
slices.Sort(seshNames)
printSeshContents := func(name string) (content string, ok bool) {
cmd := exec.Command(tmux, "capture-pane", "-epN", "-t", name)
stdout, err := cmd.Output()
return string(stdout), err == nil
}
options := []fuzzyfinder.Option{
fuzzyfinder.WithPreviewWindow(
func(i, width, height int) string {
@@ -100,6 +106,10 @@ func main() {
return ""
}
seshName := seshNames[i]
content, ok := printSeshContents(seshName)
if ok {
return content
}
windows, _ := config[seshName]
builder := strings.Builder{}
for _, window := range windows {
+2 -1
View File
@@ -30,6 +30,7 @@ bind b break-pane
set -g default-terminal "tmux-256color"
set -as terminal-overrides ",xterm-256color:Tc"
set -as terminal-features ',xterm-256color:sync'
set -g base-index 1
setw -g pane-base-index 1
set -g renumber-windows on
@@ -46,7 +47,7 @@ set -g status-position top
set -g status-left-length 100
set -g status-style "fg=${gray_light},bg=default"
set -g status-left "#[fg=${green_soft},bold] #S #[fg=${gray_light},nobold] | "
set -g status-right "#[fg=${gray_dark}]%H:%M"
set -g status-right ""
set -g window-status-current-format " #[fg=${white},bold]#I.#W "
set -g window-status-format " #I.#W "
set -g message-style "fg=${gray_medium},bg=default"
+7 -6
View File
@@ -62,12 +62,13 @@ set wildignore=*.o,*.obj,.git/**,tags,*.pyc
set noswapfile
set makeprg=just
syntax on
tnoremap <c-w>c <c-\><c-n><c-w>c
xnoremap H ^
xnoremap L $
nnoremap Q @@
nnoremap ,m :make<CR>
nnoremap - :E<CR>
tnoremap <silent> <c-w>c <c-\><c-n><c-w>c
xnoremap <silent> H ^
xnoremap <silent> L $
nnoremap <silent> Q @@
nnoremap <silent> ,m :make<CR>
nnoremap <silent> - :E<CR>
nnoremap <silent> _ :execute 'Explore ' . fnameescape(getcwd())<CR>
if has('clipboard')
set clipboard^=unnamed,unnamedplus