diff --git a/data/resources/style.css b/data/resources/style.css index 1bf6cdd7353181e36ce6a992b48ec0e4c3408f7d..30efac0961f991b44dae4d07a036a29974453042 100644 --- a/data/resources/style.css +++ b/data/resources/style.css @@ -52,14 +52,14 @@ .page:nth-child(3) { } /* customize */ /* .page:nth-child(4) { background: linear-gradient(to right, #e66100, #c64600); } workspaces */ - .page:nth-child(5) { /* up down */ + .touchpad .page:nth-child(5) { /* up down */ background: url('/org/gnome/Tour/hand-fg.svg'), url('/org/gnome/Tour/updown-bg.svg'); background-repeat: no-repeat; background-position: center 30%; animation: up-and-down 2s ease-in-out infinite alternate; } - .page:nth-child(6) { /* left right */ + .touchpad .page:nth-child(6) { /* left right */ background: url('/org/gnome/Tour/hand-fg.svg'), url('/org/gnome/Tour/leftright-bg.svg'); background-repeat: no-repeat; diff --git a/meson.build b/meson.build index 9e29d145318478023e65587c835a4ebaddfcc901..0760303d3b69cfbdfbde1f1928eccc2bfff48be0 100644 --- a/meson.build +++ b/meson.build @@ -13,6 +13,7 @@ dependency('gio-2.0', version: '>= 2.56') dependency('gdk-pixbuf-2.0') dependency('gtk+-3.0', version: '>= 3.16') dependency('libhandy-1', version: '>= 1') +#dependency('gnome-settings-daemon') if get_option('video_path') != '' dependency('gstreamer-1.0', version: '>= 1.12') diff --git a/src/meson.build b/src/meson.build index 35f2841b1ec91c1a14e5713c46b43e91550abf11..d5c513b8a480cf22b93817e39c665a07e054a54e 100644 --- a/src/meson.build +++ b/src/meson.build @@ -39,6 +39,7 @@ sources = files( 'widgets/pages/image.rs', 'widgets/pages/mod.rs', 'widgets/pages/welcome.rs', + 'widgets/gsd.rs', 'widgets/mod.rs', 'widgets/paginator.rs', 'widgets/window.rs', diff --git a/src/widgets/mod.rs b/src/widgets/mod.rs index c58dca4efc965a038e8b7f29034ab6c6d5aee61b..7d5bfdd5ac51d82caf982b752a62fb5275c8eb63 100644 --- a/src/widgets/mod.rs +++ b/src/widgets/mod.rs @@ -1,3 +1,4 @@ +mod gsd; mod pages; mod paginator; mod window; diff --git a/src/widgets/window.rs b/src/widgets/window.rs index 71aedef35fd4af31322c2b57ccc9192704b66a02..4dcd5659ad2f84834882679c983351d8aa023d8e 100644 --- a/src/widgets/window.rs +++ b/src/widgets/window.rs @@ -4,6 +4,7 @@ use gtk::prelude::*; use std::cell::RefCell; use std::rc::Rc; +use super::gsd::touchpad_is_present; use super::pages::{ImagePageWidget, WelcomePageWidget}; use super::paginator::PaginatorWidget; use crate::config::{APP_ID, PROFILE}; @@ -35,6 +36,7 @@ impl Window { } fn init(&mut self) { + let has_touchpad = touchpad_is_present(); self.widget.set_default_size(960, 720); self.widget.set_icon_name(Some(APP_ID)); @@ -42,6 +44,11 @@ impl Window { if PROFILE == "Devel" { self.widget.get_style_context().add_class("devel"); } + if has_touchpad { + self.widget.get_style_context().add_class("touchpad"); + } else { + self.widget.get_style_context().add_class("no-touchpad"); + } self.paginator .borrow_mut() .add_page(WelcomePageWidget::new().widget.upcast::()); @@ -78,8 +85,16 @@ impl Window { self.paginator.borrow_mut().add_page( ImagePageWidget::new( "/org/gnome/Tour/blank.svg", - gettext("Up/Down for the Overview"), - gettext("On a touchpad, use three-finger vertical swipes. Try it!"), + if has_touchpad { + gettext("Up/Down for the Overview") + } else { + gettext("Logo+Alt+Up/Down for the Overview") + }, + if has_touchpad { + gettext("On a touchpad, use three-finger vertical swipes. Try it!") + } else { + gettext("Write a better string here") + }, ) .widget .upcast::(), @@ -88,8 +103,16 @@ impl Window { self.paginator.borrow_mut().add_page( ImagePageWidget::new( "/org/gnome/Tour/blank.svg", - gettext("Left/Right for Workspaces"), - gettext("On a touchpad, use three-finger horizontal swipes. Try it!"), + if has_touchpad { + gettext("Left/Right for Workspaces") + } else { + gettext("Logo+Alt+Left/Right for Workspaces") + }, + if has_touchpad { + gettext("On a touchpad, use three-finger horizontal swipes. Try it!") + } else { + gettext("Hit some keys. Try it!") + }, ) .widget .upcast::(),