From bbe6d35a00182934849abedf24b937f93bc28154 Mon Sep 17 00:00:00 2001 From: fuleyi Date: Fri, 3 Jan 2025 10:42:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=89=8B=E5=8A=BF=E5=8A=A8=E4=BD=9C?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 手势动作支持设置 Log: 手势动作支持设置 pms: TASK-362119 --- gesture1/built-in.go | 137 ----------- gesture1/config.go | 95 -------- gesture1/config_test.go | 109 --------- gesture1/exported_methods_auto.go | 11 + gesture1/gesture_action.go | 218 ++++++++++++++++++ gesture1/gesture_info.go | 75 ++++++ gesture1/manager.go | 174 +++++++------- gesture1/manager_ifc.go | 66 ++++++ keybinding1/shortcuts/system_shortcut.go | 2 +- misc/dde-daemon/gesture.json | 167 -------------- .../org.deepin.dde.daemon.gesture.json | 54 +++++ misc/po/dde-daemon.pot | 81 ++++++- misc/po/en_US.po | 73 +++++- misc/po/zh_CN.po | 73 +++++- 14 files changed, 718 insertions(+), 617 deletions(-) delete mode 100644 gesture1/built-in.go delete mode 100644 gesture1/config.go delete mode 100644 gesture1/config_test.go create mode 100644 gesture1/gesture_action.go create mode 100644 gesture1/gesture_info.go delete mode 100644 misc/dde-daemon/gesture.json diff --git a/gesture1/built-in.go b/gesture1/built-in.go deleted file mode 100644 index b44d18cd6..000000000 --- a/gesture1/built-in.go +++ /dev/null @@ -1,137 +0,0 @@ -// SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -package gesture1 - -import ( - "os/exec" -) - -const ( - wmActionShowWorkspace int32 = iota + 1 - wmActionToggleMaximize - wmActionMinimize - wmActionShowWindow = 6 - wmActionShowAllWindow = 7 -) - -const ( - wmTileDirectionLeft uint32 = iota + 1 - wmTileDirectionRight -) - -func (m *Manager) initBuiltinSets() { - m.builtinSets = map[string]func() error{ - "ShowWorkspace": m.toggleShowMultiTasking, - "Handle4Or5FingersSwipeUp": m.doHandle4Or5FingersSwipeUp, - "Handle4Or5FingersSwipeDown": m.doHandle4Or5FingersSwipeDown, - "ToggleMaximize": m.doToggleMaximize, - "Minimize": m.doMinimize, - "ShowWindow": m.doShowWindow, - "ShowAllWindow": m.doShowAllWindow, - "SwitchApplication": m.doSwitchApplication, - "ReverseSwitchApplication": m.doReverseSwitchApplication, - "SwitchWorkspace": m.doSwitchWorkspace, - "ReverseSwitchWorkspace": m.doReverseSwitchWorkspace, - "SplitWindowLeft": m.doTileActiveWindowLeft, - "SplitWindowRight": m.doTileActiveWindowRight, - "MoveWindow": m.doMoveActiveWindow, - } -} - -func (m *Manager) toggleShowDesktop() error { - return exec.Command("/usr/lib/deepin-daemon/desktop-toggle").Run() -} - -func (m *Manager) toggleShowMultiTasking() error { - return m.wm.PerformAction(0, wmActionShowWorkspace) -} - -func (m *Manager) getWmStates() (bool, bool, error) { - isShowDesktop, err := m.wm.GetIsShowDesktop(0) - if err != nil { - return false, false, err - } - isShowMultiTask, err := m.wm.GetMultiTaskingStatus(0) - if err != nil { - return false, false, err - } - - return isShowDesktop, isShowMultiTask, nil -} - -func (m *Manager) doHandle4Or5FingersSwipeUp() error { - isShowDesktop, isShowMultiTask, err := m.getWmStates() - if err != nil { - return err - } - - if !isShowMultiTask { - if !isShowDesktop { - return m.toggleShowMultiTasking() - } - return m.toggleShowDesktop() - } - - return nil -} - -func (m *Manager) doHandle4Or5FingersSwipeDown() error { - isShowDesktop, isShowMultiTask, err := m.getWmStates() - if err != nil { - return err - } - - if isShowMultiTask { - return m.toggleShowMultiTasking() - } - if !isShowDesktop { - return m.toggleShowDesktop() - } - return nil -} - -func (m *Manager) doToggleMaximize() error { - return m.wm.PerformAction(0, wmActionToggleMaximize) -} - -func (m *Manager) doMinimize() error { - return m.wm.PerformAction(0, wmActionMinimize) -} - -func (m *Manager) doShowWindow() error { - return m.wm.PerformAction(0, wmActionShowWindow) -} - -func (m *Manager) doShowAllWindow() error { - return m.wm.PerformAction(0, wmActionShowAllWindow) -} - -func (m *Manager) doSwitchApplication() error { - return m.wm.SwitchApplication(0, false) -} - -func (m *Manager) doReverseSwitchApplication() error { - return m.wm.SwitchApplication(0, true) -} - -func (m *Manager) doSwitchWorkspace() error { - return m.wm.SwitchToWorkspace(0, false) -} - -func (m *Manager) doReverseSwitchWorkspace() error { - return m.wm.SwitchToWorkspace(0, true) -} - -func (m *Manager) doTileActiveWindowLeft() error { - return m.wm.TileActiveWindow(0, wmTileDirectionLeft) -} - -func (m *Manager) doTileActiveWindowRight() error { - return m.wm.TileActiveWindow(0, wmTileDirectionRight) -} - -func (m *Manager) doMoveActiveWindow() error { - return m.wm.BeginToMoveActiveWindow(0) -} diff --git a/gesture1/config.go b/gesture1/config.go deleted file mode 100644 index 190ad4b5f..000000000 --- a/gesture1/config.go +++ /dev/null @@ -1,95 +0,0 @@ -// SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -package gesture1 - -import ( - "encoding/json" - "fmt" - "os" - "path/filepath" - - "github.com/adrg/xdg" - "github.com/linuxdeepin/go-lib/xdg/basedir" -) - -const ( - ActionTypeShortcut = "shortcut" - ActionTypeCommandline = "commandline" - ActionTypeBuiltin = "built-in" -) - -var ( - configUserPath = filepath.Join(basedir.GetUserConfigDir(), "deepin/dde-daemon/gesture.json") - configSystemPath, _ = xdg.SearchDataFile("dde-daemon/gesture.json") -) - -const ( - gestureSchemaId = "com.deepin.dde.gesture" - gsKeyTouchPadEnabled = "touch-pad-enabled" - gsKeyTouchScreenEnabled = "touch-screen-enabled" - - configManagerId = "org.desktopspec.ConfigManager" -) - -type ActionInfo struct { - Type string - Action string -} - -type EventInfo struct { - Name string - Direction string - Fingers int32 -} - -type gestureInfo struct { - Event EventInfo - Action ActionInfo -} -type gestureInfos []*gestureInfo - -func (action ActionInfo) toString() string { - return fmt.Sprintf("Type:%s, Action=%s", action.Type, action.Action) -} - -func (evInfo EventInfo) toString() string { - return fmt.Sprintf("Name=%s, Direction=%s, Fingers=%d", evInfo.Name, evInfo.Direction, evInfo.Fingers) -} - -func (infos gestureInfos) Get(evInfo EventInfo) *gestureInfo { - for _, info := range infos { - if info.Event == evInfo { - return info - } - } - return nil -} - -func (infos gestureInfos) Set(evInfo EventInfo, action ActionInfo) error { - info := infos.Get(evInfo) - if info == nil { - return fmt.Errorf("not found gesture info for: %s, %s, %d", evInfo.Name, evInfo.Direction, evInfo.Fingers) - } - info.Action = action - return nil -} - -func newGestureInfosFromFile(filename string) (gestureInfos, error) { - content, err := os.ReadFile(filepath.Clean(filename)) - if err != nil { - return nil, err - } - - if len(content) == 0 { - return nil, fmt.Errorf("file '%s' is empty", filename) - } - - var infos gestureInfos - err = json.Unmarshal(content, &infos) - if err != nil { - return nil, err - } - return infos, nil -} diff --git a/gesture1/config_test.go b/gesture1/config_test.go deleted file mode 100644 index 25be2ad2b..000000000 --- a/gesture1/config_test.go +++ /dev/null @@ -1,109 +0,0 @@ -// SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -package gesture1 - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -var ( - configPath = "testdata/gesture" -) - -// 查找手势信息 -func findGestureInfo(evInfo EventInfo, infos gestureInfos) bool { - for _, info := range infos { - if info.Event == evInfo { - return true - } - } - return false -} - -// 测试: 从文件读取手势信息 -func Test_newGestureInfosFromFile(t *testing.T) { - infos, err := newGestureInfosFromFile(configPath) - assert.NoError(t, err) - - assert.True(t, findGestureInfo(EventInfo{Name: "swipe", Direction: "up", Fingers: 3}, infos)) - assert.True(t, findGestureInfo(EventInfo{Name: "swipe", Direction: "down", Fingers: 3}, infos)) - assert.True(t, findGestureInfo(EventInfo{Name: "swipe", Direction: "left", Fingers: 3}, infos)) - assert.True(t, findGestureInfo(EventInfo{Name: "swipe", Direction: "right", Fingers: 3}, infos)) - assert.True(t, findGestureInfo(EventInfo{Name: "swipe", Direction: "up", Fingers: 4}, infos)) - assert.True(t, findGestureInfo(EventInfo{Name: "swipe", Direction: "down", Fingers: 4}, infos)) - assert.True(t, findGestureInfo(EventInfo{Name: "swipe", Direction: "left", Fingers: 4}, infos)) - assert.True(t, findGestureInfo(EventInfo{Name: "swipe", Direction: "right", Fingers: 4}, infos)) - assert.True(t, findGestureInfo(EventInfo{Name: "swipe", Direction: "up", Fingers: 5}, infos)) - assert.True(t, findGestureInfo(EventInfo{Name: "swipe", Direction: "down", Fingers: 5}, infos)) - assert.True(t, findGestureInfo(EventInfo{Name: "swipe", Direction: "left", Fingers: 5}, infos)) - assert.True(t, findGestureInfo(EventInfo{Name: "swipe", Direction: "right", Fingers: 5}, infos)) -} - -// 测试:Get接口 -func Test_Get(t *testing.T) { - infos, err := newGestureInfosFromFile(configPath) - assert.NoError(t, err) - - // for touch long press - infos = append(infos, &gestureInfo{ - Event: EventInfo{ - Name: "touch right button", - Direction: "down", - Fingers: 0, - }, - Action: ActionInfo{ - Type: ActionTypeCommandline, - Action: "xdotool mousedown 3", - }, - }) - infos = append(infos, &gestureInfo{ - Event: EventInfo{ - Name: "touch right button", - Direction: "up", - Fingers: 0, - }, - Action: ActionInfo{ - Type: ActionTypeCommandline, - Action: "xdotool mouseup 3", - }, - }) - - assert.NoError(t, err) - assert.NotNil(t, infos.Get(EventInfo{Name: "touch right button", Direction: "down", Fingers: 0})) - assert.NotNil(t, infos.Get(EventInfo{Name: "touch right button", Direction: "up", Fingers: 0})) - assert.NotNil(t, infos.Get(EventInfo{Name: "swipe", Direction: "up", Fingers: 3})) - assert.NotNil(t, infos.Get(EventInfo{Name: "swipe", Direction: "down", Fingers: 3})) - assert.NotNil(t, infos.Get(EventInfo{Name: "swipe", Direction: "left", Fingers: 3})) - assert.NotNil(t, infos.Get(EventInfo{Name: "swipe", Direction: "right", Fingers: 3})) - assert.NotNil(t, infos.Get(EventInfo{Name: "swipe", Direction: "up", Fingers: 4})) - assert.NotNil(t, infos.Get(EventInfo{Name: "swipe", Direction: "down", Fingers: 4})) - assert.NotNil(t, infos.Get(EventInfo{Name: "swipe", Direction: "left", Fingers: 4})) - assert.NotNil(t, infos.Get(EventInfo{Name: "swipe", Direction: "right", Fingers: 4})) - assert.NotNil(t, infos.Get(EventInfo{Name: "swipe", Direction: "up", Fingers: 5})) - assert.NotNil(t, infos.Get(EventInfo{Name: "swipe", Direction: "down", Fingers: 5})) - assert.NotNil(t, infos.Get(EventInfo{Name: "swipe", Direction: "left", Fingers: 5})) - assert.NotNil(t, infos.Get(EventInfo{Name: "swipe", Direction: "right", Fingers: 5})) -} - -// 测试:Set接口 -func Test_Set(t *testing.T) { - infos, err := newGestureInfosFromFile(configPath) - assert.NoError(t, err) - - action1 := ActionInfo{ - Type: "shortcut", - Action: "ctrl+minus", - } - action2 := ActionInfo{ - Type: "shortcut", - Action: "ctrl+find", - } - assert.NotNil(t, infos.Set(EventInfo{Name: "pinch", Direction: "in", Fingers: 2}, action1)) - assert.NotNil(t, infos.Set(EventInfo{Name: "pinch", Direction: "out", Fingers: 2}, action1)) - assert.Nil(t, infos.Set(EventInfo{Name: "swipe", Direction: "up", Fingers: 3}, action2)) - assert.Nil(t, infos.Set(EventInfo{Name: "swipe", Direction: "down", Fingers: 3}, action2)) -} diff --git a/gesture1/exported_methods_auto.go b/gesture1/exported_methods_auto.go index 3e114736d..1c62a8e8d 100644 --- a/gesture1/exported_methods_auto.go +++ b/gesture1/exported_methods_auto.go @@ -38,5 +38,16 @@ func (v *Manager) GetExportedMethods() dbusutil.ExportedMethods { Fn: v.SetShortPressDuration, InArgs: []string{"duration"}, }, + { + Name: "GetGestureAvaiableActions", + Fn: v.GetGestureAvaiableActions, + InArgs: []string{"name", "fingers"}, + OutArgs: []string{"actions"}, + }, + { + Name: "SetGesture", + Fn: v.SetGesture, + InArgs: []string{"name", "direction", "fingers", "action"}, + }, } } diff --git a/gesture1/gesture_action.go b/gesture1/gesture_action.go new file mode 100644 index 000000000..fe1184f05 --- /dev/null +++ b/gesture1/gesture_action.go @@ -0,0 +1,218 @@ +// SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +package gesture1 + +import ( + "fmt" + "github.com/linuxdeepin/go-lib/gettext" + "os/exec" +) + +type actionInfo struct { + Name string + Description string + fn func() error +} + +type actionInfos []*actionInfo + +var actions []*actionInfo + +const ( + wmActionShowWorkspace int32 = iota + 1 + wmActionToggleMaximize + wmActionMinimize + wmActionShowWindow = 6 + wmActionShowAllWindow = 7 +) + +const ( + wmTileDirectionLeft uint32 = iota + 1 + wmTileDirectionRight +) + +func (m *Manager) initActions() { + actions = []*actionInfo{ + {"MaximizeWindow", gettext.Tr("Maximize Window"), m.doToggleMaximize}, + {"RestoreWindow", gettext.Tr("Restore Window"), m.doToggleMaximize}, + {"SplitWindowLeft", gettext.Tr("Current Window Left Split"), m.doTileActiveWindowLeft}, + {"SplitWindowRight", gettext.Tr("Current Window Right Split"), m.doTileActiveWindowRight}, + {"ShowMultiTask", gettext.Tr("Show multitasking view"), m.doShowMultiTasking}, + {"HideMultitask", gettext.Tr("Hide multitasking view"), m.doHideMultiTasking}, + {"SwitchToPreDesktop", gettext.Tr("Switch to previous desktop"), m.doPreviousWorkspace}, + {"SwitchToNextDesktop", gettext.Tr("Switch to the next desktop"), m.doNextWorkspace}, + {"ShowDesktop", gettext.Tr("Show desktop"), m.toggleShowDesktop}, + {"HideDesktop", gettext.Tr("Hide desktop"), m.toggleShowDesktop}, + {"ToggleLaunchPad", gettext.Tr("Show/hide launcher"), m.doToggleLaunchpad}, + {"MouseRightButtonDown", gettext.Tr("Mouse right button pressed"), m.doXdotoolsMouseDown}, + {"MouseRightButtonUp", gettext.Tr("Mouse right button released"), m.doXdotoolsMouseUp}, + {"ToggleClipboard", gettext.Tr("Show/hide clipboard"), m.doToggleClipboard}, + {"ToggleGrandSearch", gettext.Tr("Show/hide grand search"), m.doToggleGrandSearch}, + {"ToggleNotifications", gettext.Tr("Show/hide notificaion center"), m.doToggleNotifications}, + {"Disable", gettext.Tr("Disable"), nil}, + } +} + +func (m *Manager) toggleShowDesktop() error { + return exec.Command("/usr/lib/deepin-daemon/desktop-toggle").Run() +} + +func (m *Manager) toggleShowMultiTasking() error { + return m.wm.PerformAction(0, wmActionShowWorkspace) +} + +func (m *Manager) getWmStates() (bool, bool, error) { + isShowDesktop, err := m.wm.GetIsShowDesktop(0) + if err != nil { + return false, false, err + } + isShowMultiTask, err := m.wm.GetMultiTaskingStatus(0) + if err != nil { + return false, false, err + } + + return isShowDesktop, isShowMultiTask, nil +} + +func (m *Manager) doHandle4Or5FingersSwipeUp() error { + isShowDesktop, isShowMultiTask, err := m.getWmStates() + if err != nil { + return err + } + + if !isShowMultiTask { + if !isShowDesktop { + return m.toggleShowMultiTasking() + } + return m.toggleShowDesktop() + } + + return nil +} + +func (m *Manager) doHandle4Or5FingersSwipeDown() error { + isShowDesktop, isShowMultiTask, err := m.getWmStates() + if err != nil { + return err + } + + if isShowMultiTask { + return m.toggleShowMultiTasking() + } + if !isShowDesktop { + return m.toggleShowDesktop() + } + return nil +} + +func (m *Manager) doToggleMaximize() error { + return m.wm.PerformAction(0, wmActionToggleMaximize) +} + +func (m *Manager) doMinimize() error { + return m.wm.PerformAction(0, wmActionMinimize) +} + +func (m *Manager) doShowWindow() error { + return m.wm.PerformAction(0, wmActionShowWindow) +} + +func (m *Manager) doShowAllWindow() error { + return m.wm.PerformAction(0, wmActionShowAllWindow) +} + +func (m *Manager) doSwitchApplication() error { + return m.wm.SwitchApplication(0, false) +} + +func (m *Manager) doReverseSwitchApplication() error { + return m.wm.SwitchApplication(0, true) +} + +func (m *Manager) doSwitchWorkspace() error { + return m.wm.SwitchToWorkspace(0, false) +} + +func (m *Manager) doReverseSwitchWorkspace() error { + return m.wm.SwitchToWorkspace(0, true) +} + +func (m *Manager) doTileActiveWindowLeft() error { + return m.wm.TileActiveWindow(0, wmTileDirectionLeft) +} + +func (m *Manager) doTileActiveWindowRight() error { + return m.wm.TileActiveWindow(0, wmTileDirectionRight) +} + +func (m *Manager) doMoveActiveWindow() error { + return m.wm.BeginToMoveActiveWindow(0) +} + +func (m *Manager) doNextWorkspace() error { + return m.wm.NextWorkspace(0) +} + +func (m *Manager) doPreviousWorkspace() error { + return m.wm.PreviousWorkspace(0) +} + +func (m *Manager) doToggleLaunchpad() error { + return m.launchpad.Toggle(0) +} + +func (m *Manager) doXdotoolsMouseDown() error { + cmd := "xdotool mousedown 3" + out, err := exec.Command("/bin/sh", "-c", cmd).CombinedOutput() + if err != nil { + return fmt.Errorf("%s", string(out)) + } + return nil +} + +func (m *Manager) doXdotoolsMouseUp() error { + cmd := "xdotool mousedown 3" + out, err := exec.Command("/bin/sh", "-c", cmd).CombinedOutput() + if err != nil { + return fmt.Errorf("%s", string(out)) + } + return nil +} + +func (m *Manager) doShowMultiTasking() error { + isShowMultiTask, err := m.wm.GetMultiTaskingStatus(0) + if err != nil { + return err + } + if !isShowMultiTask { + return m.toggleShowMultiTasking() + } + return nil +} + +func (m *Manager) doHideMultiTasking() error { + isShowMultiTask, err := m.wm.GetMultiTaskingStatus(0) + if err != nil { + return err + } + if isShowMultiTask { + return m.toggleShowMultiTasking() + } + return nil +} + +func (m *Manager) doToggleClipboard() error { + return m.clipboard.Toggle(0) +} + +func (m *Manager) doToggleGrandSearch() error { + cmd := "/usr/libexec/dde-daemon/keybinding/shortcut-dde-grand-search.sh" + return exec.Command("/bin/sh", "-c", cmd).Run() +} + +func (m *Manager) doToggleNotifications() error { + cmd := "dbus-send --print-reply --dest=org.deepin.dde.Osd1 /org/deepin/dde/shell/notification/center org.deepin.dde.shell.notification.center.Toggle" + return exec.Command("/bin/bash", "-c", cmd).Run() +} diff --git a/gesture1/gesture_info.go b/gesture1/gesture_info.go new file mode 100644 index 000000000..a1b6f992c --- /dev/null +++ b/gesture1/gesture_info.go @@ -0,0 +1,75 @@ +// SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +package gesture1 + +import ( + "fmt" +) + +const ( + gestureSchemaId = "com.deepin.dde.gesture" + gsKeyTouchPadEnabled = "touch-pad-enabled" + gsKeyTouchScreenEnabled = "touch-screen-enabled" +) + +type EventInfo struct { + Name string + Direction string + Fingers int32 +} + +type GestureInfo struct { + Name string + Direction string + Fingers int32 + ActionName string +} + +type GestureInfos []*GestureInfo + +var gestureInfos = GestureInfos{ + {"swipe", "up", 3, "MaximizeWindow"}, + {"swipe", "down", 3, "RestoreWindow"}, + {"swipe", "left", 3, "SplitWindowLeft"}, + {"swipe", "right", 3, "SplitWindowRight"}, + {"tap", "none", 3, "ToggleLaunchPad"}, + {"swipe", "up", 4, "ShowMultiTask"}, + {"swipe", "down", 4, "HideMultitask"}, + {"swipe", "left", 4, "SwitchToPreDesktop"}, + {"swipe", "right", 4, "SwitchToNextDesktop"}, + {"tap", "none", 4, "ToggleLaunchPad"}, + {"touch right button", "down", 0, "MouseRightButtonDown"}, + {"touch right button", "up", 0, "MouseRightButtonUp"}, +} + +func (m *Manager) GetGestureByEvent(event EventInfo) *GestureInfo { + for _, gesture := range m.Infos { + if gesture.Name == event.Name && + gesture.Direction == event.Direction && + gesture.Fingers == event.Fingers { + return gesture + } + } + return nil +} + +func (info *GestureInfo) toString() string { + return fmt.Sprintf("Name=%s, Direction=%s, Fingers=%d action info:%v", info.Name, info.Direction, info.Fingers, info.ActionName) +} + +func (evInfo EventInfo) toString() string { + return fmt.Sprintf("Name=%s, Direction=%s, Fingers=%d", evInfo.Name, evInfo.Direction, evInfo.Fingers) +} + +func (info *GestureInfo) doAction() error { + for _, action := range actions { + if info.ActionName == action.Name { + if action.fn != nil { + return action.fn() + } + } + } + return nil +} diff --git a/gesture1/manager.go b/gesture1/manager.go index e15a5482c..fa9b86f92 100644 --- a/gesture1/manager.go +++ b/gesture1/manager.go @@ -7,11 +7,10 @@ package gesture1 import ( "encoding/json" "fmt" + configManager "github.com/linuxdeepin/go-dbus-factory/org.desktopspec.ConfigManager" "math" "os" - "os/exec" - "path/filepath" "strings" "sync" @@ -21,6 +20,7 @@ import ( wm "github.com/linuxdeepin/go-dbus-factory/session/com.deepin.wm" clipboard "github.com/linuxdeepin/go-dbus-factory/session/org.deepin.dde.clipboard1" display "github.com/linuxdeepin/go-dbus-factory/session/org.deepin.dde.display1" + launchpad "github.com/linuxdeepin/go-dbus-factory/session/org.deepin.dde.launcher1" sessionmanager "github.com/linuxdeepin/go-dbus-factory/session/org.deepin.dde.sessionmanager1" sessionwatcher "github.com/linuxdeepin/go-dbus-factory/session/org.deepin.dde.sessionwatcher1" daemon "github.com/linuxdeepin/go-dbus-factory/system/org.deepin.dde.daemon1" @@ -42,6 +42,12 @@ const ( tsSchemaKeyBlacklist = "longpress-blacklist" ) +const ( + availableGesturesWith3Fingers = "availableGesturesWith3Fingers" + availableGesturesWith4Fingers = "availableGesturesWith4Fingers" + availableGesturesWithActionTap = "availableGesturesWithActionTap" +) + type deviceType int32 // 设备类型(触摸屏,触摸板) const ( @@ -60,7 +66,6 @@ type Manager struct { sysDaemon daemon.Daemon systemSigLoop *dbusutil.SignalLoop mu sync.RWMutex - userFile string builtinSets map[string]func() error gesture gesture.Gesture dock dock.Dock @@ -69,7 +74,7 @@ type Manager struct { tsSetting *gio.Settings touchPadEnabled bool touchScreenEnabled bool - Infos gestureInfos + Infos GestureInfos sessionmanager sessionmanager.SessionManager clipboard clipboard.Clipboard notification notification.Notification @@ -80,6 +85,10 @@ type Manager struct { oneFingerRightEnable bool configManagerPath dbus.ObjectPath sessionWatcher sessionwatcher.SessionWatcher + launchpad launchpad.Launcher + + dsGestureConfigManager configManager.Manager + availableGestures map[string][]string } func newManager() (*Manager, error) { @@ -94,39 +103,6 @@ func newManager() (*Manager, error) { return nil, err } - var filename = configUserPath - if !dutils.IsFileExist(configUserPath) { - filename = configSystemPath - } - - infos, err := newGestureInfosFromFile(filename) - if err != nil { - return nil, err - } - // for touch long press - infos = append(infos, &gestureInfo{ - Event: EventInfo{ - Name: "touch right button", - Direction: "down", - Fingers: 0, - }, - Action: ActionInfo{ - Type: ActionTypeCommandline, - Action: "xdotool mousedown 3", - }, - }) - infos = append(infos, &gestureInfo{ - Event: EventInfo{ - Name: "touch right button", - Direction: "up", - Fingers: 0, - }, - Action: ActionInfo{ - Type: ActionTypeCommandline, - Action: "xdotool mouseup 3", - }, - }) - setting, err := dutils.CheckAndNewGSettings(gestureSchemaId) if err != nil { return nil, err @@ -138,8 +114,6 @@ func newManager() (*Manager, error) { } m := &Manager{ - userFile: configUserPath, - Infos: infos, setting: setting, tsSetting: tsSetting, touchPadEnabled: setting.GetBoolean(gsKeyTouchPadEnabled), @@ -151,17 +125,25 @@ func newManager() (*Manager, error) { sessionmanager: sessionmanager.NewSessionManager(sessionConn), clipboard: clipboard.NewClipboard(sessionConn), notification: notification.NewNotification(sessionConn), + launchpad: launchpad.NewLauncher(sessionConn), + availableGestures: make(map[string][]string), } - - systemConnObj := systemConn.Object(configManagerId, "/") - err = systemConnObj.Call(configManagerId+".acquireManager", 0, "org.deepin.dde.daemon", "org.deepin.dde.daemon.gesture", "").Store(&m.configManagerPath) + dsg := configManager.NewConfigManager(systemConn) + powerConfigManagerPath, err := dsg.AcquireManager(0, "org.deepin.dde.daemon", "org.deepin.dde.daemon.gesture", "") if err != nil { logger.Warning(err) + return nil, err } + m.dsGestureConfigManager, err = configManager.NewManager(systemConn, powerConfigManagerPath) + m.longPressEnable = m.getGestureConfigValue("longPressEnable") m.oneFingerBottomEnable = m.getGestureConfigValue("oneFingerBottomEnable") m.oneFingerLeftEnable = m.getGestureConfigValue("oneFingerLeftEnable") m.oneFingerRightEnable = m.getGestureConfigValue("oneFingerRightEnable") + m.availableGestures[availableGesturesWith3Fingers] = m.getAvailableGestureConfigValue(availableGesturesWith3Fingers) + m.availableGestures[availableGesturesWith4Fingers] = m.getAvailableGestureConfigValue(availableGesturesWith4Fingers) + m.availableGestures[availableGesturesWithActionTap] = m.getAvailableGestureConfigValue(availableGesturesWithActionTap) + m.Infos = m.getGestureConfig() if _useWayland { setLongPressEnable(m.longPressEnable) @@ -173,6 +155,8 @@ func newManager() (*Manager, error) { if _useWayland { m.sessionWatcher = sessionwatcher.NewSessionWatcher(sessionConn) } + m.saveGestureConfig() + return m, nil } @@ -190,18 +174,58 @@ func setLongPressEnable(enable bool) { } func (m *Manager) getGestureConfigValue(key string) bool { - systemConn, err := dbus.SystemBus() + data, err := m.dsGestureConfigManager.Value(0, key) if err != nil { + logger.Warning(err) return true } - systemConnObj := systemConn.Object("org.desktopspec.ConfigManager", m.configManagerPath) - var val bool - err = systemConnObj.Call("org.desktopspec.ConfigManager.Manager.value", 0, key).Store(&val) + return data.Value().(bool) +} + +func (m *Manager) getAvailableGestureConfigValue(key string) []string { + var gestures []string + data, err := m.dsGestureConfigManager.Value(0, key) + if err != nil { + logger.Warning(err) + return nil + } + for _, v := range data.Value().([]dbus.Variant) { + gestures = append(gestures, v.Value().(string)) + } + return gestures +} + +func (m *Manager) getGestureConfig() (infos GestureInfos) { + var val string + data, err := m.dsGestureConfigManager.Value(0, "gestures") + if err != nil { + logger.Warning(err) + return nil + } + val = data.Value().(string) + if len(val) == 0 { + return gestureInfos + } else { + err = json.Unmarshal([]byte(val), &infos) + if err != nil { + logger.Warning("gesture config unmarshal fail:", err.Error()) + return + } + } + return +} + +func (m *Manager) saveGestureConfig() { + data, err := json.Marshal(m.Infos) + if err != nil { + logger.Warning(err) + return + } + err = m.dsGestureConfigManager.SetValue(0, "gestures", dbus.MakeVariant(data)) if err != nil { logger.Warning(err) - return true } - return val + return } func (m *Manager) destroy() { @@ -211,7 +235,7 @@ func (m *Manager) destroy() { } func (m *Manager) init() { - m.initBuiltinSets() + m.initActions() err := m.sysDaemon.SetLongPressDuration(0, uint32(m.tsSetting.GetInt(tsSchemaKeyLongPress))) if err != nil { logger.Warning("call SetLongPressDuration failed:", err) @@ -376,14 +400,14 @@ func (m *Manager) init() { m.listenGSettingsChanged() } -func (m *Manager) shouldIgnoreGesture(info *gestureInfo) bool { +func (m *Manager) shouldIgnoreGesture(info *GestureInfo) bool { // allow right button up when kbd grabbed - if (info.Event.Name != "touch right button" || info.Event.Direction != "up") && isKbdAlreadyGrabbed() { + if (info.Name != "touch right button" || info.Direction != "up") && isKbdAlreadyGrabbed() { // 多任务窗口下,不应该忽略手势操作 isShowMultiTask, err := m.wm.GetMultiTaskingStatus(0) if err != nil { logger.Warning(err) - } else if isShowMultiTask && info.Event.Name == "swipe" { + } else if isShowMultiTask && info.Name == "swipe" { logger.Debug("should not ignore swipe event, because we are in multi task") return false } @@ -392,13 +416,13 @@ func (m *Manager) shouldIgnoreGesture(info *gestureInfo) bool { } // TODO(jouyouyun): improve touch right button handler - if info.Event.Name == "touch right button" { + if info.Name == "touch right button" { // filter google chrome if isInWindowBlacklist(getCurrentActionWindowCmd(), m.tsSetting.GetStrv(tsSchemaKeyBlacklist)) { logger.Debug("the current active window in blacklist") return true } - } else if strings.HasPrefix(info.Event.Name, "touch") { + } else if strings.HasPrefix(info.Name, "touch") { return true } @@ -416,56 +440,22 @@ func (m *Manager) Exec(evInfo EventInfo) error { } } - info := m.Infos.Get(evInfo) + info := m.GetGestureByEvent(evInfo) if info == nil { logger.Infof("[Exec]: not found event info: %s", evInfo.toString()) return nil } - logger.Debugf("[Exec]: event info:%s action info:%s", info.Event.toString(), info.Action.toString()) + logger.Debugf("[Exec]: event info:%s", info.toString()) if m.shouldIgnoreGesture(info) { return nil } - if (!m.longPressEnable || _useWayland) && strings.Contains(string(info.Event.Name), "touch right button") { + if (!m.longPressEnable || _useWayland) && strings.Contains(string(info.Name), "touch right button") { return nil } - var cmd = info.Action.Action - switch info.Action.Type { - case ActionTypeCommandline: - break - case ActionTypeShortcut: - cmd = fmt.Sprintf("xdotool key %s", cmd) - case ActionTypeBuiltin: - return m.handleBuiltinAction(cmd) - default: - return fmt.Errorf("invalid action type: %s", info.Action.Type) - } - - // #nosec G204 - out, err := exec.Command("/bin/sh", "-c", cmd).CombinedOutput() - if err != nil { - return fmt.Errorf("%s", string(out)) - } - return nil -} - -func (m *Manager) Write() error { - m.mu.Lock() - defer m.mu.Unlock() - - // #nosec G301 - err := os.MkdirAll(filepath.Dir(m.userFile), 0755) - if err != nil { - return err - } - data, err := json.Marshal(m.Infos) - if err != nil { - return err - } - // #nosec G306 - return os.WriteFile(m.userFile, data, 0644) + return info.doAction() } func (m *Manager) listenGSettingsChanged() { diff --git a/gesture1/manager_ifc.go b/gesture1/manager_ifc.go index 60a23b1d6..a1c79ad42 100644 --- a/gesture1/manager_ifc.go +++ b/gesture1/manager_ifc.go @@ -5,8 +5,11 @@ package gesture1 import ( + "encoding/json" + "fmt" "github.com/godbus/dbus/v5" "github.com/linuxdeepin/go-lib/dbusutil" + "github.com/linuxdeepin/go-lib/strv" ) func (m *Manager) SetLongPressDuration(duration uint32) *dbus.Error { @@ -56,3 +59,66 @@ func (m *Manager) SetEdgeMoveStopDuration(duration uint32) *dbus.Error { func (m *Manager) GetEdgeMoveStopDuration() (duration uint32, busErr *dbus.Error) { return uint32(m.tsSetting.GetInt(tsSchemaKeyEdgeMoveStop)), nil } + +// GetGestureAvaiableActions 获取手势可选的操作 +func (m *Manager) GetGestureAvaiableActions(name string, fingers int32) (string, *dbus.Error) { + search := func(typ string) (string, *dbus.Error) { + if m.availableGestures[typ] == nil { + return "", dbusutil.ToError(fmt.Errorf("%s has no available actions", typ)) + } + var actionMap actionInfos + for _, gusture := range m.availableGestures[typ] { + for _, info := range actions { + if info.Name == gusture { + actionMap = append(actionMap, info) + continue + } + } + } + infos, err := json.Marshal(actionMap) + if err != nil { + return "", dbusutil.ToError(err) + } + return string(infos), nil + } + if name == "swipe" { + if fingers == 3 { + return search(availableGesturesWith3Fingers) + } else if fingers == 4 { + return search(availableGesturesWith4Fingers) + } + } else if name == "tap" { + return search(availableGesturesWithActionTap) + } + return "", nil +} + +func (m *Manager) SetGesture(name string, direction string, fingers int32, action string) *dbus.Error { + var typ string + if name == "swipe" { + if fingers == 3 { + typ = availableGesturesWith3Fingers + + } else if fingers == 4 { + typ = availableGesturesWith4Fingers + } + } else if name == "tap" { + typ = availableGesturesWithActionTap + } + if typ != "" { + available := m.availableGestures[typ] + if !strv.Strv(available).Contains(action) { + return dbusutil.ToError(fmt.Errorf("actions %v not found", action)) + } + } + for _, gesture := range m.Infos { + if gesture.Name == name && + gesture.Direction == direction && + gesture.Fingers == fingers { + gesture.ActionName = action + m.saveGestureConfig() + break + } + } + return nil +} diff --git a/keybinding1/shortcuts/system_shortcut.go b/keybinding1/shortcuts/system_shortcut.go index d1af6f0f3..68363275e 100644 --- a/keybinding1/shortcuts/system_shortcut.go +++ b/keybinding1/shortcuts/system_shortcut.go @@ -104,7 +104,7 @@ var defaultSysActionCmdMap = map[string]string{ "disable-touchpad": "gsettings set com.deepin.dde.touchpad touchpad-enabled false", "wm-switcher": "dbus-send --type=method_call --dest=org.deepin.dde.WMSwitcher1 /org/deepin/dde/WMSwitcher1 org.deepin.dde.WMSwitcher1.RequestSwitchWM", "turn-off-screen": "sleep 0.5; xset dpms force off", - "notification-center": "dbus-send --print-reply --dest=org.deepin.dde.Osd1 /org/freedesktop/dde/Notifications org.deepin.dde.Notification1.Toggle", + "notification-center": "dbus-send --print-reply --dest=org.deepin.dde.Osd1 /org/deepin/dde/shell/notification/center org.deepin.dde.shell.notification.center.Toggle", "clipboard": "dbus-send --print-reply --dest=org.deepin.dde.Clipboard1 /org/deepin/dde/Clipboard1 org.deepin.dde.Clipboard1.Toggle; dbus-send --print-reply --dest=org.deepin.dde.Launcher1 /org/deepin/dde/Launcher1 org.deepin.dde.Launcher1.Hide", "global-search": "/usr/libexec/dde-daemon/keybinding/shortcut-dde-grand-search.sh", "switch-next-kbd-layout": "dbus-send --print-reply --dest=org.deepin.dde.Keybinding1 /org/deepin/dde/InputDevice1/Keyboard org.deepin.dde.InputDevice1.Keyboard.ToggleNextLayout", diff --git a/misc/dde-daemon/gesture.json b/misc/dde-daemon/gesture.json deleted file mode 100644 index 14db6803e..000000000 --- a/misc/dde-daemon/gesture.json +++ /dev/null @@ -1,167 +0,0 @@ -[ - { - "Event": { - "Name": "swipe", - "Direction": "up", - "Fingers": 3 - }, - "Action": { - "Type": "built-in", - "Action": "ToggleMaximize" - } - }, - { - "Event": { - "Name": "swipe", - "Direction": "down", - "Fingers": 3 - }, - "Action": { - "Type": "built-in", - "Action": "ToggleMaximize" - } - }, - { - "Event": { - "Name": "swipe", - "Direction": "left", - "Fingers": 3 - }, - "Action": { - "Type": "built-in", - "Action": "SplitWindowLeft" - } - }, - { - "Event": { - "Name": "swipe", - "Direction": "right", - "Fingers": 3 - }, - "Action": { - "Type": "built-in", - "Action": "SplitWindowRight" - } - }, - { - "Event": { - "Name": "tap", - "Direction": "none", - "Fingers": 3 - }, - "Action": { - "Type": "shortcut", - "Action": "ctrl+alt+u" - } - }, - { - "Event": { - "Name": "swipe", - "Direction": "up", - "Fingers": 4 - }, - "Action": { - "Type": "built-in", - "Action": "Handle4Or5FingersSwipeUp" - } - }, - { - "Event": { - "Name": "swipe", - "Direction": "down", - "Fingers": 4 - }, - "Action": { - "Type": "built-in", - "Action": "Handle4Or5FingersSwipeDown" - } - }, - { - "Event": { - "Name": "swipe", - "Direction": "right", - "Fingers": 4 - }, - "Action": { - "Type": "built-in", - "Action": "ReverseSwitchWorkspace" - } - }, - { - "Event": { - "Name": "swipe", - "Direction": "left", - "Fingers": 4 - }, - "Action": { - "Type": "built-in", - "Action": "SwitchWorkspace" - } - }, - { - "Event": { - "Name": "tap", - "Direction": "none", - "Fingers": 4 - }, - "Action": { - "Type": "commandline", - "Action": "dbus-send --type=method_call --dest=org.deepin.dde.Launcher1 /org/deepin/dde/Launcher1 org.deepin.dde.Launcher1.Toggle" - } - }, - { - "Event": { - "Name": "swipe", - "Direction": "up", - "Fingers": 5 - }, - "Action": { - "Type": "built-in", - "Action": "Handle4Or5FingersSwipeUp" - } - }, - { - "Event": { - "Name": "swipe", - "Direction": "down", - "Fingers": 5 - }, - "Action": { - "Type": "built-in", - "Action": "Handle4Or5FingersSwipeDown" - } - }, - { - "Event": { - "Name": "swipe", - "Direction": "right", - "Fingers": 5 - }, - "Action": { - "Type": "built-in", - "Action": "ReverseSwitchWorkspace" - } - }, - { - "Event": { - "Name": "swipe", - "Direction": "left", - "Fingers": 5 - }, - "Action": { - "Type": "built-in", - "Action": "SwitchWorkspace" - } - }, - { - "Event": { - "Name": "tap", - "Direction": "none", - "Fingers": 5 - }, - "Action": { - "Type": "commandline", - "Action": "dbus-send --type=method_call --dest=org.deepin.dde.Launcher1 /org/deepin/dde/Launcher1 org.deepin.dde.Launcher1.Toggle" - } - } -] diff --git a/misc/dsg-configs/org.deepin.dde.daemon.gesture.json b/misc/dsg-configs/org.deepin.dde.daemon.gesture.json index df20cdb4d..1cc52a7e0 100644 --- a/misc/dsg-configs/org.deepin.dde.daemon.gesture.json +++ b/misc/dsg-configs/org.deepin.dde.daemon.gesture.json @@ -41,6 +41,60 @@ "description": "single finger right edge delimit property", "permissions": "readwrite", "visibility": "private" + }, + "availableGesturesWith3Fingers": { + "value": [ + "MaximizeWindow", + "RestoreWindow", + "SplitWindowLeft", + "SplitWindowRight", + "Disable" + ], + "serial": 0, + "flags": [], + "name": "availableGesturesWith3Fingers", + "name[zh_CN]": "三指滑动可选手势动作", + "description": "available gestures with 3 fingers", + "permissions": "readwrite", + "visibility": "private" + }, + "availableGesturesWith4Fingers": { + "value": [ + "ShowMultiTask", + "HideMultitask", + "SwitchToPreDesktop", + "SwitchToNextDesktop", + "ShowDesktop", + "HideDesktop", + "Disable" + ], + "serial": 0, + "flags": [], + "name": "availableGesturesWith4Fingers", + "name[zh_CN]": "四指滑动可选手势动作", + "description": "available gestures with 4 fingers", + "permissions": "readwrite", + "visibility": "private" + }, + "availableGesturesWithActionTap": { + "value": ["ToggleLaunchPad","ToggleClipboard","ToggleGrandSearch","ToggleNotifications", "Disable"], + "serial": 0, + "flags": [], + "name": "availableGesturesWithActionTap", + "name[zh_CN]": "三指、四指短触可选手势动作", + "description": "available gestures with tap", + "permissions": "readwrite", + "visibility": "private" + }, + "gestures": { + "value": "", + "serial": 0, + "flags": [], + "name": "gestures", + "name[zh_CN]": "手势配置", + "description": "gesture config", + "permissions": "readwrite", + "visibility": "private" } } } \ No newline at end of file diff --git a/misc/po/dde-daemon.pot b/misc/po/dde-daemon.pot index d965b1438..478697b76 100644 --- a/misc/po/dde-daemon.pot +++ b/misc/po/dde-daemon.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-12 16:11+0800\n" +"POT-Creation-Date: 2025-01-06 17:16+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -69,7 +69,7 @@ msgstr "" msgid "Audio Server changed, please log out and then log in" msgstr "" -#: ../../audio1/audio.go:368 ../../audio1/audio_events.go:465 +#: ../../audio1/audio.go:368 ../../audio1/audio_events.go:451 #: ../../bluetooth1/obex_agent.go:392 ../../bluetooth1/obex_agent.go:407 #: ../../bluetooth1/obex_agent.go:434 ../../bluetooth1/obex_agent.go:471 #: ../../bluetooth1/obex_agent.go:526 ../../bluetooth1/utils_notify.go:77 @@ -77,12 +77,12 @@ msgstr "" msgid "dde-control-center" msgstr "" -#: ../../audio1/audio_events.go:459 +#: ../../audio1/audio_events.go:445 #, c-format msgid "%s had been disabled" msgstr "" -#: ../../audio1/audio_events.go:460 +#: ../../audio1/audio_events.go:446 msgid "Open" msgstr "" @@ -220,6 +220,75 @@ msgstr "" msgid "Pair" msgstr "" +#: ../../gesture1/gesture_action.go:38 +msgid "Maximize Window" +msgstr "" + +#: ../../gesture1/gesture_action.go:39 +msgid "Restore Window" +msgstr "" + +#: ../../gesture1/gesture_action.go:40 +msgid "Current Window Left Split" +msgstr "" + +#: ../../gesture1/gesture_action.go:41 +msgid "Current Window Right Split" +msgstr "" + +#: ../../gesture1/gesture_action.go:42 +msgid "Show multitasking view" +msgstr "" + +#: ../../gesture1/gesture_action.go:43 +msgid "Hide multitasking view" +msgstr "" + +#: ../../gesture1/gesture_action.go:44 +msgid "Switch to previous desktop" +msgstr "" + +#: ../../gesture1/gesture_action.go:45 +msgid "Switch to the next desktop" +msgstr "" + +#: ../../gesture1/gesture_action.go:46 +#: ../../keybinding1/shortcuts/id_name_map.go:85 +msgid "Show desktop" +msgstr "" + +#: ../../gesture1/gesture_action.go:47 +msgid "Hide desktop" +msgstr "" + +#: ../../gesture1/gesture_action.go:48 +msgid "Show/hide launcher" +msgstr "" + +#: ../../gesture1/gesture_action.go:49 +msgid "Mouse right button pressed" +msgstr "" + +#: ../../gesture1/gesture_action.go:50 +msgid "Mouse right button released" +msgstr "" + +#: ../../gesture1/gesture_action.go:51 +msgid "Show/hide clipboard" +msgstr "" + +#: ../../gesture1/gesture_action.go:52 +msgid "Show/hide grand search" +msgstr "" + +#: ../../gesture1/gesture_action.go:53 +msgid "Show/hide notification center" +msgstr "" + +#: ../../gesture1/gesture_action.go:54 +msgid "Disable" +msgstr "" + #: ../../housekeeping/init.go:136 msgid "Insufficient disk space, please clean up in time!" msgstr "" @@ -373,10 +442,6 @@ msgstr "" msgid "Switch windows in reverse" msgstr "" -#: ../../keybinding1/shortcuts/id_name_map.go:85 -msgid "Show desktop" -msgstr "" - #: ../../keybinding1/shortcuts/id_name_map.go:94 msgid "Maximize window" msgstr "" diff --git a/misc/po/en_US.po b/misc/po/en_US.po index e60e832ae..e838975c9 100644 --- a/misc/po/en_US.po +++ b/misc/po/en_US.po @@ -228,6 +228,75 @@ msgstr "Add Bluetooth devices" msgid "Pair" msgstr "Pair" +#: ../../gesture1/gesture_action.go:38 +msgid "Maximize Window" +msgstr "Maximize Window" + +#: ../../gesture1/gesture_action.go:39 +msgid "Restore Window" +msgstr "Restore Window" + +#: ../../gesture1/gesture_action.go:40 +msgid "Current Window Left Split" +msgstr "Current Window Left Split" + +#: ../../gesture1/gesture_action.go:41 +msgid "Current Window Right Split" +msgstr "Current Window Right Split" + +#: ../../gesture1/gesture_action.go:42 +msgid "Show multitasking view" +msgstr "Show multitasking view" + +#: ../../gesture1/gesture_action.go:43 +msgid "Hide multitasking view" +msgstr "Hide multitasking view" + +#: ../../gesture1/gesture_action.go:44 +msgid "Switch to previous desktop" +msgstr "Switch to previous desktop" + +#: ../../gesture1/gesture_action.go:45 +msgid "Switch to the next desktop" +msgstr "Switch to the next desktop" + +#: ../../gesture1/gesture_action.go:51 +msgid "Show/hide clipboard" +msgstr "Show/hide clipboard" + +#: ../../gesture1/gesture_action.go:52 +msgid "Show/hide grand search" +msgstr "Show/hide grand search" + +#: ../../gesture1/gesture_action.go:53 +msgid "Show/hide notification center" +msgstr "Show/hide notification center" + +#: ../../gesture1/gesture_action.go:46 +#: ../../keybinding1/shortcuts/id_name_map.go:85 +msgid "Show desktop" +msgstr "Show desktop" + +#: ../../gesture1/gesture_action.go:47 +msgid "Hide desktop" +msgstr "Hide desktop" + +#: ../../gesture1/gesture_action.go:48 +msgid "Show/hide launcher" +msgstr "Show/hide launcher" + +#: ../../gesture1/gesture_action.go:49 +msgid "Mouse right button pressed" +msgstr "Mouse right button pressed" + +#: ../../gesture1/gesture_action.go:50 +msgid "Mouse right button released" +msgstr "Mouse right button released" + +#: ../../gesture1/gesture_action.go:51 +msgid "Disable" +msgstr "Disable" + #: ../../dock/app_entry_menu.go:102 msgid "Close All" msgstr "Close All" @@ -402,10 +471,6 @@ msgstr "Switch windows" msgid "Switch windows in reverse" msgstr "Switch windows in reverse" -#: ../../keybinding/shortcuts/id_name_map.go:85 -msgid "Show desktop" -msgstr "Show desktop" - #: ../../keybinding/shortcuts/id_name_map.go:94 msgid "Maximize window" msgstr "Maximize window" diff --git a/misc/po/zh_CN.po b/misc/po/zh_CN.po index 58b787e41..9d2101d58 100644 --- a/misc/po/zh_CN.po +++ b/misc/po/zh_CN.po @@ -231,6 +231,75 @@ msgstr "添加蓝牙设备" msgid "Pair" msgstr "配对" +#: ../../gesture1/gesture_action.go:38 +msgid "Maximize Window" +msgstr "最大化窗口" + +#: ../../gesture1/gesture_action.go:39 +msgid "Restore Window" +msgstr "恢复窗口" + +#: ../../gesture1/gesture_action.go:40 +msgid "Current Window Left Split" +msgstr "当前窗口右分屏" + +#: ../../gesture1/gesture_action.go:41 +msgid "Current Window Right Split" +msgstr "当前窗口右分屏" + +#: ../../gesture1/gesture_action.go:42 +msgid "Show multitasking view" +msgstr "显示多任务视图" + +#: ../../gesture1/gesture_action.go:43 +msgid "Hide multitasking view" +msgstr "隐藏多任务视图" + +#: ../../gesture1/gesture_action.go:44 +msgid "Switch to previous desktop" +msgstr "切换至前一个桌面" + +#: ../../gesture1/gesture_action.go:45 +msgid "Switch to the next desktop" +msgstr "切换至后一个桌面" + +#: ../../gesture1/gesture_action.go:46 +#: ../../keybinding1/shortcuts/id_name_map.go:85 +msgid "Show desktop" +msgstr "显示桌面" + +#: ../../gesture1/gesture_action.go:47 +msgid "Hide desktop" +msgstr "隐藏桌面" + +#: ../../gesture1/gesture_action.go:48 +msgid "Show/hide launcher" +msgstr "显示、隐藏启动器" + +#: ../../gesture1/gesture_action.go:49 +msgid "Mouse right button pressed" +msgstr "" + +#: ../../gesture1/gesture_action.go:50 +msgid "Mouse right button released" +msgstr "" + +#: ../../gesture1/gesture_action.go:51 +msgid "Show/hide clipboard" +msgstr "打开/隐藏剪切板" + +#: ../../gesture1/gesture_action.go:52 +msgid "Show/hide grand search" +msgstr "打开/隐藏全局搜索" + +#: ../../gesture1/gesture_action.go:53 +msgid "Show/hide notification center" +msgstr "打开/隐藏消息中心" + +#: ../../gesture1/gesture_action.go:51 +msgid "Disable" +msgstr "禁用" + #: ../../housekeeping/init.go:136 msgid "Insufficient disk space, please clean up in time!" msgstr "系统磁盘空间不足,请及时清理!" @@ -384,10 +453,6 @@ msgstr "切换窗口" msgid "Switch windows in reverse" msgstr "反向切换窗口" -#: ../../keybinding1/shortcuts/id_name_map.go:85 -msgid "Show desktop" -msgstr "显示桌面" - #: ../../keybinding1/shortcuts/id_name_map.go:94 msgid "Maximize window" msgstr "最大化窗口"