-
Notifications
You must be signed in to change notification settings - Fork 625
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
[REQUEST] placeholder-font #1690
Labels
Comments
diff --git a/include/widgets/textbox.h b/include/widgets/textbox.h
index b8b5ea20..19d48ae5 100644
--- a/include/widgets/textbox.h
+++ b/include/widgets/textbox.h
@@ -65,6 +65,7 @@ typedef struct {
char *text;
const char *placeholder;
int show_placeholder;
+ int prev_show_placeholder;
PangoLayout *layout;
int tbft;
int markup;
diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c
index 00ab1ac1..0c442d6c 100644
--- a/source/widgets/textbox.c
+++ b/source/widgets/textbox.c
@@ -122,9 +122,8 @@ textbox_editable_trigger_action(widget *wid,
return WIDGET_TRIGGER_ACTION_RESULT_IGNORED;
}
-static void textbox_initialize_font(textbox *tb) {
+static void textbox_initialize_font(textbox *tb, const char *font) {
tb->tbfc = tbfc_default;
- const char *font = rofi_theme_get_string(WIDGET(tb), "font", NULL);
if (font) {
TBFontConfig *tbfc = g_hash_table_lookup(tbfc_cache, font);
if (tbfc == NULL) {
@@ -203,9 +202,12 @@ textbox *textbox_create(widget *parent, WidgetType type, const char *name,
tb->changed = FALSE;
tb->layout = pango_layout_new(p_context);
+
+ tb->prev_show_placeholder = -1;
textbox_font(tb, tbft);
- textbox_initialize_font(tb);
+ const char *font = rofi_theme_get_string(WIDGET(tb), "font", NULL);
+ textbox_initialize_font(tb, font);
textbox_tab_stops(tb);
if ((tb->flags & TB_WRAP) == TB_WRAP) {
@@ -460,6 +462,23 @@ static void textbox_draw(widget *wid, cairo_t *draw) {
__textbox_update_pango_text(tb);
}
+ if (tb->prev_show_placeholder != tb->show_placeholder) {
+ if (tb->show_placeholder) {
+ const char *font =
+ rofi_theme_get_string(WIDGET(tb), "font-placeholder", NULL);
+ if (font) {
+ printf("%s\n", font);
+ textbox_initialize_font(tb, font);
+ }
+ } else {
+ const char *font = rofi_theme_get_string(WIDGET(tb), "font", NULL);
+ if (font) {
+ printf("%s\n", font);
+ textbox_initialize_font(tb, font);
+ }
+ }
+ tb->prev_show_placeholder = tb->show_placeholder;
+ }
// Skip the side MARGIN on the X axis.
int x;
int top = widget_padding_get_top(WIDGET(tb));
could be problematic with resizing. |
Maybe making the placeholder string support pango markup better, then you can just hint what you want. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Before opening a feature request
What is the user problem or growth opportunity you want to see solved?
i would like to see placeholder-font to set thinner or smaller font in placeholder(entry)
How do you know that this problem exists today? Why is this important?
I couldn't find such functionality. Besides, the font is usually installed in the configuration{}, so I think that it was installing only once
Who will benefit from it?
i, me, myself, mb another customer and theme-makers
Rofi version (rofi -v)
1.7.3
Configuration
https://gist.github.com/urasssopretty/3ccf1e8d996ed15182118ddcbd73399d
Additional information
No response
The text was updated successfully, but these errors were encountered: