shortcuts: Implement do not disturb shortcut
Adds new shortcut action for do not disturb and maps the do not disturb key to do this action. By default there are no other shortcuts, however the user may add more in the custom shortcut app. Bug: 357886709 Change-Id: Ic5211fe4d470e7c80bfa8f8677c451151d59b7e4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6098825 Reviewed-by: Jimmy Gong <jimmyxgong@chromium.org> Reviewed-by: James Cook <jamescook@chromium.org> Commit-Queue: David Padlipsky <dpad@google.com> Reviewed-by: Matthew Denton <mpdenton@chromium.org> Cr-Commit-Position: refs/heads/main@{#1399380}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
4eee6e3177
commit
8085d90ce4
ash
accelerators
accelerator_commands.ccaccelerator_commands.haccelerator_controller_impl.ccaccelerator_controller_unittest.ccash_accelerator_configuration.cckeyboard_code_util.cc
ash_strings.grdash_strings_grd
constants
public
cpp
accelerator_actions.haccelerator_actions_unittest.ccaccelerators.ccaccelerators.haccelerators_util.cc
app_list
mojom
resources
vector_icons
webui
common
shortcut_customization_ui
chrome/browser/ash/app_list/search
chromeos
chromeos_strings.grd
chromeos_strings_grd
tools/metrics/histograms/metadata
@ -117,6 +117,7 @@
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/display/util/display_util.h"
|
||||
#include "ui/gfx/geometry/point.h"
|
||||
#include "ui/message_center/message_center.h"
|
||||
#include "ui/strings/grit/ui_strings.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
#include "ui/wm/core/window_animations.h"
|
||||
@ -1448,6 +1449,14 @@ void ToggleClipboardHistory(bool is_plain_text_paste) {
|
||||
is_plain_text_paste);
|
||||
}
|
||||
|
||||
void ToggleDoNotDisturb() {
|
||||
message_center::MessageCenter* message_center =
|
||||
message_center::MessageCenter::Get();
|
||||
CHECK(message_center);
|
||||
const bool is_quiet_mode = message_center->IsQuietMode();
|
||||
message_center->SetQuietMode(!is_quiet_mode);
|
||||
}
|
||||
|
||||
void ToggleQuickInsert(base::TimeTicks accelerator_timestamp) {
|
||||
const bool outside_user_session =
|
||||
!Shell::Get()->session_controller()->IsActiveUserSessionStarted();
|
||||
|
@ -324,6 +324,9 @@ ASH_EXPORT void ToggleCapsLock();
|
||||
// Toggles the clipboard history.
|
||||
ASH_EXPORT void ToggleClipboardHistory(bool is_plain_text_paste);
|
||||
|
||||
// Toggles do not disturb functionality.
|
||||
ASH_EXPORT void ToggleDoNotDisturb();
|
||||
|
||||
// Toggles Quick Insert.
|
||||
// `accelerator_timestamp` is the timestamp associated with the accelerator that
|
||||
// triggered Quick Insert.
|
||||
|
@ -977,6 +977,8 @@ bool AcceleratorControllerImpl::CanPerformAction(
|
||||
*capslock_state_machine_, notification_controller_.get());
|
||||
case AcceleratorAction::kToggleClipboardHistory:
|
||||
return true;
|
||||
case AcceleratorAction::kToggleDoNotDisturb:
|
||||
return features::IsDoNotDisturbShortcutEnabled();
|
||||
case AcceleratorAction::kEnableSelectToSpeak:
|
||||
return true;
|
||||
case AcceleratorAction::kEnableOrToggleDictation:
|
||||
@ -1549,6 +1551,9 @@ void AcceleratorControllerImpl::PerformAction(
|
||||
case AcceleratorAction::kToggleClipboardHistory:
|
||||
accelerators::ToggleClipboardHistory(/*is_plain_text_paste=*/false);
|
||||
break;
|
||||
case AcceleratorAction::kToggleDoNotDisturb:
|
||||
accelerators::ToggleDoNotDisturb();
|
||||
break;
|
||||
case AcceleratorAction::kEnableSelectToSpeak:
|
||||
accelerators::EnableSelectToSpeak();
|
||||
break;
|
||||
|
@ -2637,6 +2637,20 @@ TEST_F(AcceleratorControllerTest, ChangeIMEMode_SwitchesInputMethod) {
|
||||
EXPECT_EQ(1, client.next_ime_count_);
|
||||
}
|
||||
|
||||
TEST_F(AcceleratorControllerTest, ToggleDoNotDisturbKey) {
|
||||
base::test::ScopedFeatureList feature_list(features::kDoNotDisturbShortcut);
|
||||
|
||||
ASSERT_FALSE(message_center()->IsQuietMode());
|
||||
|
||||
// Toggle do not disturb on.
|
||||
accelerators::ToggleDoNotDisturb();
|
||||
ASSERT_TRUE(message_center()->IsQuietMode());
|
||||
|
||||
// Toggle do not disturb off.
|
||||
accelerators::ToggleDoNotDisturb();
|
||||
ASSERT_FALSE(message_center()->IsQuietMode());
|
||||
}
|
||||
|
||||
class SystemShortcutBehaviorTest : public AcceleratorControllerTest {
|
||||
void SetUp() override {
|
||||
AcceleratorControllerTest::SetUp();
|
||||
|
@ -146,6 +146,11 @@ std::vector<ash::AcceleratorData> GetDefaultAccelerators() {
|
||||
ash::kTilingWindowResizeAcceleratorData);
|
||||
}
|
||||
|
||||
if (ash::features::IsDoNotDisturbShortcutEnabled()) {
|
||||
AppendAcceleratorData(accelerators,
|
||||
ash::kToggleDoNotDisturbAcceleratorData);
|
||||
}
|
||||
|
||||
// Debug accelerators.
|
||||
if (ash::debug::DebugAcceleratorsEnabled()) {
|
||||
AppendAcceleratorData(accelerators, ash::kDebugAcceleratorData);
|
||||
|
@ -143,6 +143,8 @@ const gfx::VectorIcon* GetVectorIconForKeyboardCode(ui::KeyboardCode key_code) {
|
||||
return &ash::kKsvSnapshotIcon;
|
||||
case ui::VKEY_QUICK_INSERT:
|
||||
return &ash::kQuickInsertIcon;
|
||||
case ui::VKEY_DO_NOT_DISTURB:
|
||||
return &ash::kKsDoNotDisturbIcon;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -4235,6 +4235,9 @@ No devices connected.
|
||||
<message name="IDS_ASH_ACCELERATOR_DESCRIPTION_OPEN_ACCESSIBILITY_SETTINGS" desc="Label for accelerator action - Open accessibility quick settings.">
|
||||
Open accessibility options
|
||||
</message>
|
||||
<message name="IDS_ASH_ACCELERATOR_DESCRIPTION_TOGGLE_DO_NOT_DISTURB" desc="Label for accelerator action - Turn on/off do not disturb.">
|
||||
Turn on/off do not disturb
|
||||
</message>
|
||||
|
||||
<message name="IDS_ASH_ACCELERATOR_DESCRIPTION_FOCUS_CAMERA_PREVIEW" translateable="false" desc="Label for accelerator action - Focus on the camera preview.">
|
||||
Focus on the camera preview
|
||||
|
@ -0,0 +1 @@
|
||||
f33c945aae38123383e4c27187c8dd7eed74165d
|
@ -527,6 +527,11 @@ BASE_FEATURE(kDisplayPerformanceMode,
|
||||
"DisplayPerformanceMode",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
// Enable the do not disturb shortcut.
|
||||
BASE_FEATURE(kDoNotDisturbShortcut,
|
||||
"DoNotDisturbShortcut",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
// Adds a desk button to the shelf that the user can use to navigate between
|
||||
// desks.
|
||||
BASE_FEATURE(kDeskButton, "DeskButton", base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
@ -3485,6 +3490,10 @@ bool IsDisplayAlignmentAssistanceEnabled() {
|
||||
return base::FeatureList::IsEnabled(kDisplayAlignAssist);
|
||||
}
|
||||
|
||||
bool IsDoNotDisturbShortcutEnabled() {
|
||||
return base::FeatureList::IsEnabled(kDoNotDisturbShortcut);
|
||||
}
|
||||
|
||||
bool IsDriveFsMirroringEnabled() {
|
||||
return base::FeatureList::IsEnabled(kDriveFsMirroring);
|
||||
}
|
||||
|
@ -198,6 +198,7 @@ COMPONENT_EXPORT(ASH_CONSTANTS)
|
||||
BASE_DECLARE_FEATURE(kDisconnectWiFiOnEthernetConnected);
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kDisplayAlignAssist);
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kDisplayPerformanceMode);
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kDoNotDisturbShortcut);
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kDriveFs);
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kDriveFsMirroring);
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS)
|
||||
@ -1077,6 +1078,7 @@ COMPONENT_EXPORT(ASH_CONSTANTS) bool IsInputDeviceSettingsSplitEnabled();
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsPeripheralCustomizationEnabled();
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsPeripheralsLoggingEnabled();
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsDisplayAlignmentAssistanceEnabled();
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsDoNotDisturbShortcutEnabled();
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsDozeModePowerSchedulerEnabled();
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsDriveFsMirroringEnabled();
|
||||
COMPONENT_EXPORT(ASH_CONSTANTS) int GetDriveFsBulkPinningQueueSize();
|
||||
|
@ -172,6 +172,7 @@ namespace ash {
|
||||
ACCELERATOR_ACTION_ENTRY(ToggleMouseKeys) \
|
||||
ACCELERATOR_ACTION_ENTRY(ResizePipWindow) \
|
||||
ACCELERATOR_ACTION_ENTRY(ToggleGeminiApp) \
|
||||
ACCELERATOR_ACTION_ENTRY(ToggleDoNotDisturb) \
|
||||
/* Debug actions are kept at an offset.*/ \
|
||||
/* This offset should be kept consistent with the enum*/ \
|
||||
/* `AcceleratorAction` in*/ \
|
||||
|
@ -18,12 +18,12 @@ namespace ash {
|
||||
namespace {
|
||||
|
||||
// The total number of accelerator actions.
|
||||
constexpr int kAcceleratorActionsTotalNum = 168;
|
||||
constexpr int kAcceleratorActionsTotalNum = 169;
|
||||
// The toal number of debug accelerators, these will not be used for hashing.
|
||||
constexpr int kDebugAcceleratorActionsNum = 28;
|
||||
// The hash of accelerator actions. Please update this when adding a new
|
||||
// accelerator action.
|
||||
constexpr char kAcceleratorActionsHash[] = "bee5c18782483909ca5d43579d44442f";
|
||||
constexpr char kAcceleratorActionsHash[] = "c959943640043de5e44136e3154e30d2";
|
||||
|
||||
// Define the mapping between an AcceleratorAction and its string name.
|
||||
// Example:
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "base/no_destructor.h"
|
||||
#include "media/base/media_switches.h"
|
||||
#include "ui/events/event_constants.h"
|
||||
#include "ui/events/keycodes/keyboard_codes_posix.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
@ -59,6 +60,7 @@ bool AcceleratorController::IsSystemKey(ui::KeyboardCode key_code) {
|
||||
case ui::VKEY_F13: // Lock button on some chromebooks emits F13.
|
||||
case ui::VKEY_PRIVACY_SCREEN_TOGGLE:
|
||||
case ui::VKEY_SETTINGS:
|
||||
case ui::VKEY_DO_NOT_DISTURB:
|
||||
return true;
|
||||
case ui::VKEY_MEDIA_NEXT_TRACK:
|
||||
case ui::VKEY_MEDIA_PAUSE:
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "base/observer_list.h"
|
||||
#include "ui/events/event_constants.h"
|
||||
#include "ui/events/keycodes/keyboard_codes.h"
|
||||
#include "ui/events/keycodes/keyboard_codes_posix.h"
|
||||
|
||||
namespace ui {
|
||||
class Accelerator;
|
||||
@ -446,6 +447,15 @@ ASH_PUBLIC_EXPORT inline constexpr AcceleratorData kGeminiAcceleratorData[] = {
|
||||
ASH_PUBLIC_EXPORT inline constexpr size_t kGeminiAcceleratorDataLength =
|
||||
std::size(kGeminiAcceleratorData);
|
||||
|
||||
ASH_PUBLIC_EXPORT inline constexpr AcceleratorData
|
||||
kToggleDoNotDisturbAcceleratorData[] = {
|
||||
{true, ui::VKEY_DO_NOT_DISTURB, ui::EF_NONE,
|
||||
AcceleratorAction::kToggleDoNotDisturb},
|
||||
};
|
||||
ASH_PUBLIC_EXPORT inline constexpr size_t
|
||||
kToggleDoNotDisturbAcceleratorDataLength =
|
||||
std::size(kToggleDoNotDisturbAcceleratorData);
|
||||
|
||||
// The public-facing interface for accelerator handling, which is Ash's duty to
|
||||
// implement.
|
||||
class ASH_PUBLIC_EXPORT AcceleratorController {
|
||||
|
@ -123,6 +123,7 @@ const base::flat_map<ui::KeyboardCode, std::u16string>& GetKeyDisplayMap() {
|
||||
{ui::KeyboardCode::VKEY_CAPITAL, u"caps lock"},
|
||||
{ui::KeyboardCode::VKEY_ACCESSIBILITY, u"Accessibility"},
|
||||
{ui::KeyboardCode::VKEY_QUICK_INSERT, u"QuickInsert"},
|
||||
{ui::KeyboardCode::VKEY_DO_NOT_DISTURB, u"DoNotDisturb"},
|
||||
}));
|
||||
return *key_display_map;
|
||||
}
|
||||
|
@ -526,6 +526,8 @@ const gfx::VectorIcon* SearchResultTextItem::GetIconFromCode() const {
|
||||
return &kKsContextMenuIcon;
|
||||
case kKeyboardShortcutKeyboardQuickInsert:
|
||||
return &kQuickInsertIcon;
|
||||
case kKeyboardShortcutDoNotDisturb:
|
||||
return &kKsDoNotDisturbIcon;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -688,6 +688,7 @@ class ASH_PUBLIC_EXPORT SearchResultTextItem {
|
||||
kKeyboardShortcutBrowserHome,
|
||||
kKeyboardShortcutMediaLaunchMail,
|
||||
kKeyboardShortcutContextMenu,
|
||||
kKeyboardShortcutDoNotDisturb,
|
||||
};
|
||||
|
||||
// Only used for SearchResultTextItemType kString
|
||||
|
@ -146,6 +146,7 @@ enum AcceleratorAction {
|
||||
kToggleMouseKeys,
|
||||
kResizePipWindow,
|
||||
kToggleGeminiApp,
|
||||
kToggleDoNotDisturb,
|
||||
// The following are DEBUG actions with an offset. This is to keep the enum
|
||||
// in sync with `AcceleratorActions` in ash/public/cpp/accelerator_actions.h.
|
||||
kDebugClearUseKMeansPref = 9000,
|
||||
|
@ -295,6 +295,8 @@ EnumTraits<mojom_accelerator_action, ash::AcceleratorAction>::ToMojom(
|
||||
return mojom_accelerator_action::kResizePipWindow;
|
||||
case ash::AcceleratorAction::kToggleGeminiApp:
|
||||
return mojom_accelerator_action::kToggleGeminiApp;
|
||||
case ash::kToggleDoNotDisturb:
|
||||
return mojom_accelerator_action::kToggleDoNotDisturb;
|
||||
case ash::AcceleratorAction::kDebugClearUseKMeansPref:
|
||||
return mojom_accelerator_action::kDebugClearUseKMeansPref;
|
||||
case ash::AcceleratorAction::kDebugKeyboardBacklightToggle:
|
||||
@ -780,6 +782,9 @@ bool EnumTraits<mojom_accelerator_action, ash::AcceleratorAction>::FromMojom(
|
||||
case mojom_accelerator_action::kToggleGeminiApp:
|
||||
*out = ash::AcceleratorAction::kToggleGeminiApp;
|
||||
return true;
|
||||
case mojom_accelerator_action::kToggleDoNotDisturb:
|
||||
*out = ash::AcceleratorAction::kToggleDoNotDisturb;
|
||||
return true;
|
||||
case mojom_accelerator_action::kDebugClearUseKMeansPref:
|
||||
*out = ash::AcceleratorAction::kDebugClearUseKMeansPref;
|
||||
return true;
|
||||
|
@ -195,6 +195,7 @@ aggregate_vector_icons("ash_vector_icons") {
|
||||
"ks_calculator.icon",
|
||||
"ks_context_menu.icon",
|
||||
"ks_dictation.icon",
|
||||
"ks_do_not_disturb.icon",
|
||||
"ks_emoji_picker.icon",
|
||||
"ks_input_mode_change.icon",
|
||||
"ks_keyboard_brightness_down.icon",
|
||||
|
40
ash/resources/vector_icons/ks_do_not_disturb.icon
Normal file
40
ash/resources/vector_icons/ks_do_not_disturb.icon
Normal file
@ -0,0 +1,40 @@
|
||||
// Copyright 2024 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
CANVAS_DIMENSIONS, 20,
|
||||
FILL_RULE_NONZERO,
|
||||
MOVE_TO, 6, 10.88f,
|
||||
R_H_LINE_TO, 8,
|
||||
R_V_LINE_TO, -1.75f,
|
||||
H_LINE_TO, 6,
|
||||
R_V_LINE_TO, 1.75f,
|
||||
CLOSE,
|
||||
R_MOVE_TO, 4, 7.29f,
|
||||
R_ARC_TO, 8.21f, 8.21f, 0, 0, 1, -3.19f, -0.62f,
|
||||
R_ARC_TO, 8.59f, 8.59f, 0, 0, 1, -2.6f, -1.75f,
|
||||
R_ARC_TO, 8.59f, 8.59f, 0, 0, 1, -1.75f, -2.6f,
|
||||
ARC_TO, 8.2f, 8.2f, 0, 0, 1, 1.83f, 10,
|
||||
R_CUBIC_TO, 0, -1.14f, 0.21f, -2.2f, 0.63f, -3.19f,
|
||||
R_ARC_TO, 8.33f, 8.33f, 0, 0, 1, 1.75f, -2.58f,
|
||||
R_ARC_TO, 8.11f, 8.11f, 0, 0, 1, 2.6f, -1.75f,
|
||||
R_CUBIC_TO, 1, -0.43f, 2.06f, -0.65f, 3.19f, -0.65f,
|
||||
R_CUBIC_TO, 1.14f, 0, 2.2f, 0.22f, 3.19f, 0.65f,
|
||||
R_ARC_TO, 7.88f, 7.88f, 0, 0, 1, 2.58f, 1.75f,
|
||||
R_ARC_TO, 7.82f, 7.82f, 0, 0, 1, 1.75f, 2.6f,
|
||||
R_CUBIC_TO, 0.43f, 0.99f, 0.65f, 2.04f, 0.65f, 3.17f,
|
||||
R_ARC_TO, 7.97f, 7.97f, 0, 0, 1, -0.65f, 3.19f,
|
||||
R_CUBIC_TO, -0.42f, 0.99f, -1, 1.85f, -1.75f, 2.6f,
|
||||
R_ARC_TO, 8.26f, 8.26f, 0, 0, 1, -2.6f, 1.75f,
|
||||
R_ARC_TO, 8.05f, 8.05f, 0, 0, 1, -3.17f, 0.63f,
|
||||
CLOSE,
|
||||
R_MOVE_TO, 0, -1.73f,
|
||||
R_CUBIC_TO, 1.79f, 0, 3.31f, -0.62f, 4.56f, -1.87f,
|
||||
R_CUBIC_TO, 1.25f, -1.25f, 1.87f, -2.77f, 1.87f, -4.56f,
|
||||
R_CUBIC_TO, 0, -1.79f, -0.62f, -3.31f, -1.87f, -4.56f,
|
||||
R_CUBIC_TO, -1.25f, -1.25f, -2.77f, -1.87f, -4.56f, -1.87f,
|
||||
R_CUBIC_TO, -1.79f, 0, -3.31f, 0.63f, -4.56f, 1.88f,
|
||||
R_CUBIC_TO, -1.25f, 1.25f, -1.87f, 2.77f, -1.87f, 4.56f,
|
||||
R_CUBIC_TO, 0, 1.79f, 0.63f, 3.31f, 1.88f, 4.56f,
|
||||
R_CUBIC_TO, 1.25f, 1.25f, 2.77f, 1.87f, 4.56f, 1.87f,
|
||||
CLOSE
|
@ -46,6 +46,9 @@
|
||||
</clipPath>
|
||||
</defs>
|
||||
</g>
|
||||
<g id="do-not-disturb" viewbox="0 0 20 20">
|
||||
<path d="M6 10.875h8v-1.75H6v1.75Zm4 7.292a8.205 8.205 0 0 1-3.188-.625 8.59 8.59 0 0 1-2.604-1.75 8.589 8.589 0 0 1-1.75-2.604A8.204 8.204 0 0 1 1.833 10c0-1.139.209-2.201.625-3.188a8.327 8.327 0 0 1 1.75-2.583 8.112 8.112 0 0 1 2.604-1.75c1-.43 2.063-.646 3.188-.646 1.139 0 2.201.216 3.188.646a7.88 7.88 0 0 1 2.583 1.75 7.82 7.82 0 0 1 1.75 2.604c.43.986.646 2.042.646 3.167a7.974 7.974 0 0 1-.646 3.188c-.417.986-1 1.854-1.75 2.604a8.262 8.262 0 0 1-2.604 1.75 8.053 8.053 0 0 1-3.167.625Zm0-1.73c1.792 0 3.313-.625 4.563-1.875 1.25-1.25 1.874-2.77 1.874-4.562 0-1.792-.625-3.313-1.875-4.563-1.25-1.25-2.77-1.875-4.562-1.875-1.792 0-3.313.626-4.563 1.876-1.25 1.25-1.875 2.77-1.875 4.562 0 1.792.626 3.313 1.876 4.563 1.25 1.25 2.77 1.874 4.562 1.874Z"></path>
|
||||
</g>
|
||||
<g id="display-brightness-down" viewbox="0 0 20 20">
|
||||
<path fill-rule="evenodd"
|
||||
d="M9.99982 4.13281L11.7889 5.87499H14.1285V8.15322L15.7799 9.76139L14.1285 11.5036V13.7818H11.7889L9.99982 15.39L8.34836 13.7818H6.00878V11.5036L4.21973 9.76139L6.00878 8.15322V5.87499H8.34836L9.99982 4.13281ZM9.99982 6.41105L8.89883 7.48315H7.66025V8.68928L6.5593 9.76139L7.66025 10.9675V12.0396H8.89883L9.99982 13.2457L11.2384 12.0396H12.3394V10.9675L13.5779 9.76139L12.3394 8.68928V7.48315H11.2384L9.99982 6.41105Z">
|
||||
|
@ -93,6 +93,7 @@ export const KeyToIconNameMap: {[key: string]: string|undefined} = {
|
||||
'BrowserRefresh': 'refresh',
|
||||
'BrowserSearch': 'browser-search',
|
||||
'ContextMenu': 'menu',
|
||||
'DoNotDisturb': 'do-not-disturb',
|
||||
'EmojiPicker': 'emoji-picker',
|
||||
'EnableOrToggleDictation': 'dictation-toggle',
|
||||
'KeyboardBacklightToggle': 'keyboard-brightness-toggle',
|
||||
|
@ -44,6 +44,8 @@ void AddShortcutInputKeyStrings(content::WebUIDataSource* html_source) {
|
||||
IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_BROWSER_SEARCH},
|
||||
{"iconLabelContextMenu",
|
||||
IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_CONTEXT_MENU},
|
||||
{"iconLabelDoNotDisturb",
|
||||
IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_DO_NOT_DISTURB},
|
||||
{"iconLabelEnableOrToggleDictation",
|
||||
IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_ENABLE_OR_TOGGLE_DICTATION},
|
||||
{"iconLabelEmojiPicker",
|
||||
|
@ -455,6 +455,8 @@ bool ShouldExcludeItem(const AcceleratorLayoutDetails& details) {
|
||||
case kTilingWindowResizeUp:
|
||||
case kTilingWindowResizeDown:
|
||||
return !features::IsTilingWindowResizeEnabled();
|
||||
case kToggleDoNotDisturb:
|
||||
return !features::IsDoNotDisturbShortcutEnabled();
|
||||
case kToggleMouseKeys:
|
||||
return !::features::IsAccessibilityMouseKeysEnabled();
|
||||
case kToggleGeminiApp:
|
||||
|
@ -3,9 +3,12 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "ash/webui/shortcut_customization_ui/backend/accelerator_layout_table.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ash/public/cpp/accelerator_actions.h"
|
||||
#include "ash/public/cpp/accelerators_util.h"
|
||||
#include "ash/public/mojom/accelerator_info.mojom-shared.h"
|
||||
#include "ash/public/mojom/accelerator_info.mojom.h"
|
||||
#include "ash/strings/grit/ash_strings.h"
|
||||
#include "base/check_op.h"
|
||||
@ -560,6 +563,14 @@ const AcceleratorLayoutMap& GetAcceleratorLayoutMap() {
|
||||
mojom::AcceleratorSubcategory::kGeneralControls,
|
||||
/*locked=*/false, mojom::AcceleratorLayoutStyle::kDefault,
|
||||
mojom::AcceleratorSource::kAsh)},
|
||||
{AcceleratorAction::kToggleDoNotDisturb,
|
||||
AcceleratorLayoutDetails(
|
||||
AcceleratorAction::kToggleDoNotDisturb,
|
||||
IDS_ASH_ACCELERATOR_DESCRIPTION_TOGGLE_DO_NOT_DISTURB,
|
||||
mojom::AcceleratorCategory::kGeneral,
|
||||
mojom::AcceleratorSubcategory::kGeneralControls, /*locked=*/false,
|
||||
mojom::AcceleratorLayoutStyle::kDefault,
|
||||
mojom::AcceleratorSource::kAsh)},
|
||||
{AcceleratorAction::kOpenFileManager,
|
||||
AcceleratorLayoutDetails(
|
||||
AcceleratorAction::kOpenFileManager,
|
||||
|
@ -295,6 +295,7 @@ inline constexpr uint32_t kAcceleratorLayouts[] = {
|
||||
AcceleratorAction::kSwitchToNextUser,
|
||||
AcceleratorAction::kSwitchToPreviousUser,
|
||||
AcceleratorAction::kStartAssistant,
|
||||
AcceleratorAction::kToggleDoNotDisturb,
|
||||
|
||||
// General > Apps
|
||||
AcceleratorAction::kOpenFileManager,
|
||||
|
@ -57,6 +57,7 @@ export const keyToIconNameMap: {[key: string]: string|undefined} = {
|
||||
'BrowserRefresh': 'refresh',
|
||||
'BrowserSearch': 'browser-search',
|
||||
'ContextMenu': 'menu',
|
||||
'DoNotDisturb': 'do-not-disturb',
|
||||
'EmojiPicker': 'emoji-picker',
|
||||
'EnableOrToggleDictation': 'dictation-toggle',
|
||||
'KeyboardBacklightToggle': 'keyboard-brightness-toggle',
|
||||
|
@ -191,6 +191,8 @@ void AddLocalizedStrings(content::WebUIDataSource* source) {
|
||||
IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_BROWSER_SEARCH},
|
||||
{"iconLabelContextMenu",
|
||||
IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_CONTEXT_MENU},
|
||||
{"iconLabelDoNotDisturb",
|
||||
IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_DO_NOT_DISTURB},
|
||||
{"iconLabelEnableSelectToSpeak",
|
||||
IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_ENABLE_SELECT_TO_SPEAK},
|
||||
{"iconLabelEnableOrToggleDictation",
|
||||
|
@ -142,6 +142,8 @@ std::optional<int> GetStringIdForIconCode(IconCode icon_code) {
|
||||
return IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_ACCESSIBILITY;
|
||||
case ash::SearchResultTextItem::kKeyboardShortcutKeyboardQuickInsert:
|
||||
return IDS_KEYBOARD_QUICK_INSERT_LABEL;
|
||||
case ash::SearchResultTextItem::kKeyboardShortcutDoNotDisturb:
|
||||
return IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_DO_NOT_DISTURB;
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,6 +276,8 @@ std::optional<IconCode> KeyboardShortcutResult::GetIconCodeFromKeyboardCode(
|
||||
return IconCode::kKeyboardShortcutMicrophone;
|
||||
case (KeyboardCode::VKEY_ACCESSIBILITY):
|
||||
return IconCode::kKeyboardShortcutAccessibility;
|
||||
case KeyboardCode::VKEY_DO_NOT_DISTURB:
|
||||
return IconCode::kKeyboardShortcutDoNotDisturb;
|
||||
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
||||
case (KeyboardCode::VKEY_QUICK_INSERT):
|
||||
return IconCode::kKeyboardShortcutKeyboardQuickInsert;
|
||||
@ -304,6 +308,7 @@ KeyboardShortcutResult::GetIconCodeByKeyString(std::u16string_view key_string) {
|
||||
{u"BrowserHome", IconCode::kKeyboardShortcutBrowserHome},
|
||||
{u"BrowserRefresh", IconCode::kKeyboardShortcutBrowserRefresh},
|
||||
{u"BrowserSearch", IconCode::kKeyboardShortcutBrowserSearch},
|
||||
{u"DoNotDisturb", IconCode::kKeyboardShortcutDoNotDisturb},
|
||||
{u"EmojiPicker", IconCode::kKeyboardShortcutEmojiPicker},
|
||||
{u"EnableOrToggleDictation", IconCode::kKeyboardShortcutDictationToggle},
|
||||
{u"KeyboardBacklightToggle",
|
||||
|
@ -6481,6 +6481,9 @@
|
||||
<message name="IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_ACCESSIBILITY" desc="The text read aloud by the screen reader describing the keyboard icon 'accessibility'.">
|
||||
accessibility options
|
||||
</message>
|
||||
<message name="IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_DO_NOT_DISTURB" desc="The text read aloud by the screen reader describing the keyboard icon 'do not disturb'.">
|
||||
do not disturb
|
||||
</message>
|
||||
|
||||
<!-- End of Shortcut Customization -->
|
||||
|
||||
|
1
chromeos/chromeos_strings_grd/IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_DO_NOT_DISTURB.png.sha1
Normal file
1
chromeos/chromeos_strings_grd/IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_DO_NOT_DISTURB.png.sha1
Normal file
@ -0,0 +1 @@
|
||||
393e8fc4eefadd8ed530dab644abc08dacc750a6
|
@ -156,6 +156,7 @@ chromium-metrics-reviews@google.com.
|
||||
<variant name="ToggleClipboardHistory"/>
|
||||
<variant name="ToggleDictation"/>
|
||||
<variant name="ToggleDockedMagnifier"/>
|
||||
<variant name="ToggleDoNotDisturb"/>
|
||||
<variant name="ToggleFloating"/>
|
||||
<variant name="ToggleFullscreen"/>
|
||||
<variant name="ToggleFullscreenMagnifier"/>
|
||||
|
@ -190,6 +190,7 @@ chromium-metrics-reviews@google.com.
|
||||
<int value="136" label="ToggleMouseKeys"/>
|
||||
<int value="137" label="ResizePipWindow"/>
|
||||
<int value="138" label="ToggleGeminiApp"/>
|
||||
<int value="139" label="ToggleDoNotDisturb"/>
|
||||
<int value="9000" label="DebugClearUseKMeansPref"/>
|
||||
<int value="9001" label="DebugKeyboardBacklightToggle"/>
|
||||
<int value="9002" label="DebugMicrophoneMuteToggle"/>
|
||||
|
Reference in New Issue
Block a user