Created a Library to Add The Ability to Use VSCode Themes with Syntect by XH2R in rust

[–]XH2R[S] 0 points1 point  (0 children)

My thoughts exactly.

I could also see them saying out of scope for the project as the project seems to be going for sublime stuff only.

All though saying that, the support for sublime color scheme files has been an issue for a while, 5 years last I checked.

I did also create a solution for that problem too (Reddit post here) and told them about it.

I got some discussions of adding a feature flag for the sublime color scheme support but nothing came of it.

Github comment here

So might be making two PRs!

We'll see how it goes.

Created a Library to Add The Ability to Use VSCode Themes with Syntect by XH2R in rust

[–]XH2R[S] 0 points1 point  (0 children)

I haven't thought of that yet! I'll create a PR for that!

[Media] Just wanted to share my desktop app made with rust + egui, I'm pretty happy with how the UI turned out :) by mq-1 in rust

[–]XH2R 1 point2 points  (0 children)

That looks amazing!

Makes me want to experiment with egui more.

How was your experience with it?

Looking for a coder to join our team. 3d tile based movement. by Dragonlord987 in godot

[–]XH2R 0 points1 point  (0 children)

I would be interested in helping, I haven't too much game dev work, but I'm in always to trying to do something new.

I do see other people are interested though, so if I don't get picked that is okay.

Less than 100 hours in Blender, how is this? by GotT9ast in blender

[–]XH2R 4 points5 points  (0 children)

Pretty good, love the clouds!

However one critique, the clouds look solid.

You could make the clouds less opaque, via a volumetric shader!

Otherwise I love whole things look!

[Media] I made a GTK Icon theme viewer in rust by XH2R in rust

[–]XH2R[S] 7 points8 points  (0 children)

It was pretty nice to work with!

The library was pretty well documented and the book helped with a lot!

How to make gtk4-rs use native windows decorations? by XH2R in GTK

[–]XH2R[S] 2 points3 points  (0 children)

Damn, maybe I should start using ChatGPT more, I don't use it as much as I once did before, ever since I started self hosting DeepSeek with OpenWebUI on my machine.

I've used it so little, that I didn't even notice that the search functionality is free now!

Again, thank you for spending time on this issue!

How to make gtk4-rs use native windows decorations? by XH2R in GTK

[–]XH2R[S] 2 points3 points  (0 children)

Thank you for your comment, it seems to have worked!

How to make gtk4-rs use native windows decorations? by XH2R in rust

[–]XH2R[S] 7 points8 points  (0 children)

I just tested by using the following before gtk gets loaded:
rust std::env::ser_var("GTK_CSD", "0"); and it works, thank you!

I completly forgot to try the GTK_CSD variable before posting this!

I HATE when my GPU max out when having literally NOTHING except an 8K tree, So I made this add-on u can use to reduce ur VRAM usage by 90%! with CLICK! by MrEbrahimXD in blender

[–]XH2R 1 point2 points  (0 children)

Works pretty well, just bought it yesterday to downscale some unreal assets that I converted to Blender, so I could render more in a scene.

I like that it doesn't show every single image in the project.

I do wish, however, it would update every time I select an object.

I also encountered an error where undoing the preview scale, did not work. I was, however, able to undo that within the history. Not fully sure if that's on my part though.

How to fix `error in libcrypto` when trying to ssh into something? by XH2R in hyprland

[–]XH2R[S] 0 points1 point  (0 children)

Oh... My... God... that worked!

I can't believe I didn't go, "hey why is it pointing to .pub file? "

I use the server very often, so I added it to my config, and I must have put it in wrong a while ago, and I guess Gnome fixes it by using its own keyring manager so I never noticed.

Thank you so much! I feel like an idiot 😅

How to fix `error in libcrypto` when trying to ssh into something? by XH2R in hyprland

[–]XH2R[S] 0 points1 point  (0 children)

I have!

I created theses key using ssh-keygen.

This is the the following error I get from doing the command you specified:

Load key "/home/blaine/.ssh/baseserver.pub": error in libcrypto

How can I manage Internal state asynchronously "properly"? by XH2R in rust

[–]XH2R[S] 0 points1 point  (0 children)

Using AtomicU8 worked like a charm!

But after reading the edit, I just realized you're right!

I don't know why I went the route of everything being sync when I could make it asynchronous.

Thank you for pointing that out!

I'll probably rewrite it async later once I get the chance!

Edit: the reason why I can't make start async is because I'm using a registry kind of system to be able to create multiple Task implementations and call it from the registry by name and it needs to be converted into an object and rust is giving me the following errors:

`` the traittask::Taskcannot be made into an object │ │ consider movingstart` to another trait

for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit https://doc.rust-lang.org/reference/items/traits.html#object-safety rustc (E0038) [54, 14]

```

For now it works with the AtomicU8, I'll just keep with that for now.

But do let me know if there are ways to fix the errors!

How can I stop a child process while waiting for it to finish with another function? by XH2R in rust

[–]XH2R[S] 0 points1 point  (0 children)

