1
0
Fork 0
forked from wry/wry

cli: allow overriding non-desktop setting

This commit is contained in:
Julian Orth 2024-04-25 18:39:29 +02:00
parent 24d08918c4
commit 1f18b46135
5 changed files with 84 additions and 7 deletions

View file

@ -6,7 +6,7 @@ use {
utils::transform_ext::TransformExt,
wire::{jay_compositor, jay_randr, JayRandrId},
},
clap::{Args, Subcommand},
clap::{Args, Subcommand, ValueEnum},
isnt::std_1::vec::IsntVecExt,
jay_config::video::Transform,
std::{
@ -115,6 +115,21 @@ pub enum OutputCommand {
Enable,
/// Disable the output.
Disable,
/// Override the display's non-desktop setting.
NonDesktop(NonDesktopArgs),
}
#[derive(ValueEnum, Debug, Clone)]
pub enum NonDesktopType {
Default,
False,
True,
}
#[derive(Args, Debug, Clone)]
pub struct NonDesktopArgs {
/// Whether this output is a non-desktop output.
pub setting: NonDesktopType,
}
#[derive(Args, Debug, Clone)]
@ -374,6 +389,16 @@ impl Randr {
enabled: enable as _,
});
}
OutputCommand::NonDesktop(a) => {
self.handle_error(randr, move |msg| {
eprintln!("Could not change the non-desktop setting: {}", msg);
});
tc.send(jay_randr::SetNonDesktop {
self_id: randr,
output: &args.output,
non_desktop: a.setting as _,
});
}
}
tc.round_trip().await;
}