granite icon indicating copy to clipboard operation
granite copied to clipboard

Add flat text entry box

Open hanaral opened this issue 4 years ago • 3 comments

Problem

In many situations, having the inset text entry box looks off. This is especially the case with renaming items in the Granite.SourceList or in the Files app, where the items are tightly packed and appear flat on the UI by default. There also seems to be a couple of places something similar is being used, but there is no overarching widget that can be used anywhere.

Proposal

There should be a Granite.FlatEntry that has custom styling to make the text box not have a box around it, and instead has a rounded 'pill' like accent colour outline for when it is selected. Another idea may be to automatically put the symbolic pencil icon at the end of the box when hovered to make it obvious it can be edited - and then the symbolic delete icon in the pencil's place while being edited

Prior Art

Something like this but an actual widget that can be selected with a keyboard Screenshot from 2021-01-31 11 39 36

hanaral avatar Jan 31 '21 11:01 hanaral

This already exists and is a stylesheet feature. You can add Gtk.STYLE_CLASS_FLAT to entries for a flat style. I don't think there really needs to be a widget here. If it's important to have the pencil on hover, that could be done in the stylesheet too.

Moving to stylesheet for further conversation

danirabbit avatar Feb 01 '21 23:02 danirabbit

Also how about making the pencil thingy a default? I’d argue a pretty good thing, but I’m wondering why Files and such doesn’t use it instead of the weird inset box... Is this HIG territory or unfinished territory?

hanaral avatar Feb 02 '21 09:02 hanaral

Gtk.Entry has a built-in property these days for flat styles: https://valadoc.org/gtk4/Gtk.Entry.has_frame.html so we should definitely make sure the new stylesheet supports that

I think we can re-evaluate whether Entries should be inset or outset for sure. There's a lot of prior art going either way

danirabbit avatar Apr 10 '25 19:04 danirabbit