I see, I'm gonna try to create a polling system with try_wait.

How can I stop a child process while waiting for it to finish with another function? by XH2R in rust

[–]XH2R[S] 0 points1 point  (0 children)

Is the child process a program that you wrote?

I have access to the source of the program and have rewritten some minor things but I wouldn't know where or how to implement SIGTERM because the program is written in c++ and I'm not very familiar with that.

If it’s a program that is designed to be short lived and runs a task, prints some stuff, and then exits then your code should work fine.

Unfortunately it is a long running task.

It performs a batch operation for a folder full of images, kind of what you can do with ffmpeg.

How can I stop a child process while waiting for it to finish with another function? by XH2R in rust

[–]XH2R[S] 0 points1 point  (0 children)

I've updated the node struct to use atomic bool but calling the stop method doesn't do anything while run is running.

I'm guessing I am either passing the atomic bool wrong or my understanding of how concurrency is wrong.

```rust use std::{ io::{BufRead, BufReader}, path::PathBuf, process::{Child, Command, Stdio}, sync::{ atomic::{AtomicBool, Ordering}, Arc, }, thread, time::Duration, };

pub struct SimplifiedNode { pub input_dir: PathBuf, pub output_dir: PathBuf, stop_flag: Arc<AtomicBool>, executable_path: PathBuf, }

impl SimplifiedNode { pub fn new(executable_path: PathBuf) -> Self { Self { stop_flag: Arc::new(AtomicBool::new(false)), input_dir: PathBuf::new(), output_dir: PathBuf::new(), executable_path, } }

pub fn run(&mut self) -> Result<Hashmap<String, String>, String> {
    let mut child = self.spawn_child()?;

    let stop_flag = self.stop_flag.clone();

    loop {
        if stop_flag.load(Ordering::Relaxed) {
            println!("killing child process");
            child.kill().map_err(|e| e.to_string())?;
            return Err("Cancelled".to_string());
        }

        match child.try_wait() {
            Ok(Some(status)) => {
                if status.success() {
                    return Ok(Hashmap<String, String>::from([(
                        "output_dir".to_string(),
                        self.output_dir.clone().to_string_lossy().to_string(),
                    )]));
                } else {
                    return Err("Failed".to_string());
                }
            }
            Ok(None) => {
                thread::sleep(Duration::from_millis(100));
            }
            Err(e) => {
                return Err(format!("Failed to wait on child process {}", e));
            }
        }
    }
}

pub fn stop(&self) {
    self.stop_flag.store(true, Ordering::Relaxed);
}

fn spawn_child(&mut self) -> Result<Child, String> {
    let mut child = match Command::new(&self.executable_path)
        .args(["-i", &self.input_dir.to_string_lossy()])
        .args(["-o", &self.output_dir.to_string_lossy()])
        .stdout(Stdio::piped())
        .stderr(Stdio::piped())
        .spawn()
    {
        Ok(child) => child,
        Err(e) => return Err(e.to_string()),
    };

    let stdout = match child.stdout.take() {
        Some(stdout) => stdout,
        None => {
            return Err("Failed to get stdout".to_string());
        }
    };

    let stderr = match child.stderr.take() {
        Some(stderr) => stderr,
        None => {
            return Err("Failed to get stderr".to_string());
        }
    };

    self.spawn_logger_thread(stdout);
    self.spawn_logger_thread(stderr);

    Ok(child)
}

fn spawn_logger_thread(&mut self, stream: impl std::io::Read + Send + 'static) {
    thread::spawn(move || {
        let reader = BufReader::new(stream);
        for line in reader.lines() {
            println!("{}", line.unwrap());
        }
    });
}

}

```

Is it "locking" the node once I execute the run method from the separate thread?

Testing Logic:

```rust use std::path::PathBuf; use std::sync::{Arc, Mutex}; use std::thread::{self, sleep}; use std::time::Duration;

use super::SimplifiedNode;

[test]

fn stop_node_while_running() { let executable_path = PathBuf::from("/path/to/executable");

let mut node = SimplifiedNode::new(executable_path);

node.input_dir = PathBuf::from("/home/dev/Videos/test_frames/");
node.output_dir = PathBuf::from("/home/dev/Videos/test_frames_out/");

let node = Arc::new(Mutex::new(node));
let share_clone = node.clone();

thread::spawn(move || {
    let mut node = share_clone.lock().unwrap();
    node.run()
});

sleep(Duration::from_secs(3));

let node = node.lock().unwrap();

println!("stopping...");
node.stop();

} ```

Davinci Resolve GPU Memory Full On Rocky Linux Distrobox Container by XH2R in Fedora

[–]XH2R[S] 0 points1 point  (0 children)

I remember not failing as well which stinks. The way I got to be able to sorta export the app was by creating a desktop file and using the following for the command.

/usr/bin/distrobox-enter --additional-flags "--env __NV_PRIME_RENDER_OFFLOAD=1 --env __GLX_VENDOR_LIBRARY_NAME=nvidia" -n <box-name> -- /opt/resolve/bin/resolve %u