Skip to content

Commit 960d35d

Browse files
authored
fix ctrl key (#2042)
1 parent 489c1c7 commit 960d35d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

core/QuickAddCore.vala

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,6 @@ public class Layouts.QuickAddCore : Adw.Bin {
575575
signal_map[event_controller_key.key_pressed.connect ((keyval, keycode, state) => {
576576
if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {
577577
ctrl_pressed = true;
578-
create_more_button.active = ctrl_pressed;
579578
}
580579

581580
return false;
@@ -584,7 +583,6 @@ public class Layouts.QuickAddCore : Adw.Bin {
584583
signal_map[event_controller_key.key_released.connect ((keyval, keycode, state) => {
585584
if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {
586585
ctrl_pressed = false;
587-
create_more_button.active = ctrl_pressed;
588586
}
589587
})] = event_controller_key;
590588

@@ -632,9 +630,15 @@ public class Layouts.QuickAddCore : Adw.Bin {
632630
return true;
633631
}));
634632

633+
var toggle_keep_adding_shortcut = new Gtk.Shortcut (Gtk.ShortcutTrigger.parse_string ("<Control>k"), new Gtk.CallbackAction (() => {
634+
create_more_button.active = !create_more_button.active;
635+
return true;
636+
}));
637+
635638
shortcut_controller = new Gtk.ShortcutController ();
636639
shortcut_controller.add_shortcut (open_label_shortcut);
637640
shortcut_controller.add_shortcut (open_reminder_shortcut);
641+
shortcut_controller.add_shortcut (toggle_keep_adding_shortcut);
638642
add_controller (shortcut_controller);
639643

640644
destroy_controller = new Gtk.EventControllerKey ();
@@ -1272,7 +1276,7 @@ public class Layouts.QuickAddCore : Adw.Bin {
12721276
margin_top = 3,
12731277
margin_bottom = 3
12741278
});
1275-
popover_box.append (build_shortcut_widget ("", "#1e63ec", _("Keep adding"), _("Stay open after creating task")));
1279+
popover_box.append (build_shortcut_widget ("Ctrl+K", "#1e63ec", _("Keep adding"), _("Toggle stay open after creating task")));
12761280
popover_box.append (new Widgets.ContextMenu.MenuSeparator () {
12771281
margin_top = 3,
12781282
margin_bottom = 3
@@ -1303,7 +1307,7 @@ public class Layouts.QuickAddCore : Adw.Bin {
13031307

13041308
private Gtk.Widget build_shortcut_widget (string shortcut_key, string color, string title, string subtitle) {
13051309
var shortcut_label = new Gtk.Label (shortcut_key) {
1306-
width_chars = 5,
1310+
width_chars = 6,
13071311
valign = CENTER
13081312
};
13091313
shortcut_label.add_css_class ("caption");

0 commit comments

Comments
 (0)