~soapdog/fafi-browser

8563b87a70c62d69fef7c21fcbb2a78583bfe77f — Louis Brauer 3 years ago 770103a
Use OS dependent leader key for new/close tab, add new tab to file menu
2 files changed, 23 insertions(+), 5 deletions(-)

M CHANGELOG.md
M window.rkt
M CHANGELOG.md => CHANGELOG.md +8 -0
@@ 1,3 1,11 @@
# Version 0.11

* Use standard keybindings for MacOS
  * open new tab with ⌘-t
  * close tab with ⌘-w
* New menu items
  * "New Tab" in File menu

# Version 0.10

* Refactor to move low-level protocol implementations over to `protocols/`.

M window.rkt => window.rkt +15 -5
@@ 50,8 50,10 @@
     (super-new) 

     (define (handle-keycombo key)
       (let ((ctrl? (send key get-control-down))
             (meta? (send key get-meta-down))
       (let ((meta? (send key get-meta-down))
             (leader? (if (equal? (system-type) 'macosx)
                         (send key get-meta-down)
                         (send key get-control-down)))
             (key-code (send key get-key-code)))
         (cond
           ((eq? key-code 'f5)


@@ 62,12 64,12 @@
            (go-forward))
           ((eq? key-code 'home)
            (go-to-url (get-pref 'homepage)))
           ((and ctrl? (eq? key-code #\l))
           ((and leader? (eq? key-code #\l))
            (send address-bar focus)
            (send (send address-bar get-editor) select-all))
           ((and ctrl? (eq? key-code #\w))
           ((and leader? (eq? key-code #\w))
            (close-tab (send browser-tabs get-selection)))
           ((and ctrl? (eq? key-code #\t))
           ((and leader? (eq? key-code #\t))
            (new-tab))
           (else
            #f))))


@@ 334,6 336,14 @@
         [parent menu-bar]
         [label "&File"]))

  (define new-tab-menu
    (new menu-item%
         [parent file-menu]
         [label "&New Tab"]
         [help-string "Opens a new tab"]
         [shortcut #\t]
         [callback (λ _ (new-tab))]))
  
  (define preferences-menu
    (new menu-item%
         [parent file-menu]