diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-09-06 15:10:01 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-09-06 18:32:41 +0300 |
| commit | dcb29efce58ce0e122806b7f352a9f682e2fcbd8 (patch) | |
| tree | 8b002d6e1ca6df7cd481ca4740829b33e9fd693d /niri-ipc/src | |
| parent | cb5d97f600c7dc5bb31525c5cd664c1377145d87 (diff) | |
| download | niri-dcb29efce58ce0e122806b7f352a9f682e2fcbd8.tar.gz niri-dcb29efce58ce0e122806b7f352a9f682e2fcbd8.tar.bz2 niri-dcb29efce58ce0e122806b7f352a9f682e2fcbd8.zip | |
Implement by-id window addressing in IPC and CLI, fix move-column-to-workspace
This is a JSON-breaking change for the IPC actions that changed from
unit variants to struct variants. Unfortunately, I couldn't find a way
with serde to both preserve a single variant, and make it serialize to
the old value when the new field is None. I don't think anyone is using
these actions from JSON at the moment, so this breaking change is fine.
Diffstat (limited to 'niri-ipc/src')
| -rw-r--r-- | niri-ipc/src/lib.rs | 80 |
1 files changed, 70 insertions, 10 deletions
diff --git a/niri-ipc/src/lib.rs b/niri-ipc/src/lib.rs index bf394a50..02465638 100644 --- a/niri-ipc/src/lib.rs +++ b/niri-ipc/src/lib.rs @@ -138,12 +138,42 @@ pub enum Action { Screenshot, /// Screenshot the focused screen. ScreenshotScreen, - /// Screenshot the focused window. - ScreenshotWindow, - /// Close the focused window. - CloseWindow, - /// Toggle fullscreen on the focused window. - FullscreenWindow, + /// Screenshot a window. + #[cfg_attr(feature = "clap", clap(about = "Screenshot the focused window"))] + ScreenshotWindow { + /// Id of the window to screenshot. + /// + /// If `None`, uses the focused window. + #[cfg_attr(feature = "clap", arg(long))] + id: Option<u64>, + }, + /// Close a window. + #[cfg_attr(feature = "clap", clap(about = "Close the focused window"))] + CloseWindow { + /// Id of the window to close. + /// + /// If `None`, uses the focused window. + #[cfg_attr(feature = "clap", arg(long))] + id: Option<u64>, + }, + /// Toggle fullscreen on a window. + #[cfg_attr( + feature = "clap", + clap(about = "Toggle fullscreen on the focused window") + )] + FullscreenWindow { + /// Id of the window to toggle fullscreen of. + /// + /// If `None`, uses the focused window. + #[cfg_attr(feature = "clap", arg(long))] + id: Option<u64>, + }, + /// Focus a window by id. + FocusWindow { + /// Id of the window to focus. + #[cfg_attr(feature = "clap", arg(long))] + id: u64, + }, /// Focus the column to the left. FocusColumnLeft, /// Focus the column to the right. @@ -226,8 +256,18 @@ pub enum Action { MoveWindowToWorkspaceDown, /// Move the focused window to the workspace above. MoveWindowToWorkspaceUp, - /// Move the focused window to a workspace by reference (index or name). + /// Move a window to a workspace. + #[cfg_attr( + feature = "clap", + clap(about = "Move the focused window to a workspace by reference (index or name)") + )] MoveWindowToWorkspace { + /// Id of the window to move. + /// + /// If `None`, uses the focused window. + #[cfg_attr(feature = "clap", arg(long))] + window_id: Option<u64>, + /// Reference (index or name) of the workspace to move the window to. #[cfg_attr(feature = "clap", arg())] reference: WorkspaceReferenceArg, @@ -270,14 +310,34 @@ pub enum Action { MoveColumnToMonitorDown, /// Move the focused column to the monitor above. MoveColumnToMonitorUp, - /// Change the height of the focused window. + /// Change the height of a window. + #[cfg_attr( + feature = "clap", + clap(about = "Change the height of the focused window") + )] SetWindowHeight { + /// Id of the window whose height to set. + /// + /// If `None`, uses the focused window. + #[cfg_attr(feature = "clap", arg(long))] + id: Option<u64>, + /// How to change the height. #[cfg_attr(feature = "clap", arg())] change: SizeChange, }, - /// Reset the height of the focused window back to automatic. - ResetWindowHeight, + /// Reset the height of a window back to automatic. + #[cfg_attr( + feature = "clap", + clap(about = "Reset the height of the focused window back to automatic") + )] + ResetWindowHeight { + /// Id of the window whose height to reset. + /// + /// If `None`, uses the focused window. + #[cfg_attr(feature = "clap", arg(long))] + id: Option<u64>, + }, /// Switch between preset column widths. SwitchPresetColumnWidth, /// Toggle the maximized state of the focused column. |
