Add cosmic-applet-osk (#1564)
This applet will toggle the OSK, once https://github.com/pop-os/cosmic-session/pull/227 is merged --- - [x] I have disclosed use of any AI generated code in my commit messages. - If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR. - In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment. - [x] I understand these changes in full and will be able to respond to review comments. - [x] My change is accurately described in the commit message. - [x] My contribution is tested and working as described. - [x] I have read the [Developer Certificate of Origin](https://developercertificate.org/) and certify my contribution under its conditions.
This commit is contained in:
commit
ca5cc038d9
13 changed files with 160 additions and 13 deletions
45
Cargo.lock
generated
45
Cargo.lock
generated
|
|
@ -651,7 +651,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "build_helpers"
|
||||
version = "0.14.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#a401af8b1c54a8abd393b8c5b7c8809402f83850"
|
||||
source = "git+https://github.com/pop-os/libcosmic#87ab8179e1bd9880239c340855ae8862034bd0e8"
|
||||
dependencies = [
|
||||
"cfg_aliases",
|
||||
]
|
||||
|
|
@ -1156,6 +1156,17 @@ dependencies = [
|
|||
"zbus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cosmic-applet-osk"
|
||||
version = "1.0.15"
|
||||
dependencies = [
|
||||
"cosmic-osk-config",
|
||||
"libcosmic",
|
||||
"tracing",
|
||||
"tracing-log",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cosmic-applet-power"
|
||||
version = "1.0.15"
|
||||
|
|
@ -1257,6 +1268,7 @@ dependencies = [
|
|||
"cosmic-applet-minimize",
|
||||
"cosmic-applet-network",
|
||||
"cosmic-applet-notifications",
|
||||
"cosmic-applet-osk",
|
||||
"cosmic-applet-power",
|
||||
"cosmic-applet-status-area",
|
||||
"cosmic-applet-tiling",
|
||||
|
|
@ -1304,7 +1316,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-config"
|
||||
version = "1.0.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#a401af8b1c54a8abd393b8c5b7c8809402f83850"
|
||||
source = "git+https://github.com/pop-os/libcosmic#87ab8179e1bd9880239c340855ae8862034bd0e8"
|
||||
dependencies = [
|
||||
"atomicwrites",
|
||||
"cosmic-config-derive",
|
||||
|
|
@ -1325,7 +1337,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-config-derive"
|
||||
version = "1.0.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#a401af8b1c54a8abd393b8c5b7c8809402f83850"
|
||||
source = "git+https://github.com/pop-os/libcosmic#87ab8179e1bd9880239c340855ae8862034bd0e8"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
|
|
@ -1376,6 +1388,15 @@ dependencies = [
|
|||
"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]]
|
||||
name = "cosmic-panel-button"
|
||||
version = "1.0.15"
|
||||
|
|
@ -1902,7 +1923,7 @@ dependencies = [
|
|||
"libc",
|
||||
"option-ext",
|
||||
"redox_users",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2100,7 +2121,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2911,7 +2932,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_core"
|
||||
version = "0.14.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#a401af8b1c54a8abd393b8c5b7c8809402f83850"
|
||||
source = "git+https://github.com/pop-os/libcosmic#87ab8179e1bd9880239c340855ae8862034bd0e8"
|
||||
dependencies = [
|
||||
"bitflags 2.13.0",
|
||||
"build_helpers",
|
||||
|
|
@ -2947,7 +2968,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_futures"
|
||||
version = "0.14.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#a401af8b1c54a8abd393b8c5b7c8809402f83850"
|
||||
source = "git+https://github.com/pop-os/libcosmic#87ab8179e1bd9880239c340855ae8862034bd0e8"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"iced_core",
|
||||
|
|
@ -3856,7 +3877,7 @@ version = "1.4.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a1886916523694cd6ea3d175f03a1e5010699a2a4cc13696d83d7bea1d80638"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -4441,7 +4462,7 @@ version = "0.50.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -5567,7 +5588,7 @@ dependencies = [
|
|||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys 0.12.1",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -6148,7 +6169,7 @@ dependencies = [
|
|||
"getrandom 0.4.3",
|
||||
"once_cell",
|
||||
"rustix 1.1.4",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -7155,7 +7176,7 @@ version = "0.1.11"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ members = [
|
|||
"cosmic-applet-minimize",
|
||||
"cosmic-applet-network",
|
||||
"cosmic-applet-notifications",
|
||||
"cosmic-applet-osk",
|
||||
"cosmic-applet-power",
|
||||
"cosmic-applet-status-area",
|
||||
"cosmic-applet-tiling",
|
||||
|
|
@ -27,6 +28,7 @@ resolver = "3"
|
|||
anyhow = "1.0.102"
|
||||
cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "a7d2d7a" }
|
||||
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 = [
|
||||
"client",
|
||||
], rev = "a7d2d7a" }
|
||||
|
|
|
|||
12
cosmic-applet-osk/Cargo.toml
Normal file
12
cosmic-applet-osk/Cargo.toml
Normal 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
|
||||
13
cosmic-applet-osk/data/com.system76.CosmicAppletOsk.desktop
Normal file
13
cosmic-applet-osk/data/com.system76.CosmicAppletOsk.desktop
Normal 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
|
||||
72
cosmic-applet-osk/src/lib.rs
Normal file
72
cosmic-applet-osk/src/lib.rs
Normal 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>(())
|
||||
}
|
||||
13
cosmic-applet-osk/src/main.rs
Normal file
13
cosmic-applet-osk/src/main.rs
Normal 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()
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@ cosmic-applet-bluetooth = { path = "../cosmic-applet-bluetooth" }
|
|||
cosmic-applet-minimize = { path = "../cosmic-applet-minimize" }
|
||||
cosmic-applet-network = { path = "../cosmic-applet-network" }
|
||||
cosmic-applet-notifications = { path = "../cosmic-applet-notifications" }
|
||||
cosmic-applet-osk = { path = "../cosmic-applet-osk" }
|
||||
cosmic-applet-power = { path = "../cosmic-applet-power" }
|
||||
cosmic-applet-status-area = { path = "../cosmic-applet-status-area" }
|
||||
cosmic-applet-tiling = { path = "../cosmic-applet-tiling" }
|
||||
|
|
|
|||
|
|
@ -59,6 +59,12 @@ fn main() {
|
|||
"cosmic-applet-notifications-comment",
|
||||
"cosmic-applet-notifications-keywords",
|
||||
),
|
||||
(
|
||||
"com.system76.CosmicAppletOsk",
|
||||
"cosmic-applet-osk",
|
||||
"cosmic-applet-osk-comment",
|
||||
"cosmic-applet-osk-keywords",
|
||||
),
|
||||
(
|
||||
"com.system76.CosmicAppletPower",
|
||||
"cosmic-applet-power",
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ fn main() -> cosmic::iced::Result {
|
|||
"cosmic-applet-minimize" => cosmic_applet_minimize::run(),
|
||||
"cosmic-applet-network" => cosmic_applet_network::run(),
|
||||
"cosmic-applet-notifications" => cosmic_applet_notifications::run(),
|
||||
"cosmic-applet-osk" => cosmic_applet_osk::run(),
|
||||
"cosmic-applet-power" => cosmic_applet_power::run(),
|
||||
"cosmic-applet-status-area" => cosmic_applet_status_area::run(),
|
||||
"cosmic-applet-tiling" => cosmic_applet_tiling::run(),
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
<launchable type="desktop-id">com.system76.CosmicAppletMinimize.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.CosmicAppletOsk.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.CosmicAppletTiling.desktop</launchable>
|
||||
|
|
@ -83,6 +84,7 @@
|
|||
<binary>cosmic-applet-minimize</binary>
|
||||
<binary>cosmic-applet-network</binary>
|
||||
<binary>cosmic-applet-notifications</binary>
|
||||
<binary>cosmic-applet-osk</binary>
|
||||
<binary>cosmic-applet-power</binary>
|
||||
<binary>cosmic-applet-status-area</binary>
|
||||
<binary>cosmic-applet-tiling</binary>
|
||||
|
|
|
|||
1
debian/links
vendored
1
debian/links
vendored
|
|
@ -5,6 +5,7 @@
|
|||
/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-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-status-area
|
||||
/usr/bin/cosmic-applets /usr/bin/cosmic-applet-tiling
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ cosmic-applet-network-keywords = COSMIC;Applet;Network;
|
|||
cosmic-applet-notifications = Notifications Center
|
||||
cosmic-applet-notifications-comment = Manage notifications and Do Not Disturb
|
||||
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-comment = Lock screen, log out, suspend, reboot, and shutdown
|
||||
cosmic-applet-power-keywords = COSMIC;Applet;User;Session;Lock;Log;Reboot;Shutdown;Suspend;
|
||||
|
|
|
|||
2
justfile
2
justfile
|
|
@ -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
|
||||
|
||||
# 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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue