Merge branch 'master' into bulgarian

This commit is contained in:
Jeremy Soller 2026-01-27 10:38:05 -07:00 committed by GitHub
commit 055befb30a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
272 changed files with 4273 additions and 4972 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "cosmic-applet-input-sources"
version = "0.1.0"
version = "1.0.2"
edition = "2024"
license = "GPL-3.0-only"

View file

@ -2,7 +2,7 @@
Name=Input Sources
Name[ar]=مصادر الإدخال
Name[bg]=Входни устройства
Name[cs]=Metody zadávání
Name[cs]=Vstupní zdroje
Name[zh_CN]=
Name[hu]=Beviteli Források
Name[pl]=Źródła wprowadzdania danych
@ -12,6 +12,7 @@ Name[de]=Eigangsquellen
Name[sk]=Vstupné zdroje
Name[es]=Fuentes de entrada de teclado
Name[sv]=Inmatningskällor
Name[it]=Sorgenti di immissione
Type=Application
Exec=cosmic-applet-input-sources
Terminal=false
@ -22,5 +23,6 @@ Icon=com.system76.CosmicAppletInputSources-symbolic
StartupNotify=true
NoDisplay=true
X-CosmicApplet=true
X-CosmicShrinkable=true
X-CosmicHoverPopup=Auto
X-OverflowPriority=10

View file

@ -1,2 +1,2 @@
show-keyboard-layout = إظهار تخطيط لوحة المفاتيح...
show-keyboard-layout = أظهر تخطيط لوحة المفاتيح...
keyboard-settings = إعدادات لوحة المفاتيح...

View file

@ -1,2 +1,2 @@
show-keyboard-layout = Taispeáin Leagan Amach na Méarchláir...
keyboard-settings = Socruithe Méarchláir...
show-keyboard-layout = Taispeáin leagan amach na méarchláir...
keyboard-settings = Socruithe méarchláir...

View file

@ -1,2 +1,2 @@
show-keyboard-layout = Billentyűzetkiosztás megjelenítése...
keyboard-settings = Billentyűzet beállításai...
show-keyboard-layout = Billentyűzetkiosztás megjelenítése
keyboard-settings = Billentyűzetbeállítások…

View file

@ -0,0 +1,2 @@
show-keyboard-layout = Пернетақта жаймасын көрсету...
keyboard-settings = Пернетақта баптаулары...

View file

@ -0,0 +1,2 @@
show-keyboard-layout = 키보드 레이아웃 표시...
keyboard-settings = 키보드 설정...

View file

@ -0,0 +1,2 @@
show-keyboard-layout = Rodyti Klaviatūros išdėstymą...
keyboard-settings = Klaviatūros Nustatymai...

View file

@ -1,2 +1,2 @@
show-keyboard-layout = Toetsenbordindeling weergeven...
keyboard-settings = Toetsenbordinstellingen...
show-keyboard-layout = Laat toetsenbordindeling zien…
keyboard-settings = Toetsenbordinstellingen

View file

@ -11,7 +11,7 @@ use cosmic::{
cosmic_config::{self, ConfigSet, CosmicConfigEntry},
cosmic_theme::Spacing,
iced::{
Task,
Rectangle, Task,
platform_specific::shell::commands::popup::{destroy_popup, get_popup},
widget::{column, row},
window::Id,
@ -20,11 +20,17 @@ use cosmic::{
iced_runtime::{Appearance, core::window},
prelude::*,
surface, theme,
widget::{self, horizontal_space, vertical_space},
widget::{
self, autosize, horizontal_space,
rectangle_tracker::{RectangleTracker, RectangleUpdate, rectangle_tracker_subscription},
vertical_space,
},
};
use cosmic_comp_config::CosmicCompConfig;
use std::sync::LazyLock;
use xkb_data::KeyboardLayout;
static AUTOSIZE_MAIN_ID: LazyLock<widget::Id> = LazyLock::new(|| widget::Id::new("autosize-main"));
pub const ID: &str = "com.system76.CosmicAppletInputSources";
pub fn run() -> cosmic::iced::Result {
@ -77,6 +83,8 @@ pub struct Window {
comp_config_handler: Option<cosmic_config::Config>,
layouts: Vec<KeyboardLayout>,
active_layouts: Vec<ActiveLayout>,
rectangle_tracker: Option<RectangleTracker<u32>>,
rectangle: Rectangle,
}
#[derive(Clone, Debug)]
@ -87,6 +95,7 @@ pub enum Message {
SetActiveLayout(usize),
KeyboardSettings,
Surface(surface::Action),
Rectangle(RectangleUpdate<u32>),
}
#[derive(Debug)]
@ -119,6 +128,8 @@ impl cosmic::Application for Window {
popup: None,
comp_config: flags.comp_config,
active_layouts: Vec::new(),
rectangle_tracker: None,
rectangle: Rectangle::default(),
};
(window, Task::none())
}
@ -194,42 +205,42 @@ impl cosmic::Application for Window {
cosmic::app::Action::Surface(a),
));
}
Message::Rectangle(u) => match u {
RectangleUpdate::Rectangle(r) => {
self.rectangle = r.1;
}
RectangleUpdate::Init(tracker) => {
self.rectangle_tracker = Some(tracker);
}
},
}
Task::none()
}
fn view(&self) -> Element<'_, Self::Message> {
let input_source_text = self.core.applet.text(
self.active_layouts
.first()
.map_or("", |l| l.layout.as_str()),
);
cosmic::widget::button::custom(
row!(
column!(
input_source_text,
horizontal_space().width(Length::Fixed(
(self.core.applet.suggested_size(true).0
+ 2 * self.core.applet.suggested_padding(true))
as f32
))
)
.width(Length::Shrink)
.height(Length::Shrink)
.align_x(Alignment::Center),
vertical_space().height(Length::Fixed(
(self.core.applet.suggested_size(true).1
+ 2 * self.core.applet.suggested_padding(true)) as f32
))
)
.align_y(Alignment::Center)
.width(Length::Shrink)
.height(Length::Shrink),
let applet_text = if let Some(l) = self.active_layouts.first() {
if !l.variant.is_empty() {
format!("{} ({})", l.layout, l.variant)
} else {
l.layout.clone()
}
} else {
String::new()
};
let input_source_text = self.core.applet.text(applet_text);
let button = self
.core
.applet
.text_button(input_source_text, Message::TogglePopup);
autosize::autosize(
if let Some(tracker) = self.rectangle_tracker.as_ref() {
Element::from(tracker.container(0, button).ignore_bounds(true))
} else {
button.into()
},
AUTOSIZE_MAIN_ID.clone(),
)
.on_press_down(Message::TogglePopup)
.class(cosmic::theme::Button::AppletIcon)
.into()
}
@ -263,18 +274,21 @@ impl cosmic::Application for Window {
}
fn subscription(&self) -> Subscription<Self::Message> {
self.core
.watch_config("com.system76.CosmicComp")
.map(|update| {
if !update.errors.is_empty() {
tracing::error!(
"errors loading config {:?}: {:?}",
update.keys,
update.errors
);
}
Message::CompConfig(Box::new(update.config))
})
Subscription::batch(vec![
rectangle_tracker_subscription(0).map(|e| Message::Rectangle(e.1)),
self.core
.watch_config("com.system76.CosmicComp")
.map(|update| {
if !update.errors.is_empty() {
tracing::error!(
"errors loading config {:?}: {:?}",
update.keys,
update.errors
);
}
Message::CompConfig(Box::new(update.config))
}),
])
}
fn style(&self) -> Option<Appearance> {