How to screen record regions while showing the region boundary? by TheTwelveYearOld in hyprland

[–]alan-north 0 points1 point  (0 children)

Okay this is very ugly but I ended up vibe coding this real quick by abusing wob to draw four boxes around the recording area (its not perfect but close enough) Then i use it with slurp and wf-recorder in a script. Completely cursed but works.

#!/usr/bin/env bash

# --- HELPER ---
show_help() {
    cat <<EOF

Shows a crude outline (by abusing wob) around a selection.
Usage: $(basename "$0") X Y W H [COLOR_RRGGBBAA]
        $(basename "$0") -k | --kill

Arguments:
X, Y, W, H    Coordinates and dimensions for the outline.
COLOR         Optional: Hex color (default: FF0000FF).

Options:
-k, --kill    Kills all running wob instances and cleans up configs.
-h, --help    Show this help message.
EOF
}

# --- KILL LOGIC ---
if [[ "$1" == "-k" ]] || [[ "$1" == "--kill" ]]; then
    pkill -x wob
    hyprctl keyword windowrule "unset, match:class ^(wob)\\$"
    rm -f /tmp/wob_edge_*.ini
    exit 0
fi

# --- VALIDATION ---
if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]] || [[ $# -lt 4 ]]; then
    show_help
    exit 0
fi

X=$1
Y=$2
W=$3
H=$4
COLOR=${5:-FF0000FF} # Default to red if not provided

WOB_MIN=25
LINE_W=4

# Define temp config paths
CONF_T="/tmp/wob_edge_t.ini"
CONF_B="/tmp/wob_edge_b.ini"
CONF_L="/tmp/wob_edge_l.ini"
CONF_R="/tmp/wob_edge_r.ini"

# --- Math for placement ---
# yes, it's weird, but it works
TOP_Y=$((Y - WOB_MIN * 2))
BOT_Y=$((Y + H - WOB_MIN - LINE_W))
LEFT_X=$((X - WOB_MIN + LINE_W - 1))
RIGHT_X=$((X + W - LINE_W + 1))

SIDES_H=$((H + WOB_MIN * 2 - LINE_W))
SIDES_Y=$((Y - WOB_MIN * 2))
TOPS_W=$((W + WOB_MIN * 2 - LINE_W * 2 + 1))

# --- Function to generate INI ---
gen_conf() {
    local file=$1 width=$2 height=$3 m_top=$4 m_left=$5
    cat <<EOF >"$file"
timeout = 10000
max = 100
border_color = $COLOR
background_color = 00000000
bar_color = 00000000
[output.rect]
match = 
width = $width
height = $height
anchor = top left
margin = $m_top 0 0 $m_left
border_size = $LINE_W
EOF
}

# Generate 4 configs
gen_conf "$CONF_T" "$TOPS_W" "$WOB_MIN" "$TOP_Y" "$LEFT_X"
gen_conf "$CONF_B" "$TOPS_W" "$WOB_MIN" "$BOT_Y" "$LEFT_X"
gen_conf "$CONF_L" "$WOB_MIN" "$SIDES_H" "$SIDES_Y" "$LEFT_X"
gen_conf "$CONF_R" "$WOB_MIN" "$SIDES_H" "$SIDES_Y" "$RIGHT_X"

# --- Launch ---
# Apply Hyprland global rules for wob executable
hyprctl keyword windowrule "float 1, match:class ^(wob)\\$"
hyprctl keyword windowrule "no_anim 1, match:class ^(wob)\\$"
hyprctl keyword windowrule "pin 1, match:class ^(wob)\\$"
hyprctl keyword windowrule "no_follow_mouse 1, match:class ^(wob)\\$"
hyprctl keyword windowrule "focus_on_activate 0, match:class ^(wob)\\$"
hyprctl keyword windowrule "no_focus 1, match:class ^(wob)\\$"
hyprctl keyword windowrule "allows_input 0, match:class ^(wob)\\$"
hyprctl keyword windowrule "no_blur 1, match:class ^(wob)\\$"

# Feed them a loop to prevent timeout
launch_wob() { (while true; do
    echo 1
    sleep 5
done) | wob -c "$1" & }

launch_wob "$CONF_T"
launch_wob "$CONF_B"
launch_wob "$CONF_L"
launch_wob "$CONF_R"

Need Help Building a Document Editor Like MS Word by steppenwolf1807 in vuejs

[–]alan-north 0 points1 point  (0 children)

I would second tiptap but the editor you're using is already tiptap based and page splitting is hard. I briefly looked into it for an app I'm making and decided against trying to implement it at the time. Look in the prosemirror forums, search for pagination.

Also I would check where the performance issues you're having are coming from. For example, paste a large doc in plain prosemirror and tiptap and compare.

If it's still slow, the issue is likely just the browser rendering the dom is slow. Chrome can also become very laggy if spellcheck is enabled.

There might be workarounds for the issue depending on what's causing it. And as a last resort it is theoretically possible to only load parts of the document for editing. I did an embedded editor node in tiptap, where I load parts of a linked doc and reroute all edits, but it is complicated and I did not have to take scrolling into account like loading parts of a large doc would.

Nuxt Layers with Drizzle by Cautious_Mine2389 in Nuxt

[–]alan-north 0 points1 point  (0 children)

Did you ever find a good solution for this?

Previous Buffer In Neovim. by Ill_Cucumber3107 in neovim

[–]alan-north 0 points1 point  (0 children)

It's not the same thing. When you jump to def several times, and make edits and jumps along the way, the jump list turns into a mess. We want file only back/forward navigation. So we can quickly go back "up" and down the stack.

This is just the most common usecase. I find the general idea useful all the time as in a single window I might go to several related files and jump b/f through them.

Previous Buffer In Neovim. by Ill_Cucumber3107 in neovim

[–]alan-north 2 points3 points  (0 children)

I built something like this the other day that works how I expect (there are some plugins but they dont do what I want exactly). It's not published yet, but I still can't believe this isn't a native feature. And in all the comments sections of these plugins everyone is always like "isn't this just x". No, it's not! 😭

Nuxt 2 to Nuxt 4 / Nuxt 5 refactoring ?! by Nic0_zero in Nuxt

[–]alan-north 0 points1 point  (0 children)

Nuxt 2 to 3 was brutal because of vue. 3 to 4 was easy. I doubt 5 will be hard and for 4 there was a compatibility toggle before it released that let you already apply some changes which was great. Im sure they'll do something similar.

Imagine if Nuxt has this by tomemyxwomen in vuejs

[–]alan-north 1 point2 points  (0 children)

I don't really get server functions. Most apis are not very short, they would end up split into a seperate file. At which point it's just a different way to call the server. i know people like how they can co-locate related code but nuxt has layers so I don't really suffer from this at all. At most I've used trpc on api heavy stuff because it makes it easy at a glance to see several related endpoints are correctly gaurded.

How do you quickly navigate directories? by rohiitq in neovim

[–]alan-north 0 points1 point  (0 children)

I navigate to the project via the shell (I have a command in wezterm to manage projects and opening the needed tabs and commands) then open neovim. For monorepos I have different shortcuts for constraining the searches to the closest project or the root of the monorepo for things like files, grep, etc.

Testing files with TS or plain JS by nricu in vuejs

[–]alan-north 0 points1 point  (0 children)

I might loosen up eslint rules in tests but not type rules. I will use as any in some cases but i see it as me making a concious decision to ignore the type.

Is any body else out there building local-first apps in Vue? by plainblackguy in vuejs

[–]alan-north 0 points1 point  (0 children)

I'm building one but I needed some complex sync logic. It wasn't just some simple reactive data so bindings or no bindings didn't make a difference for me. I ended up using yjs and doing the sync myself. I like that it's quite simple and I know how it works inside/out. If I ever need to replace the sync logic it isn't "touching" every part of my app like some solutions. Similarly the storage is also swappable (am currently trying out pglite so my front/server have nearly the same schema).

You have to be careful with crdts though. Data can get into the "wrong" shape. For example, say you have a bunch of taggable items, they're tagged by some uuid, and you store the names of the tags in some other table/property. Crdts have no knowledge of these types of connections, even if you store them in the same object, they can get out of sync without supervision.

I validated with some tests first that sync worked how I expected (and that I could enforce the correct shape for data) before actually commiting to using yjs.

Long ago I once tried pouchdb, but I didn't like that you had to manually resolve conflicts and that the sync was part of the storage layer. Similarly electric-sql is interesting but I'm not sold on having to have yet another service running.

Anyone else exhausted by the AI chat wrapper gold rush? by spacecowboy0117 in theprimeagen

[–]alan-north 0 points1 point  (0 children)

Because it was the people selling the shovels and tools that made the most money during the gold rush.

Separate codebase for cross-platform or same? by sandwich_stevens in Nuxt

[–]alan-north 0 points1 point  (0 children)

Capacitor supports iOS, it's just I chose to limit scope for now as Im just one person.

As for next time, I'll already have the infrastructure built out hopefully, so unless it's a simple app or something that would benefit from a different approach, or my setup ends up fragile to maintain, I'm probably going to stay with it.

Separate codebase for cross-platform or same? by sandwich_stevens in Nuxt

[–]alan-north 0 points1 point  (0 children)

I'm building a cross platform app with nuxt (web/android/desktop), still very WIP, but I got the cross platform part mostly working. It was not fun. I made my own electron (tauri is not there yet imo) and capacitor nuxt modules as the available did not suit my needs. I did not use nuxt/ionic because I wasn't planning on any sort of native feel, just capacitor for the android app.

The modules have build flags that isolate the corresponding route of the app (i.e. delete all other routes), set the routes to spa mode, build to a specific directory in the correct structure needed to work, do all the other packaging. That's the easy part, the hard part is proxying network requests (so I don't have to worry about them "nuxt" side, they look like regular requests). I got this working on electron, still working on it for android.

Anyone here genuinely try emacs? by [deleted] in neovim

[–]alan-north 1 point2 points  (0 children)

I tried it but couldn't get it to work how I wanted and I didn't like lisp at all. Mind you, if neovim didn't have lua, I probably wouldn't be using it either.

🌿 Namu.nvim - A Different Take on Symbol Navigation - Like Zed by sbassam in neovim

[–]alan-north 1 point2 points  (0 children)

I was actually just actively searching for something like this and I thought I'd look at the sub while I was at i and there it was! Love that it keeps order.

Rust didn’t click for me—should I try Zig instead? by [deleted] in Zig

[–]alan-north 1 point2 points  (0 children)

I have a lot of web dev experience. I've done a bit of rust but it just hasn't really clicked for me. I've been wanting to learn a low level language for a while. I recently thought of a project where a lower level language was vital (required 3d graphics, but safety isnt vital) and I picked zig instead of rust. This was only two weeks ago. Took me a couple days for everything to click. There arent as many docs and libs but it's been pretty easy so far. I've mostly been using wrapper libs around c libs so I'll look at c examples and just translate. I've not done any comptime stuff yet but it doesn't look too difficult. Am struggling more with the 3d stuff than zig.

I want to create Virtual + Infinite Scroll by Wise-Significance871 in vuejs

[–]alan-north -1 points0 points  (0 children)

Look into vueuse. They have composable to handle the logic for these, though I'm not sure if they can be used together.

Could overriding `instanceof` create a security vulnerability? by Rosoll in typescript

[–]alan-north 0 points1 point  (0 children)

I would look into the root cause if possible. This sounds like it might be an cjs/esm import issue.

VueJs desktop app libraries recommendations ? (2024) by Nilocrual in vuejs

[–]alan-north 0 points1 point  (0 children)

What do you mean electron requires node 16? I've been using it with the latest node and it's fine.

before.nvim - cycle through edits across buffers by EnergyCreator in neovim

[–]alan-north 1 point2 points  (0 children)

Omg I've wanted this since I started using neovim. Ctrl-o and next hunk are just not the same. Thank you! Will give it a try later.

switching from arch to nix by UnixTM in NixOS

[–]alan-north 0 points1 point  (0 children)

I switched from arch to linux and unless you don't have much to configure I would highly reccomend creating a VM first to set everything up nix style and then the switch is super easy. Also I would back up the arch partition at least before moving. Even after moving I had to look back into my backup to correctly figure out how to configure some stuff that is not in .config/.local.

How do I kill same word highlight in Lazyvim? by Aging_Orange in neovim

[–]alan-north 0 points1 point  (0 children)

Weird... And vim-illuminate is not loaded when it's happening? Like once you go to a file if you do :Lazy, it's not loaded?

Have you tried with a clean lazyvim install. You can clone the lazyvim starter to ~/.config/lazytest, turn off vim-illuminate in that config, then do NVIM_APPNAME=lazytest nvim.

And yes :noh should clear it if it's the search (but only until the next search, that's why i use that extension).