feat: support color picker functionality

chore: format code

refactor: improve quality

feat: implement gnomes PickColor method

refactor: minor code extraction

misc: fix reviews

fixes
This commit is contained in:
nnyyxxxx
2025-03-06 17:24:44 -05:00
committed by Ivan Molodetskikh
parent ed20822ce9
commit 7210045b2a
8 changed files with 343 additions and 3 deletions

View File

@@ -65,6 +65,8 @@ pub enum Request {
FocusedWindow,
/// Request picking a window and get its information.
PickWindow,
/// Request picking a color from the screen.
PickColor,
/// Perform an action.
Action(Action),
/// Change output configuration temporarily.
@@ -133,10 +135,20 @@ pub enum Response {
FocusedWindow(Option<Window>),
/// Information about the picked window.
PickedWindow(Option<Window>),
/// Information about the picked color.
PickedColor(Option<PickedColor>),
/// Output configuration change result.
OutputConfigChanged(OutputConfigChanged),
}
/// Color picked from the screen.
#[derive(Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "json-schema", derive(schemars::JsonSchema))]
pub struct PickedColor {
/// Color values as red, green, blue, each ranging from 0.0 to 1.0.
pub rgb: [f64; 3],
}
/// Actions that niri can perform.
// Variants in this enum should match the spelling of the ones in niri-config. Most, but not all,
// variants from niri-config should be present here.