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

gtk: implement sensitive content reveal on paste confirmation #6054

Conversation

maciekbartczak
Copy link
Contributor

@maciekbartczak maciekbartczak commented Mar 2, 2025

Fixes #4947 for gtk
This PR implements the senstive content hiding when displaying the paste confirmation dialog in secure input mode.

Following changes are implemented:

  • in the blueprint for each dialog add a show/hide button that is not visible by default, and a Revealer that is revealed by default
  • save the secure_input action value for each surface in the GTK apprt
  • pass the value when initializing the paste confirmation dialog
  • in the dialog code, alter the visibility of the content and reveal/hide buttons based on secure input flag value

Demo:

2025-03-02.17-37-11.mp4

I feel like this is already a nearly full implementation, but I'm leaving this as a draft for now, since i need to look into blueprints for Adwaita 1.2, and verify if it behaves properly when the dialog is in not-sensitive input mode and in OSC52 mode.

Copy link
Member

@jcollie jcollie left a comment

Choose a reason for hiding this comment

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

As noted in the start of the PR, need to get this working for Adwaita 1.2.

Copy link
Member

@pluiedev pluiedev left a comment

Choose a reason for hiding this comment

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

From a UI design perspective I'm not sure if a background blur is idiomatic for GTK4 apps, although I'm not opposed to it. A separate row button is definitely not it, though... maybe an overlaid button in the corner could be used to reenable the overlay? I'm not sure why anyone would do this anyway.

@tristan957
Copy link
Member

The blur is sweet

@jcollie
Copy link
Member

jcollie commented Mar 3, 2025

I like the blur as well, but I agree that a separate button isn't the right UI. Generally clicking on the blurred panel is what I see for UI.

@maciekbartczak
Copy link
Contributor Author

How about something like this?

2025-03-03.16-46-29.mp4

I'm not really sure what to think about the hide button, it feels out of place in there, maybe it is actually not needed at all?

@jcollie
Copy link
Member

jcollie commented Mar 3, 2025

How about something like this?

Looks good!

I'm not really sure what to think about the hide button, it feels out of place in there, maybe it is actually not needed at all?

Yeah, I'd just get rid of the hide button, and let clicking on the text view itself hide the content again.

@tristan957
Copy link
Member

tristan957 commented Mar 3, 2025

What about a button similar to a password entry. Just an 👁️ button overlaid in the top right corner (or top left corner) in LTR languages?

@pluiedev
Copy link
Member

pluiedev commented Mar 3, 2025

Just an 👁️ button overlaid in the top right corner

This

@maciekbartczak
Copy link
Contributor Author

maciekbartczak commented Mar 3, 2025

Ok, that looks perfect to me, but I'm open to any suggestions 😄

2025-03-03.19-26-39.mp4

I'll address the rest of the required changes in the following days, since I don't have any more time for now.

@jcollie
Copy link
Member

jcollie commented Mar 3, 2025

Ok, that looks perfect to me, but I'm open to any suggestions 😄

Looks good!

@tristan957
Copy link
Member

For the overlay, I would add the .osd class.

- implement blueprints for Adwaita 1.2
- use postifx notation for casting gtk widgets
- fix formatting
@maciekbartczak maciekbartczak force-pushed the gtk-paste-confirmation-reveals-sensitive-content branch from 2f72b06 to bd617c5 Compare March 5, 2025 20:03
@maciekbartczak maciekbartczak marked this pull request as ready for review March 5, 2025 20:03
@maciekbartczak maciekbartczak requested a review from a team as a code owner March 5, 2025 20:03
@maciekbartczak
Copy link
Contributor Author

Ok, that should be the final version. I've Added the implemenation for Adwaita 1.2, addressed the other issues and resolved merge conflicts.

@jcollie jcollie merged commit d6bd7b5 into ghostty-org:main Mar 5, 2025
30 checks passed
@github-actions github-actions bot added this to the 1.2.0 milestone Mar 5, 2025
@jcollie
Copy link
Member

jcollie commented Mar 5, 2025

Thanks @maciekbartczak for putting up with all our nitpicks, great work!

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.

Unsafe paste confirmation should not reveal contents in UI by default in secure input mode
4 participants