瀏覽代碼

Ladybird: Allow opening the Inspector with both ctrl+shift+I and F12

Ladybird on Serenity currently only uses F12, and on other platforms
only uses ctrl+shift+I. Most browsers support both hotkeys, so let's do
the same for consistency.

Note that the AppKit chrome cannot support both shortcuts. macOS does
not allow setting multiple "key equivalent" strings on an action. There
are some questionable hacks we could do to support this eventually, but
for now, just ctrl+shift+I is supported on macOS.
Timothy Flynn 1 年之前
父節點
當前提交
582f19ba24
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      Ladybird/Qt/BrowserWindow.cpp
  2. 1 1
      Userland/Applications/Browser/BrowserWindow.cpp

+ 1 - 1
Ladybird/Qt/BrowserWindow.cpp

@@ -175,7 +175,7 @@ BrowserWindow::BrowserWindow(Vector<URL> const& initial_urls, WebView::CookieJar
 
 
     auto* inspector_action = new QAction("Open &Inspector", this);
     auto* inspector_action = new QAction("Open &Inspector", this);
     inspector_action->setIcon(load_icon_from_uri("resource://icons/browser/dom-tree.png"sv));
     inspector_action->setIcon(load_icon_from_uri("resource://icons/browser/dom-tree.png"sv));
-    inspector_action->setShortcut(QKeySequence("Ctrl+Shift+I"));
+    inspector_action->setShortcuts({ QKeySequence("Ctrl+Shift+I"), QKeySequence("F12") });
     inspect_menu->addAction(inspector_action);
     inspect_menu->addAction(inspector_action);
     QObject::connect(inspector_action, &QAction::triggered, this, [this] {
     QObject::connect(inspector_action, &QAction::triggered, this, [this] {
         if (m_current_tab) {
         if (m_current_tab) {

+ 1 - 1
Userland/Applications/Browser/BrowserWindow.cpp

@@ -238,7 +238,7 @@ void BrowserWindow::build_menus()
     m_view_source_action->set_status_tip("View source code of the current page"_string);
     m_view_source_action->set_status_tip("View source code of the current page"_string);
 
 
     m_inspect_dom_tree_action = GUI::Action::create(
     m_inspect_dom_tree_action = GUI::Action::create(
-        "Inspect &DOM Tree", { Mod_None, Key_F12 }, g_icon_bag.dom_tree, [this](auto&) {
+        "Inspect &DOM Tree", { Mod_Ctrl | Mod_Shift, Key_I }, { Mod_None, Key_F12 }, g_icon_bag.dom_tree, [this](auto&) {
             active_tab().show_inspector_window(Tab::InspectorTarget::Document);
             active_tab().show_inspector_window(Tab::InspectorTarget::Document);
         },
         },
         this);
         this);