File tree Expand file tree Collapse file tree 3 files changed +58
-0
lines changed Expand file tree Collapse file tree 3 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -1736,6 +1736,12 @@ pub enum Action {
1736
1736
SetDynamicCastWindowById ( u64 ) ,
1737
1737
SetDynamicCastMonitor ( #[ knuffel( argument) ] Option < String > ) ,
1738
1738
ClearDynamicCastTarget ,
1739
+ #[ knuffel( skip) ]
1740
+ ToggleUrgent ( u64 ) ,
1741
+ #[ knuffel( skip) ]
1742
+ SetUrgent ( u64 ) ,
1743
+ #[ knuffel( skip) ]
1744
+ UnsetUrgent ( u64 ) ,
1739
1745
}
1740
1746
1741
1747
impl From < niri_ipc:: Action > for Action {
@@ -2000,6 +2006,9 @@ impl From<niri_ipc::Action> for Action {
2000
2006
Self :: SetDynamicCastMonitor ( output)
2001
2007
}
2002
2008
niri_ipc:: Action :: ClearDynamicCastTarget { } => Self :: ClearDynamicCastTarget ,
2009
+ niri_ipc:: Action :: ToggleUrgent { id } => Self :: ToggleUrgent ( id) ,
2010
+ niri_ipc:: Action :: SetUrgent { id } => Self :: SetUrgent ( id) ,
2011
+ niri_ipc:: Action :: UnsetUrgent { id } => Self :: UnsetUrgent ( id) ,
2003
2012
}
2004
2013
}
2005
2014
}
Original file line number Diff line number Diff line change @@ -764,6 +764,24 @@ pub enum Action {
764
764
} ,
765
765
/// Clear the dynamic cast target, making it show nothing.
766
766
ClearDynamicCastTarget { } ,
767
+ /// Toggle urgent status of a window.
768
+ ToggleUrgent {
769
+ /// Id of the window to toggle urgent.
770
+ #[ cfg_attr( feature = "clap" , arg( long) ) ]
771
+ id : u64 ,
772
+ } ,
773
+ /// Set urgent status of a window.
774
+ SetUrgent {
775
+ /// Id of the window to set urgent.
776
+ #[ cfg_attr( feature = "clap" , arg( long) ) ]
777
+ id : u64 ,
778
+ } ,
779
+ /// Unset urgent status of a window.
780
+ UnsetUrgent {
781
+ /// Id of the window to unset urgent.
782
+ #[ cfg_attr( feature = "clap" , arg( long) ) ]
783
+ id : u64 ,
784
+ } ,
767
785
}
768
786
769
787
/// Change in window or column size.
Original file line number Diff line number Diff line change @@ -1915,6 +1915,37 @@ impl State {
1915
1915
Action :: ClearDynamicCastTarget => {
1916
1916
self . set_dynamic_cast_target ( CastTarget :: Nothing ) ;
1917
1917
}
1918
+ Action :: ToggleUrgent ( id) => {
1919
+ let window = self
1920
+ . niri
1921
+ . layout
1922
+ . workspaces_mut ( )
1923
+ . find_map ( |ws| ws. windows_mut ( ) . find ( |w| w. id ( ) . get ( ) == id) ) ;
1924
+ if let Some ( window) = window {
1925
+ let urgent = window. is_urgent ( ) ;
1926
+ window. set_urgent ( !urgent) ;
1927
+ }
1928
+ }
1929
+ Action :: SetUrgent ( id) => {
1930
+ let window = self
1931
+ . niri
1932
+ . layout
1933
+ . workspaces_mut ( )
1934
+ . find_map ( |ws| ws. windows_mut ( ) . find ( |w| w. id ( ) . get ( ) == id) ) ;
1935
+ if let Some ( window) = window {
1936
+ window. set_urgent ( true ) ;
1937
+ }
1938
+ }
1939
+ Action :: UnsetUrgent ( id) => {
1940
+ let window = self
1941
+ . niri
1942
+ . layout
1943
+ . workspaces_mut ( )
1944
+ . find_map ( |ws| ws. windows_mut ( ) . find ( |w| w. id ( ) . get ( ) == id) ) ;
1945
+ if let Some ( window) = window {
1946
+ window. set_urgent ( false ) ;
1947
+ }
1948
+ }
1918
1949
}
1919
1950
}
1920
1951
You can’t perform that action at this time.
0 commit comments