refactor: add namespace
This commit is contained in:
parent
301892aaa5
commit
39d88f2ffa
7 changed files with 33 additions and 12 deletions
5
Cargo.lock
generated
5
Cargo.lock
generated
|
|
@ -1283,7 +1283,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-client-toolkit"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/cosmic-protocols?rev=27d70b6#27d70b6eb9c785a2a48341016f32a7b1ac4980ac"
|
||||
source = "git+https://github.com/pop-os/cosmic-protocols?rev=d218c76#d218c76b58c7a3b20dd5e7943f93fc306a1b81b8"
|
||||
dependencies = [
|
||||
"cosmic-protocols",
|
||||
"libc",
|
||||
|
|
@ -1295,7 +1295,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-protocols"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/cosmic-protocols?rev=27d70b6#27d70b6eb9c785a2a48341016f32a7b1ac4980ac"
|
||||
source = "git+https://github.com/pop-os/cosmic-protocols?rev=d218c76#d218c76b58c7a3b20dd5e7943f93fc306a1b81b8"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"wayland-backend",
|
||||
|
|
@ -5850,6 +5850,7 @@ dependencies = [
|
|||
"once_cell",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ tiny-skia = { version = "0.11", default-features = false, features = [
|
|||
"std",
|
||||
"simd",
|
||||
] }
|
||||
cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "27d70b6" }
|
||||
cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "d218c76" }
|
||||
softbuffer = { git = "https://github.com/pop-os/softbuffer", tag = "cosmic-4.0" }
|
||||
syntect = "5.2"
|
||||
tokio = "1.0"
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ pub enum OverlapNotifyEvent {
|
|||
},
|
||||
OverlapLayerAdd {
|
||||
identifier: String,
|
||||
namespace: String,
|
||||
exclusive: u32,
|
||||
layer: Option<Layer>,
|
||||
logical_rect: crate::Rectangle,
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ log = "0.4.17"
|
|||
env_logger = "0.10.0"
|
||||
async-std = "1.0"
|
||||
directories-next = "2.0.0"
|
||||
tracing = "0.1"
|
||||
|
||||
[profile.release-opt]
|
||||
debug = true
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
use env_logger::Env;
|
||||
use iced::alignment::{self, Alignment};
|
||||
use iced::event::{self, listen_raw, Event};
|
||||
use iced::platform_specific::shell::commands::layer_surface::{
|
||||
get_layer_surface, Anchor,
|
||||
use iced::platform_specific::shell::commands::{
|
||||
layer_surface::{get_layer_surface, Anchor},
|
||||
overlap_notify::overlap_notify,
|
||||
};
|
||||
use iced::theme::{self, Theme};
|
||||
use iced::widget::{
|
||||
|
|
@ -24,11 +25,11 @@ use std::fmt::Debug;
|
|||
static INPUT_ID: Lazy<text_input::Id> = Lazy::new(|| text_input::Id::unique());
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
let env = Env::default()
|
||||
.filter_or("MY_LOG_LEVEL", "info")
|
||||
.write_style_or("MY_LOG_STYLE", "always");
|
||||
// let env = Env::default()
|
||||
// .filter_or("MY_LOG_LEVEL", "info")
|
||||
// .write_style_or("MY_LOG_STYLE", "always");
|
||||
|
||||
env_logger::init_from_env(env);
|
||||
// env_logger::init_from_env(env);
|
||||
iced::daemon(Todos::title, Todos::update, Todos::view)
|
||||
.subscription(Todos::subscription)
|
||||
.font(include_bytes!("../fonts/icons.ttf").as_slice())
|
||||
|
|
@ -89,17 +90,20 @@ impl Debug for Message {
|
|||
|
||||
impl Todos {
|
||||
fn new() -> (Todos, Task<Message>) {
|
||||
let id = window::Id::unique();
|
||||
(
|
||||
Todos::Loading,
|
||||
Task::batch(vec![
|
||||
Task::perform(SavedState::load(), Message::Loaded),
|
||||
get_layer_surface(iced::platform_specific::runtime::wayland::layer_surface::SctkLayerSurfaceSettings {
|
||||
id: id.clone(),
|
||||
size: Some((None, Some(500))),
|
||||
pointer_interactivity: true,
|
||||
keyboard_interactivity: cctk::sctk::shell::wlr_layer::KeyboardInteractivity::OnDemand,
|
||||
anchor: Anchor::LEFT.union(Anchor::RIGHT).union(Anchor::TOP),
|
||||
..Default::default()
|
||||
}),
|
||||
overlap_notify(id, true)
|
||||
]),
|
||||
)
|
||||
}
|
||||
|
|
@ -311,12 +315,22 @@ impl Todos {
|
|||
}),
|
||||
(
|
||||
Event::PlatformSpecific(event::PlatformSpecific::Wayland(
|
||||
event::wayland::Event::Window(e),
|
||||
event::wayland::Event::Layer(e, ..),
|
||||
)),
|
||||
_,
|
||||
_,
|
||||
) => {
|
||||
dbg!(&e);
|
||||
dbg!(e);
|
||||
None
|
||||
}
|
||||
(
|
||||
Event::PlatformSpecific(event::PlatformSpecific::Wayland(
|
||||
event::wayland::Event::OverlapNotify(e),
|
||||
)),
|
||||
_,
|
||||
_,
|
||||
) => {
|
||||
dbg!(e);
|
||||
None
|
||||
}
|
||||
_ => None,
|
||||
|
|
|
|||
|
|
@ -82,13 +82,14 @@ impl Dispatch<ZcosmicOverlapNotificationV1, OverlapNotificationV1, SctkState>
|
|||
}
|
||||
zcosmic_overlap_notification_v1::Event::LayerEnter {
|
||||
identifier,
|
||||
namespace,
|
||||
exclusive,
|
||||
layer,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
} => SctkEvent::OverlapLayerAdd { surface, identifier, exclusive, layer: match layer {
|
||||
} => SctkEvent::OverlapLayerAdd { surface, namespace, identifier, exclusive, layer: match layer {
|
||||
wayland_client::WEnum::Value(v) => match v {
|
||||
cctk::sctk::reexports::protocols_wlr::layer_shell::v1::client::zwlr_layer_shell_v1::Layer::Background => Some(Layer::Background),
|
||||
cctk::sctk::reexports::protocols_wlr::layer_shell::v1::client::zwlr_layer_shell_v1::Layer::Bottom => Some(Layer::Bottom),
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ pub enum SctkEvent {
|
|||
},
|
||||
OverlapLayerAdd {
|
||||
surface: WlSurface,
|
||||
namespace: String,
|
||||
identifier: String,
|
||||
exclusive: u32,
|
||||
layer: Option<Layer>,
|
||||
|
|
@ -1263,6 +1264,7 @@ impl SctkEvent {
|
|||
}
|
||||
SctkEvent::OverlapLayerAdd {
|
||||
surface,
|
||||
namespace,
|
||||
identifier,
|
||||
exclusive,
|
||||
layer,
|
||||
|
|
@ -1276,6 +1278,7 @@ impl SctkEvent {
|
|||
wayland::Event::OverlapNotify(
|
||||
OverlapNotifyEvent::OverlapLayerAdd {
|
||||
identifier,
|
||||
namespace,
|
||||
exclusive,
|
||||
layer,
|
||||
logical_rect,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue