Skip to content
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

change name of clear arg to color #194

Open
exoess opened this issue Jan 11, 2024 · 9 comments · May be fixed by #195
Open

change name of clear arg to color #194

exoess opened this issue Jan 11, 2024 · 9 comments · May be fixed by #195
Labels
enhancement New feature or request

Comments

@exoess
Copy link

exoess commented Jan 11, 2024

the name clear doesn't really make sense for just changing the background to a solid color, i recommend changing clear to making the background black, and having an arg color that requires a color after it and doesn't have a default

@flick0 flick0 linked a pull request Jan 11, 2024 that will close this issue
@LGFae LGFae added the enhancement New feature or request label Feb 18, 2024
@LGFae
Copy link
Owner

LGFae commented Mar 11, 2024

I just realized that clear already does this. Maybe it's not been documented visibly enough. Calling just swww clear will make the background black by default. swww clear <color> will make the background whatever color you sent in.

So, I am not sure this is necessary at all.

@flick0
Copy link
Contributor

flick0 commented Mar 13, 2024

imo its just an alternative to clear to set solid colors with transitions and cache, also #195 might seem unnecessary according to this issue but this idea originally started on discord with a conversation with op

@LGFae
Copy link
Owner

LGFae commented Mar 17, 2024

Ah, I see. Well, ok then. Let's go with it.

@hkupty
Copy link
Contributor

hkupty commented Apr 27, 2024

Can I offer a different perspective?One could simplify here and take the same approach of grim + slurp. It might make sense to generate the bitmap/image in a separate process and pass it on to swww instead...

@LGFae
Copy link
Owner

LGFae commented May 14, 2024

Yeah, I think I like @hkupty's idea better. We can create the image straight in swww itself, consisting of one full static color. We get transitions and cache "for free".

That would actually even simplify some code in the daemon, because we could both merge Clear and Image requests into one.

The problem would only be how to cache it, because colors aren't associated with any filepath. But this should be easy: we store the image's fullpath in the cache right now, so all we have to do is:

  • if it's a file, store its fullpath
  • if it's a color, store its value, with a starting #.

Since no fullpath will ever start with # (as far as I know), we should be safe.

EDIT: ah, this is fact mostly what @flick0 already implemented in his PR. It's been a while since I had a look at this, so I had forgotten, my bad.

@flick0
Copy link
Contributor

flick0 commented May 15, 2024

That does sound like a better idea, i can update this pr to move the image stuff to swww

@flick0
Copy link
Contributor

flick0 commented May 28, 2024

sorry im a bit late to this, but dont we already do the image gen in swww instead of daemon lol

@LGFae
Copy link
Owner

LGFae commented May 28, 2024

we do??? I mean, in master we have:

        Swww::Clear(c) => {
            let (format, _, _) = get_format_dims_and_outputs(&[])?;
            let mut color = c.color;
            if format.must_swap_r_and_b_channels() {
                color.swap(0, 2);
            }
            let clear = ipc::ClearSend {
                color,
                outputs: split_cmdline_outputs(&c.outputs),
            };
            Ok(Some(RequestSend::Clear(clear.create_request())))
        }

So, right now we don't. Maybe in the PR you've already implemented it.

@flick0
Copy link
Contributor

flick0 commented May 28, 2024

I didn't change the clear request but img generating and stuff happens in swww instead of daemon for color, we cud also alias clear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants