From 4156ea6bbf3252fd111f6a2f5a0e87ac97171c93 Mon Sep 17 00:00:00 2001 From: yangfeng Date: Tue, 23 Jul 2024 17:20:17 +0800 Subject: [PATCH 20/22] fix(media-keys-action):The shutdown shortcut cannot be found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复关机快捷键找不到 Related #44337 --- .../media-keys/media-keys-action.cpp | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/plugins/keybinding/media-keys/media-keys-action.cpp b/plugins/keybinding/media-keys/media-keys-action.cpp index 31552d5..864f8dc 100644 --- a/plugins/keybinding/media-keys/media-keys-action.cpp +++ b/plugins/keybinding/media-keys/media-keys-action.cpp @@ -1,14 +1,14 @@ /** - * Copyright (c) 2020 ~ 2021 KylinSec Co., Ltd. + * Copyright (c) 2020 ~ 2021 KylinSec Co., Ltd. * kiran-cc-daemon is licensed under Mulan PSL v2. - * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: - * http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PSL v2 for more details. + * * Author: meizhigang */ #include "plugins/keybinding/media-keys/media-keys-action.h" @@ -68,8 +68,7 @@ void MediaKeysAction::init_touchpad() if (device_helper->is_touchpad()) { this->has_touchpad_ = true; - } - }); + } }); } bool MediaKeysAction::do_action(XEvent *xev, std::string name) @@ -208,10 +207,9 @@ void MediaKeysAction::do_touchpad_osd(bool state) void MediaKeysAction::do_shutdown() { - std::string cmdline = std::string("mate-session-save --shutdown-dialog"); - try { + std::string cmdline = "kiran-session-quit --power-off"; Glib::spawn_command_line_async(cmdline); } catch (const Glib::Error &e) @@ -222,10 +220,9 @@ void MediaKeysAction::do_shutdown() void MediaKeysAction::do_logout() { - std::string cmdline = std::string("mate-session-save --logout-dialog"); - try { + std::string cmdline = "kiran-session-quit --logout"; Glib::spawn_command_line_async(cmdline); } catch (const Glib::Error &e) -- 2.27.0