update: use dyrend & use autosized window in app-list & fix button size in workspaces & only update popup text in time when creating popup
This commit is contained in:
parent
9b229c6e72
commit
982b8f5fd1
6 changed files with 164 additions and 205 deletions
231
Cargo.lock
generated
231
Cargo.lock
generated
|
|
@ -176,7 +176,7 @@ dependencies = [
|
|||
"slab",
|
||||
"socket2",
|
||||
"waker-fn",
|
||||
"windows-sys 0.42.0",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -360,15 +360,6 @@ version = "0.1.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
|
||||
|
||||
[[package]]
|
||||
name = "cgl"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cgmath"
|
||||
version = "0.18.0"
|
||||
|
|
@ -1411,6 +1402,16 @@ version = "0.1.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
||||
|
||||
[[package]]
|
||||
name = "fraction"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c37ba08fe22fba12a3ada3e479d09a8f7fac6081aa6f5c27f22b78639025031"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"num",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "freedesktop-desktop-entry"
|
||||
version = "0.5.0"
|
||||
|
|
@ -1701,58 +1702,6 @@ dependencies = [
|
|||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glutin"
|
||||
version = "0.30.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "524d807cd49a0c56a53ef9a6738cd15e7c8c4e9d37a3b7fdb3c250c1cd5bf7a3"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg_aliases",
|
||||
"cgl",
|
||||
"cocoa",
|
||||
"core-foundation",
|
||||
"glutin_egl_sys",
|
||||
"glutin_glx_sys",
|
||||
"glutin_wgl_sys",
|
||||
"libloading",
|
||||
"objc",
|
||||
"once_cell",
|
||||
"raw-window-handle",
|
||||
"wayland-sys",
|
||||
"windows-sys 0.36.1",
|
||||
"x11-dl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glutin_egl_sys"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3adbb8fec0e18e340f990c78f79f5f0e142d0d83f46b10909aaa7d251c00afdf"
|
||||
dependencies = [
|
||||
"gl_generator",
|
||||
"windows-sys 0.36.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glutin_glx_sys"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "947c4850c58211c9627969c2b4e2674764b81ae5b47bab2c9a477d7942f96e0f"
|
||||
dependencies = [
|
||||
"gl_generator",
|
||||
"x11-dl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glutin_wgl_sys"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20c33975a6c9d49d72c8f032a60079bf8df536954fbf9e4cee90396ace815c57"
|
||||
dependencies = [
|
||||
"gl_generator",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glyph_brush"
|
||||
version = "0.7.5"
|
||||
|
|
@ -2011,9 +1960,10 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#cd19bbf37aa23954bb3dbd8599543bf705aa41a1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#4733069988e784ef390c72eaad46cde74c2559f5"
|
||||
dependencies = [
|
||||
"iced_core",
|
||||
"iced_dyrend",
|
||||
"iced_futures",
|
||||
"iced_glow",
|
||||
"iced_graphics",
|
||||
|
|
@ -2028,17 +1978,31 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_core"
|
||||
version = "0.6.2"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#cd19bbf37aa23954bb3dbd8599543bf705aa41a1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#4733069988e784ef390c72eaad46cde74c2559f5"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"palette",
|
||||
"wasm-timer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iced_dyrend"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#4733069988e784ef390c72eaad46cde74c2559f5"
|
||||
dependencies = [
|
||||
"iced_glow",
|
||||
"iced_graphics",
|
||||
"iced_native",
|
||||
"iced_softbuffer",
|
||||
"iced_wgpu",
|
||||
"log",
|
||||
"raw-window-handle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iced_futures"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#cd19bbf37aa23954bb3dbd8599543bf705aa41a1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#4733069988e784ef390c72eaad46cde74c2559f5"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"log",
|
||||
|
|
@ -2050,7 +2014,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_glow"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#cd19bbf37aa23954bb3dbd8599543bf705aa41a1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#4733069988e784ef390c72eaad46cde74c2559f5"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"euclid",
|
||||
|
|
@ -2065,7 +2029,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_graphics"
|
||||
version = "0.5.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#cd19bbf37aa23954bb3dbd8599543bf705aa41a1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#4733069988e784ef390c72eaad46cde74c2559f5"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bytemuck",
|
||||
|
|
@ -2085,7 +2049,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_lazy"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#cd19bbf37aa23954bb3dbd8599543bf705aa41a1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#4733069988e784ef390c72eaad46cde74c2559f5"
|
||||
dependencies = [
|
||||
"iced_native",
|
||||
"ouroboros 0.13.0",
|
||||
|
|
@ -2094,7 +2058,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_native"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#cd19bbf37aa23954bb3dbd8599543bf705aa41a1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#4733069988e784ef390c72eaad46cde74c2559f5"
|
||||
dependencies = [
|
||||
"iced_core",
|
||||
"iced_futures",
|
||||
|
|
@ -2108,12 +2072,10 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_sctk"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#cd19bbf37aa23954bb3dbd8599543bf705aa41a1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#4733069988e784ef390c72eaad46cde74c2559f5"
|
||||
dependencies = [
|
||||
"enum-repr",
|
||||
"futures",
|
||||
"glow",
|
||||
"glutin",
|
||||
"iced_futures",
|
||||
"iced_graphics",
|
||||
"iced_native",
|
||||
|
|
@ -2127,7 +2089,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_softbuffer"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#cd19bbf37aa23954bb3dbd8599543bf705aa41a1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#4733069988e784ef390c72eaad46cde74c2559f5"
|
||||
dependencies = [
|
||||
"cosmic-text",
|
||||
"iced_graphics",
|
||||
|
|
@ -2142,7 +2104,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_style"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#cd19bbf37aa23954bb3dbd8599543bf705aa41a1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#4733069988e784ef390c72eaad46cde74c2559f5"
|
||||
dependencies = [
|
||||
"iced_core",
|
||||
"once_cell",
|
||||
|
|
@ -2152,7 +2114,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_wgpu"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#cd19bbf37aa23954bb3dbd8599543bf705aa41a1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#4733069988e784ef390c72eaad46cde74c2559f5"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bytemuck",
|
||||
|
|
@ -2250,7 +2212,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.42.0",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2342,12 +2304,13 @@ checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
|
|||
[[package]]
|
||||
name = "libcosmic"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#cd19bbf37aa23954bb3dbd8599543bf705aa41a1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#4733069988e784ef390c72eaad46cde74c2559f5"
|
||||
dependencies = [
|
||||
"apply",
|
||||
"cosmic-panel-config",
|
||||
"cosmic-theme",
|
||||
"derive_setters",
|
||||
"fraction",
|
||||
"freedesktop-icons",
|
||||
"iced",
|
||||
"iced_core",
|
||||
|
|
@ -2597,7 +2560,7 @@ dependencies = [
|
|||
"libc",
|
||||
"log",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
"windows-sys 0.42.0",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2685,6 +2648,40 @@ dependencies = [
|
|||
"minimal-lexical",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606"
|
||||
dependencies = [
|
||||
"num-bigint",
|
||||
"num-complex",
|
||||
"num-integer",
|
||||
"num-iter",
|
||||
"num-rational",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-complex"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-derive"
|
||||
version = "0.3.3"
|
||||
|
|
@ -2706,6 +2703,17 @@ dependencies = [
|
|||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-iter"
|
||||
version = "0.1.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-rational"
|
||||
version = "0.4.1"
|
||||
|
|
@ -2713,6 +2721,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-bigint",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
|
@ -2942,7 +2951,7 @@ dependencies = [
|
|||
"libc",
|
||||
"redox_syscall 0.2.16",
|
||||
"smallvec",
|
||||
"windows-sys 0.42.0",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3054,7 +3063,7 @@ dependencies = [
|
|||
"libc",
|
||||
"log",
|
||||
"wepoll-ffi",
|
||||
"windows-sys 0.42.0",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3418,7 +3427,7 @@ dependencies = [
|
|||
"io-lifetimes",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.42.0",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3709,8 +3718,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "softbuffer"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3177eca2c15033e254b9b70c4915150200b1cf6fa777de18be9977ae5850077f"
|
||||
source = "git+https://github.com/pop-os/softbuffer?rev=68240f56b#68240f56b6e837b9c4f43438bce866a0e1b1ab61"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"cfg_aliases",
|
||||
|
|
@ -3729,7 +3737,7 @@ dependencies = [
|
|||
"wayland-client",
|
||||
"wayland-sys",
|
||||
"web-sys",
|
||||
"windows-sys 0.42.0",
|
||||
"windows-sys",
|
||||
"x11-dl",
|
||||
"x11rb",
|
||||
]
|
||||
|
|
@ -3992,7 +4000,7 @@ dependencies = [
|
|||
"socket2",
|
||||
"tokio-macros",
|
||||
"tracing",
|
||||
"windows-sys 0.42.0",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -4643,19 +4651,6 @@ version = "0.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
|
||||
dependencies = [
|
||||
"windows_aarch64_msvc 0.36.1",
|
||||
"windows_i686_gnu 0.36.1",
|
||||
"windows_i686_msvc 0.36.1",
|
||||
"windows_x86_64_gnu 0.36.1",
|
||||
"windows_x86_64_msvc 0.36.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.42.0"
|
||||
|
|
@ -4663,12 +4658,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc 0.42.0",
|
||||
"windows_i686_gnu 0.42.0",
|
||||
"windows_i686_msvc 0.42.0",
|
||||
"windows_x86_64_gnu 0.42.0",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc 0.42.0",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -4677,48 +4672,24 @@ version = "0.42.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.0"
|
||||
|
|
@ -4731,12 +4702,6 @@ version = "0.42.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.0"
|
||||
|
|
|
|||
|
|
@ -14,15 +14,19 @@ use cctk::wayland_client::protocol::wl_seat::WlSeat;
|
|||
use cosmic::applet::cosmic_panel_config::PanelAnchor;
|
||||
use cosmic::applet::CosmicAppletHelper;
|
||||
use cosmic::iced;
|
||||
use cosmic::iced::wayland::actions::window::SctkWindowSettings;
|
||||
use cosmic::iced::wayland::popup::destroy_popup;
|
||||
use cosmic::iced::wayland::popup::get_popup;
|
||||
use cosmic::iced::wayland::SurfaceIdWrapper;
|
||||
use cosmic::iced::widget::mouse_listener;
|
||||
use cosmic::iced::widget::{column, row};
|
||||
use cosmic::iced::Settings;
|
||||
use cosmic::iced::{window, Application, Command, Subscription};
|
||||
use cosmic::iced_native::alignment::Horizontal;
|
||||
use cosmic::iced_native::subscription::events_with;
|
||||
use cosmic::iced_native::widget::vertical_space;
|
||||
use cosmic::iced_sctk::layout::Limits;
|
||||
use cosmic::iced_sctk::settings::InitialSurface;
|
||||
use cosmic::iced_style::application::{self, Appearance};
|
||||
use cosmic::iced_style::Color;
|
||||
use cosmic::theme::Button;
|
||||
|
|
@ -43,7 +47,31 @@ use itertools::Itertools;
|
|||
|
||||
pub fn run() -> cosmic::iced::Result {
|
||||
let helper = CosmicAppletHelper::default();
|
||||
CosmicAppList::run(helper.window_settings())
|
||||
let pixel_size = helper.suggested_size().0;
|
||||
let padding = 8;
|
||||
let dot_size = 4;
|
||||
let spacing = 4;
|
||||
let thickness = (pixel_size + 2 * padding + dot_size + spacing) as u32;
|
||||
let (w, h) = match helper.anchor {
|
||||
PanelAnchor::Top | PanelAnchor::Bottom => (2000, thickness),
|
||||
PanelAnchor::Left | PanelAnchor::Right => (thickness, 2000),
|
||||
};
|
||||
|
||||
CosmicAppList::run(Settings {
|
||||
initial_surface: InitialSurface::XdgWindow(SctkWindowSettings {
|
||||
iced_settings: cosmic::iced_native::window::Settings {
|
||||
..Default::default()
|
||||
},
|
||||
autosize: true,
|
||||
size_limits: Limits::NONE
|
||||
.min_height(1)
|
||||
.min_width(1)
|
||||
.max_height(h)
|
||||
.max_width(w),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
|
|
@ -70,30 +98,6 @@ struct CosmicAppList {
|
|||
rectangles: HashMap<u32, iced::Rectangle>,
|
||||
}
|
||||
|
||||
impl CosmicAppList {
|
||||
fn window_size(&self) -> (u32, u32) {
|
||||
let pixel_size = self.applet_helper.suggested_size().0;
|
||||
let padding = 8;
|
||||
let dot_size = 4;
|
||||
let spacing = 4;
|
||||
let mut length = self
|
||||
.toplevel_list
|
||||
.iter()
|
||||
.map(|t| {
|
||||
(pixel_size + 2 * padding).max((dot_size + spacing) * t.toplevels.len() as u16)
|
||||
as u32
|
||||
+ spacing as u32
|
||||
})
|
||||
.sum();
|
||||
length += spacing as u32 * 2 + 2;
|
||||
let thickness = (pixel_size + 2 * padding + dot_size + spacing) as u32;
|
||||
match self.applet_helper.anchor {
|
||||
PanelAnchor::Left | PanelAnchor::Right => (thickness, length),
|
||||
PanelAnchor::Top | PanelAnchor::Bottom => (length, thickness),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO DnD after sctk merges DnD
|
||||
#[derive(Debug, Clone)]
|
||||
enum Message {
|
||||
|
|
@ -185,9 +189,8 @@ impl Application for CosmicAppList {
|
|||
toplevel_ctr,
|
||||
..Default::default()
|
||||
};
|
||||
let (w, h) = self_.window_size();
|
||||
|
||||
(self_, resize_window(window::Id::new(0), w, h))
|
||||
(self_, Command::none())
|
||||
}
|
||||
|
||||
fn title(&self) -> String {
|
||||
|
|
@ -288,9 +291,6 @@ impl Application for CosmicAppList {
|
|||
desktop_info,
|
||||
popup: None,
|
||||
});
|
||||
|
||||
let (w, h) = self.window_size();
|
||||
return resize_window(window::Id::new(0), w, h);
|
||||
}
|
||||
}
|
||||
ToplevelUpdate::Init(tx) => {
|
||||
|
|
@ -321,8 +321,6 @@ impl Application for CosmicAppList {
|
|||
) {
|
||||
self.toplevel_list.remove(i);
|
||||
}
|
||||
let (w, h) = self.window_size();
|
||||
return resize_window(window::Id::new(0), w, h);
|
||||
}
|
||||
ToplevelUpdate::UpdateToplevel(handle, info) => {
|
||||
// TODO probably want to make sure it is removed
|
||||
|
|
@ -337,8 +335,6 @@ impl Application for CosmicAppList {
|
|||
}
|
||||
}
|
||||
}
|
||||
let (w, h) = self.window_size();
|
||||
return resize_window(window::Id::new(0), w, h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -402,20 +398,9 @@ impl Application for CosmicAppList {
|
|||
Path::new(&desktop_info.icon),
|
||||
self.applet_helper.suggested_size().0,
|
||||
);
|
||||
// let icon = if desktop_info.icon.extension() == Some(&OsStr::new("svg")) {
|
||||
// svg::Handle::from_path(&desktop_info.icon);
|
||||
// svg::Svg::new(handle)
|
||||
// .width(Length::Units(self.applet_helper.suggested_size().0))
|
||||
// .height(Length::Units(self.applet_helper.suggested_size().0))
|
||||
// .into()
|
||||
// } else {
|
||||
// Image::new(&desktop_info.icon)
|
||||
// .width(Length::Units(self.applet_helper.suggested_size().0))
|
||||
// .height(Length::Units(self.applet_helper.suggested_size().0))
|
||||
// .into()
|
||||
// };
|
||||
|
||||
let dot_radius = 2;
|
||||
let mut dots = (0..toplevels.len())
|
||||
let dots = (0..toplevels.len())
|
||||
.into_iter()
|
||||
.map(|_| {
|
||||
container(vertical_space(Length::Units(0)))
|
||||
|
|
@ -434,7 +419,6 @@ impl Application for CosmicAppList {
|
|||
.into()
|
||||
})
|
||||
.collect_vec();
|
||||
dots.push(vertical_space(Length::Units(4)).into());
|
||||
let icon_wrapper = match &self.applet_helper.anchor {
|
||||
PanelAnchor::Left => {
|
||||
row(vec![column(dots).spacing(4).into(), cosmic_icon.into()])
|
||||
|
|
@ -494,6 +478,11 @@ impl Application for CosmicAppList {
|
|||
},
|
||||
);
|
||||
|
||||
let (w, h) = match self.applet_helper.anchor {
|
||||
PanelAnchor::Top | PanelAnchor::Bottom => (Length::Shrink, Length::Fill),
|
||||
PanelAnchor::Left | PanelAnchor::Right => (Length::Fill, Length::Shrink),
|
||||
};
|
||||
|
||||
let content = match &self.applet_helper.anchor {
|
||||
PanelAnchor::Left | PanelAnchor::Right => container(
|
||||
column![column(favorites), horizontal_rule(1), column(running)]
|
||||
|
|
@ -508,9 +497,7 @@ impl Application for CosmicAppList {
|
|||
.align_items(Alignment::Center)
|
||||
.height(Length::Fill)
|
||||
.width(Length::Fill),
|
||||
)
|
||||
.height(Length::Fill)
|
||||
.width(Length::Fill),
|
||||
),
|
||||
};
|
||||
if self.popup.is_some() {
|
||||
mouse_listener(content)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ pub fn main() -> cosmic::iced::Result {
|
|||
.min_width(1)
|
||||
.max_width(1000);
|
||||
}
|
||||
InitialSurface::None => unimplemented!(),
|
||||
};
|
||||
}
|
||||
_ => {}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
use cosmic::iced_sctk::Rectangle;
|
||||
use cosmic::iced_style;
|
||||
use cosmic::{
|
||||
applet::CosmicAppletHelper,
|
||||
|
|
@ -13,14 +14,14 @@ use cosmic::{
|
|||
alignment::{Horizontal, Vertical},
|
||||
layout::Limits,
|
||||
renderer::BorderRadius,
|
||||
subscription, window,
|
||||
window,
|
||||
},
|
||||
iced_style::{application, button::StyleSheet, svg},
|
||||
theme::{Button, Svg},
|
||||
widget::{button, horizontal_rule, icon, list_column, toggler},
|
||||
widget::{button, horizontal_rule, icon, toggler},
|
||||
Element, Theme,
|
||||
};
|
||||
use cosmic_dbus_networkmanager::{access_point, interface::enums::DeviceState};
|
||||
use cosmic_dbus_networkmanager::interface::enums::DeviceState;
|
||||
use futures::channel::mpsc::UnboundedSender;
|
||||
|
||||
use crate::network_manager::NetworkManagerState;
|
||||
|
|
@ -151,11 +152,12 @@ impl Application for CosmicNetworkApplet {
|
|||
None,
|
||||
None,
|
||||
);
|
||||
|
||||
popup_settings.positioner.size_limits = Limits::NONE
|
||||
.min_height(1)
|
||||
.min_width(1)
|
||||
.max_height(600)
|
||||
.max_width(600);
|
||||
.max_height(800)
|
||||
.max_width(400);
|
||||
return get_popup(popup_settings);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ struct Time {
|
|||
id_ctr: u32,
|
||||
update_at: Every,
|
||||
now: DateTime<Local>,
|
||||
msg: String,
|
||||
}
|
||||
|
||||
impl Default for Time {
|
||||
|
|
@ -39,6 +40,7 @@ impl Default for Time {
|
|||
id_ctr: 0,
|
||||
update_at: Every::Minute,
|
||||
now: Local::now(),
|
||||
msg: String::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -113,6 +115,20 @@ impl Application for Time {
|
|||
if let Some(p) = self.popup.take() {
|
||||
destroy_popup(p)
|
||||
} else {
|
||||
use std::os::unix::process::ExitStatusExt;
|
||||
let calendar = std::str::from_utf8(
|
||||
&std::process::Command::new("happiness")
|
||||
.output()
|
||||
.unwrap_or(std::process::Output {
|
||||
stdout: "`sudo apt install happiness`".as_bytes().to_vec(),
|
||||
stderr: Vec::new(),
|
||||
status: std::process::ExitStatus::from_raw(0),
|
||||
})
|
||||
.stdout,
|
||||
)
|
||||
.unwrap()
|
||||
.to_string();
|
||||
self.msg = calendar;
|
||||
self.id_ctr += 1;
|
||||
let new_id = window::Id::new(self.id_ctr);
|
||||
self.popup.replace(new_id);
|
||||
|
|
@ -148,25 +164,11 @@ impl Application for Time {
|
|||
.width(Length::Units(120))
|
||||
.into(),
|
||||
SurfaceIdWrapper::Popup(_) => {
|
||||
use std::os::unix::process::ExitStatusExt;
|
||||
let calendar = std::str::from_utf8(
|
||||
&std::process::Command::new("happiness")
|
||||
.output()
|
||||
.unwrap_or(std::process::Output {
|
||||
stdout: "`sudo apt install happiness`".as_bytes().to_vec(),
|
||||
stderr: Vec::new(),
|
||||
status: std::process::ExitStatus::from_raw(0),
|
||||
})
|
||||
.stdout,
|
||||
)
|
||||
.unwrap()
|
||||
.to_string();
|
||||
|
||||
let content = column![]
|
||||
.align_items(Alignment::Start)
|
||||
.spacing(12)
|
||||
.padding([24, 0])
|
||||
.push(text(calendar))
|
||||
.push(text(&self.msg))
|
||||
.padding(8);
|
||||
|
||||
self.applet_helper.popup_container(content).into()
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ struct IcedWorkspacesApplet {
|
|||
workspaces: WorkspaceList,
|
||||
workspace_tx: Option<SyncSender<WorkspaceEvent>>,
|
||||
layout: Layout,
|
||||
helper: CosmicAppletHelper,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
@ -74,6 +75,7 @@ impl Application for IcedWorkspacesApplet {
|
|||
theme: Default::default(),
|
||||
workspaces: Vec::new(),
|
||||
workspace_tx: Default::default(),
|
||||
helper: Default::default(),
|
||||
},
|
||||
Command::none(),
|
||||
)
|
||||
|
|
@ -96,7 +98,7 @@ impl Application for IcedWorkspacesApplet {
|
|||
Ordering::Greater => Ordering::Greater,
|
||||
});
|
||||
self.workspaces = list;
|
||||
let unit = 32;
|
||||
let unit = self.helper.suggested_size().0 as u32 + 16;
|
||||
let (w, h) = match self.layout {
|
||||
Layout::Row => (unit * self.workspaces.len().max(1) as u32, unit),
|
||||
Layout::Column => (unit, unit * self.workspaces.len().max(1) as u32),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue