Compare commits

...

17 commits

Author SHA1 Message Date
57bc2dc3dc chore: fige Cargo.lock (epoch-1.9.0, [patch] locaux)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 21:03:54 +02:00
7ac6ece2ba fix: cosmic-osk-config depuis le checkout local ../cosmic-osk
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 21:03:54 +02:00
647332f1a4 merge: epoch-1.9.0 d'upstream
# Conflicts:
#	Cargo.lock
#	Cargo.toml
2026-09-24 20:48:00 +02:00
Ashley Wulber
b87331f4eb fix: for exclusive keyboard interactivity layer must be >= Top
moves osk to overlay
2026-09-22 17:10:59 -06:00
Jeremy Soller
4c1e532b69 Reduce keyboard layout max width 2026-09-22 17:10:59 -06:00
Jeremy Soller
04d61e30c5 Move greeter surface to bottom to allow OSK to show on top 2026-09-22 17:10:59 -06:00
Jeremy Soller
ce726d8470 OSK integration 2026-09-22 17:10:59 -06:00
Jeremy Soller
db39ee661d Remove zed settings and use stable rustfmt 2026-09-22 17:10:59 -06:00
Nara Díaz Viñolas
bbf553e284 fix: compilation error on greeter bin 2026-09-21 22:55:38 +02:00
Nara Díaz Viñolas
b9587deadb chore: put systemd-homed extra support behind 'systemd' feature 2026-09-21 22:55:38 +02:00
Nara Díaz Viñolas
8ff96e94f7 feat: load user icon and background from systemd-homed paths as a
fallback
2026-09-21 22:55:38 +02:00
Nara Díaz Viñolas
63c2812959 fix: add systemd-homed reported uids to user filter 2026-09-21 22:55:38 +02:00
Ashley Wulber
0b0d2925ff chore: blur updates 2026-09-16 11:12:18 -06:00
Michael Murphy
bb5c7e12a4
i18n: translation update from Hosted Weblate (#529)
Translations update from [Hosted Weblate](https://hosted.weblate.org)
for [Pop OS/COSMIC
Greeter](https://hosted.weblate.org/projects/pop-os/cosmic-greeter/).



Current translation status:

![Weblate translation
status](https://hosted.weblate.org/widget/pop-os/cosmic-greeter/matrix-auto.svg)
2026-09-15 21:55:52 +02:00
Hosted Weblate
31ca2e67b3
i18n: translation updates from weblate
Co-authored-by: Amadɣas <massiin@proton.me>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Kurt Harren Catindig <kurtharrencatindig03@gmail.com>
Co-authored-by: Quentin PAGÈS <quentinantonin@free.fr>
Co-authored-by: Satakun Utama <galaxytomostore@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/pop-os/cosmic-greeter/kab/
Translate-URL: https://hosted.weblate.org/projects/pop-os/cosmic-greeter/oc/
Translate-URL: https://hosted.weblate.org/projects/pop-os/cosmic-greeter/th/
Translation: Pop OS/COSMIC Greeter
2026-09-12 13:51:38 +02:00
Ian Douglas Scott
06a762caca locker: Rely on cosmic-bg for showing background
Requires https://github.com/pop-os/cosmic-comp/pull/2792 and
https://github.com/pop-os/cosmic-bg/pull/144.
2026-09-11 14:38:19 -06:00
Hojjat
601e16af0e chore: adapt to the changes in libcosmic 2026-09-11 21:49:05 +02:00
15 changed files with 1002 additions and 782 deletions

View file

@ -1,15 +0,0 @@
{
"format_on_save": "on",
"lsp": {
"rust-analyzer": {
"initialization_options": {
"check": {
"command": "clippy",
},
"rustfmt": {
"extraArgs": ["+nightly"],
},
},
},
},
}

1363
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -18,6 +18,7 @@ cosmic-comp-config.workspace = true
cosmic-config = { workspace = true, features = ["calloop", "macro"] } cosmic-config = { workspace = true, features = ["calloop", "macro"] }
cosmic-greeter-config.workspace = true cosmic-greeter-config.workspace = true
cosmic-greeter-daemon = { path = "daemon" } cosmic-greeter-daemon = { path = "daemon" }
cosmic-osk-config = { git = "https://github.com/pop-os/cosmic-osk" }
dirs = "6" dirs = "6"
cosmic = { package = "libcosmic-yoda", path = "../libcosmic", default-features = false, features = [ cosmic = { package = "libcosmic-yoda", path = "../libcosmic", default-features = false, features = [
"advanced-shaping", "advanced-shaping",
@ -89,6 +90,7 @@ image = { version = "0.25", default-features = false, features = [
] } ] }
# JPEG-XL support # JPEG-XL support
jxl-oxide = { version = "0.12.6", features = ["image"] } jxl-oxide = { version = "0.12.6", features = ["image"] }
enumflags2 = "0.7.12"
[dependencies.greetd_ipc] [dependencies.greetd_ipc]
version = "0.10.3" version = "0.10.3"
@ -171,8 +173,8 @@ iced_widget = { path = "../libcosmic/iced/widget" }
iced_winit = { path = "../libcosmic/iced/winit" } iced_winit = { path = "../libcosmic/iced/winit" }
[patch."https://github.com/pop-os/cosmic-protocols"] [patch."https://github.com/pop-os/cosmic-protocols"]
cosmic-protocols = { path = "../cosmic-protocols" }
cosmic-client-toolkit = { path = "../cosmic-protocols/client-toolkit" } cosmic-client-toolkit = { path = "../cosmic-protocols/client-toolkit" }
cosmic-protocols = { path = "../cosmic-protocols" }
[patch."https://github.com/pop-os/cosmic-settings-daemon"] [patch."https://github.com/pop-os/cosmic-settings-daemon"]
cosmic-settings-config = { path = "../cosmic-settings-daemon/config" } cosmic-settings-config = { path = "../cosmic-settings-daemon/config" }
@ -187,3 +189,7 @@ dnd = { path = "../window_clipboard/dnd" }
mime = { path = "../window_clipboard/mime" } mime = { path = "../window_clipboard/mime" }
clipboard_wayland = { path = "../window_clipboard/wayland" } clipboard_wayland = { path = "../window_clipboard/wayland" }
clipboard_macos = { path = "../window_clipboard/macos" } clipboard_macos = { path = "../window_clipboard/macos" }
# Yoda: cosmic-osk-config depuis le checkout local (meme source que le paquet cosmic-osk).
[patch."https://github.com/pop-os/cosmic-osk"]
cosmic-osk-config = { path = "../cosmic-osk/config" }

View file

@ -28,7 +28,8 @@ whitespace-conf = "1"
#TODO: reduce features #TODO: reduce features
tokio = { workspace = true, features = ["full"] } tokio = { workspace = true, features = ["full"] }
xdg = "3.0" xdg = "3.0"
zbus_systemd = { version = "0.26000.0", features = ["home1"], optional = true }
[features] [features]
default = ["systemd"] default = ["systemd"]
systemd = ["tracing-journald"] systemd = ["tracing-journald", "zbus_systemd"]

View file

@ -1,11 +1,12 @@
use cosmic_comp_config::output::randr; use cosmic_comp_config::output::randr;
use cosmic_config::CosmicConfigEntry; use cosmic_config::CosmicConfigEntry;
use kdl::KdlDocument; use kdl::KdlDocument;
use std::collections::BTreeMap; use std::collections::{BTreeMap, BTreeSet};
use std::fs; use std::fs;
use std::io::Read; use std::io::Read;
use std::os::unix::fs::OpenOptionsExt; use std::os::unix::fs::OpenOptionsExt;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use zbus::Connection;
pub use cosmic_applets_config::time::TimeAppletConfig; pub use cosmic_applets_config::time::TimeAppletConfig;
pub use cosmic_bg_config::state::State as BgState; pub use cosmic_bg_config::state::State as BgState;
@ -16,12 +17,41 @@ pub use cosmic_theme::{Theme, ThemeBuilder};
pub struct UserFilter { pub struct UserFilter {
uid_min: u32, uid_min: u32,
uid_max: u32, uid_max: u32,
homed_uids: BTreeSet<u32>,
} }
impl Default for UserFilter { impl UserFilter {
fn default() -> Self { #[cfg(feature = "systemd")]
async fn get_homed_uids() -> Result<BTreeSet<u32>, zbus::Error> {
use zbus_systemd::home1;
let connection = Connection::system().await?;
let homed = home1::ManagerProxy::new(&connection).await?;
let homed_uids = homed
.list_homes()
.await?
.iter()
.map(|(_, uid, ..)| *uid)
.collect();
Ok(homed_uids)
}
pub async fn new() -> Self {
let login_defs_data = fs::read_to_string("/etc/login.defs").unwrap_or_default(); let login_defs_data = fs::read_to_string("/etc/login.defs").unwrap_or_default();
let login_defs = whitespace_conf::parse(&login_defs_data); let login_defs = whitespace_conf::parse(&login_defs_data);
#[cfg(feature = "systemd")]
let homed_uids = Self::get_homed_uids()
.await
.inspect_err(|e| {
tracing::warn!("failed to list dynamic UIDs from systemd-homed: {e:?}")
})
.unwrap_or_default();
#[cfg(not(feature = "systemd"))]
let homed_uids = BTreeSet::new();
Self { Self {
uid_min: login_defs uid_min: login_defs
.get("UID_MIN") .get("UID_MIN")
@ -31,17 +61,14 @@ impl Default for UserFilter {
.get("UID_MAX") .get("UID_MAX")
.and_then(|x| x.parse::<u32>().ok()) .and_then(|x| x.parse::<u32>().ok())
.unwrap_or(65000), .unwrap_or(65000),
homed_uids,
} }
} }
}
impl UserFilter {
pub fn new() -> Self {
Self::default()
}
pub fn filter(&self, user: &pwd::Passwd) -> bool { pub fn filter(&self, user: &pwd::Passwd) -> bool {
if user.uid < self.uid_min || user.uid > self.uid_max { if (user.uid < self.uid_min || user.uid > self.uid_max)
&& !self.homed_uids.contains(&user.uid)
{
// Skip system accounts // Skip system accounts
return false; return false;
} }
@ -101,19 +128,20 @@ impl UserData {
} }
} }
pub fn load_config_as_user(&mut self) { fn load_icon_as_user(&mut self) {
self.icon_opt = None;
self.theme_opt = None;
self.theme_builder_opt = None;
self.bg_state = Default::default();
self.xkb_config_opt = None;
self.time_applet_config = Default::default();
//TODO: use accountsservice? //TODO: use accountsservice?
let icon_paths = [
//IMPORTANT: This file is owned by root and safe to read (it won't be a link to /etc/shadow for example) //IMPORTANT: This file is owned by root and safe to read (it won't be a link to /etc/shadow for example)
// It may not exist if the user uses one of the system icons. In that case, we should read the // It may not exist if the user uses one of the system icons. In that case, we should read the
// information in /var/lib/AccountsService/users, and then read the icon path as the user // information in /var/lib/AccountsService/users, and then read the icon path as the user
let icon_path = Path::new("/var/lib/AccountsService/icons").join(&self.name); Path::new("/var/lib/AccountsService/icons").join(&self.name),
// systemd-homed cache
Path::new("/var/cache/systemd/home")
.join(&self.name)
.join("avatar"),
];
for icon_path in icon_paths {
match fs::OpenOptions::new() match fs::OpenOptions::new()
.read(true) .read(true)
// Do not follow symlinks // Do not follow symlinks
@ -126,6 +154,7 @@ impl UserData {
Ok(count) => { Ok(count) => {
icon_data.truncate(count); icon_data.truncate(count);
self.icon_opt = Some(icon_data); self.icon_opt = Some(icon_data);
return;
} }
Err(err) => { Err(err) => {
tracing::error!("failed to read icon data {:?}: {:?}", icon_path, err); tracing::error!("failed to read icon data {:?}: {:?}", icon_path, err);
@ -133,9 +162,23 @@ impl UserData {
} }
} }
Err(err) => { Err(err) => {
tracing::error!("failed to open icon {:?}: {:?}", icon_path, err); tracing::warn!("failed to open icon {:?}: {:?}", icon_path, err);
} }
} }
}
tracing::error!("failed to load icon for user {:?}", self.name)
}
pub fn load_config_as_user(&mut self) {
self.icon_opt = None;
self.theme_opt = None;
self.theme_builder_opt = None;
self.bg_state = Default::default();
self.xkb_config_opt = None;
self.time_applet_config = Default::default();
self.load_icon_as_user();
let mut is_dark = true; let mut is_dark = true;
match cosmic_theme::ThemeMode::config() { match cosmic_theme::ThemeMode::config() {
@ -209,6 +252,16 @@ impl UserData {
tracing::error!("failed to create cosmic-bg state helper: {:?}", err); tracing::error!("failed to create cosmic-bg state helper: {:?}", err);
} }
} }
if self.bg_state.wallpapers.is_empty() {
self.bg_state.wallpapers.push((
String::new(),
BgSource::Path(
Path::new("/var/cache/systemd/home")
.join(&self.name)
.join("login-background"),
),
));
}
self.load_wallpapers_as_user(); self.load_wallpapers_as_user();
match cosmic_config::Config::new("com.system76.CosmicComp", CosmicCompConfig::VERSION) { match cosmic_config::Config::new("com.system76.CosmicComp", CosmicCompConfig::VERSION) {

View file

@ -70,8 +70,8 @@ struct GreeterProxy;
#[zbus::interface(name = "com.system76.CosmicGreeter")] #[zbus::interface(name = "com.system76.CosmicGreeter")]
impl GreeterProxy { impl GreeterProxy {
fn get_user_data(&mut self) -> Result<String, GreeterError> { async fn get_user_data(&mut self) -> Result<String, GreeterError> {
let user_filter = UserFilter::new(); let user_filter = UserFilter::new().await;
// The pwd::Passwd method is unsafe (but not labelled as such) due to using global state (libc pwent functions). // The pwd::Passwd method is unsafe (but not labelled as such) due to using global state (libc pwent functions).
// To prevent issues, this should only be called once in the entire process space at a time // To prevent issues, this should only be called once in the entire process space at a time

View file

@ -9,6 +9,7 @@ caps-lock = Caps Lock is active.
enter-user = Enter name manually... enter-user = Enter name manually...
type-username = Username: type-username = Username:
keyboard-layout = Keyboard layout keyboard-layout = Keyboard layout
on-screen-keyboard = On-screen keyboard
restart = Restart restart = Restart
restart-now = Restart now? restart-now = Restart now?
restart-timeout = The system will restart automatically restart-timeout = The system will restart automatically

View file

View file

@ -1,4 +1,4 @@
cancel = Sefsex cancel = Semmet
restart-timeout = restart-timeout =
Anagraw ad yales tanekra s wudem awurman Anagraw ad yales tanekra s wudem awurman
{ $seconds -> { $seconds ->

View file

@ -13,3 +13,5 @@ shutdown-timeout =
[1] d’aquí 1 segondas. [1] d’aquí 1 segondas.
*[other] d’aquí { $seconds } segondas. *[other] d’aquí { $seconds } segondas.
} }
cancel = Anullar
user = Utilizaire

View file

@ -1 +0,0 @@
imports_granularity = "Module"

View file

@ -10,6 +10,7 @@ use cosmic::iced::{self, Rectangle, Size, Subscription};
use cosmic::surface::corner_radius::rounded_rect_strips; use cosmic::surface::corner_radius::rounded_rect_strips;
use cosmic::widget::rectangle_tracker::{RectangleUpdate, rectangle_tracker_subscription}; use cosmic::widget::rectangle_tracker::{RectangleUpdate, rectangle_tracker_subscription};
use cosmic::widget::{self, RectangleTracker}; use cosmic::widget::{self, RectangleTracker};
use cosmic_config::CosmicConfigEntry;
use cosmic_greeter_daemon::{BgSource, UserData}; use cosmic_greeter_daemon::{BgSource, UserData};
use cosmic_protocols::keyboard_layout::v1::client::zcosmic_keyboard_layout_v1::ZcosmicKeyboardLayoutV1; use cosmic_protocols::keyboard_layout::v1::client::zcosmic_keyboard_layout_v1::ZcosmicKeyboardLayoutV1;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
@ -19,6 +20,7 @@ use wayland_client::{Connection, Proxy};
use crate::keyboard_layout_wayland; use crate::keyboard_layout_wayland;
pub const MAX_WIDTH: f32 = 866.;
pub const DEFAULT_MENU_ITEM_HEIGHT: f32 = 36.; pub const DEFAULT_MENU_ITEM_HEIGHT: f32 = 36.;
#[derive(Debug, Clone, Eq, PartialEq)] #[derive(Debug, Clone, Eq, PartialEq)]
@ -28,6 +30,18 @@ pub struct ActiveLayout {
pub variant: String, pub variant: String,
} }
impl ActiveLayout {
pub fn name(&self) -> String {
let mut name = self.layout.clone();
if !self.variant.is_empty() {
name.push_str(" (");
name.push_str(&self.variant);
name.push_str(")");
}
name
}
}
pub struct Common<M> { pub struct Common<M> {
pub wayland_connection: Option<Connection>, pub wayland_connection: Option<Connection>,
pub keyboard_layout: Option<ZcosmicKeyboardLayoutV1>, pub keyboard_layout: Option<ZcosmicKeyboardLayoutV1>,
@ -67,6 +81,7 @@ pub enum Message {
Focus(SurfaceId), Focus(SurfaceId),
Key(Modifiers, Key, Option<SmolStr>), Key(Modifiers, Key, Option<SmolStr>),
NetworkIcon(Option<&'static str>), NetworkIcon(Option<&'static str>),
OnScreenKeyboard,
SubsurfaceOpened(SurfaceId), SubsurfaceOpened(SurfaceId),
OutputEvent(OutputEvent, WlOutput), OutputEvent(OutputEvent, WlOutput),
PowerInfo(Option<(f64, bool, bool)>), PowerInfo(Option<(f64, bool, bool)>),
@ -276,6 +291,26 @@ impl<M: From<Message> + Send + 'static> Common<M> {
self.network_icon_opt = self.network_icon_opt =
network_icon_opt.map(|name| widget::icon::from_name(name).into()); network_icon_opt.map(|name| widget::icon::from_name(name).into());
} }
Message::OnScreenKeyboard => {
use cosmic_osk_config::Config;
match Config::handler() {
Ok(handler) => {
let mut config = match Config::get_entry(&handler) {
Ok(config) => config,
Err((errs, config)) => {
tracing::warn!("failed to parse OSK config: {:?}", errs);
config
}
};
if let Err(err) = config.set_always_shown(&handler, !config.always_shown) {
tracing::error!("failed to set OSK always_shown config: {}", err);
}
}
Err(err) => {
tracing::error!("failed to create OSK config handler: {}", err);
}
}
}
Message::OutputEvent(output_event, output) => { Message::OutputEvent(output_event, output) => {
if self.wayland_connection.is_none() { if self.wayland_connection.is_none() {
if let Some(backend) = output.backend().upgrade() { if let Some(backend) = output.backend().upgrade() {

View file

@ -11,6 +11,7 @@ use cosmic::cctk::wayland_protocols::xdg::shell::client::xdg_positioner::Gravity
use cosmic::cosmic_config::{self, ConfigSet}; use cosmic::cosmic_config::{self, ConfigSet};
use cosmic::cosmic_theme::{self, CosmicPalette}; use cosmic::cosmic_theme::{self, CosmicPalette};
use cosmic::desktop::fde::{DesktopEntry, get_languages_from_env}; use cosmic::desktop::fde::{DesktopEntry, get_languages_from_env};
use cosmic::iced::core::text::{Ellipsize, EllipsizeHeightLimit};
use cosmic::iced::event::listen_with; use cosmic::iced::event::listen_with;
use cosmic::iced::event::wayland::OutputEvent; use cosmic::iced::event::wayland::OutputEvent;
use cosmic::iced::futures::SinkExt; use cosmic::iced::futures::SinkExt;
@ -18,7 +19,7 @@ use cosmic::iced::platform_specific::runtime::wayland::layer_surface::{
IcedMargin, IcedOutput, SctkLayerSurfaceSettings, IcedMargin, IcedOutput, SctkLayerSurfaceSettings,
}; };
use cosmic::iced::platform_specific::shell::wayland::commands::layer_surface::{ use cosmic::iced::platform_specific::shell::wayland::commands::layer_surface::{
Anchor, KeyboardInteractivity, Layer, destroy_layer_surface, get_layer_surface, Anchor, KeyboardInteractivity, Layer, destroy_layer_surface,
}; };
use cosmic::iced::platform_specific::shell::wayland::commands::subsurface::reposition_subsurface; use cosmic::iced::platform_specific::shell::wayland::commands::subsurface::reposition_subsurface;
use cosmic::iced::runtime::core::window::Id as SurfaceId; use cosmic::iced::runtime::core::window::Id as SurfaceId;
@ -26,6 +27,7 @@ use cosmic::iced::runtime::platform_specific::wayland::subsurface::SctkSubsurfac
use cosmic::iced::{ use cosmic::iced::{
self, Alignment, Background, Border, Length, Point, Rectangle, Size, Subscription, window, self, Alignment, Background, Border, Length, Point, Rectangle, Size, Subscription, window,
}; };
use cosmic::surface::action::{LiveSettings, app_layer_shell};
use cosmic::widget::{id_container, text}; use cosmic::widget::{id_container, text};
use cosmic::{Element, executor, surface, theme, widget}; use cosmic::{Element, executor, surface, theme, widget};
use cosmic_greeter_config::Config as CosmicGreeterConfig; use cosmic_greeter_config::Config as CosmicGreeterConfig;
@ -40,7 +42,7 @@ use std::num::NonZeroU32;
use std::process::Stdio; use std::process::Stdio;
use std::sync::{Arc, LazyLock}; use std::sync::{Arc, LazyLock};
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use std::{fs, io, process}; use std::{fs, io, process, thread};
use tokio::process::Child; use tokio::process::Child;
use tokio::time; use tokio::time;
use tracing::metadata::LevelFilter; use tracing::metadata::LevelFilter;
@ -51,7 +53,7 @@ use wayland_client::Proxy;
use wayland_client::protocol::wl_output::WlOutput; use wayland_client::protocol::wl_output::WlOutput;
use zbus::{Connection, proxy}; use zbus::{Connection, proxy};
use crate::common::{self, Common, DEFAULT_MENU_ITEM_HEIGHT}; use crate::common::{self, Common, DEFAULT_MENU_ITEM_HEIGHT, MAX_WIDTH};
use crate::fl; use crate::fl;
static USERNAME_ID: LazyLock<iced::id::Id> = LazyLock::new(|| iced::id::Id::new("username-id")); static USERNAME_ID: LazyLock<iced::id::Id> = LazyLock::new(|| iced::id::Id::new("username-id"));
@ -76,8 +78,8 @@ async fn user_data_dbus() -> Result<Vec<UserData>, Box<dyn Error>> {
Ok(user_datas) Ok(user_datas)
} }
fn user_data_fallback() -> Vec<UserData> { async fn user_data_fallback() -> Vec<UserData> {
let user_filter = UserFilter::new(); let user_filter = UserFilter::new().await;
// The pwd::Passwd method is unsafe (but not labelled as such) due to using global state (libc pwent functions). // The pwd::Passwd method is unsafe (but not labelled as such) due to using global state (libc pwent functions).
/* unsafe */ /* unsafe */
@ -129,7 +131,7 @@ pub fn main() -> Result<(), Box<dyn Error>> {
Ok(ok) => ok, Ok(ok) => ok,
Err(err) => { Err(err) => {
tracing::error!("failed to load user data from daemon: {}", err); tracing::error!("failed to load user data from daemon: {}", err);
user_data_fallback() runtime.block_on(user_data_fallback())
} }
}; };
@ -279,6 +281,22 @@ pub fn main() -> Result<(), Box<dyn Error>> {
sessions sessions
}; };
match process::Command::new("cosmic-osk")
.arg("overlay")
.env("RUST_LOG", "cosmic_osk=info")
.spawn()
{
Ok(mut child) => {
thread::spawn(move || match child.wait() {
Ok(status) => tracing::warn!("cosmic-osk exited: {}", status),
Err(err) => tracing::error!("failed to wait on cosmic-osk: {}", err),
});
}
Err(err) => {
tracing::error!("failed to spawn cosmic-osk: {}", err);
}
}
let flags = Flags { let flags = Flags {
user_icons: user_datas user_icons: user_datas
.iter_mut() .iter_mut()
@ -389,7 +407,7 @@ pub enum Message {
Session(String), Session(String),
Shutdown, Shutdown,
Socket(SocketState), Socket(SocketState),
Surface(surface::Action), Surface(surface::Action<Message>),
Suspend, Suspend,
Username(String), Username(String),
EnterUser(bool, String), EnterUser(bool, String),
@ -481,9 +499,9 @@ impl App {
.window_size .window_size
.get(&id) .get(&id)
.map(|s| s.width) .map(|s| s.width)
.unwrap_or(800.); .unwrap_or(MAX_WIDTH);
let menu_width = if window_width > 800. { let menu_width = if window_width > MAX_WIDTH {
800. MAX_WIDTH
} else { } else {
window_width window_width
}; };
@ -583,10 +601,20 @@ impl App {
}; };
let mut input_button = widget::popover( let mut input_button = widget::popover(
widget::button::custom(widget::icon::from_name("input-keyboard-symbolic")) widget::container(
widget::button::custom(
widget::text(
self.common.active_layouts[self.common.current_keyboard_layout].name(),
)
.ellipsize(Ellipsize::End(EllipsizeHeightLimit::Lines(1)))
.height(16)
.center(),
)
.padding(12.0) .padding(12.0)
.on_press(Message::DropdownToggle(Dropdown::Keyboard)), .on_press(Message::DropdownToggle(Dropdown::Keyboard)),
) )
.max_width(80),
)
.position(widget::popover::Position::Bottom); .position(widget::popover::Position::Bottom);
if matches!(self.dropdown_opt, Some(Dropdown::Keyboard)) { if matches!(self.dropdown_opt, Some(Dropdown::Keyboard)) {
let mut items = Vec::with_capacity(self.common.active_layouts.len()); let mut items = Vec::with_capacity(self.common.active_layouts.len());
@ -701,6 +729,13 @@ impl App {
text(fl!("accessibility")), text(fl!("accessibility")),
widget::tooltip::Position::Top widget::tooltip::Position::Top
), ),
widget::tooltip(
widget::button::custom(widget::icon::from_name("input-keyboard-symbolic"))
.padding(12.0)
.on_press(Message::Common(common::Message::OnScreenKeyboard)),
text(fl!("on-screen-keyboard")),
widget::tooltip::Position::Top,
),
widget::tooltip( widget::tooltip(
input_button, input_button,
text(fl!("keyboard-layout")), text(fl!("keyboard-layout")),
@ -964,7 +999,7 @@ impl App {
appearance appearance
}, },
))) )))
.width(Length::Fixed(800.0)); .width(Length::Fixed(MAX_WIDTH));
let menu = if let Some(t) = self.common.rectangle_tracker.as_ref() { let menu = if let Some(t) = self.common.rectangle_tracker.as_ref() {
Element::from(t.container((id, false), menu)) Element::from(t.container((id, false), menu))
} else { } else {
@ -1252,10 +1287,10 @@ impl cosmic::Application for App {
let unwrapped_size = size let unwrapped_size = size
.map(|s| (s.0.unwrap_or(1920), s.1.unwrap_or(1080))) .map(|s| (s.0.unwrap_or(1920), s.1.unwrap_or(1080)))
.unwrap_or((1920, 1080)); .unwrap_or((1920, 1080));
let (loc, sub_size) = if unwrapped_size.0 > 800 { let (loc, sub_size) = if unwrapped_size.0 as f32 > MAX_WIDTH {
( (
Point::new(unwrapped_size.0 as f32 / 2. - 400., 32.), Point::new((unwrapped_size.0 as f32 - MAX_WIDTH) / 2., 32.),
Size::new(800., unwrapped_size.1 as f32 - 32.), Size::new(MAX_WIDTH, unwrapped_size.1 as f32 - 32.),
) )
} else { } else {
( (
@ -1291,14 +1326,25 @@ impl cosmic::Application for App {
); );
return Task::batch([ return Task::batch([
self.update_user_data(), self.update_user_data(),
get_layer_surface(SctkLayerSurfaceSettings { cosmic::surface::surface_task(app_layer_shell(
|_: &App| LiveSettings {
padding: None,
corners: None,
blur: Some(false),
},
move |_: &mut App| {
let output = output.clone();
SctkLayerSurfaceSettings {
id: surface_id, id: surface_id,
layer: Layer::Overlay, layer: Layer::Top,
keyboard_interactivity: KeyboardInteractivity::Exclusive, keyboard_interactivity: KeyboardInteractivity::Exclusive,
input_zone: None, input_zone: None,
anchor: Anchor::TOP | Anchor::LEFT | Anchor::BOTTOM | Anchor::RIGHT, anchor: Anchor::TOP
| Anchor::LEFT
| Anchor::BOTTOM
| Anchor::RIGHT,
output: IcedOutput::Output(output), output: IcedOutput::Output(output),
namespace: "cosmic-locker".into(), namespace: "cosmic-greeter".into(),
size: Some((None, None)), size: Some((None, None)),
margin: IcedMargin { margin: IcedMargin {
top: 0, top: 0,
@ -1307,11 +1353,14 @@ impl cosmic::Application for App {
right: 0, right: 0,
}, },
exclusive_zone: -1, exclusive_zone: -1,
size_limits: iced::Limits::NONE.min_width(1.0).min_height(1.0), size_limits: iced::Limits::NONE
}), .min_width(1.0)
cosmic::task::message(cosmic::Action::Cosmic( .min_height(1.0),
cosmic::app::Action::Surface(msg), }
},
None,
)), )),
cosmic::task::message(cosmic::Action::Surface(msg)),
]); ]);
} }
OutputEvent::Removed => { OutputEvent::Removed => {
@ -1659,9 +1708,7 @@ impl cosmic::Application for App {
self.greetd_sender = Some(sender); self.greetd_sender = Some(sender);
} }
Message::Surface(a) => { Message::Surface(a) => {
return cosmic::task::message(cosmic::Action::Cosmic( return cosmic::task::message(cosmic::Action::Surface(a));
cosmic::app::Action::Surface(a),
));
} }
Message::ScreenReader(enabled) => { Message::ScreenReader(enabled) => {
if enabled if enabled
@ -1859,8 +1906,8 @@ impl cosmic::Application for App {
tracing::error!("Failed to find subsurface menu id"); tracing::error!("Failed to find subsurface menu id");
return Task::none(); return Task::none();
}; };
let loc = if size.width > 800. { let loc = if size.width > MAX_WIDTH {
Point::new(size.width / 2. - 400., 32.) Point::new((size.width - MAX_WIDTH) / 2., 32.)
} else { } else {
Point::new(0., 32.) Point::new(0., 32.)
}; };

View file

@ -4,16 +4,18 @@
use color_eyre::eyre::WrapErr; use color_eyre::eyre::WrapErr;
use cosmic::app::{Core, Settings, Task}; use cosmic::app::{Core, Settings, Task};
use cosmic::cctk::wayland_protocols::xdg::shell::client::xdg_positioner::Gravity; use cosmic::cctk::wayland_protocols::xdg::shell::client::xdg_positioner::Gravity;
use cosmic::iced::core::text::{Ellipsize, EllipsizeHeightLimit};
use cosmic::iced::event::wayland::{OutputEvent, SessionLockEvent}; use cosmic::iced::event::wayland::{OutputEvent, SessionLockEvent};
use cosmic::iced::futures::{self, SinkExt}; use cosmic::iced::futures::{self, SinkExt};
use cosmic::iced::platform_specific::shell::wayland::commands::session_lock::{ use cosmic::iced::platform_specific::shell::wayland::commands::session_lock::{
destroy_lock_surface, get_lock_surface, lock, unlock, destroy_lock_surface, lock, unlock,
}; };
use cosmic::iced::runtime::core::window::Id as SurfaceId; use cosmic::iced::runtime::core::window::Id as SurfaceId;
use cosmic::iced::runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings; use cosmic::iced::runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings;
use cosmic::iced::{ use cosmic::iced::{
self, Alignment, Background, Border, Length, Point, Rectangle, Size, Subscription, self, Alignment, Background, Border, Length, Point, Rectangle, Size, Subscription,
}; };
use cosmic::surface::action::LiveSettings;
use cosmic::{Element, executor, surface, theme, widget}; use cosmic::{Element, executor, surface, theme, widget};
use cosmic_config::CosmicConfigEntry; use cosmic_config::CosmicConfigEntry;
use cosmic_greeter_daemon::{TimeAppletConfig, UserData}; use cosmic_greeter_daemon::{TimeAppletConfig, UserData};
@ -33,7 +35,7 @@ use tracing_subscriber::{EnvFilter, fmt};
use wayland_client::Proxy; use wayland_client::Proxy;
use wayland_client::protocol::wl_output::WlOutput; use wayland_client::protocol::wl_output::WlOutput;
use crate::common::{self, Common, DEFAULT_MENU_ITEM_HEIGHT}; use crate::common::{self, Common, DEFAULT_MENU_ITEM_HEIGHT, MAX_WIDTH};
use crate::fl; use crate::fl;
fn lockfile_opt() -> Option<PathBuf> { fn lockfile_opt() -> Option<PathBuf> {
@ -273,7 +275,7 @@ pub enum Message {
KeyboardLayout(usize), KeyboardLayout(usize),
Inhibit(Arc<OwnedFd>), Inhibit(Arc<OwnedFd>),
Submit(String), Submit(String),
Surface(surface::Action), Surface(surface::Action<Message>),
Suspend, Suspend,
TimeAppletConfig(TimeAppletConfig), TimeAppletConfig(TimeAppletConfig),
Error(String), Error(String),
@ -325,9 +327,9 @@ impl App {
.window_size .window_size
.get(&surface_id) .get(&surface_id)
.map(|s| s.width) .map(|s| s.width)
.unwrap_or(800.); .unwrap_or(MAX_WIDTH);
let menu_width = if window_width > 800. { let menu_width = if window_width > MAX_WIDTH {
800. MAX_WIDTH
} else { } else {
window_width window_width
}; };
@ -416,10 +418,20 @@ impl App {
}; };
let mut input_button = widget::popover( let mut input_button = widget::popover(
widget::button::custom(widget::icon::from_name("input-keyboard-symbolic")) widget::container(
widget::button::custom(
widget::text(
self.common.active_layouts[self.common.current_keyboard_layout].name(),
)
.ellipsize(Ellipsize::End(EllipsizeHeightLimit::Lines(1)))
.height(16)
.center(),
)
.padding(12.0) .padding(12.0)
.on_press(Message::DropdownToggle(Dropdown::Keyboard)), .on_press(Message::DropdownToggle(Dropdown::Keyboard)),
) )
.max_width(80),
)
.position(widget::popover::Position::Bottom); .position(widget::popover::Position::Bottom);
if matches!(self.dropdown_opt, Some(Dropdown::Keyboard)) { if matches!(self.dropdown_opt, Some(Dropdown::Keyboard)) {
let mut items = Vec::with_capacity(self.common.active_layouts.len()); let mut items = Vec::with_capacity(self.common.active_layouts.len());
@ -442,6 +454,13 @@ impl App {
.padding(12.0) .padding(12.0)
.on_press(Message::None), .on_press(Message::None),
*/ */
widget::tooltip(
widget::button::custom(widget::icon::from_name("input-keyboard-symbolic"))
.padding(12.0)
.on_press(Message::Common(common::Message::OnScreenKeyboard)),
widget::text(fl!("on-screen-keyboard")),
widget::tooltip::Position::Top,
),
widget::tooltip( widget::tooltip(
input_button, input_button,
widget::text(fl!("keyboard-layout")), widget::text(fl!("keyboard-layout")),
@ -663,6 +682,7 @@ impl cosmic::Application for App {
/// Creates the application, and optionally emits command on initialize. /// Creates the application, and optionally emits command on initialize.
fn init(mut core: Core, flags: Self::Flags) -> (Self, Task<Self::Message>) { fn init(mut core: Core, flags: Self::Flags) -> (Self, Task<Self::Message>) {
core.set_app_type(cosmic::core::AppType::System); core.set_app_type(cosmic::core::AppType::System);
let (mut common, common_task) = Common::init(core); let (mut common, common_task) = Common::init(core);
common.on_output_event = Some(Box::new(|output_event, output| { common.on_output_event = Some(Box::new(|output_event, output| {
Message::OutputEvent(output_event, output) Message::OutputEvent(output_event, output)
@ -781,10 +801,10 @@ impl cosmic::Application for App {
let unwrapped_size = size let unwrapped_size = size
.map(|s| (s.0.unwrap_or(1920), s.1.unwrap_or(1080))) .map(|s| (s.0.unwrap_or(1920), s.1.unwrap_or(1080)))
.unwrap_or((1920, 1080)); .unwrap_or((1920, 1080));
let (loc, sub_size) = if unwrapped_size.0 > 800 { let (loc, sub_size) = if unwrapped_size.0 as f32 > MAX_WIDTH {
( (
Point::new(unwrapped_size.0 as f32 / 2. - 400., 32.), Point::new(unwrapped_size.0 as f32 / 2. - 400., 32.),
Size::new(800., unwrapped_size.1 as f32 - 32.), Size::new(MAX_WIDTH, unwrapped_size.1 as f32 - 32.),
) )
} else { } else {
( (
@ -819,11 +839,19 @@ impl cosmic::Application for App {
); );
if matches!(self.state, State::Locked { .. }) { if matches!(self.state, State::Locked { .. }) {
return get_lock_surface(surface_id, output).chain({ return cosmic::task::message(cosmic::Action::Surface(
cosmic::task::message(cosmic::Action::Cosmic( cosmic::surface::action::lock(
cosmic::app::Action::Surface(msg), || LiveSettings {
padding: None,
corners: None,
blur: Some(false),
},
surface_id,
output,
None::<fn() -> cosmic::Element<'static, cosmic::Action<Message>>>,
),
)) ))
}); .chain(cosmic::task::message(cosmic::Action::Surface(msg)));
} }
} }
OutputEvent::Removed => { OutputEvent::Removed => {
@ -854,10 +882,10 @@ impl cosmic::Application for App {
let unwrapped_size = size let unwrapped_size = size
.map(|s| (s.0.unwrap_or(1920), s.1.unwrap_or(1080))) .map(|s| (s.0.unwrap_or(1920), s.1.unwrap_or(1080)))
.unwrap_or((1920, 1080)); .unwrap_or((1920, 1080));
let (loc, sub_size) = if unwrapped_size.0 > 800 { let (loc, sub_size) = if unwrapped_size.0 as f32 > MAX_WIDTH {
( (
Point::new(unwrapped_size.0 as f32 / 2. - 400., 32.), Point::new(unwrapped_size.0 as f32 / 2. - 400., 32.),
Size::new(800., unwrapped_size.1 as f32 - 32.), Size::new(MAX_WIDTH, unwrapped_size.1 as f32 - 32.),
) )
} else { } else {
(Point::ORIGIN, Size::new(1920., 1080.)) (Point::ORIGIN, Size::new(1920., 1080.))
@ -963,7 +991,18 @@ impl cosmic::Application for App {
// Create lock surfaces // Create lock surfaces
for (output, surface_id) in self.common.surface_ids.iter() { for (output, surface_id) in self.common.surface_ids.iter() {
commands.push(get_lock_surface(*surface_id, output.clone())); commands.push(cosmic::task::message(cosmic::Action::Surface(
cosmic::surface::action::lock(
|| LiveSettings {
padding: None,
corners: None,
blur: Some(false),
},
*surface_id,
output.clone(),
None::<fn() -> cosmic::Element<'static, cosmic::Action<Message>>>,
),
)));
if let Some((rect, name)) = self if let Some((rect, name)) = self
.common .common
@ -998,9 +1037,7 @@ impl cosmic::Application for App {
app.menu(subsurface_id).map(cosmic::Action::App) app.menu(subsurface_id).map(cosmic::Action::App)
})), })),
); );
commands.push(cosmic::task::message(cosmic::Action::Cosmic( commands.push(cosmic::task::message(cosmic::Action::Surface(msg)));
cosmic::app::Action::Surface(msg),
)));
} else { } else {
tracing::error!("no rectangle for subsurface creation..."); tracing::error!("no rectangle for subsurface creation...");
} }
@ -1165,9 +1202,7 @@ impl cosmic::Application for App {
} }
} }
Message::Surface(a) => { Message::Surface(a) => {
return cosmic::task::message(cosmic::Action::Cosmic( return cosmic::task::message(cosmic::Action::Surface(a));
cosmic::app::Action::Surface(a),
));
} }
} }
Task::none() Task::none()
@ -1179,17 +1214,8 @@ impl cosmic::Application for App {
} }
/// Creates a view after each update. /// Creates a view after each update.
fn view_window(&self, surface_id: SurfaceId) -> Element<'_, Self::Message> { fn view_window(&self, _surface_id: SurfaceId) -> Element<'_, Self::Message> {
let img = self widget::space::horizontal().into()
.common
.surface_images
.get(&surface_id)
.unwrap_or(&self.common.fallback_background);
widget::image(img)
.content_fit(iced::ContentFit::Cover)
.width(Length::Fill)
.height(Length::Fill)
.into()
} }
fn subscription(&self) -> Subscription<Self::Message> { fn subscription(&self) -> Subscription<Self::Message> {