2 using System.Text.RegularExpressions;
4 using bytex64.WebThing;
10 public Plugin(WebThing wt) {
12 wt.WebView.KeyPressEvent += WebView_KeyPress;
14 commandline = new Gtk.Entry();
15 commandline.Activated += command_Activate;
16 commandline.KeyPressEvent += command_KeyPress;
17 wt.AttachWidget(commandline, CompassDirection.S, AttachOptions.Fill, AttachOptions.Shrink);
22 private void WebView_KeyPress(object o, KeyPressEventArgs e) {
23 Console.WriteLine(e.Event.Key);
26 wt.ScrolledWindow.Vadjustment.Value += wt.ScrolledWindow.Vadjustment.StepIncrement;
29 wt.ScrolledWindow.Vadjustment.Value -= wt.ScrolledWindow.Vadjustment.StepIncrement;
32 wt.ScrolledWindow.Hadjustment.Value += wt.ScrolledWindow.Hadjustment.StepIncrement;
35 wt.ScrolledWindow.Hadjustment.Value -= wt.ScrolledWindow.Hadjustment.StepIncrement;
38 CommandStart("open ");
44 CommandStart("tabopen ");
50 wt.WebView.ExecuteScript("document.activeElement.blur()");
55 public void CommandStart(string text) {
56 commandline.Text = text;
57 commandline.GrabFocus();
58 commandline.Position = text.Length;
62 public void CommandlineShow() {
64 commandline.GrabFocus();
67 public void CommandlineHide() {
69 wt.WebView.GrabFocus();
72 private void command_Activate(object o, EventArgs e) {
73 string[] args = Regex.Split(commandline.Text, @"\s+");
76 if (args.Length < 2) return;
86 private void command_KeyPress(object o, KeyPressEventArgs e) {
87 if (e.Event.Key == Gdk.Key.Escape)