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

Add transparent overlay window #4746

Merged
merged 71 commits into from
Oct 6, 2024

Conversation

Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Aug 2, 2023

Description

This PR adds a hotkey to open a transparent overlay channel-view. The colors of the overlay can be customized in the theme. To move, resize, and close the overlay, you have to press the SHIFT key.

This is an early feature and requires more PRs in the future to support more stuff like scaling.

TODO

firefox_2023-08-02_19-57-18.mp4

Link to the video in case the embed is broken: https://github.com/Chatterino/chatterino2/assets/19953266/3e798169-a82f-4123-b834-7ce55daf0fc1

Closes #1618.

@RangerFrank
Copy link

I've been using https://github.com/baffler/Transparent-Twitch-Chat-Overlay for the functionality that this PR is going to add to Chatterino, very glad to see it finally happening. One major feature that is an oversight for many chat overlays is that it needs to have toggleable click-through, so that the widget can be sized and moved, but when toggled won't be able to be clicked or interfere with mouse pointer tracking in games and other programs.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/platform/windows/GlobalShortcutPrivateWin.cpp Outdated Show resolved Hide resolved
src/widgets/OverlayWindow.cpp Outdated Show resolved Hide resolved
@pajlada
Copy link
Member

pajlada commented Sep 8, 2024

Looks great, I'd like to see the interactability toggleable as part of a Chatterino hotkey instead of a Global Shortcut.

If the need arises for speed, we can re-investigate Global Shortcuts

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/widgets/OverlayWindow.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/widgets/OverlayWindow.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

using namespace literals;

/// Progress the user has made in exploring the overlay
enum class Knowledge : std::int32_t {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: enum 'Knowledge' uses a larger base type ('std::int32_t' (aka 'int'), size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size [performance-enum-size]

enum class Knowledge : std::int32_t {
           ^

Copy link
Member

@pajlada pajlada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small nits

@@ -128,6 +128,9 @@ class WindowManager final
// again
void queueSave();

/// Toggles the inertia in all open popup windows
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Toggles the inertia in all open popup windows
/// Toggles the inertia in all open overlay windows

Comment on lines 803 to 807
if (arg == "all")
{
getApp()->getWindows()->toggleAllPopupInertia();
return {};
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the default keybind action should be all, and I think toggleAllPopupIntertia should not toggle each overlay individually, rather think of all of them as a group.
If any overlay is interactable, make all overlays inert. Otherwise, make all overlays interactable.

Comment on lines 608 to 612
this->messageColors_.applyTheme(getTheme());
if (this->colorVisitor_)
{
this->colorVisitor_(this->messageColors_, getTheme());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could applyTheme on MessageColors accept the overlayBackgroundOpacity plus a boolean whether this is an overlay enough, and let it do the logic for how to apply the colors instead?

so MessageColors::applyTheme(Theme*) would instead be MessageColors::applyTheme(Theme*, bool isInOverlay, int backgroundOpacity) - that should let us get rid of the visitor pattern

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/messages/layouts/MessageLayoutContext.cpp Outdated Show resolved Hide resolved
src/widgets/OverlayWindow.cpp Outdated Show resolved Hide resolved
@Nerixyz
Copy link
Contributor Author

Nerixyz commented Sep 30, 2024

75e3dbf is a bit bigger, as I didn't use the correct colors from the theme for the text (it used the "regular" ones instead of the ones for the overlay). Light themes don't look as good as dark themes, as the text colors are "normalized". We should do that a bit differently, but that's for a future PR imo.

Copy link
Member

@pajlada pajlada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just found one small nit - not committing it myself in case there's a better way to do it

src/widgets/OverlayWindow.cpp Show resolved Hide resolved
@pajlada pajlada merged commit afa8067 into Chatterino:master Oct 6, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transparent background on program
3 participants