Add cosmic-applet-osk

This commit is contained in:
Jeremy Soller 2026-09-15 20:11:08 -06:00
parent 0bfc3da2cb
commit f2ef09d4a0
13 changed files with 160 additions and 13 deletions

45
Cargo.lock generated
View file

@ -651,7 +651,7 @@ dependencies = [
[[package]] [[package]]
name = "build_helpers" name = "build_helpers"
version = "0.14.0" version = "0.14.0"
source = "git+https://github.com/pop-os/libcosmic#a401af8b1c54a8abd393b8c5b7c8809402f83850" source = "git+https://github.com/pop-os/libcosmic#87ab8179e1bd9880239c340855ae8862034bd0e8"
dependencies = [ dependencies = [
"cfg_aliases", "cfg_aliases",
] ]
@ -1156,6 +1156,17 @@ dependencies = [
"zbus", "zbus",
] ]
[[package]]
name = "cosmic-applet-osk"
version = "1.0.15"
dependencies = [
"cosmic-osk-config",
"libcosmic",
"tracing",
"tracing-log",
"tracing-subscriber",
]
[[package]] [[package]]
name = "cosmic-applet-power" name = "cosmic-applet-power"
version = "1.0.15" version = "1.0.15"
@ -1257,6 +1268,7 @@ dependencies = [
"cosmic-applet-minimize", "cosmic-applet-minimize",
"cosmic-applet-network", "cosmic-applet-network",
"cosmic-applet-notifications", "cosmic-applet-notifications",
"cosmic-applet-osk",
"cosmic-applet-power", "cosmic-applet-power",
"cosmic-applet-status-area", "cosmic-applet-status-area",
"cosmic-applet-tiling", "cosmic-applet-tiling",
@ -1304,7 +1316,7 @@ dependencies = [
[[package]] [[package]]
name = "cosmic-config" name = "cosmic-config"
version = "1.0.0" version = "1.0.0"
source = "git+https://github.com/pop-os/libcosmic#a401af8b1c54a8abd393b8c5b7c8809402f83850" source = "git+https://github.com/pop-os/libcosmic#87ab8179e1bd9880239c340855ae8862034bd0e8"
dependencies = [ dependencies = [
"atomicwrites", "atomicwrites",
"cosmic-config-derive", "cosmic-config-derive",
@ -1325,7 +1337,7 @@ dependencies = [
[[package]] [[package]]
name = "cosmic-config-derive" name = "cosmic-config-derive"
version = "1.0.0" version = "1.0.0"
source = "git+https://github.com/pop-os/libcosmic#a401af8b1c54a8abd393b8c5b7c8809402f83850" source = "git+https://github.com/pop-os/libcosmic#87ab8179e1bd9880239c340855ae8862034bd0e8"
dependencies = [ dependencies = [
"quote", "quote",
"syn", "syn",
@ -1376,6 +1388,15 @@ dependencies = [
"zbus", "zbus",
] ]
[[package]]
name = "cosmic-osk-config"
version = "0.1.0"
source = "git+https://github.com/pop-os/cosmic-osk#d7b66a24890d03e38dd8962d956bc802d4a41067"
dependencies = [
"cosmic-config",
"serde",
]
[[package]] [[package]]
name = "cosmic-panel-button" name = "cosmic-panel-button"
version = "1.0.15" version = "1.0.15"
@ -1902,7 +1923,7 @@ dependencies = [
"libc", "libc",
"option-ext", "option-ext",
"redox_users", "redox_users",
"windows-sys 0.61.2", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@ -2100,7 +2121,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [ dependencies = [
"libc", "libc",
"windows-sys 0.61.2", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@ -2911,7 +2932,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_core" name = "iced_core"
version = "0.14.0" version = "0.14.0"
source = "git+https://github.com/pop-os/libcosmic#a401af8b1c54a8abd393b8c5b7c8809402f83850" source = "git+https://github.com/pop-os/libcosmic#87ab8179e1bd9880239c340855ae8862034bd0e8"
dependencies = [ dependencies = [
"bitflags 2.13.0", "bitflags 2.13.0",
"build_helpers", "build_helpers",
@ -2947,7 +2968,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_futures" name = "iced_futures"
version = "0.14.0" version = "0.14.0"
source = "git+https://github.com/pop-os/libcosmic#a401af8b1c54a8abd393b8c5b7c8809402f83850" source = "git+https://github.com/pop-os/libcosmic#87ab8179e1bd9880239c340855ae8862034bd0e8"
dependencies = [ dependencies = [
"futures", "futures",
"iced_core", "iced_core",
@ -3856,7 +3877,7 @@ version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a1886916523694cd6ea3d175f03a1e5010699a2a4cc13696d83d7bea1d80638" checksum = "7a1886916523694cd6ea3d175f03a1e5010699a2a4cc13696d83d7bea1d80638"
dependencies = [ dependencies = [
"windows-sys 0.61.2", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@ -4441,7 +4462,7 @@ version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [ dependencies = [
"windows-sys 0.61.2", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@ -5567,7 +5588,7 @@ dependencies = [
"errno", "errno",
"libc", "libc",
"linux-raw-sys 0.12.1", "linux-raw-sys 0.12.1",
"windows-sys 0.61.2", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@ -6148,7 +6169,7 @@ dependencies = [
"getrandom 0.4.3", "getrandom 0.4.3",
"once_cell", "once_cell",
"rustix 1.1.4", "rustix 1.1.4",
"windows-sys 0.61.2", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@ -7155,7 +7176,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [ dependencies = [
"windows-sys 0.61.2", "windows-sys 0.59.0",
] ]
[[package]] [[package]]

View file

@ -10,6 +10,7 @@ members = [
"cosmic-applet-minimize", "cosmic-applet-minimize",
"cosmic-applet-network", "cosmic-applet-network",
"cosmic-applet-notifications", "cosmic-applet-notifications",
"cosmic-applet-osk",
"cosmic-applet-power", "cosmic-applet-power",
"cosmic-applet-status-area", "cosmic-applet-status-area",
"cosmic-applet-tiling", "cosmic-applet-tiling",
@ -27,6 +28,7 @@ resolver = "3"
anyhow = "1.0.102" anyhow = "1.0.102"
cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "a7d2d7a" } cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "a7d2d7a" }
cosmic-applets-config = { path = "cosmic-applets-config" } cosmic-applets-config = { path = "cosmic-applets-config" }
cosmic-osk-config = { git = "https://github.com/pop-os/cosmic-osk" }
cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", default-features = false, features = [ cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", default-features = false, features = [
"client", "client",
], rev = "a7d2d7a" } ], rev = "a7d2d7a" }

View file

@ -0,0 +1,12 @@
[package]
name = "cosmic-applet-osk"
version = "1.0.15"
edition = "2024"
license = "GPL-3.0-only"
[dependencies]
cosmic-osk-config.workspace = true
libcosmic.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
tracing-log.workspace = true

View file

@ -0,0 +1,13 @@
[Desktop Entry]
Name=On-screen Keyboard Button
Comment=Open the on-screen keyboard
Type=Application
Exec=cosmic-applet-osk
Terminal=false
Categories=COSMIC;
Keywords=COSMIC;Applet;OSK;Keyboard;
Icon=input-keyboard-symbolic
StartupNotify=true
NoDisplay=true
X-CosmicApplet=true
X-OverflowPriority=10

View file

@ -0,0 +1,72 @@
// Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: GPL-3.0-only
use cosmic::{Task, app, cosmic_config::CosmicConfigEntry, iced};
use cosmic_osk_config::Config;
struct Button {
core: cosmic::app::Core,
}
#[derive(Debug, Clone)]
enum Msg {
Press,
}
impl cosmic::Application for Button {
type Message = Msg;
type Executor = cosmic::SingleThreadExecutor;
type Flags = ();
const APP_ID: &'static str = "com.system76.CosmicAppletOsk";
fn init(core: cosmic::app::Core, _: ()) -> (Self, app::Task<Msg>) {
(Self { core }, Task::none())
}
fn core(&self) -> &cosmic::app::Core {
&self.core
}
fn core_mut(&mut self) -> &mut cosmic::app::Core {
&mut self.core
}
fn style(&self) -> Option<iced::theme::Style> {
Some(cosmic::applet::style())
}
fn update(&mut self, message: Msg) -> app::Task<Msg> {
match message {
Msg::Press => 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);
}
},
}
Task::none()
}
fn view(&self) -> cosmic::Element<'_, Msg> {
self.core
.applet
.icon_button("input-keyboard-symbolic")
.on_press_down(Msg::Press)
.into()
}
}
pub fn run() -> iced::Result {
cosmic::applet::run::<Button>(())
}

View file

@ -0,0 +1,13 @@
// Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: GPL-3.0-only
const VERSION: &str = env!("CARGO_PKG_VERSION");
fn main() -> cosmic::iced::Result {
tracing_subscriber::fmt::init();
let _ = tracing_log::LogTracer::init();
tracing::info!("Starting OSK applet with version {VERSION}");
cosmic_applet_osk::run()
}

View file

@ -16,6 +16,7 @@ cosmic-applet-bluetooth = { path = "../cosmic-applet-bluetooth" }
cosmic-applet-minimize = { path = "../cosmic-applet-minimize" } cosmic-applet-minimize = { path = "../cosmic-applet-minimize" }
cosmic-applet-network = { path = "../cosmic-applet-network" } cosmic-applet-network = { path = "../cosmic-applet-network" }
cosmic-applet-notifications = { path = "../cosmic-applet-notifications" } cosmic-applet-notifications = { path = "../cosmic-applet-notifications" }
cosmic-applet-osk = { path = "../cosmic-applet-osk" }
cosmic-applet-power = { path = "../cosmic-applet-power" } cosmic-applet-power = { path = "../cosmic-applet-power" }
cosmic-applet-status-area = { path = "../cosmic-applet-status-area" } cosmic-applet-status-area = { path = "../cosmic-applet-status-area" }
cosmic-applet-tiling = { path = "../cosmic-applet-tiling" } cosmic-applet-tiling = { path = "../cosmic-applet-tiling" }

View file

@ -59,6 +59,12 @@ fn main() {
"cosmic-applet-notifications-comment", "cosmic-applet-notifications-comment",
"cosmic-applet-notifications-keywords", "cosmic-applet-notifications-keywords",
), ),
(
"com.system76.CosmicAppletOsk",
"cosmic-applet-osk",
"cosmic-applet-osk-comment",
"cosmic-applet-osk-keywords",
),
( (
"com.system76.CosmicAppletPower", "com.system76.CosmicAppletPower",
"cosmic-applet-power", "cosmic-applet-power",

View file

@ -25,6 +25,7 @@ fn main() -> cosmic::iced::Result {
"cosmic-applet-minimize" => cosmic_applet_minimize::run(), "cosmic-applet-minimize" => cosmic_applet_minimize::run(),
"cosmic-applet-network" => cosmic_applet_network::run(), "cosmic-applet-network" => cosmic_applet_network::run(),
"cosmic-applet-notifications" => cosmic_applet_notifications::run(), "cosmic-applet-notifications" => cosmic_applet_notifications::run(),
"cosmic-applet-osk" => cosmic_applet_osk::run(),
"cosmic-applet-power" => cosmic_applet_power::run(), "cosmic-applet-power" => cosmic_applet_power::run(),
"cosmic-applet-status-area" => cosmic_applet_status_area::run(), "cosmic-applet-status-area" => cosmic_applet_status_area::run(),
"cosmic-applet-tiling" => cosmic_applet_tiling::run(), "cosmic-applet-tiling" => cosmic_applet_tiling::run(),

View file

@ -55,6 +55,7 @@
<launchable type="desktop-id">com.system76.CosmicAppletMinimize.desktop</launchable> <launchable type="desktop-id">com.system76.CosmicAppletMinimize.desktop</launchable>
<launchable type="desktop-id">com.system76.CosmicAppletNetwork.desktop</launchable> <launchable type="desktop-id">com.system76.CosmicAppletNetwork.desktop</launchable>
<launchable type="desktop-id">com.system76.CosmicAppletNotifications.desktop</launchable> <launchable type="desktop-id">com.system76.CosmicAppletNotifications.desktop</launchable>
<launchable type="desktop-id">com.system76.CosmicAppletOsk.desktop</launchable>
<launchable type="desktop-id">com.system76.CosmicAppletPower.desktop</launchable> <launchable type="desktop-id">com.system76.CosmicAppletPower.desktop</launchable>
<launchable type="desktop-id">com.system76.CosmicAppletStatusArea.desktop</launchable> <launchable type="desktop-id">com.system76.CosmicAppletStatusArea.desktop</launchable>
<launchable type="desktop-id">com.system76.CosmicAppletTiling.desktop</launchable> <launchable type="desktop-id">com.system76.CosmicAppletTiling.desktop</launchable>
@ -83,6 +84,7 @@
<binary>cosmic-applet-minimize</binary> <binary>cosmic-applet-minimize</binary>
<binary>cosmic-applet-network</binary> <binary>cosmic-applet-network</binary>
<binary>cosmic-applet-notifications</binary> <binary>cosmic-applet-notifications</binary>
<binary>cosmic-applet-osk</binary>
<binary>cosmic-applet-power</binary> <binary>cosmic-applet-power</binary>
<binary>cosmic-applet-status-area</binary> <binary>cosmic-applet-status-area</binary>
<binary>cosmic-applet-tiling</binary> <binary>cosmic-applet-tiling</binary>

1
debian/links vendored
View file

@ -5,6 +5,7 @@
/usr/bin/cosmic-applets /usr/bin/cosmic-applet-minimize /usr/bin/cosmic-applets /usr/bin/cosmic-applet-minimize
/usr/bin/cosmic-applets /usr/bin/cosmic-applet-network /usr/bin/cosmic-applets /usr/bin/cosmic-applet-network
/usr/bin/cosmic-applets /usr/bin/cosmic-applet-notifications /usr/bin/cosmic-applets /usr/bin/cosmic-applet-notifications
/usr/bin/cosmic-applets /usr/bin/cosmic-applet-osk
/usr/bin/cosmic-applets /usr/bin/cosmic-applet-power /usr/bin/cosmic-applets /usr/bin/cosmic-applet-power
/usr/bin/cosmic-applets /usr/bin/cosmic-applet-status-area /usr/bin/cosmic-applets /usr/bin/cosmic-applet-status-area
/usr/bin/cosmic-applets /usr/bin/cosmic-applet-tiling /usr/bin/cosmic-applets /usr/bin/cosmic-applet-tiling

View file

@ -25,6 +25,9 @@ cosmic-applet-network-keywords = COSMIC;Applet;Network;
cosmic-applet-notifications = Notifications Center cosmic-applet-notifications = Notifications Center
cosmic-applet-notifications-comment = Manage notifications and Do Not Disturb cosmic-applet-notifications-comment = Manage notifications and Do Not Disturb
cosmic-applet-notifications-keywords = COSMIC;Applet;Notification; cosmic-applet-notifications-keywords = COSMIC;Applet;Notification;
cosmic-applet-osk = On-screen Keyboard Button
cosmic-applet-osk-comment = Open the on-screen keyboard
cosmic-applet-osk-keywords = COSMIC;Applet;OSK;Keyboard;
cosmic-applet-power = User Session cosmic-applet-power = User Session
cosmic-applet-power-comment = Lock screen, log out, suspend, reboot, and shutdown cosmic-applet-power-comment = Lock screen, log out, suspend, reboot, and shutdown
cosmic-applet-power-keywords = COSMIC;Applet;User;Session;Lock;Log;Reboot;Shutdown;Suspend; cosmic-applet-power-keywords = COSMIC;Applet;User;Session;Lock;Log;Reboot;Shutdown;Suspend;

View file

@ -63,7 +63,7 @@ _install_secret_agent_policy:
install -Dm0644 cosmic-applet-network/data/dbus-1/system.d/com.system76.CosmicSettings.Applet.NetworkManager.SecretAgent.conf {{ sharedir }}/dbus-1/system.d/com.system76.CosmicSettings.Applet.NetworkManager.SecretAgent.conf install -Dm0644 cosmic-applet-network/data/dbus-1/system.d/com.system76.CosmicSettings.Applet.NetworkManager.SecretAgent.conf {{ sharedir }}/dbus-1/system.d/com.system76.CosmicSettings.Applet.NetworkManager.SecretAgent.conf
# Installs files into the system # Installs files into the system
install: (_install_bin 'cosmic-applets') (_link_applet 'cosmic-panel-button') (_install_applet 'com.system76.CosmicAppList' 'cosmic-app-list') (_install_default_schema 'cosmic-app-list') (_install_applet 'com.system76.CosmicAppletA11y' 'cosmic-applet-a11y') (_install_applet 'com.system76.CosmicAppletAudio' 'cosmic-applet-audio') (_install_applet 'com.system76.CosmicAppletInputSources' 'cosmic-applet-input-sources') (_install_applet 'com.system76.CosmicAppletBattery' 'cosmic-applet-battery') (_install_applet 'com.system76.CosmicAppletBluetooth' 'cosmic-applet-bluetooth') (_install_applet 'com.system76.CosmicAppletMinimize' 'cosmic-applet-minimize') (_install_applet 'com.system76.CosmicAppletNetwork' 'cosmic-applet-network') (_install_applet 'com.system76.CosmicAppletNotifications' 'cosmic-applet-notifications') (_install_applet 'com.system76.CosmicAppletPower' 'cosmic-applet-power') (_install_applet 'com.system76.CosmicAppletStatusArea' 'cosmic-applet-status-area') (_install_applet 'com.system76.CosmicAppletTiling' 'cosmic-applet-tiling') (_install_applet 'com.system76.CosmicAppletTime' 'cosmic-applet-time') (_install_applet 'com.system76.CosmicAppletWorkspaces' 'cosmic-applet-workspaces') (_install_button 'com.system76.CosmicPanelAppButton' 'cosmic-panel-app-button') (_install_button 'com.system76.CosmicPanelLauncherButton' 'cosmic-panel-launcher-button') (_install_button 'com.system76.CosmicPanelWorkspacesButton' 'cosmic-panel-workspaces-button') _install_metainfo _install_status_notifier_watcher _install_secret_agent_policy install: (_install_bin 'cosmic-applets') (_link_applet 'cosmic-panel-button') (_install_applet 'com.system76.CosmicAppList' 'cosmic-app-list') (_install_default_schema 'cosmic-app-list') (_install_applet 'com.system76.CosmicAppletA11y' 'cosmic-applet-a11y') (_install_applet 'com.system76.CosmicAppletAudio' 'cosmic-applet-audio') (_install_applet 'com.system76.CosmicAppletInputSources' 'cosmic-applet-input-sources') (_install_applet 'com.system76.CosmicAppletBattery' 'cosmic-applet-battery') (_install_applet 'com.system76.CosmicAppletBluetooth' 'cosmic-applet-bluetooth') (_install_applet 'com.system76.CosmicAppletMinimize' 'cosmic-applet-minimize') (_install_applet 'com.system76.CosmicAppletNetwork' 'cosmic-applet-network') (_install_applet 'com.system76.CosmicAppletNotifications' 'cosmic-applet-notifications') (_install_applet 'com.system76.CosmicAppletOsk' 'cosmic-applet-osk') (_install_applet 'com.system76.CosmicAppletPower' 'cosmic-applet-power') (_install_applet 'com.system76.CosmicAppletStatusArea' 'cosmic-applet-status-area') (_install_applet 'com.system76.CosmicAppletTiling' 'cosmic-applet-tiling') (_install_applet 'com.system76.CosmicAppletTime' 'cosmic-applet-time') (_install_applet 'com.system76.CosmicAppletWorkspaces' 'cosmic-applet-workspaces') (_install_button 'com.system76.CosmicPanelAppButton' 'cosmic-panel-app-button') (_install_button 'com.system76.CosmicPanelLauncherButton' 'cosmic-panel-launcher-button') (_install_button 'com.system76.CosmicPanelWorkspacesButton' 'cosmic-panel-workspaces-button') _install_metainfo _install_status_notifier_watcher _install_secret_agent_policy
# Vendor Cargo dependencies locally # Vendor Cargo dependencies locally
vendor: vendor: