mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
Add niri msg stop-cast --session-id
This commit is contained in:
@@ -356,6 +356,8 @@ pub enum Action {
|
||||
SetDynamicCastWindowById(u64),
|
||||
SetDynamicCastMonitor(#[knuffel(argument)] Option<String>),
|
||||
ClearDynamicCastTarget,
|
||||
#[knuffel(skip)]
|
||||
StopCast(u64),
|
||||
ToggleOverview,
|
||||
OpenOverview,
|
||||
CloseOverview,
|
||||
@@ -690,6 +692,7 @@ impl From<niri_ipc::Action> for Action {
|
||||
Self::SetDynamicCastMonitor(output)
|
||||
}
|
||||
niri_ipc::Action::ClearDynamicCastTarget {} => Self::ClearDynamicCastTarget,
|
||||
niri_ipc::Action::StopCast { session_id } => Self::StopCast(session_id),
|
||||
niri_ipc::Action::ToggleOverview {} => Self::ToggleOverview,
|
||||
niri_ipc::Action::OpenOverview {} => Self::OpenOverview,
|
||||
niri_ipc::Action::CloseOverview {} => Self::CloseOverview,
|
||||
|
||||
@@ -898,6 +898,16 @@ pub enum Action {
|
||||
},
|
||||
/// Clear the dynamic cast target, making it show nothing.
|
||||
ClearDynamicCastTarget {},
|
||||
/// Stop a PipeWire screencast.
|
||||
///
|
||||
/// wlr-screencopy screencasts cannot currently be stopped via IPC.
|
||||
StopCast {
|
||||
/// Session ID of the screencast to stop.
|
||||
///
|
||||
/// If the session has multiple screencast streams, this will stop all of them.
|
||||
#[cfg_attr(feature = "clap", arg(long))]
|
||||
session_id: u64,
|
||||
},
|
||||
/// Toggle (open/close) the Overview.
|
||||
ToggleOverview {},
|
||||
/// Open the Overview.
|
||||
|
||||
+4
-1
@@ -51,7 +51,7 @@ use crate::niri::{CastTarget, PointerVisibility, State};
|
||||
use crate::ui::mru::{WindowMru, WindowMruUi};
|
||||
use crate::ui::screenshot_ui::ScreenshotUi;
|
||||
use crate::utils::spawning::{spawn, spawn_sh};
|
||||
use crate::utils::{center, get_monotonic_time, ResizeEdge};
|
||||
use crate::utils::{center, get_monotonic_time, CastSessionId, ResizeEdge};
|
||||
|
||||
pub mod backend_ext;
|
||||
pub mod move_grab;
|
||||
@@ -2241,6 +2241,9 @@ impl State {
|
||||
Action::ClearDynamicCastTarget => {
|
||||
self.set_dynamic_cast_target(CastTarget::Nothing);
|
||||
}
|
||||
Action::StopCast(session_id) => {
|
||||
self.niri.stop_cast(CastSessionId::from(session_id));
|
||||
}
|
||||
Action::ToggleOverview => {
|
||||
self.niri.layout.toggle_overview();
|
||||
self.niri.queue_redraw_all();
|
||||
|
||||
@@ -5086,6 +5086,9 @@ impl Niri {
|
||||
#[cfg(not(feature = "xdp-gnome-screencast"))]
|
||||
pub fn stop_casts_for_target(&mut self, _target: CastTarget) {}
|
||||
|
||||
#[cfg(not(feature = "xdp-gnome-screencast"))]
|
||||
pub fn stop_cast(&mut self, _session_id: crate::utils::CastSessionId) {}
|
||||
|
||||
pub fn debug_toggle_damage(&mut self) {
|
||||
self.debug_draw_damage = !self.debug_draw_damage;
|
||||
|
||||
|
||||
@@ -693,7 +693,7 @@ impl Niri {
|
||||
}
|
||||
}
|
||||
|
||||
fn stop_cast(&mut self, session_id: CastSessionId) {
|
||||
pub fn stop_cast(&mut self, session_id: CastSessionId) {
|
||||
let _span = tracy_client::span!("Niri::stop_cast");
|
||||
let _span = debug_span!("stop_cast", %session_id).entered();
|
||||
|
||||
|
||||
@@ -68,6 +68,12 @@ impl Display for CastSessionId {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<u64> for CastSessionId {
|
||||
fn from(value: u64) -> Self {
|
||||
Self(value)
|
||||
}
|
||||
}
|
||||
|
||||
/// Unique ID for a screencast stream.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct CastStreamId(u64);
|
||||
|
||||
Reference in New Issue
Block a user