From 299a4229960b85497013b0b44b3f4c3f65af098e Mon Sep 17 00:00:00 2001 From: zsien Date: Thu, 20 Jun 2024 10:10:54 +0800 Subject: [PATCH] fix: pressing the power button opened the lock screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 应该打开关机界面 Issues: linuxdeepin/developer-center#9360 --- Makefile | 1 + keybinding/special_keycode.go | 2 +- misc/scripts/dde-lock.sh | 6 +++++- misc/scripts/dde-shutdown.sh | 7 +++++++ 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100755 misc/scripts/dde-shutdown.sh diff --git a/Makefile b/Makefile index 1aa657680..ff0aaa4c8 100644 --- a/Makefile +++ b/Makefile @@ -223,6 +223,7 @@ install: build install-dde-data install-icons cp -r misc/dsg-configs/*.json ${DESTDIR}${PREFIX}/share/dsg/configs/org.deepin.dde.daemon/ cp -f misc/scripts/dde-lock.sh ${DESTDIR}${PREFIX}/lib/deepin-daemon/ + cp -f misc/scripts/dde-shutdown.sh ${DESTDIR}${PREFIX}/lib/deepin-daemon/ install-dde-data: mkdir -pv ${DESTDIR}${PREFIX}/share/dde/ cp -r misc/data misc/zoneinfo ${DESTDIR}${PREFIX}/share/dde/ diff --git a/keybinding/special_keycode.go b/keybinding/special_keycode.go index 4e175d8fa..e58bc837a 100644 --- a/keybinding/special_keycode.go +++ b/keybinding/special_keycode.go @@ -276,7 +276,7 @@ func (m *Manager) handlePower() { } m.systemTurnOffScreen() case powerActionShowUI: - cmd := "/usr/lib/deepin-daemon/dde-lock.sh" + cmd := "/usr/lib/deepin-daemon/dde-shutdown.sh" go func() { locked, err := m.sessionManager.Locked().Get(0) if err != nil { diff --git a/misc/scripts/dde-lock.sh b/misc/scripts/dde-lock.sh index e98e52503..65109b92e 100755 --- a/misc/scripts/dde-lock.sh +++ b/misc/scripts/dde-lock.sh @@ -1,3 +1,7 @@ #!/bin/sh -originmap=$(setxkbmap -query | grep option | awk -F ' ' '{print $2}');setxkbmap -option grab:break_actions&&xdotool key XF86Ungrab&&dbus-send --print-reply --dest=org.deepin.dde.LockFront1 /org/deepin/dde/LockFront1 org.deepin.dde.LockFront1.Show; setxkbmap -option $originmap \ No newline at end of file +originmap=$(setxkbmap -query | grep option | awk -F ' ' '{print $2}'); +setxkbmap -option grab:break_actions && + xdotool key XF86Ungrab && + dbus-send --print-reply --dest=org.deepin.dde.LockFront1 /org/deepin/dde/LockFront1 org.deepin.dde.LockFront1.Show +setxkbmap -option $originmap diff --git a/misc/scripts/dde-shutdown.sh b/misc/scripts/dde-shutdown.sh new file mode 100755 index 000000000..fea7a0cd4 --- /dev/null +++ b/misc/scripts/dde-shutdown.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +originmap=$(setxkbmap -query | grep option | awk -F ' ' '{print $2}'); +setxkbmap -option grab:break_actions && + xdotool key XF86Ungrab && + dbus-send --print-reply --dest=org.deepin.dde.ShutdownFront1 /org/deepin/dde/ShutdownFront1 org.deepin.dde.ShutdownFront1.Show +setxkbmap -option $originmap