diff --git a/src/window.rs b/src/window.rs index 6ac2def..bbb271f 100644 --- a/src/window.rs +++ b/src/window.rs @@ -9,7 +9,7 @@ use gtk::prelude::*; use gtk::gdk_pixbuf::Pixbuf; use gtk::glib::GString; -use gtk::{glib, Builder, HeaderBar, Window}; +use gtk::{gdk, glib, Builder, HeaderBar, Window}; use tracing::{debug, error}; use unic_langid::LanguageIdentifier; @@ -61,6 +61,26 @@ impl HelloWindow { let icon_path = format!("{RESPREFIX}/data/img/{name}.png"); let image: gtk::Image = builder.object(name.as_str()).unwrap(); image.set_from_resource(Some(&icon_path)); + + // Enable keyboard activation (Enter/Space) for social EventBoxes + btn.connect_key_press_event(|widget, event| { + let keyval = event.keyval(); + if keyval == gdk::keys::constants::Return + || keyval == gdk::keys::constants::KP_Enter + || keyval == gdk::keys::constants::space + { + let name = widget.widget_name(); + let hello_window = + unsafe { crate::G_HELLO_WINDOW.as_ref().unwrap() }; + let preferences = hello_window.get_preferences("urls"); + if let Some(uri) = preferences[name.as_str()].as_str() { + hello_window.open_uri(uri); + } + glib::Propagation::Stop + } else { + glib::Propagation::Proceed + } + }); } let homepage_grid: gtk::Grid = builder.object("homepage").unwrap(); @@ -165,6 +185,15 @@ impl HelloWindow { // Show the UI main_window.show(); + // Set initial focus on a meaningful interactive widget + if installer::is_iso(&preferences) { + let install: gtk::Button = builder.object("install").unwrap(); + install.grab_focus(); + } else { + let readme: gtk::Button = builder.object("readme").unwrap(); + readme.grab_focus(); + } + // setup pages content let hello_window = HelloWindow { window: main_window, builder, preferences }; hello_window.switch_locale(best_locale); diff --git a/ui/cachyos-hello.glade b/ui/cachyos-hello.glade index aa3fa41..843514a 100644 --- a/ui/cachyos-hello.glade +++ b/ui/cachyos-hello.glade @@ -69,8 +69,7 @@ along with cachyos-welcome. If not, see . True - True - True + False Welcome to CachyOS! @@ -148,7 +147,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we Read me readme True - False + True True @@ -162,7 +161,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we Release info release True - False + True True True @@ -177,7 +176,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we Wiki wiki True - False + True True Web resource right @@ -194,7 +193,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we Get involved involved True - False + True True @@ -208,7 +207,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we Forums forum True - False + True True Web resource right @@ -225,7 +224,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we Software software True - False + True True Web resource right @@ -242,7 +241,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we Development development True - False + True True Web resource right @@ -259,7 +258,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we Donate donate True - False + True True Web resource right @@ -281,7 +280,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we True - False + True English @@ -371,7 +370,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we Launch installer install - False + True True @@ -390,7 +389,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we Apps/Tweaks tweaksBrowser - False + True True Apps/Tweaks 15 @@ -407,7 +406,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we Install Apps appBrowser - False + True True Common application selection 15 @@ -437,7 +436,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we discord True - False + True @@ -457,7 +456,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we reddit True - False + True @@ -520,7 +519,7 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we about True - False + True True About abouticon diff --git a/ui/style.css b/ui/style.css index 3286b48..47b8845 100644 --- a/ui/style.css +++ b/ui/style.css @@ -22,6 +22,32 @@ window { border-radius: 5px 5px 5px 5px; } +/* Focus indicators for keyboard navigation */ +button:focus { + outline: 2px solid @theme_selected_bg_color; + outline-offset: 2px; +} + +combobox button:focus { + outline: 2px solid @theme_selected_bg_color; + outline-offset: 2px; +} + +switch:focus { + outline: 2px solid @theme_selected_bg_color; + outline-offset: 2px; +} + +checkbutton:focus { + outline: 2px solid @theme_selected_bg_color; + outline-offset: 2px; +} + +eventbox:focus { + outline: 2px solid @theme_selected_bg_color; + outline-offset: 2px; +} + .aboutdialog { border-radius: 7px; }