Skip to content

Instantly share code, notes, and snippets.

@nununoisy
Created November 18, 2019 17:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nununoisy/8ea739964ad11607c6cd0a57884a53c7 to your computer and use it in GitHub Desktop.
Save nununoisy/8ea739964ad11607c6cd0a57884a53c7 to your computer and use it in GitHub Desktop.
Tiny Material
#include <gtk/gtk.h>
/* Login prompt text */
static const char *user_text = "Username";
/* Password prompt text */
static const char *pass_text = "Password";
/* Session name */
static const char *session = "sway";
/* GTK UI CSS */
static const gchar *style =
"window {"
"background-image: url(\"/usr/share/backgrounds/wall.png\");"
"background-position: center;"
"background-size: cover;"
"}"
"window * {"
"font: 16px \"Lato\";"
"}"
"#prompt_box {"
"background-color: #121212;"
"padding: 5px 15px 15px 15px;"
"margin: 50px 650px 50px 650px;"
"box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);"
"border-bottom: 2px solid #ff9800;"
"border-radius: 5px 5px 0 0;"
"}"
"label {"
"color: #ff9800;"
"font-size: 10px;"
"}"
"entry {"
"color: #f2f2f2;"
"background-color: #121212;"
"box-shadow: none;"
"caret-color: #f2f2f2;"
"}"
"#message_label {"
"color: #000000;"
"font-weight: bold;"
"}";
/* GTK UI XML*/
static const gchar *ui =
"<?xml version='1.0' encoding='UTF-8'?>"
"<interface>"
"<requires lib='gtk+' version='3.20'/>"
"<object class='GtkWindow' id='login_window'>"
"<property name='name'>login_window</property>"
"<property name='can_focus'>False</property>"
"<property name='resizable'>False</property>"
"<property name='accept_focus'>False</property>"
"<property name='decorated'>False</property>"
"<child>"
"<placeholder/>"
"</child>"
"<child>"
"<object class='GtkBox' id='login_box'>"
"<property name='name'>login_box</property>"
"<property name='visible'>True</property>"
"<property name='can_focus'>False</property>"
"<property name='valign'>center</property>"
"<property name='vexpand'>True</property>"
"<property name='orientation'>vertical</property>"
"<child>"
"<object class='GtkBox' id='prompt_box'>"
"<property name='name'>prompt_box</property>"
"<property name='visible'>True</property>"
"<property name='can_focus'>False</property>"
"<property name='spacing'>5</property>"
"<property name='homogeneous'>True</property>"
"<property name='orientation'>vertical</property>"
"<child>"
"<object class='GtkLabel' id='prompt_label'>"
"<property name='name'>prompt_label</property>"
"<property name='visible'>True</property>"
"<property name='can_focus'>False</property>"
"<property name='halign'>start</property>"
"</object>"
"<packing>"
"<property name='expand'>False</property>"
"<property name='fill'>True</property>"
"<property name='position'>0</property>"
"</packing>"
"</child>"
"<child>"
"<object class='GtkEntry' id='prompt_entry'>"
"<property name='name'>prompt_entry</property>"
"<property name='visible'>True</property>"
"<property name='can_focus'>True</property>"
"<property name='halign'>start</property>"
"<property name='xalign'>0</property>"
"<property name='has_frame'>False</property>"
"<property name='max_width_chars'>15</property>"
"<property name='primary_icon_activatable'>False</property>"
"<property name='secondary_icon_activatable'>False</property>"
"<signal name='activate' handler='login_cb' swapped='no'/>"
"</object>"
"<packing>"
"<property name='expand'>False</property>"
"<property name='fill'>True</property>"
"<property name='position'>1</property>"
"</packing>"
"</child>"
"</object>"
"<packing>"
"<property name='expand'>False</property>"
"<property name='fill'>True</property>"
"<property name='position'>0</property>"
"</packing>"
"</child>"
"<child>"
"<object class='GtkLabel' id='message_label'>"
"<property name='name'>message_label</property>"
"<property name='visible'>True</property>"
"<property name='can_focus'>False</property>"
"<property name='halign'>center</property>"
"<property name='width_chars'>25</property>"
"<property name='max_width_chars'>50</property>"
"</object>"
"<packing>"
"<property name='expand'>False</property>"
"<property name='fill'>True</property>"
"<property name='position'>1</property>"
"</packing>"
"</child>"
"</object>"
"</child>"
"</object>"
"</interface>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment