Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/gtklock.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ struct GtkLock {
char *unlock_command;

GArray *modules;

gboolean test_mode;
};

void gtklock_remove_window(struct GtkLock *gtklock, struct Window *win);
Expand Down
3 changes: 3 additions & 0 deletions src/source.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ static gboolean should_daemonize = FALSE;
static gboolean follow_focus = FALSE;
static gboolean idle_hide = FALSE;
static gboolean start_hidden = FALSE;
static gboolean test_mode = FALSE;

static gint idle_timeout = 15;

Expand All @@ -59,6 +60,7 @@ static GOptionEntry main_entries[] = {
{ "version", 'v', 0, G_OPTION_ARG_NONE, &show_version, "Show version", NULL },
{ "config", 'c', 0, G_OPTION_ARG_FILENAME, &config_path, "Load config file", NULL },
{ "daemonize", 'd', 0, G_OPTION_ARG_NONE, &should_daemonize, "Detach from controlling terminal", NULL },
{ "preview", 'p', 0, G_OPTION_ARG_NONE, &test_mode, "Enable preview mode where any password can unlock", NULL },
{ NULL },
};

Expand Down Expand Up @@ -343,6 +345,7 @@ int main(int argc, char **argv) {

gtklock->hidden = start_hidden;
gtklock->idle_timeout = (guint)idle_timeout;
gtklock->test_mode = test_mode;

gtklock->follow_focus = follow_focus;
gtklock->use_idle_hide = idle_hide;
Expand Down
3 changes: 3 additions & 0 deletions src/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ static gboolean window_pw_message(gpointer data) {
}

static gpointer window_pw_wait(gpointer data) {
if (gtklock->test_mode) {
g_application_quit(G_APPLICATION(gtklock->app));
}
struct Window *ctx = data;
const char *password = gtk_entry_get_text((GtkEntry*)ctx->input_field);
while(TRUE) {
Expand Down