8000 custom namespace support by LGFae · Pull Request #435 · LGFae/swww · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

custom namespace support #435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
### Unreleased

#### BREAKING

Note: though this are technically breaking changes, they are unlikely to break
most setups. They are only a problem if you used scripts that relied on
`swww query` output format, or if you relied on the `swww-daemon` socket file
name.

* `swww query` now returns information in the following format:
`<namespace>: OUTPUT: SIZE, scale: SCALE, currently displaying: IMAGE_OR_COLOR`
* we are creating the socket in a slightly different location now:
`${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}-swww-daemon.<specified namespace>.socket`

#### Additions

* every command (except `clear-cache`) now accepts a `-n|--namespace`
argument. This namespace will then be appended to `swww-daemon` to make up the
wayland namespace of the daemon's layer surface.
* as a convenience, every command (except `clear-cache`) also accepts a
`-a|--all` flag, that lets the user send commands to all namespaces at once.

### 0.10.3

Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ members = ["client", "daemon", "common", "tests"]
default-members = ["client", "daemon"]

[workspace.package]
version = "0.10.3"
version = "0.10.3-master"
authors = ["Leonardo Gibrowski Faé <leonardo.fae44@gmail.com>"]
edition = "2021"
license-file = "LICENSE"
rust-version = "1.85"
rust-version = "1.87"

[workspace.dependencies]
common = { path = "common" }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
### Dependencies:

- wayland-client and wayland-protocol `.xml` files installed in your system (`pkg-config` must be able to find it)
- Up to date stable rustc compiler and cargo (specifically, MSRV is 1.82.0)
- Up to date stable rustc compiler and cargo (specifically, MSRV is 1.87.0)

To build, clone this repository and run:
```
Expand Down
92 changes: 86 additions & 6 deletions client/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,30 +189,81 @@ pub enum Swww {
Img(Img),

///Kills the daemon
Kill,
Kill(Kill),

///Asks the daemon to print output information (names and dimensions).
///
///You may use this to find out valid values for the <swww-img --outputs> option. If you want
///more detailed information about your outputs, I would recommend trying wlr-randr.
Query,
Query(Query),
}

#[derive(Parser)]
pub struct Clear {
/// Clear all swww-daemon instances (all namespaces)
#[arg(short, long, default_value = "false")]
pub all: bool,

/// Color to fill the screen with.
///
/// Must be given in rrggbb format (note there is no prepended '#').
#[arg(value_parser = from_hex, default_value = "000000")]
pub color: [u8; 3],

/// The daemon's namespace.
///
/// The resulting namespace will be 'swww-daemon' appended to what you pass in this argument.
/// For this to work, you must call `swww-daemon --namespace <custom_namespace>` with the same
/// value you use here.
///
/// You can specify multiple namespaces at once with multiple `--namespaces` arguments. The
/// commands will be sent to every namespace you have specified.
#[arg(short, long, default_value = "")]
pub namespace: Vec<String>,

/// Comma separated list of outputs to display the image at.
///
/// If it isn't set, the image is displayed on all outputs.
#[clap(short, long, default_value = "")]
pub outputs: String,
}

#[derive(Parser)]
pub struct Kill {
/// Kill all swww-daemon instances (all namespaces)
#[arg(short, long, default_value = "false")]
pub all: bool,

/// The daemon's namespace.
///
/// The resulting namespace will be 'swww-daemon' appended to what you pass in this argument.
/// For this to work, you must call `swww-daemon --namespace <custom_namespace>` with the same
/// value you use here.
///
/// You can specify multiple namespaces at once with multiple `--namespaces` arguments. The
/// commands will be sent to every namespace you have specified.
#[arg(short, long, default_value = "")]
pub namespace: Vec<String>,
}

#[derive(Parser)]
pub struct Query {
/// Kill all swww-daemon instances (all namespaces)
#[arg(short, long, default_value = "false")]
pub all: bool,

/// The daemon's namespace.
///
/// The resulting namespace will be 'swww-daemon' appended to what you pass in this argument.
/// For this to work, you must call `swww-daemon --namespace <custom_namespace>` with the same
/// value you use here.
///
/// You can specify multiple namespaces at once with multiple `--namespaces` arguments. The
/// commands will be sent to every namespace you have specified.
#[arg(short, long, default_value = "")]
pub namespace: Vec<String>,
}

#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash, ValueEnum)]
pub enum ResizeStrategy {
/// Do not resize the image
Expand All @@ -232,6 +283,20 @@ pub enum ResizeStrategy {

#[derive(Parser)]
pub struct Restore {
/// Restore all swww-daemon instances (all namespaces)
#[arg(short, long, default_value = "false")]
pub all: bool,
/// The daemon's namespace.
///
/// The resulting namespace will be 'swww-daemon' appended to what you pass in this argument.
/// For this to work, you must call `swww-daemon --namespace <custom_namespace>` with the same
/// value you use here.
///
/// You can specify multiple namespaces at once with multiple `--namespaces` arguments. The
/// commands will be sent to every namespace you have specified.
#[arg(short, long, default_value = "")]
pub namespace: Vec<String>,

/// Comma separated list of outputs to restore.
///
/// If it isn't set, all outputs will be restored.
Expand All @@ -241,6 +306,10 @@ pub struct Restore {

#[derive(Parser)]
pub struct Img {
/// Set the image for all swww-daemon instances (all namespaces)
#[arg(short, long, default_value = "false")]
pub all: bool,

/// Path of image or hexcode (starting with 0x) to display
#[arg(value_parser = parse_image)]
pub image: CliImage,
Expand All @@ -251,6 +320,17 @@ pub struct Img {
#[arg(short, long, default_value = "")]
pub outputs: String,

/// The daemon's namespace.
///
/// The resulting namespace will be 'swww-daemon' appended to what you pass in this argument.
/// For this to work, you must call `swww-daemon --namespace <custom_namespace>` with the same
/// value you use here.
///
/// You can specify multiple namespaces at once with multiple `--namespaces` arguments. The
/// commands will be sent to every namespace you have specified.
#[arg(short, long, default_value = "")]
pub namespace: Vec<String>,

/// Do not resize the image. Equivalent to `--resize=no`
///
/// If this is set, the image won't be resized, and will be centralized in the middle of the
Expand Down Expand Up @@ -376,10 +456,6 @@ pub struct Img {
#[arg(long, env = "SWWW_TRANSITION_POS", default_value = "center", value_parser=parse_coords)]
pub transition_pos: CliPosition,

/// inverts the y position sent in 'transition_pos' flag
#[arg(long, env = "INVERT_Y", default_value = "false")]
pub invert_y: bool,

///bezier curve to use for the transition
///https://cubic-bezier.com is a good website to get these values from
///
Expand All @@ -390,6 +466,10 @@ pub struct Img {
///currently only used for 'wave' transition to control the width and height of each wave
#[arg(long, env = "SWWW_TRANSITION_WAVE", default_value = "20,20", value_parser = parse_wave)]
pub transition_wave: (f32, f32),

/// inverts the y position sent in 'transition_pos' flag
#[arg(long, env = "INVERT_Y", default_value = "false")]
pub invert_y: bool,
}

fn parse_wave(raw: &str) -> Result<(f32, f32), String> {
Expand Down
Loading
Loading
0