feat: add --nvidia flag
Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
22
src/main.rs
22
src/main.rs
@@ -67,12 +67,16 @@ struct CliArgs {
|
|||||||
/// Restore the session with the given ID (or `latest`), ignoring the startup script. Sessions are stored in directories at `~/.local/state/stardust/`.
|
/// Restore the session with the given ID (or `latest`), ignoring the startup script. Sessions are stored in directories at `~/.local/state/stardust/`.
|
||||||
#[clap(id = "SESSION_ID", long = "restore", action)]
|
#[clap(id = "SESSION_ID", long = "restore", action)]
|
||||||
restore: Option<String>,
|
restore: Option<String>,
|
||||||
|
/// this should fix nvidia issues, it'll only help on driver 565+
|
||||||
|
/// and only if running under wayland, probably
|
||||||
|
#[clap(long)]
|
||||||
|
nvidia: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
static STARDUST_INSTANCE: OnceLock<String> = OnceLock::new();
|
static STARDUST_INSTANCE: OnceLock<String> = OnceLock::new();
|
||||||
|
|
||||||
// #[tokio::main]
|
// #[tokio::main(flavor = "current_thread")]
|
||||||
#[tokio::main(flavor = "current_thread")]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
color_eyre::install().unwrap();
|
color_eyre::install().unwrap();
|
||||||
|
|
||||||
@@ -98,6 +102,20 @@ async fn main() {
|
|||||||
|
|
||||||
let cli_args = CliArgs::parse();
|
let cli_args = CliArgs::parse();
|
||||||
|
|
||||||
|
if cli_args.nvidia && !cli_args.flatscreen {
|
||||||
|
// Only call this while singlethreaded since it can/will cause raceconditions with other
|
||||||
|
// functions reading or writing from the env
|
||||||
|
unsafe {
|
||||||
|
std::env::set_var("__GLX_VENDOR_LIBRARY_NAME", "mesa");
|
||||||
|
std::env::set_var(
|
||||||
|
"__EGL_VENDOR_LIBRARY_FILENAMES",
|
||||||
|
"/usr/share/glvnd/egl_vendor.d/50_mesa.json",
|
||||||
|
);
|
||||||
|
std::env::set_var("MESA_LOADER_DRIVER_OVERRIDE", "zink");
|
||||||
|
std::env::set_var("GALLIUM_DRIVER", "zink");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let socket_path =
|
let socket_path =
|
||||||
server::get_free_socket_path().expect("Unable to find a free stardust socket path");
|
server::get_free_socket_path().expect("Unable to find a free stardust socket path");
|
||||||
STARDUST_INSTANCE.set(socket_path.file_name().unwrap().to_string_lossy().into_owned()).expect("Someone hasn't done their job, yell at Nova because how is this set multiple times what the hell");
|
STARDUST_INSTANCE.set(socket_path.file_name().unwrap().to_string_lossy().into_owned()).expect("Someone hasn't done their job, yell at Nova because how is this set multiple times what the hell");
|
||||||
|
|||||||
Reference in New Issue
Block a user