File tree Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -14,3 +14,4 @@ serde_json = "0.6.0"
14
14
15
15
[features ]
16
16
i3-4-12 = []
17
+ i3-4-13 = [" i3-4-12" ]
Original file line number Diff line number Diff line change @@ -131,6 +131,10 @@ impl FromStr for WindowEventInfo {
131
131
"move" => WindowChange :: Move ,
132
132
"floating" => WindowChange :: Floating ,
133
133
"urgent" => WindowChange :: Urgent ,
134
+
135
+ #[ cfg( feature = "i3-4-13" ) ]
136
+ "mark" => WindowChange :: Mark ,
137
+
134
138
other => {
135
139
warn ! ( target: "i3ipc" , "Unknown WindowChange {}" , other) ;
136
140
WindowChange :: Unknown
@@ -251,6 +255,11 @@ pub mod inner {
251
255
Floating ,
252
256
/// The window has become urgent or lost its urgent status.
253
257
Urgent ,
258
+
259
+ /// A mark has been added to or removed from the window.
260
+ #[ cfg( feature = "i3-4-13" ) ]
261
+ Mark ,
262
+
254
263
/// A WindowChange we don't support yet.
255
264
Unknown ,
256
265
}
Original file line number Diff line number Diff line change @@ -467,6 +467,23 @@ impl I3Connection {
467
467
. unwrap ( ) . to_owned ( )
468
468
} )
469
469
}
470
+
471
+ /// Gets the list of currently configured binding modes.
472
+ #[ cfg( feature = "i3-4-13" ) ]
473
+ pub fn get_binding_modes ( & mut self ) -> Result < reply:: BindingModes , MessageError > {
474
+ if let Err ( e) = self . stream . send_i3_message ( 8 , "" ) {
475
+ return Err ( MessageError :: Send ( e) ) ;
476
+ }
477
+ let payload = match self . stream . receive_i3_message ( ) {
478
+ Ok ( ( _, payload) ) => payload,
479
+ Err ( e) => { return Err ( MessageError :: Receive ( e) ) ; } ,
480
+ } ;
481
+ let modes: Vec < String > = match json:: from_str ( & payload) {
482
+ Ok ( v) => v,
483
+ Err ( e) => { return Err ( MessageError :: JsonCouldntParse ( e) ) ; } ,
484
+ } ;
485
+ Ok ( reply:: BindingModes { modes : modes } )
486
+ }
470
487
}
471
488
472
489
@@ -556,6 +573,12 @@ mod test {
556
573
I3Connection :: connect ( ) . unwrap ( ) . get_version ( ) . unwrap ( ) ;
557
574
}
558
575
576
+ #[ cfg( feature = "i3-4-13" ) ]
577
+ #[ test]
578
+ fn get_binding_modes ( ) {
579
+ I3Connection :: connect ( ) . unwrap ( ) . get_binding_modes ( ) . unwrap ( ) ;
580
+ }
581
+
559
582
#[ test]
560
583
fn event_subscribe ( ) {
561
584
let s = I3EventListener :: connect ( ) . unwrap ( ) . subscribe ( & [ Subscription :: Workspace ] ) . unwrap ( ) ;
Original file line number Diff line number Diff line change @@ -354,3 +354,11 @@ pub struct Version {
354
354
/// The current config path.
355
355
pub loaded_config_file_name : String
356
356
}
357
+
358
+ /// The reply to the `get_binding_modes` request.
359
+ #[ cfg( feature = "i3-4-13" ) ]
360
+ #[ derive( Debug ) ]
361
+ pub struct BindingModes {
362
+ /// A vector of all currently configured binding modes.
363
+ pub modes : Vec < String > ,
364
+ }
You can’t perform that action at this time.
0 commit comments