aboutsummaryrefslogtreecommitdiff
path: root/src/ui/config_error_notification.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-08-21 15:02:25 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-08-26 21:03:54 +0300
commit1f76dce345153d7da95262773c317446c1f6fc32 (patch)
tree518ba49abb67f2d9f2f32d8201662c8343aa19fe /src/ui/config_error_notification.rs
parente1afa712385bc4f2124a3bb7438743d3fdc1854a (diff)
downloadniri-1f76dce345153d7da95262773c317446c1f6fc32.tar.gz
niri-1f76dce345153d7da95262773c317446c1f6fc32.tar.bz2
niri-1f76dce345153d7da95262773c317446c1f6fc32.zip
Implement screen reader announcements via AccessKit
Diffstat (limited to 'src/ui/config_error_notification.rs')
-rw-r--r--src/ui/config_error_notification.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/ui/config_error_notification.rs b/src/ui/config_error_notification.rs
index 20667172..c6928b6b 100644
--- a/src/ui/config_error_notification.rs
+++ b/src/ui/config_error_notification.rs
@@ -20,9 +20,6 @@ use crate::render_helpers::renderer::NiriRenderer;
use crate::render_helpers::texture::{TextureBuffer, TextureRenderElement};
use crate::utils::{output_size, to_physical_precise_round};
-const TEXT: &str = "Failed to parse the config file. \
- Please run <span face='monospace' bgcolor='#000000'>niri validate</span> \
- to see the errors.";
const PADDING: i32 = 8;
const FONT: &str = "sans 14px";
const BORDER: i32 = 4;
@@ -186,7 +183,7 @@ fn render(
let padding: i32 = to_physical_precise_round(scale, PADDING);
- let mut text = String::from(TEXT);
+ let mut text = error_text(true);
let mut border_color = (1., 0.3, 0.3);
if let Some(path) = created_path {
text = format!(
@@ -249,3 +246,13 @@ fn render(
Ok(buffer)
}
+
+pub fn error_text(markup: bool) -> String {
+ let command = if markup {
+ "<span face='monospace' bgcolor='#000000'>niri validate</span>"
+ } else {
+ "niri validate"
+ };
+
+ format!("Failed to parse the config file. Please run {command} to see the errors.")
+}