mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: check compositor support status before using ueberzug wayland output
This commit is contained in:
parent
ddb8ce530f
commit
220354727e
1 changed files with 10 additions and 2 deletions
|
|
@ -95,12 +95,20 @@ impl Adapter {
|
||||||
return *p;
|
return *p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Currently Überzug++'s Wayland output only supports Sway, Hyprland and Wayfire
|
||||||
|
// as it requires information from specific compositior socket directly.
|
||||||
|
// These environment variables are from ueberzugpp src/canvas/wayland/config.cpp
|
||||||
|
let supports_ueberzug_wayland = env_exists("SWAYSOCK")
|
||||||
|
|| env_exists("HYPRLAND_INSTANCE_SIGNATURE")
|
||||||
|
|| env_exists("WAYFIRE_SOCKET");
|
||||||
|
|
||||||
match env::var("XDG_SESSION_TYPE").unwrap_or_default().as_str() {
|
match env::var("XDG_SESSION_TYPE").unwrap_or_default().as_str() {
|
||||||
"x11" => return Self::X11,
|
"x11" => return Self::X11,
|
||||||
"wayland" => return Self::Wayland,
|
"wayland" if supports_ueberzug_wayland => return Self::Wayland,
|
||||||
|
"wayland" if !supports_ueberzug_wayland => warn!("[Adapter] Unsupported Wayland compositor"),
|
||||||
_ => warn!("[Adapter] Could not identify XDG_SESSION_TYPE"),
|
_ => warn!("[Adapter] Could not identify XDG_SESSION_TYPE"),
|
||||||
}
|
}
|
||||||
if env_exists("WAYLAND_DISPLAY") {
|
if supports_ueberzug_wayland && env_exists("WAYLAND_DISPLAY") {
|
||||||
return Self::Wayland;
|
return Self::Wayland;
|
||||||
}
|
}
|
||||||
if env_exists("DISPLAY") {
|
if env_exists("DISPLAY") {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue