forge
Explore
Log in

Don't you dare go Hollow

add {toggle,set,unset}-urgent cli actions

Browse files at this commit

9d3d7cb0e973827e5fcaa5d312a05695564a44c0Duncan OverbruckParent: 398bc78
niri-config/src/lib.rsmodified+9 -0
@@ -1874,6 +1874,12 @@ pub enum Action {
1874 ToggleOverview,1874 ToggleOverview,
1875 OpenOverview,1875 OpenOverview,
1876 CloseOverview,1876 CloseOverview,
1877+ #[knuffel(skip)]
1878+ ToggleUrgent(u64),
1879+ #[knuffel(skip)]
1880+ SetUrgent(u64),
1881+ #[knuffel(skip)]
1882+ UnsetUrgent(u64),
1877 }1883 }
1878 1884
1879 impl From<niri_ipc::Action> for Action {1885 impl From<niri_ipc::Action> for Action {
@@ -2145,6 +2151,9 @@ impl From<niri_ipc::Action> for Action {
2145 niri_ipc::Action::ToggleOverview {} => Self::ToggleOverview,2151 niri_ipc::Action::ToggleOverview {} => Self::ToggleOverview,
2146 niri_ipc::Action::OpenOverview {} => Self::OpenOverview,2152 niri_ipc::Action::OpenOverview {} => Self::OpenOverview,
2147 niri_ipc::Action::CloseOverview {} => Self::CloseOverview,2153 niri_ipc::Action::CloseOverview {} => Self::CloseOverview,
2154+ niri_ipc::Action::ToggleUrgent { id } => Self::ToggleUrgent(id),
2155+ niri_ipc::Action::SetUrgent { id } => Self::SetUrgent(id),
2156+ niri_ipc::Action::UnsetUrgent { id } => Self::UnsetUrgent(id),
2148 }2157 }
2149 }2158 }
2150 }2159 }
niri-ipc/src/lib.rsmodified+18 -0
@@ -803,6 +803,24 @@ pub enum Action {
803 OpenOverview {},803 OpenOverview {},
804 /// Close the Overview.804 /// Close the Overview.
805 CloseOverview {},805 CloseOverview {},
806+ /// Toggle urgent status of a window.
807+ ToggleUrgent {
808+ /// Id of the window to toggle urgent.
809+ #[cfg_attr(feature = "clap", arg(long))]
810+ id: u64,
811+ },
812+ /// Set urgent status of a window.
813+ SetUrgent {
814+ /// Id of the window to set urgent.
815+ #[cfg_attr(feature = "clap", arg(long))]
816+ id: u64,
817+ },
818+ /// Unset urgent status of a window.
819+ UnsetUrgent {
820+ /// Id of the window to unset urgent.
821+ #[cfg_attr(feature = "clap", arg(long))]
822+ id: u64,
823+ },
806 }824 }
807 825
808 /// Change in window or column size.826 /// Change in window or column size.
src/input/mod.rsmodified+31 -0
@@ -1971,6 +1971,37 @@ impl State {
1971 self.niri.queue_redraw_all();1971 self.niri.queue_redraw_all();
1972 }1972 }
1973 }1973 }
1974+ Action::ToggleUrgent(id) => {
1975+ let window = self
1976+ .niri
1977+ .layout
1978+ .workspaces_mut()
1979+ .find_map(|ws| ws.windows_mut().find(|w| w.id().get() == id));
1980+ if let Some(window) = window {
1981+ let urgent = window.is_urgent();
1982+ window.set_urgent(!urgent);
1983+ }
1984+ }
1985+ Action::SetUrgent(id) => {
1986+ let window = self
1987+ .niri
1988+ .layout
1989+ .workspaces_mut()
1990+ .find_map(|ws| ws.windows_mut().find(|w| w.id().get() == id));
1991+ if let Some(window) = window {
1992+ window.set_urgent(true);
1993+ }
1994+ }
1995+ Action::UnsetUrgent(id) => {
1996+ let window = self
1997+ .niri
1998+ .layout
1999+ .workspaces_mut()
2000+ .find_map(|ws| ws.windows_mut().find(|w| w.id().get() == id));
2001+ if let Some(window) = window {
2002+ window.set_urgent(false);
2003+ }
2004+ }
1974 }2005 }
1975 }2006 }
1976 2007