refactor: use randr kdl command
cleanup chore: update deps fix: typo
This commit is contained in:
parent
f3f7d5cfb6
commit
0e2141ac6c
5 changed files with 125 additions and 313 deletions
|
|
@ -19,6 +19,9 @@ pwd.workspace = true
|
|||
ron.workspace = true
|
||||
serde.workspace = true
|
||||
zbus.workspace = true
|
||||
cosmic-randr-shell.workspace = true
|
||||
kdl.workspace = true
|
||||
|
||||
#TODO: reduce features
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
xdg = "3.0.0"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use cosmic_comp_config::output::{self, OutputsConfig};
|
||||
use cosmic_comp_config::output::randr;
|
||||
use cosmic_config::CosmicConfigEntry;
|
||||
use kdl::KdlDocument;
|
||||
use std::{
|
||||
collections::BTreeMap,
|
||||
fs,
|
||||
|
|
@ -24,7 +25,7 @@ pub struct UserData {
|
|||
pub xkb_config_opt: Option<XkbConfig>,
|
||||
pub time_applet_config: TimeAppletConfig,
|
||||
pub accessibility_zoom: ZoomConfig,
|
||||
pub outputs: Option<OutputsConfig>,
|
||||
pub kdl_output_lists: Vec<String>,
|
||||
}
|
||||
|
||||
impl UserData {
|
||||
|
|
@ -178,10 +179,17 @@ impl UserData {
|
|||
};
|
||||
|
||||
let xdg = xdg::BaseDirectories::new();
|
||||
self.outputs = xdg.get_state_home().map(|mut s| {
|
||||
s.push("cosmic-comp/outputs.ron");
|
||||
output::load_outputs(Some(&s))
|
||||
});
|
||||
self.kdl_output_lists = xdg
|
||||
.get_state_home()
|
||||
.map(|mut s| {
|
||||
s.push("cosmic-comp/outputs.ron");
|
||||
let lists = randr::load_outputs(Some(&s));
|
||||
lists
|
||||
.into_iter()
|
||||
.map(|l| KdlDocument::from(l).to_string())
|
||||
.collect()
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
match cosmic_config::Config::new("com.system76.CosmicAppletTime", TimeAppletConfig::VERSION)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue