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