feat(appearance): add font configuration settings
This commit is contained in:
parent
752c4bd427
commit
d90074045f
8 changed files with 525 additions and 93 deletions
118
Cargo.lock
generated
118
Cargo.lock
generated
|
|
@ -1001,9 +1001,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.1.23"
|
version = "1.1.24"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3bbb537bb4a30b90362caddba8f360c0a56bc13d3a5570028e7197204cb54a17"
|
checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jobserver",
|
"jobserver",
|
||||||
"libc",
|
"libc",
|
||||||
|
|
@ -1092,9 +1092,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.5.18"
|
version = "4.5.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3"
|
checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
"clap_derive",
|
"clap_derive",
|
||||||
|
|
@ -1102,9 +1102,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.5.18"
|
version = "4.5.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b"
|
checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
|
|
@ -1447,7 +1447,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cosmic-comp-config"
|
name = "cosmic-comp-config"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/pop-os/cosmic-comp#afdb65677857946b403043f04ca083810639e4e5"
|
source = "git+https://github.com/pop-os/cosmic-comp#a96394f7a6fd1d96289e319650e3f17b873cbfb0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cosmic-config",
|
"cosmic-config",
|
||||||
"input",
|
"input",
|
||||||
|
|
@ -1457,7 +1457,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cosmic-config"
|
name = "cosmic-config"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atomicwrites",
|
"atomicwrites",
|
||||||
"cosmic-config-derive",
|
"cosmic-config-derive",
|
||||||
|
|
@ -1479,7 +1479,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cosmic-config-derive"
|
name = "cosmic-config-derive"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
|
|
@ -1535,7 +1535,7 @@ source = "git+https://github.com/pop-os/cosmic-randr#71fabbb382fa8cf750f50fb77c4
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cosmic-protocols",
|
"cosmic-protocols",
|
||||||
"futures-lite 2.3.0",
|
"futures-lite 2.3.0",
|
||||||
"indexmap 2.5.0",
|
"indexmap 2.6.0",
|
||||||
"tachyonix",
|
"tachyonix",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
|
@ -1584,6 +1584,7 @@ dependencies = [
|
||||||
"dirs",
|
"dirs",
|
||||||
"downcast-rs",
|
"downcast-rs",
|
||||||
"eyre",
|
"eyre",
|
||||||
|
"fontdb",
|
||||||
"freedesktop-desktop-entry",
|
"freedesktop-desktop-entry",
|
||||||
"futures",
|
"futures",
|
||||||
"hostname-validator",
|
"hostname-validator",
|
||||||
|
|
@ -1592,7 +1593,7 @@ dependencies = [
|
||||||
"i18n-embed-fl",
|
"i18n-embed-fl",
|
||||||
"icu",
|
"icu",
|
||||||
"image 0.25.2",
|
"image 0.25.2",
|
||||||
"indexmap 2.5.0",
|
"indexmap 2.6.0",
|
||||||
"itertools 0.13.0",
|
"itertools 0.13.0",
|
||||||
"itoa",
|
"itoa",
|
||||||
"libcosmic",
|
"libcosmic",
|
||||||
|
|
@ -1615,6 +1616,7 @@ dependencies = [
|
||||||
"udev",
|
"udev",
|
||||||
"upower_dbus",
|
"upower_dbus",
|
||||||
"url",
|
"url",
|
||||||
|
"ustr",
|
||||||
"xkb-data",
|
"xkb-data",
|
||||||
"zbus 4.4.0",
|
"zbus 4.4.0",
|
||||||
]
|
]
|
||||||
|
|
@ -1732,7 +1734,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cosmic-theme"
|
name = "cosmic-theme"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"almost",
|
"almost",
|
||||||
"cosmic-config",
|
"cosmic-config",
|
||||||
|
|
@ -2916,6 +2918,12 @@ dependencies = [
|
||||||
"allocator-api2",
|
"allocator-api2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.15.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hassle-rs"
|
name = "hassle-rs"
|
||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
|
|
@ -3077,7 +3085,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced"
|
name = "iced"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dnd",
|
"dnd",
|
||||||
"iced_accessibility",
|
"iced_accessibility",
|
||||||
|
|
@ -3096,7 +3104,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_accessibility"
|
name = "iced_accessibility"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"accesskit",
|
"accesskit",
|
||||||
"accesskit_unix",
|
"accesskit_unix",
|
||||||
|
|
@ -3105,7 +3113,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_core"
|
name = "iced_core"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
"dnd",
|
"dnd",
|
||||||
|
|
@ -3127,7 +3135,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_futures"
|
name = "iced_futures"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"iced_core",
|
"iced_core",
|
||||||
|
|
@ -3140,7 +3148,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_graphics"
|
name = "iced_graphics"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
|
|
@ -3164,7 +3172,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_renderer"
|
name = "iced_renderer"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"iced_graphics",
|
"iced_graphics",
|
||||||
"iced_tiny_skia",
|
"iced_tiny_skia",
|
||||||
|
|
@ -3176,7 +3184,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_runtime"
|
name = "iced_runtime"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dnd",
|
"dnd",
|
||||||
"iced_accessibility",
|
"iced_accessibility",
|
||||||
|
|
@ -3190,7 +3198,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_sctk"
|
name = "iced_sctk"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"enum-repr",
|
"enum-repr",
|
||||||
"float-cmp",
|
"float-cmp",
|
||||||
|
|
@ -3216,7 +3224,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_style"
|
name = "iced_style"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"iced_core",
|
"iced_core",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
|
@ -3226,7 +3234,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_tiny_skia"
|
name = "iced_tiny_skia"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"cosmic-text",
|
"cosmic-text",
|
||||||
|
|
@ -3243,7 +3251,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_wgpu"
|
name = "iced_wgpu"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as-raw-xcb-connection",
|
"as-raw-xcb-connection",
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
|
|
@ -3272,7 +3280,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_widget"
|
name = "iced_widget"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dnd",
|
"dnd",
|
||||||
"iced_renderer",
|
"iced_renderer",
|
||||||
|
|
@ -3289,7 +3297,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_winit"
|
name = "iced_winit"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dnd",
|
"dnd",
|
||||||
"iced_graphics",
|
"iced_graphics",
|
||||||
|
|
@ -3807,12 +3815,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.5.0"
|
version = "2.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5"
|
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown 0.14.5",
|
"hashbrown 0.15.0",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -4101,7 +4109,7 @@ checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libcosmic"
|
name = "libcosmic"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#228eb4d70d581be88bacb1e261106a58603d847b"
|
source = "git+https://github.com/pop-os/libcosmic#173a9557c2f03bc5fda132e884c11bf8661256ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"apply",
|
"apply",
|
||||||
"ashpd 0.9.1",
|
"ashpd 0.9.1",
|
||||||
|
|
@ -4136,6 +4144,7 @@ dependencies = [
|
||||||
"tracing",
|
"tracing",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
"url",
|
"url",
|
||||||
|
"ustr",
|
||||||
"zbus 4.4.0",
|
"zbus 4.4.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -4167,7 +4176,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
|
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"windows-targets 0.48.5",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -4579,7 +4588,7 @@ dependencies = [
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
"codespan-reporting",
|
"codespan-reporting",
|
||||||
"hexf-parse",
|
"hexf-parse",
|
||||||
"indexmap 2.5.0",
|
"indexmap 2.6.0",
|
||||||
"log",
|
"log",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
|
|
@ -4842,7 +4851,7 @@ version = "0.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56"
|
checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-crate 1.3.1",
|
"proc-macro-crate 3.2.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.79",
|
"syn 2.0.79",
|
||||||
|
|
@ -6030,7 +6039,7 @@ version = "1.0.128"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
|
checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap 2.5.0",
|
"indexmap 2.6.0",
|
||||||
"itoa",
|
"itoa",
|
||||||
"memchr",
|
"memchr",
|
||||||
"ryu",
|
"ryu",
|
||||||
|
|
@ -6059,15 +6068,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_with"
|
name = "serde_with"
|
||||||
version = "3.9.0"
|
version = "3.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857"
|
checksum = "9720086b3357bcb44fce40117d769a4d068c70ecfa190850a980a71755f66fcc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"chrono",
|
"chrono",
|
||||||
"hex",
|
"hex",
|
||||||
"indexmap 1.9.3",
|
"indexmap 1.9.3",
|
||||||
"indexmap 2.5.0",
|
"indexmap 2.6.0",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|
@ -6077,9 +6086,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_with_macros"
|
name = "serde_with_macros"
|
||||||
version = "3.9.0"
|
version = "3.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350"
|
checksum = "5f1abbfe725f27678f4663bcacb75a83e829fd464c25d78dd038a3a29e307cec"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling 0.20.10",
|
"darling 0.20.10",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
|
@ -6560,9 +6569,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "temp-dir"
|
name = "temp-dir"
|
||||||
version = "0.1.13"
|
version = "0.1.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1f227968ec00f0e5322f9b8173c7a0cbcff6181a0a5b28e9892491c286277231"
|
checksum = "bc1ee6eef34f12f765cb94725905c6312b6610ab2b0940889cfe58dae7bc3c72"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tempfile"
|
name = "tempfile"
|
||||||
|
|
@ -6821,7 +6830,7 @@ version = "0.19.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
|
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap 2.5.0",
|
"indexmap 2.6.0",
|
||||||
"toml_datetime",
|
"toml_datetime",
|
||||||
"winnow 0.5.40",
|
"winnow 0.5.40",
|
||||||
]
|
]
|
||||||
|
|
@ -6832,7 +6841,7 @@ version = "0.22.22"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
|
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap 2.5.0",
|
"indexmap 2.6.0",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_spanned",
|
"serde_spanned",
|
||||||
"toml_datetime",
|
"toml_datetime",
|
||||||
|
|
@ -6987,9 +6996,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-bidi"
|
name = "unicode-bidi"
|
||||||
version = "0.3.15"
|
version = "0.3.17"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75"
|
checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-bidi-mirroring"
|
name = "unicode-bidi-mirroring"
|
||||||
|
|
@ -7038,9 +7047,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-properties"
|
name = "unicode-properties"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "52ea75f83c0137a9b98608359a5f1af8144876eb67bcb1ce837368e906a9f524"
|
checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-script"
|
name = "unicode-script"
|
||||||
|
|
@ -7100,6 +7109,19 @@ version = "2.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
|
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ustr"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7e904a2279a4a36d2356425bb20be271029cc650c335bc82af8bfae30085a3d0"
|
||||||
|
dependencies = [
|
||||||
|
"ahash 0.8.11",
|
||||||
|
"byteorder",
|
||||||
|
"lazy_static",
|
||||||
|
"parking_lot 0.12.3",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "usvg"
|
name = "usvg"
|
||||||
version = "0.37.0"
|
version = "0.37.0"
|
||||||
|
|
@ -7534,7 +7556,7 @@ dependencies = [
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
"cfg_aliases 0.1.1",
|
"cfg_aliases 0.1.1",
|
||||||
"codespan-reporting",
|
"codespan-reporting",
|
||||||
"indexmap 2.5.0",
|
"indexmap 2.6.0",
|
||||||
"log",
|
"log",
|
||||||
"naga",
|
"naga",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
|
@ -7630,7 +7652,7 @@ version = "0.1.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,9 @@ cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols//", rev =
|
||||||
|
|
||||||
# For development and testing purposes
|
# For development and testing purposes
|
||||||
# [patch.'https://github.com/pop-os/libcosmic']
|
# [patch.'https://github.com/pop-os/libcosmic']
|
||||||
|
# libcosmic = { git = "https://github.com/pop-os/libcosmic//", branch = "fontconfig" }
|
||||||
|
# cosmic-config = { git = "https://github.com/pop-os/libcosmic//", branch = "fontconfig" }
|
||||||
|
# cosmic-theme = { git = "https://github.com/pop-os/libcosmic//", branch = "fontconfig" }
|
||||||
# libcosmic = { path = "../libcosmic" }
|
# libcosmic = { path = "../libcosmic" }
|
||||||
# cosmic-config = { path = "../libcosmic/cosmic-config" }
|
# cosmic-config = { path = "../libcosmic/cosmic-config" }
|
||||||
# cosmic-theme = { path = "../libcosmic/cosmic-theme" }
|
# cosmic-theme = { path = "../libcosmic/cosmic-theme" }
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,8 @@ bluez-zbus = { git = "https://github.com/pop-os/dbus-settings-bindings" }
|
||||||
url = "2.5.2"
|
url = "2.5.2"
|
||||||
xkb-data = "0.2.1"
|
xkb-data = "0.2.1"
|
||||||
zbus = { version = "4.4.0", features = ["tokio"] }
|
zbus = { version = "4.4.0", features = ["tokio"] }
|
||||||
|
ustr = "1.0.0"
|
||||||
|
fontdb = "0.16.2"
|
||||||
|
|
||||||
[dependencies.cosmic-settings-subscriptions]
|
[dependencies.cosmic-settings-subscriptions]
|
||||||
git = "https://github.com/pop-os/cosmic-settings-subscriptions"
|
git = "https://github.com/pop-os/cosmic-settings-subscriptions"
|
||||||
|
|
|
||||||
368
cosmic-settings/src/pages/desktop/appearance/font_config.rs
Normal file
368
cosmic-settings/src/pages/desktop/appearance/font_config.rs
Normal file
|
|
@ -0,0 +1,368 @@
|
||||||
|
use cosmic::{
|
||||||
|
config::{CosmicTk, FontConfig},
|
||||||
|
widget::{self, settings},
|
||||||
|
Apply, Command, Element,
|
||||||
|
};
|
||||||
|
use cosmic_config::ConfigSet;
|
||||||
|
use cosmic_settings_page::Section;
|
||||||
|
use ustr::Ustr;
|
||||||
|
|
||||||
|
const INTERFACE_FONT: &str = "interface_font";
|
||||||
|
const MONOSPACE_FONT: &str = "monospace_font";
|
||||||
|
|
||||||
|
pub fn section() -> Section<crate::pages::Message> {
|
||||||
|
crate::slab!(descriptions {
|
||||||
|
font_family_txt = fl!("font-family");
|
||||||
|
font_weight_txt = fl!("font-weight");
|
||||||
|
font_stretch_txt = fl!("font-stretch");
|
||||||
|
font_style_txt = fl!("font-style");
|
||||||
|
interface_font_txt = fl!("interface-font");
|
||||||
|
monospace_font_txt = fl!("monospace-font");
|
||||||
|
});
|
||||||
|
|
||||||
|
Section::default()
|
||||||
|
.title(fl!("font-config"))
|
||||||
|
.descriptions(descriptions)
|
||||||
|
.view::<super::Page>(move |_binder, page, section| {
|
||||||
|
let descriptions = §ion.descriptions;
|
||||||
|
|
||||||
|
let interface_font_family = settings::item::builder(&descriptions[font_family_txt])
|
||||||
|
.control(widget::dropdown(
|
||||||
|
&page.font_config.interface_font_families,
|
||||||
|
page.font_config.interface_font_family,
|
||||||
|
|id| super::Message::FontConfig(Message::InterfaceFontFamily(id)),
|
||||||
|
));
|
||||||
|
|
||||||
|
let interface_font_weight = settings::item::builder(&descriptions[font_weight_txt])
|
||||||
|
.control(widget::dropdown(
|
||||||
|
&page.font_config.font_weights,
|
||||||
|
page.font_config.interface_font_weight,
|
||||||
|
|id| super::Message::FontConfig(Message::InterfaceFontWeight(id)),
|
||||||
|
));
|
||||||
|
|
||||||
|
let interface_font_stretch = settings::item::builder(&descriptions[font_stretch_txt])
|
||||||
|
.control(widget::dropdown(
|
||||||
|
&page.font_config.font_stretches,
|
||||||
|
page.font_config.interface_font_stretch,
|
||||||
|
|id| super::Message::FontConfig(Message::InterfaceFontStretch(id)),
|
||||||
|
));
|
||||||
|
|
||||||
|
let interface_font_style = settings::item::builder(&descriptions[font_style_txt])
|
||||||
|
.control(widget::dropdown(
|
||||||
|
&page.font_config.font_styles,
|
||||||
|
page.font_config.interface_font_style,
|
||||||
|
|id| super::Message::FontConfig(Message::InterfaceFontStyle(id)),
|
||||||
|
));
|
||||||
|
|
||||||
|
let monospace_font_family = settings::item::builder(&descriptions[font_family_txt])
|
||||||
|
.control(widget::dropdown(
|
||||||
|
&page.font_config.monospace_font_families,
|
||||||
|
page.font_config.monospace_font_family,
|
||||||
|
|id| super::Message::FontConfig(Message::MonospaceFontFamily(id)),
|
||||||
|
));
|
||||||
|
|
||||||
|
let monospace_font_weight = settings::item::builder(&descriptions[font_weight_txt])
|
||||||
|
.control(widget::dropdown(
|
||||||
|
&page.font_config.font_weights,
|
||||||
|
page.font_config.monospace_font_weight,
|
||||||
|
|id| super::Message::FontConfig(Message::MonospaceFontWeight(id)),
|
||||||
|
));
|
||||||
|
|
||||||
|
let interface_font = settings::section()
|
||||||
|
.title(&descriptions[interface_font_txt])
|
||||||
|
.add(interface_font_family)
|
||||||
|
.add(interface_font_weight)
|
||||||
|
.add(interface_font_stretch)
|
||||||
|
.add(interface_font_style);
|
||||||
|
|
||||||
|
let monospace_font = settings::section()
|
||||||
|
.title(&descriptions[monospace_font_txt])
|
||||||
|
.add(monospace_font_family)
|
||||||
|
.add(monospace_font_weight);
|
||||||
|
|
||||||
|
widget::column::with_capacity(2)
|
||||||
|
.push(interface_font)
|
||||||
|
.push(monospace_font)
|
||||||
|
.spacing(8)
|
||||||
|
.apply(Element::from)
|
||||||
|
.map(crate::pages::Message::Appearance)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub enum Message {
|
||||||
|
InterfaceFontFamily(usize),
|
||||||
|
InterfaceFontStretch(usize),
|
||||||
|
InterfaceFontStyle(usize),
|
||||||
|
InterfaceFontWeight(usize),
|
||||||
|
LoadedFonts(Vec<String>, Vec<String>),
|
||||||
|
MonospaceFontFamily(usize),
|
||||||
|
MonospaceFontWeight(usize),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Default)]
|
||||||
|
pub struct Model {
|
||||||
|
pub font_weights: Vec<String>,
|
||||||
|
pub font_stretches: Vec<String>,
|
||||||
|
pub font_styles: Vec<String>,
|
||||||
|
pub interface_font_families: Vec<String>,
|
||||||
|
pub interface_font_family: Option<usize>,
|
||||||
|
pub interface_font_weight: Option<usize>,
|
||||||
|
pub interface_font_stretch: Option<usize>,
|
||||||
|
pub interface_font_style: Option<usize>,
|
||||||
|
pub monospace_font_families: Vec<String>,
|
||||||
|
pub monospace_font_family: Option<usize>,
|
||||||
|
pub monospace_font_weight: Option<usize>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Model {
|
||||||
|
pub fn new() -> Model {
|
||||||
|
Model {
|
||||||
|
font_weights: vec![
|
||||||
|
fl!("font-weight", "thin"),
|
||||||
|
fl!("font-weight", "extra-light"),
|
||||||
|
fl!("font-weight", "light"),
|
||||||
|
fl!("font-weight", "normal"),
|
||||||
|
fl!("font-weight", "medium"),
|
||||||
|
fl!("font-weight", "semibold"),
|
||||||
|
fl!("font-weight", "bold"),
|
||||||
|
fl!("font-weight", "extra-bold"),
|
||||||
|
fl!("font-weight", "black"),
|
||||||
|
],
|
||||||
|
|
||||||
|
font_stretches: vec![
|
||||||
|
fl!("font-stretch", "condensed"),
|
||||||
|
fl!("font-stretch", "normal"),
|
||||||
|
fl!("font-stretch", "expanded"),
|
||||||
|
],
|
||||||
|
|
||||||
|
font_styles: vec![
|
||||||
|
fl!("font-style", "normal"),
|
||||||
|
fl!("font-style", "italic"),
|
||||||
|
fl!("font-style", "oblique"),
|
||||||
|
],
|
||||||
|
|
||||||
|
interface_font_families: Vec::new(),
|
||||||
|
interface_font_family: None,
|
||||||
|
interface_font_stretch: None,
|
||||||
|
interface_font_style: None,
|
||||||
|
interface_font_weight: None,
|
||||||
|
monospace_font_families: Vec::new(),
|
||||||
|
monospace_font_family: None,
|
||||||
|
monospace_font_weight: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn update(&mut self, message: Message) -> Command<crate::app::Message> {
|
||||||
|
match message {
|
||||||
|
Message::InterfaceFontFamily(id) => {
|
||||||
|
if let Some(family) = self.interface_font_families.get(id) {
|
||||||
|
update_config(
|
||||||
|
INTERFACE_FONT,
|
||||||
|
FontConfig {
|
||||||
|
family: Ustr::from(family),
|
||||||
|
..cosmic::config::interface_font()
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
self.interface_font_family = Some(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Message::InterfaceFontStretch(id) => {
|
||||||
|
update_config(
|
||||||
|
INTERFACE_FONT,
|
||||||
|
FontConfig {
|
||||||
|
stretch: font_stretch_by_id(id),
|
||||||
|
..cosmic::config::interface_font()
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
self.interface_font_stretch = Some(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Message::InterfaceFontStyle(id) => {
|
||||||
|
update_config(
|
||||||
|
INTERFACE_FONT,
|
||||||
|
FontConfig {
|
||||||
|
style: font_style_by_id(id),
|
||||||
|
..cosmic::config::interface_font()
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
self.interface_font_style = Some(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Message::InterfaceFontWeight(id) => {
|
||||||
|
update_config(
|
||||||
|
INTERFACE_FONT,
|
||||||
|
FontConfig {
|
||||||
|
weight: font_weight_by_id(id),
|
||||||
|
..cosmic::config::interface_font()
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
self.interface_font_weight = Some(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Message::LoadedFonts(interface, mono) => {
|
||||||
|
self.interface_font_families = interface;
|
||||||
|
self.monospace_font_families = mono;
|
||||||
|
|
||||||
|
let interface_font = cosmic::config::interface_font();
|
||||||
|
let monospace_font = cosmic::config::monospace_font();
|
||||||
|
|
||||||
|
self.interface_font_stretch = font_stretch_to_pos(interface_font.stretch);
|
||||||
|
self.interface_font_style = font_style_to_pos(interface_font.style);
|
||||||
|
self.interface_font_weight = font_weight_to_pos(interface_font.weight);
|
||||||
|
self.interface_font_family =
|
||||||
|
font_family_to_pos(&self.interface_font_families, &interface_font.family);
|
||||||
|
|
||||||
|
self.monospace_font_weight = font_weight_to_pos(monospace_font.weight);
|
||||||
|
self.monospace_font_family =
|
||||||
|
font_family_to_pos(&self.monospace_font_families, &monospace_font.family);
|
||||||
|
}
|
||||||
|
|
||||||
|
Message::MonospaceFontFamily(id) => {
|
||||||
|
if let Some(family) = self.monospace_font_families.get(id) {
|
||||||
|
update_config(
|
||||||
|
MONOSPACE_FONT,
|
||||||
|
FontConfig {
|
||||||
|
family: Ustr::from(family),
|
||||||
|
..cosmic::config::monospace_font()
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
self.monospace_font_family = Some(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Message::MonospaceFontWeight(id) => {
|
||||||
|
update_config(
|
||||||
|
MONOSPACE_FONT,
|
||||||
|
FontConfig {
|
||||||
|
weight: font_weight_by_id(id),
|
||||||
|
..cosmic::config::monospace_font()
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
self.monospace_font_weight = Some(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Command::none()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn font_family_to_pos(families: &[String], family: &str) -> Option<usize> {
|
||||||
|
families.iter().position(|f| f.as_str() == family)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn font_weight_by_id(id: usize) -> cosmic::iced::font::Weight {
|
||||||
|
match id {
|
||||||
|
0 => cosmic::iced::font::Weight::Thin,
|
||||||
|
1 => cosmic::iced::font::Weight::ExtraLight,
|
||||||
|
2 => cosmic::iced::font::Weight::Light,
|
||||||
|
3 => cosmic::iced::font::Weight::Normal,
|
||||||
|
4 => cosmic::iced::font::Weight::Medium,
|
||||||
|
5 => cosmic::iced::font::Weight::Semibold,
|
||||||
|
6 => cosmic::iced::font::Weight::Bold,
|
||||||
|
7 => cosmic::iced::font::Weight::ExtraBold,
|
||||||
|
8 => cosmic::iced::font::Weight::Black,
|
||||||
|
_ => cosmic::iced::font::Weight::Normal,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fn font_weight_to_pos(weight: cosmic::iced::font::Weight) -> Option<usize> {
|
||||||
|
match weight {
|
||||||
|
cosmic::iced::font::Weight::Thin => Some(0),
|
||||||
|
cosmic::iced::font::Weight::Light => Some(1),
|
||||||
|
cosmic::iced::font::Weight::ExtraLight => Some(2),
|
||||||
|
cosmic::iced::font::Weight::Normal => Some(3),
|
||||||
|
cosmic::iced::font::Weight::Medium => Some(4),
|
||||||
|
cosmic::iced::font::Weight::Semibold => Some(5),
|
||||||
|
cosmic::iced::font::Weight::Bold => Some(6),
|
||||||
|
cosmic::iced::font::Weight::ExtraBold => Some(7),
|
||||||
|
cosmic::iced::font::Weight::Black => Some(8),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn font_stretch_by_id(id: usize) -> cosmic::iced::font::Stretch {
|
||||||
|
match id {
|
||||||
|
0 => cosmic::iced::font::Stretch::Condensed,
|
||||||
|
1 => cosmic::iced::font::Stretch::Normal,
|
||||||
|
2 => cosmic::iced::font::Stretch::Expanded,
|
||||||
|
_ => cosmic::iced::font::Stretch::Normal,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn font_stretch_to_pos(stretch: cosmic::iced::font::Stretch) -> Option<usize> {
|
||||||
|
match stretch {
|
||||||
|
cosmic::iced::font::Stretch::Condensed => Some(0),
|
||||||
|
cosmic::iced::font::Stretch::Normal => Some(1),
|
||||||
|
cosmic::iced::font::Stretch::Expanded => Some(2),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn font_style_by_id(id: usize) -> cosmic::iced::font::Style {
|
||||||
|
match id {
|
||||||
|
0 => cosmic::iced::font::Style::Normal,
|
||||||
|
1 => cosmic::iced::font::Style::Italic,
|
||||||
|
2 => cosmic::iced::font::Style::Oblique,
|
||||||
|
_ => cosmic::iced::font::Style::Normal,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn font_style_to_pos(style: cosmic::iced::font::Style) -> Option<usize> {
|
||||||
|
match style {
|
||||||
|
cosmic::iced::font::Style::Normal => Some(0),
|
||||||
|
cosmic::iced::font::Style::Italic => Some(1),
|
||||||
|
cosmic::iced::font::Style::Oblique => Some(2),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update_config(variant: &str, font: FontConfig) {
|
||||||
|
if let Ok(config) = CosmicTk::config() {
|
||||||
|
_ = config.set(variant, font);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn load_font_families() -> (Vec<String>, Vec<String>) {
|
||||||
|
let mut font_system = cosmic::iced::advanced::graphics::text::font_system()
|
||||||
|
.write()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let (mut interface, mut mono) = font_system.raw().db().faces().fold(
|
||||||
|
(Vec::new(), Vec::new()),
|
||||||
|
|(mut interface, mut mono), face| {
|
||||||
|
if face.stretch != fontdb::Stretch::Normal
|
||||||
|
|| face.weight != fontdb::Weight::NORMAL
|
||||||
|
|| face.style != fontdb::Style::Normal
|
||||||
|
{
|
||||||
|
return (interface, mono);
|
||||||
|
}
|
||||||
|
|
||||||
|
let font_name = match face.families.first() {
|
||||||
|
Some(name) => &name.0,
|
||||||
|
None => return (interface, mono),
|
||||||
|
};
|
||||||
|
|
||||||
|
if face.monospaced {
|
||||||
|
if mono.last().map_or(true, |name| name != font_name) {
|
||||||
|
mono.push(font_name.clone());
|
||||||
|
}
|
||||||
|
} else if interface.last().map_or(true, |name| name != font_name) {
|
||||||
|
interface.push(font_name.clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
(interface, mono)
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
interface.sort_unstable();
|
||||||
|
interface.dedup();
|
||||||
|
mono.sort_unstable();
|
||||||
|
mono.dedup();
|
||||||
|
|
||||||
|
(interface, mono)
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright 2023 System76 <info@system76.com>
|
// Copyright 2023 System76 <info@system76.com>
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
|
pub mod font_config;
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
@ -85,12 +87,13 @@ pub struct Page {
|
||||||
interface_text: ColorPickerModel,
|
interface_text: ColorPickerModel,
|
||||||
control_component: ColorPickerModel,
|
control_component: ColorPickerModel,
|
||||||
roundness: Roundness,
|
roundness: Roundness,
|
||||||
density: Density,
|
|
||||||
|
|
||||||
icon_theme_active: Option<usize>,
|
icon_theme_active: Option<usize>,
|
||||||
icon_themes: IconThemes,
|
icon_themes: IconThemes,
|
||||||
icon_handles: IconHandles,
|
icon_handles: IconHandles,
|
||||||
|
|
||||||
|
font_config: font_config::Model,
|
||||||
|
|
||||||
theme: Theme,
|
theme: Theme,
|
||||||
theme_mode: ThemeMode,
|
theme_mode: ThemeMode,
|
||||||
theme_mode_config: Option<Config>,
|
theme_mode_config: Option<Config>,
|
||||||
|
|
@ -99,7 +102,6 @@ pub struct Page {
|
||||||
|
|
||||||
auto_switch_descs: [Cow<'static, str>; 4],
|
auto_switch_descs: [Cow<'static, str>; 4],
|
||||||
|
|
||||||
tk: CosmicTk,
|
|
||||||
tk_config: Option<Config>,
|
tk_config: Option<Config>,
|
||||||
|
|
||||||
day_time: bool,
|
day_time: bool,
|
||||||
|
|
@ -132,17 +134,15 @@ impl
|
||||||
Option<Config>,
|
Option<Config>,
|
||||||
ThemeBuilder,
|
ThemeBuilder,
|
||||||
Option<Config>,
|
Option<Config>,
|
||||||
CosmicTk,
|
|
||||||
)> for Page
|
)> for Page
|
||||||
{
|
{
|
||||||
fn from(
|
fn from(
|
||||||
(theme_mode_config, theme_mode, theme_builder_config, theme_builder, tk_config, tk): (
|
(theme_mode_config, theme_mode, theme_builder_config, theme_builder, tk_config): (
|
||||||
Option<Config>,
|
Option<Config>,
|
||||||
ThemeMode,
|
ThemeMode,
|
||||||
Option<Config>,
|
Option<Config>,
|
||||||
ThemeBuilder,
|
ThemeBuilder,
|
||||||
Option<Config>,
|
Option<Config>,
|
||||||
CosmicTk,
|
|
||||||
),
|
),
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let theme = if theme_mode.is_dark {
|
let theme = if theme_mode.is_dark {
|
||||||
|
|
@ -150,6 +150,7 @@ impl
|
||||||
} else {
|
} else {
|
||||||
Theme::light_default()
|
Theme::light_default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let custom_accent = theme_builder.accent.filter(|c| {
|
let custom_accent = theme_builder.accent.filter(|c| {
|
||||||
let c = Srgba::new(c.red, c.green, c.blue, 1.0);
|
let c = Srgba::new(c.red, c.green, c.blue, 1.0);
|
||||||
c != theme.palette.accent_blue
|
c != theme.palette.accent_blue
|
||||||
|
|
@ -171,7 +172,6 @@ impl
|
||||||
},
|
},
|
||||||
context_view: None,
|
context_view: None,
|
||||||
roundness: theme_builder.corner_radii.into(),
|
roundness: theme_builder.corner_radii.into(),
|
||||||
density: tk.interface_density.into(),
|
|
||||||
custom_accent: ColorPickerModel::new(
|
custom_accent: ColorPickerModel::new(
|
||||||
&*HEX,
|
&*HEX,
|
||||||
&*RGB,
|
&*RGB,
|
||||||
|
|
@ -209,6 +209,7 @@ impl
|
||||||
theme_builder.window_hint.map(Color::from),
|
theme_builder.window_hint.map(Color::from),
|
||||||
),
|
),
|
||||||
no_custom_window_hint: theme_builder.window_hint.is_none(),
|
no_custom_window_hint: theme_builder.window_hint.is_none(),
|
||||||
|
font_config: font_config::Model::new(),
|
||||||
icon_theme_active: None,
|
icon_theme_active: None,
|
||||||
icon_themes: Vec::new(),
|
icon_themes: Vec::new(),
|
||||||
icon_handles: Vec::new(),
|
icon_handles: Vec::new(),
|
||||||
|
|
@ -218,7 +219,6 @@ impl
|
||||||
theme_mode,
|
theme_mode,
|
||||||
theme_builder,
|
theme_builder,
|
||||||
tk_config,
|
tk_config,
|
||||||
tk,
|
|
||||||
day_time: true,
|
day_time: true,
|
||||||
auto_switch_descs: [
|
auto_switch_descs: [
|
||||||
fl!("auto-switch", "sunrise").into(),
|
fl!("auto-switch", "sunrise").into(),
|
||||||
|
|
@ -258,25 +258,14 @@ impl From<(Option<Config>, ThemeMode)> for Page {
|
||||||
);
|
);
|
||||||
|
|
||||||
let tk_config = CosmicTk::config().ok();
|
let tk_config = CosmicTk::config().ok();
|
||||||
let tk = match tk_config.as_ref().map(CosmicTk::get_entry) {
|
|
||||||
Some(Ok(c)) => c,
|
Self::from((
|
||||||
Some(Err((errs, c))) => {
|
|
||||||
for err in errs {
|
|
||||||
tracing::error!(?err, "Error loading CosmicTk");
|
|
||||||
}
|
|
||||||
c
|
|
||||||
}
|
|
||||||
None => CosmicTk::default(),
|
|
||||||
};
|
|
||||||
(
|
|
||||||
theme_mode_config,
|
theme_mode_config,
|
||||||
theme_mode,
|
theme_mode,
|
||||||
theme_builder_config,
|
theme_builder_config,
|
||||||
theme_builder,
|
theme_builder,
|
||||||
tk_config,
|
tk_config,
|
||||||
tk,
|
))
|
||||||
)
|
|
||||||
.into()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -296,6 +285,7 @@ pub enum Message {
|
||||||
ExportError,
|
ExportError,
|
||||||
ExportFile(Arc<SelectedFiles>),
|
ExportFile(Arc<SelectedFiles>),
|
||||||
ExportSuccess,
|
ExportSuccess,
|
||||||
|
FontConfig(font_config::Message),
|
||||||
GapSize(spin_button::Message),
|
GapSize(spin_button::Message),
|
||||||
IconTheme(usize),
|
IconTheme(usize),
|
||||||
ImportError,
|
ImportError,
|
||||||
|
|
@ -386,7 +376,10 @@ impl Page {
|
||||||
settings::section().add(
|
settings::section().add(
|
||||||
settings::item::builder(fl!("enable-export"))
|
settings::item::builder(fl!("enable-export"))
|
||||||
.description(fl!("enable-export", "desc"))
|
.description(fl!("enable-export", "desc"))
|
||||||
.toggler(self.tk.apply_theme_global, Message::ApplyThemeGlobal)
|
.toggler(
|
||||||
|
cosmic::config::apply_theme_global(),
|
||||||
|
Message::ApplyThemeGlobal
|
||||||
|
)
|
||||||
),
|
),
|
||||||
// Icon theme previews
|
// Icon theme previews
|
||||||
cosmic::widget::column::with_children(vec![
|
cosmic::widget::column::with_children(vec![
|
||||||
|
|
@ -473,8 +466,7 @@ impl Page {
|
||||||
self.icon_theme_active = Some(id);
|
self.icon_theme_active = Some(id);
|
||||||
|
|
||||||
if let Some(ref config) = self.tk_config {
|
if let Some(ref config) = self.tk_config {
|
||||||
let _ = self.tk.write_entry(config);
|
_ = config.set::<String>("icon-theme", theme.id);
|
||||||
_ = self.tk.set_icon_theme(config, theme.id.clone());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tokio::spawn(set_gnome_icon_theme(theme.name));
|
tokio::spawn(set_gnome_icon_theme(theme.name));
|
||||||
|
|
@ -681,20 +673,19 @@ impl Page {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Message::Density(d) => {
|
Message::Density(density) => {
|
||||||
needs_sync = true;
|
needs_sync = true;
|
||||||
self.density = d;
|
|
||||||
|
|
||||||
if let Some(config) = self.tk_config.as_mut() {
|
if let Some(config) = self.tk_config.as_mut() {
|
||||||
let _density = self.tk.set_interface_density(config, d);
|
_ = config.set("interface_density", density);
|
||||||
let _header = self.tk.set_header_size(config, d);
|
_ = config.set("header_size", density);
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some(config) = self.theme_builder_config.as_ref() else {
|
let Some(config) = self.theme_builder_config.as_ref() else {
|
||||||
return Command::none();
|
return Command::none();
|
||||||
};
|
};
|
||||||
|
|
||||||
let spacing = self.density.into();
|
let spacing = density.into();
|
||||||
|
|
||||||
if self
|
if self
|
||||||
.theme_builder
|
.theme_builder
|
||||||
|
|
@ -705,19 +696,19 @@ impl Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
tokio::task::spawn(async move {
|
tokio::task::spawn(async move {
|
||||||
Self::update_panel_spacing(d);
|
Self::update_panel_spacing(density);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Message::Entered((icon_themes, icon_handles)) => {
|
Message::Entered((icon_themes, icon_handles)) => {
|
||||||
*self = Self::default();
|
let active_icon_theme = cosmic::config::icon_theme();
|
||||||
|
|
||||||
// Set the icon themes, and define the active icon theme.
|
// Set the icon themes, and define the active icon theme.
|
||||||
self.icon_themes = icon_themes;
|
self.icon_themes = icon_themes;
|
||||||
self.icon_theme_active = self
|
self.icon_theme_active = self
|
||||||
.icon_themes
|
.icon_themes
|
||||||
.iter()
|
.iter()
|
||||||
.position(|theme| &theme.id == &self.tk.icon_theme);
|
.position(|theme| &theme.id == &active_icon_theme);
|
||||||
self.icon_handles = icon_handles;
|
self.icon_handles = icon_handles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -979,8 +970,8 @@ impl Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
Message::ApplyThemeGlobal(enabled) => {
|
Message::ApplyThemeGlobal(enabled) => {
|
||||||
if let Some(tk_config) = self.tk_config.as_ref() {
|
if let Some(config) = self.tk_config.as_ref() {
|
||||||
_ = self.tk.set_apply_theme_global(tk_config, enabled);
|
_ = config.set("apply_theme_global", enabled);
|
||||||
} else {
|
} else {
|
||||||
tracing::error!("Failed to apply theme to GNOME config because the CosmicTK config does not exist.");
|
tracing::error!("Failed to apply theme to GNOME config because the CosmicTK config does not exist.");
|
||||||
}
|
}
|
||||||
|
|
@ -997,6 +988,10 @@ impl Page {
|
||||||
self.day_time = day_time;
|
self.day_time = day_time;
|
||||||
return Command::none();
|
return Command::none();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Message::FontConfig(message) => {
|
||||||
|
return self.font_config.update(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the theme builder changed, write a new theme to disk on a background thread.
|
// If the theme builder changed, write a new theme to disk on a background thread.
|
||||||
|
|
@ -1078,6 +1073,7 @@ impl Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reload_theme_mode(&mut self) {
|
fn reload_theme_mode(&mut self) {
|
||||||
|
let font_config = std::mem::take(&mut self.font_config);
|
||||||
let icon_themes = std::mem::take(&mut self.icon_themes);
|
let icon_themes = std::mem::take(&mut self.icon_themes);
|
||||||
let icon_handles = std::mem::take(&mut self.icon_handles);
|
let icon_handles = std::mem::take(&mut self.icon_handles);
|
||||||
let icon_theme_active = self.icon_theme_active.take();
|
let icon_theme_active = self.icon_theme_active.take();
|
||||||
|
|
@ -1088,6 +1084,7 @@ impl Page {
|
||||||
self.icon_themes = icon_themes;
|
self.icon_themes = icon_themes;
|
||||||
self.icon_handles = icon_handles;
|
self.icon_handles = icon_handles;
|
||||||
self.icon_theme_active = icon_theme_active;
|
self.icon_theme_active = icon_theme_active;
|
||||||
|
self.font_config = font_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_color_picker(
|
fn update_color_picker(
|
||||||
|
|
@ -1304,6 +1301,7 @@ impl page::Page<crate::pages::Message> for Page {
|
||||||
sections.insert(mode_and_colors()),
|
sections.insert(mode_and_colors()),
|
||||||
sections.insert(style()),
|
sections.insert(style()),
|
||||||
sections.insert(interface_density()),
|
sections.insert(interface_density()),
|
||||||
|
sections.insert(font_config::section()),
|
||||||
sections.insert(window_management()),
|
sections.insert(window_management()),
|
||||||
sections.insert(experimental()),
|
sections.insert(experimental()),
|
||||||
sections.insert(reset_button()),
|
sections.insert(reset_button()),
|
||||||
|
|
@ -1335,7 +1333,16 @@ impl page::Page<crate::pages::Message> for Page {
|
||||||
_: page::Entity,
|
_: page::Entity,
|
||||||
_sender: tokio::sync::mpsc::Sender<crate::pages::Message>,
|
_sender: tokio::sync::mpsc::Sender<crate::pages::Message>,
|
||||||
) -> Command<crate::pages::Message> {
|
) -> Command<crate::pages::Message> {
|
||||||
command::future(fetch_icon_themes()).map(crate::pages::Message::Appearance)
|
command::batch(vec![
|
||||||
|
// Load icon themes
|
||||||
|
command::future(fetch_icon_themes()).map(crate::pages::Message::Appearance),
|
||||||
|
// Load font families
|
||||||
|
command::future(async move {
|
||||||
|
let (mono, interface) = font_config::load_font_families();
|
||||||
|
Message::FontConfig(font_config::Message::LoadedFonts(mono, interface))
|
||||||
|
})
|
||||||
|
.map(crate::pages::Message::Appearance),
|
||||||
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_leave(&mut self) -> Command<crate::pages::Message> {
|
fn on_leave(&mut self) -> Command<crate::pages::Message> {
|
||||||
|
|
@ -1768,11 +1775,11 @@ pub fn style() -> Section<crate::pages::Message> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn interface_density() -> Section<crate::pages::Message> {
|
pub fn interface_density() -> Section<crate::pages::Message> {
|
||||||
let mut descriptions = Slab::new();
|
crate::slab!(descriptions {
|
||||||
|
comfortable = fl!("interface-density", "comfortable");
|
||||||
let comfortable = descriptions.insert(fl!("interface-density", "comfortable"));
|
compact = fl!("interface-density", "compact");
|
||||||
let compact = descriptions.insert(fl!("interface-density", "compact"));
|
spacious = fl!("interface-density", "spacious");
|
||||||
let spacious = descriptions.insert(fl!("interface-density", "spacious"));
|
});
|
||||||
|
|
||||||
Section::default()
|
Section::default()
|
||||||
.title(fl!("interface-density"))
|
.title(fl!("interface-density"))
|
||||||
|
|
@ -1780,12 +1787,14 @@ pub fn interface_density() -> Section<crate::pages::Message> {
|
||||||
.view::<Page>(move |_binder, page, section| {
|
.view::<Page>(move |_binder, page, section| {
|
||||||
let descriptions = §ion.descriptions;
|
let descriptions = §ion.descriptions;
|
||||||
|
|
||||||
|
let density = cosmic::config::interface_density();
|
||||||
|
|
||||||
settings::section()
|
settings::section()
|
||||||
.title(§ion.title)
|
.title(§ion.title)
|
||||||
.add(settings::item_row(vec![radio(
|
.add(settings::item_row(vec![radio(
|
||||||
text::body(&descriptions[compact]),
|
text::body(&descriptions[compact]),
|
||||||
Density::Compact,
|
Density::Compact,
|
||||||
Some(page.density),
|
Some(density),
|
||||||
Message::Density,
|
Message::Density,
|
||||||
)
|
)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
|
|
@ -1793,7 +1802,7 @@ pub fn interface_density() -> Section<crate::pages::Message> {
|
||||||
.add(settings::item_row(vec![radio(
|
.add(settings::item_row(vec![radio(
|
||||||
text::body(&descriptions[comfortable]),
|
text::body(&descriptions[comfortable]),
|
||||||
Density::Standard,
|
Density::Standard,
|
||||||
Some(page.density),
|
Some(density),
|
||||||
Message::Density,
|
Message::Density,
|
||||||
)
|
)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
|
|
@ -1801,7 +1810,7 @@ pub fn interface_density() -> Section<crate::pages::Message> {
|
||||||
.add(settings::item_row(vec![radio(
|
.add(settings::item_row(vec![radio(
|
||||||
text::body(&descriptions[spacious]),
|
text::body(&descriptions[spacious]),
|
||||||
Density::Spacious,
|
Density::Spacious,
|
||||||
Some(page.density),
|
Some(density),
|
||||||
Message::Density,
|
Message::Density,
|
||||||
)
|
)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
|
|
@ -1191,7 +1191,7 @@ pub fn settings() -> Section<crate::pages::Message> {
|
||||||
|
|
||||||
if page.wallpaper_service_config.same_on_all {
|
if page.wallpaper_service_config.same_on_all {
|
||||||
let element = text(fl!("all-displays"))
|
let element = text(fl!("all-displays"))
|
||||||
.font(cosmic::font::FONT_SEMIBOLD)
|
.font(cosmic::font::semibold())
|
||||||
.horizontal_alignment(alignment::Horizontal::Center)
|
.horizontal_alignment(alignment::Horizontal::Center)
|
||||||
.vertical_alignment(alignment::Vertical::Center)
|
.vertical_alignment(alignment::Vertical::Center)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
|
|
|
||||||
|
|
@ -353,7 +353,7 @@ impl<'a, Message: Clone> Widget<Message, cosmic::Theme, Renderer> for Arrangemen
|
||||||
content: itoa::Buffer::new().format(id),
|
content: itoa::Buffer::new().format(id),
|
||||||
size: core::Pixels(24.0),
|
size: core::Pixels(24.0),
|
||||||
line_height: core::text::LineHeight::Relative(1.2),
|
line_height: core::text::LineHeight::Relative(1.2),
|
||||||
font: cosmic::font::FONT_BOLD,
|
font: cosmic::font::bold(),
|
||||||
bounds: id_bounds.size(),
|
bounds: id_bounds.size(),
|
||||||
horizontal_alignment: alignment::Horizontal::Center,
|
horizontal_alignment: alignment::Horizontal::Center,
|
||||||
vertical_alignment: alignment::Vertical::Center,
|
vertical_alignment: alignment::Vertical::Center,
|
||||||
|
|
|
||||||
|
|
@ -205,6 +205,34 @@ window-management-appearance = Window Management
|
||||||
.active-hint = Active window hint size
|
.active-hint = Active window hint size
|
||||||
.gaps = Gaps around tiled windows
|
.gaps = Gaps around tiled windows
|
||||||
|
|
||||||
|
### Appearance: Font
|
||||||
|
|
||||||
|
font-config = Font Configuration
|
||||||
|
interface-font = Interface Font
|
||||||
|
monospace-font = Monospace Font
|
||||||
|
font-family = Family
|
||||||
|
|
||||||
|
font-weight = Weight
|
||||||
|
.thin = Thin
|
||||||
|
.extra-light = Extra Light
|
||||||
|
.light = Light
|
||||||
|
.normal = Normal
|
||||||
|
.medium = Medium
|
||||||
|
.semibold = Semi Bold
|
||||||
|
.bold = Bold
|
||||||
|
.extra-bold = Extra Bold
|
||||||
|
.black = Black
|
||||||
|
|
||||||
|
font-style = Style
|
||||||
|
.normal = Normal
|
||||||
|
.italic = Italic
|
||||||
|
.oblique = Oblique
|
||||||
|
|
||||||
|
font-stretch = Stretch
|
||||||
|
.condensed = Condensed
|
||||||
|
.normal = Normal
|
||||||
|
.expanded = Expanded
|
||||||
|
|
||||||
## Desktop: Notifications
|
## Desktop: Notifications
|
||||||
|
|
||||||
notifications = Notifications
|
notifications = Notifications
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue