u/swe__wannabe
Changing Scroll direction dynamically (Lua config)
How do I do this in the new config? in the old one, I had a script that did:hyprctl keyword scrolling:direction "$dir"
I dont see a scrolling layout message for direction for hl.dsp.layout()
Why would you need the Arch repos if you have the AUR?
I wanted zen-browser, which is in extra/ ( I think). Instead, I got the zen-browser-bin from the aur. Same with other packages like onlyoffice etc.
Why would I ever need arch repos?
[Hyprland] Artix Linux fully functional DE. 700MB on idle
Artix + Dinit
Boots in 5 seconds
hyprland (Lua)
fuzzel (menu/launcher)
waybar
mako
kitty
thunar
greetd+tuigreet
Missing Glyphs
I've been having this issue on my new setup. I had the exact same config/font in my last setup with no issue.
I use JetbrainsMono Nerd Font
My favorite coming of age movie with 10/10 music from Arctic Monkey's Alex Turner
The music is what makes this movie 10/10 for me. If you like Arctic Monkeys "slower" music then you'll LOVE this album and this movie.
The movie itself is pretty good, I really like the protagonist
So you define some escape code primitives:
// base
#define ESC "\033["
#define FG_BEGIN ESC "38;2;"
#define BG_BEGIN ESC "48;2;"
#define RESET ESC "0m"
// text
#define BOLD_ON ESC "1m"
#define BOLD_OFF ESC "22m"
#define DIM_ON ESC "2m"
...
get a simple buffer:
typedef struct {
char* data;
u32 len;
u32 cap;
} term_buf;
void tb_append_cstr(term_buf* b, const char* s)
{
u32 n = (u32)strlen(s));
strncpy(NEXT_SLOT(b), s, n);
b->len += n;
}
write to it using your primitives. We are making a box, bc[]contains border chars:
//top
// top left
tb_append_cstr(b, bc[0]);
// top horizontal
for (u32 i = 0; i < box.w - 2; i++) {
tb_append_cstr(b, bc[5]);
}
// top right
tb_append_cstr(b, bc[1]);
// Vertical sides
for (u32 i = 0; i < box.h - 2; i++) {
draw_move(b, box.r + 1 + i, box.c); // left side
tb_append_cstr(b, bc[4]);
draw_move(b, box.r + 1 + i, box.c + box.w - 1); // right side
tb_append_cstr(b, bc[4]);
}
// Bottom border
draw_move(b, box.r + box.h - 1, box.c);
tb_append_cstr(b, bc[2]); // bottom-left
for (u32 i = 0; i < box.w - 2; i++) {
tb_append_cstr(b, bc[5]);
}
tb_append_cstr(b, bc[3]); // bottom-right
flush it once per-frame:
void tb_flush(term_buf* b)
{
write(STDOUT_FILENO, b->data, b->len);
b->len = 0; // reset each frame
}
Much more control than ncurses
So I have been developing and using WCtoolkit for some time now. It is a library for generic (u8* generic data + vtable ops) data structures. Main one's being genVec, hashmap, and String.
genVec looks like:
typedef struct {
u8* data; // pointer to generic data
// Pointer to shared type-ops vtable (or NULL for POD types)
const container_ops* ops;
u64 size; // Number of elements currently in vector
u64 capacity; // Total allocated capacity (in elements)
u32 data_size; // Size of each element in bytes
} genVec;
ops is just:
typedef struct {
copy_fn copy_fn; // Deep copy function for owned resources (or NULL)
move_fn move_fn; // Transfer ownership and null original (or NULL)
delete_fn del_fn; // Cleanup function for owned resources (or NULL)
} container_ops;
You can check for POD as ops == NULL, so you can skip some loops and vtable lookup
The numbers I got by some basic tests written by AI: (String is a std::string-styled sso string)
Of course, no way near cpp's std::vector, templates do the magic there but still pretty satisfied
| Operation | POD (int) | Complex (String) |
|---|---|---|
| Push | 11 ns/op | 31 ns/op |
| Pop | 8 ns/op | 4 ns/op |
| Clear | 4 ns/op | 5 ns/op |
| Destroy | 377 ns total (50 reps of 1M) | 4,506,217 ns total (50 reps of 1M) |
| Remove Range | 0 ns/op | 4 ns/op |
| genVec_copy | 0 ns/op | 13 ns/op |
| init_val | 3 ns/op | 14 ns/op |
Now my hashmap is basically on the same level as cpp's std::unordered_map. It uses robinhood hashing with flat arrays for keys and values (still generic).
typedef struct {
u8* keys;
u8* psls;
u8* vals;
u64 size;
u64 capacity;
u32 key_size;
u32 val_size;
u8* scratch; // temp buffer for robin hood swaps
custom_hash_fn hash_fn;
compare_fn cmp_fn;
const container_ops* key_ops;
const container_ops* val_ops;
} hashmap;
performance:
| Operation | POD (int → int) | Complex (String → String) |
|---|---|---|
| Put | 114 ns/op | 291 ns/op |
| Get | 66 ns/op | 174 ns/op* |
| Clear | 34 ns/op | 19 ns/op |
So how can I do better?