Loading pkgs/desktops/deepin/default.nix +1 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ let go-gir-generator = callPackage ./go-package/go-gir-generator { }; go-dbus-factory = callPackage ./go-package/go-dbus-factory { }; dde-api = callPackage ./go-package/dde-api { inherit replaceAll; }; dde-daemon = callPackage ./go-package/dde-daemon { }; deepin-pw-check = callPackage ./go-package/deepin-pw-check { }; deepin-desktop-schemas = callPackage ./go-package/deepin-desktop-schemas { }; Loading pkgs/desktops/deepin/go-package/dde-daemon/0001-fix-wrapped-name-for-verifyExe.patch 0 → 100644 +33 −0 Original line number Diff line number Diff line From ad18742c699a08cd82f8926a31da9a19b2aef329 Mon Sep 17 00:00:00 2001 From: rewine <lhongxu@outlook.com> Date: Wed, 5 Apr 2023 23:37:24 +0800 Subject: [PATCH 1/4] fix-wrapped-name-for-verifyExe --- dock/process_info.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dock/process_info.go b/dock/process_info.go index 83c61d58..e2970f3a 100644 --- a/dock/process_info.go +++ b/dock/process_info.go @@ -119,6 +119,16 @@ func verifyExe(exe, cwd, firstArg string) bool { return false } logger.Debugf("firstArgPath: %q", firstArgPath) + if exe == firstArgPath { + return true + } + if strings.HasSuffix(exe, "-wrapped") { + exeBase := filepath.Base(exe) + if (len(exeBase) <= 9) { + return false + } + exe = exe[0:len(exe)-len(exeBase)] + exeBase[1:len(exeBase)-8] + } return exe == firstArgPath } -- 2.39.2 pkgs/desktops/deepin/go-package/dde-daemon/0002-dont-set-PATH.patch 0 → 100644 +40 −0 Original line number Diff line number Diff line From 7fe41aac7c31f6143b5f5887dbefa41fdf4c252b Mon Sep 17 00:00:00 2001 From: rewine <lhongxu@outlook.com> Date: Wed, 5 Apr 2023 23:37:49 +0800 Subject: [PATCH 2/4] dont-set-PATH --- bin/dde-system-daemon/main.go | 4 ---- grub2/modify_manger.go | 1 - 2 files changed, 5 deletions(-) diff --git a/bin/dde-system-daemon/main.go b/bin/dde-system-daemon/main.go index 03d2a415..cf92f065 100644 --- a/bin/dde-system-daemon/main.go +++ b/bin/dde-system-daemon/main.go @@ -77,10 +77,6 @@ func main() { // fix no PATH when was launched by dbus if os.Getenv("PATH") == "" { logger.Warning("No PATH found, manual special") - err = os.Setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin") - if err != nil { - logger.Warning(err) - } } // 系统级服务,无需设置LANG和LANGUAGE,保证翻译不受到影响 diff --git a/grub2/modify_manger.go b/grub2/modify_manger.go index a811770b..30e9561e 100644 --- a/grub2/modify_manger.go +++ b/grub2/modify_manger.go @@ -21,7 +21,6 @@ const ( ) func init() { - _ = os.Setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin") } type modifyManager struct { -- 2.39.2 pkgs/desktops/deepin/go-package/dde-daemon/0003-search-in-XDG-directories.patch 0 → 100644 +257 −0 Original line number Diff line number Diff line From 528f590c0c81728c324444fd76e0f7113a2e3dc4 Mon Sep 17 00:00:00 2001 From: rewine <lhongxu@outlook.com> Date: Wed, 5 Apr 2023 23:41:25 +0800 Subject: [PATCH 3/4] search-in-XDG-directories --- accounts/manager.go | 5 ++++- accounts/user.go | 8 +++++++- appearance/fsnotify.go | 21 +++++++++++++++++---- apps/utils.go | 3 ++- dock/desktop_file_path.go | 6 ++++++ gesture/config.go | 4 ++-- keybinding/shortcuts/system_shortcut.go | 4 +++- mime/app_info.go | 7 ++++++- system/gesture/config.go | 4 +++- 9 files changed, 50 insertions(+), 12 deletions(-) diff --git a/accounts/manager.go b/accounts/manager.go index a5abb157..3fd7c153 100644 --- a/accounts/manager.go +++ b/accounts/manager.go @@ -15,6 +15,7 @@ import ( "sync" "syscall" + "github.com/adrg/xdg" dbus "github.com/godbus/dbus" "github.com/linuxdeepin/dde-daemon/accounts/users" "github.com/linuxdeepin/dde-daemon/common/sessionmsg" @@ -35,8 +36,10 @@ const ( actConfigFile = actConfigDir + "/accounts.ini" actConfigGroupGroup = "Accounts" actConfigKeyGuest = "AllowGuest" +) - interfacesFile = "/usr/share/dde-daemon/accounts/dbus-udcp.json" +var ( + interfacesFile, _ = xdg.SearchDataFile("dde-daemon/accounts/dbus-udcp.json") ) type InterfaceConfig struct { diff --git a/accounts/user.go b/accounts/user.go index 99138941..56a7731a 100644 --- a/accounts/user.go +++ b/accounts/user.go @@ -15,6 +15,7 @@ import ( "strings" "sync" + "github.com/adrg/xdg" dbus "github.com/godbus/dbus" "github.com/linuxdeepin/dde-daemon/accounts/users" authenticate "github.com/linuxdeepin/go-dbus-factory/com.deepin.daemon.authenticate" @@ -645,7 +646,12 @@ func getUserSession(homeDir string) string { } func getSessionList() []string { - fileInfoList, err := ioutil.ReadDir("/usr/share/xsessions") + xsessionPath, err := xdg.SearchDataFile("xsessions") + if err != nil { + return nil; + } + + fileInfoList, err := ioutil.ReadDir(xsessionPath) if err != nil { return nil } diff --git a/appearance/fsnotify.go b/appearance/fsnotify.go index a409d0ba..ff674600 100644 --- a/appearance/fsnotify.go +++ b/appearance/fsnotify.go @@ -5,12 +5,15 @@ package appearance import ( + "errors" + "io/fs" "os" "path" "path/filepath" "strings" "time" + "github.com/adrg/xdg" "github.com/fsnotify/fsnotify" "github.com/linuxdeepin/dde-daemon/appearance/background" "github.com/linuxdeepin/dde-daemon/appearance/subthemes" @@ -100,9 +103,14 @@ func (m *Manager) watchGtkDirs() { gtkDirs = []string{ path.Join(home, ".local/share/themes"), path.Join(home, ".themes"), - "/usr/local/share/themes", - "/usr/share/themes", } + for _, dataPath := range xdg.DataDirs { + gtkPath := filepath.Join(dataPath, "themes"); + if _, err := os.Stat(gtkPath); err != nil && errors.Is(err, fs.ErrNotExist) { + continue + } + gtkDirs = append(gtkDirs, gtkPath); + } m.watchDirs(gtkDirs) } @@ -112,9 +120,14 @@ func (m *Manager) watchIconDirs() { iconDirs = []string{ path.Join(home, ".local/share/icons"), path.Join(home, ".icons"), - "/usr/local/share/icons", - "/usr/share/icons", } + for _, dataPath := range xdg.DataDirs { + iconPath := filepath.Join(dataPath, "icons"); + if _, err := os.Stat(iconPath); err != nil && errors.Is(err, fs.ErrNotExist) { + continue + } + iconDirs = append(iconDirs, iconPath); + } m.watchDirs(iconDirs) } diff --git a/apps/utils.go b/apps/utils.go index 8863d6c2..dd6f8e16 100644 --- a/apps/utils.go +++ b/apps/utils.go @@ -11,6 +11,7 @@ import ( "strconv" "strings" "syscall" + "github.com/adrg/xdg" ) func intSliceContains(slice []int, a int) bool { @@ -96,7 +97,7 @@ func removeDesktopExt(name string) string { } func getSystemDataDirs() []string { - return []string{"/usr/share", "/usr/local/share"} + return xdg.DataDirs } // get user home diff --git a/dock/desktop_file_path.go b/dock/desktop_file_path.go index 7adc9f55..e1a97679 100644 --- a/dock/desktop_file_path.go +++ b/dock/desktop_file_path.go @@ -7,6 +7,8 @@ package dock import ( "path/filepath" "strings" + + "github.com/adrg/xdg" ) var pathDirCodeMap map[string]string @@ -20,6 +22,10 @@ func initPathDirCodeMap() { "/usr/local/share/applications/": "/L@", } + for _, dataPath := range xdg.DataDirs { + pathDirCodeMap[dataPath] = "/S@" + } + dir := filepath.Join(homeDir, ".local/share/applications") dir = addDirTrailingSlash(dir) pathDirCodeMap[dir] = "/H@" diff --git a/gesture/config.go b/gesture/config.go index bfbd4db7..4ce9d641 100644 --- a/gesture/config.go +++ b/gesture/config.go @@ -10,6 +10,7 @@ import ( "io/ioutil" "path/filepath" + "github.com/adrg/xdg" "github.com/linuxdeepin/go-lib/xdg/basedir" ) @@ -21,11 +22,10 @@ const ( var ( configUserPath = filepath.Join(basedir.GetUserConfigDir(), "deepin/dde-daemon/gesture.json") + configSystemPath, _ = xdg.SearchDataFile("dde-daemon/gesture.json") ) const ( - configSystemPath = "/usr/share/dde-daemon/gesture.json" - gestureSchemaId = "com.deepin.dde.gesture" gsKeyTouchPadEnabled = "touch-pad-enabled" gsKeyTouchScreenEnabled = "touch-screen-enabled" diff --git a/keybinding/shortcuts/system_shortcut.go b/keybinding/shortcuts/system_shortcut.go index d33a69f6..c3138099 100644 --- a/keybinding/shortcuts/system_shortcut.go +++ b/keybinding/shortcuts/system_shortcut.go @@ -10,6 +10,7 @@ import ( "path" "sync" + "github.com/adrg/xdg" dutils "github.com/linuxdeepin/go-lib/utils" ) @@ -152,5 +153,6 @@ func getSystemActionsFile() string { return file } - return "" + filepath, _ := xdg.SearchDataFile(systemActionsFile) + return filepath; } diff --git a/mime/app_info.go b/mime/app_info.go index 63fcdcc0..18436164 100644 --- a/mime/app_info.go +++ b/mime/app_info.go @@ -9,6 +9,7 @@ import ( "os" "path" + "github.com/adrg/xdg" "github.com/linuxdeepin/go-lib/appinfo/desktopappinfo" "github.com/linuxdeepin/go-lib/mime" dutils "github.com/linuxdeepin/go-lib/utils" @@ -162,5 +163,9 @@ func findFilePath(file string) string { return data } - return path.Join("/usr/share", file) + filepath, err := xdg.SearchDataFile(file) + if err != nil { + return path.Join("/usr/share", file) + } + return filepath; } diff --git a/system/gesture/config.go b/system/gesture/config.go index d4aebaac..f3fc92c3 100644 --- a/system/gesture/config.go +++ b/system/gesture/config.go @@ -8,6 +8,7 @@ import ( "encoding/json" "io/ioutil" + "github.com/adrg/xdg" "github.com/linuxdeepin/go-lib/utils" ) @@ -35,5 +36,6 @@ func getConfigPath() string { if utils.IsFileExist(filename) { return filename } - return "/usr/share/" + suffix + filepath, _ := xdg.SearchDataFile(suffix) + return filepath; } -- 2.39.2 pkgs/desktops/deepin/go-package/dde-daemon/0004-aviod-use-hardcode-path.patch 0 → 100644 +323 −0 Original line number Diff line number Diff line From 12a5ccce245f82c334e78d48354e55311c15fb0c Mon Sep 17 00:00:00 2001 From: rewine <lhongxu@outlook.com> Date: Wed, 5 Apr 2023 23:51:58 +0800 Subject: [PATCH 4/4] aviod-use-hardcode-path --- accounts/user.go | 2 +- accounts/user_chpwd_union_id.go | 9 ++++----- bin/backlight_helper/ddcci/ddcci.go | 20 +++++-------------- bin/dde-authority/fprint_transaction.go | 2 +- inputdevices/keyboard.go | 5 +++-- keybinding/shortcuts/system_shortcut.go | 6 +++--- keybinding/special_keycode.go | 2 +- keybinding/utils.go | 2 +- launcher/manager_ifc.go | 2 +- .../dde-daemon/keybinding/system_actions.json | 4 ++-- misc/etc/acpi/powerbtn.sh | 2 +- misc/udev-rules/80-deepin-fprintd.rules | 2 +- system/display/displaycfg.go | 2 +- system/power/manager_lmt.go | 3 ++- system/power_manager/utils.go | 2 +- system/systeminfo/manager.go | 2 +- systeminfo/utils.go | 2 +- 17 files changed, 30 insertions(+), 39 deletions(-) diff --git a/accounts/user.go b/accounts/user.go index f8827fb2..ff604f38 100644 --- a/accounts/user.go +++ b/accounts/user.go @@ -450,7 +450,7 @@ func (u *User) checkIsControlCenter(sender dbus.Sender) bool { return false } - if exe == controlCenterPath { + if strings.Contains(exe, "dde-control-center") { return true } diff --git a/accounts/user_chpwd_union_id.go b/accounts/user_chpwd_union_id.go index b0ba9cb9..e8aa1a1e 100644 --- a/accounts/user_chpwd_union_id.go +++ b/accounts/user_chpwd_union_id.go @@ -107,14 +107,13 @@ func newCaller(service *dbusutil.Service, sender dbus.Sender) (ret *caller, err // 只允许来自控制中心, 锁屏和 greetter 的调用 var app string - switch exe { - case "/usr/bin/dde-control-center": + if (strings.Contains(exe, "dde-control-center")) { app = "control-center" - case "/usr/bin/dde-lock": + } else if (strings.Contains(exe, "dde-lock")) { app = "lock" - case "/usr/bin/lightdm-deepin-greeter": + } else if (strings.Contains(exe, "lightdm-deepin-greeter")) { app = "greeter" - default: + } else { err = fmt.Errorf("set password with Union ID called by %s, which is not allow", exe) return } diff --git a/bin/backlight_helper/ddcci/ddcci.go b/bin/backlight_helper/ddcci/ddcci.go index 21653459..01a67e91 100644 --- a/bin/backlight_helper/ddcci/ddcci.go +++ b/bin/backlight_helper/ddcci/ddcci.go @@ -15,10 +15,7 @@ import ( "bytes" "encoding/base64" "fmt" - "os/exec" - "path/filepath" "reflect" - "strings" "sync" "unsafe" @@ -113,18 +110,11 @@ func newDDCCI() (*ddcci, error) { return nil, err } - content, err := exec.Command("/usr/bin/dpkg-architecture", "-qDEB_HOST_MULTIARCH").Output() // TODO: arch和rpm打包需要通过patch修改获取路径的方式 - if err != nil { - logger.Warning(err) - } else { - path := filepath.Join("/usr/lib", strings.TrimSpace(string(content)), "libddcutil.so.0") - logger.Debug("so path:", path) - cStr := C.CString(path) - defer C.free(unsafe.Pointer(cStr)) - ret := C.InitDDCCISo(cStr) - if ret == -2 { - logger.Debug("failed to initialize ddca_free_all_displays sym") - } + cStr := C.CString("libddcutil.so.0") + defer C.free(unsafe.Pointer(cStr)) + ret := C.InitDDCCISo(cStr) + if ret == -2 { + logger.Debug("failed to initialize ddca_free_all_displays sym") } return ddc, nil diff --git a/bin/dde-authority/fprint_transaction.go b/bin/dde-authority/fprint_transaction.go index 0e460ec3..b803d1c9 100644 --- a/bin/dde-authority/fprint_transaction.go +++ b/bin/dde-authority/fprint_transaction.go @@ -461,7 +461,7 @@ func (tx *FPrintTransaction) End(sender dbus.Sender) *dbus.Error { func killFPrintDaemon() { logger.Debug("kill fprintd") - err := exec.Command("pkill", "-f", "/usr/lib/fprintd/fprintd").Run() + err := exec.Command("pkill", "fprintd").Run() if err != nil { logger.Warning("failed to kill fprintd:", err) } diff --git a/inputdevices/keyboard.go b/inputdevices/keyboard.go index 6d05f662..ca29cecc 100644 --- a/inputdevices/keyboard.go +++ b/inputdevices/keyboard.go @@ -10,6 +10,7 @@ import ( "fmt" "os" "os/user" + "os/exec" "path" "regexp" "strings" @@ -51,7 +52,7 @@ const ( kbdSystemConfig = "/etc/default/keyboard" qtDefaultConfig = ".config/Trolltech.conf" - cmdSetKbd = "/usr/bin/setxkbmap" + cmdSetKbd = "setxkbmap" ) type Keyboard struct { @@ -704,7 +705,7 @@ func (kbd *Keyboard) handlePropertyNotifyEvent(ev *x.PropertyNotifyEvent) { } func (kbd *Keyboard) shouldUseDDEKwin() bool { - _, err := os.Stat("/usr/bin/kwin_no_scale") + _, err := exec.LookPath("kwin_no_scale") return err == nil } diff --git a/keybinding/shortcuts/system_shortcut.go b/keybinding/shortcuts/system_shortcut.go index 95e1b222..95d82db7 100644 --- a/keybinding/shortcuts/system_shortcut.go +++ b/keybinding/shortcuts/system_shortcut.go @@ -83,10 +83,10 @@ var defaultSysActionCmdMap = map[string]string{ "launcher": "dbus-send --print-reply --dest=com.deepin.dde.Launcher /com/deepin/dde/Launcher com.deepin.dde.Launcher.Toggle", "terminal": "/usr/lib/deepin-daemon/default-terminal", "terminal-quake": "deepin-terminal --quake-mode", - "lock-screen": "originmap=$(setxkbmap -query | grep option | awk -F ' ' '{print $2}');/usr/bin/setxkbmap -option grab:break_actions&&/usr/bin/xdotool key XF86Ungrab&&dbus-send --print-reply --dest=com.deepin.dde.lockFront /com/deepin/dde/lockFront com.deepin.dde.lockFront.Show&&/usr/bin/setxkbmap -option; setxkbmap -option $originmap", + "lock-screen": "originmap=$(setxkbmap -query | grep option | awk -F ' ' '{print $2}');setxkbmap -option grab:break_actions&&xdotool key XF86Ungrab&&dbus-send --print-reply --dest=com.deepin.dde.lockFront /com/deepin/dde/lockFront com.deepin.dde.lockFront.Show&&/usr/bin/setxkbmap -option; setxkbmap -option $originmap", "logout": "dbus-send --print-reply --dest=com.deepin.dde.shutdownFront /com/deepin/dde/shutdownFront com.deepin.dde.shutdownFront.Show", "deepin-screen-recorder": "dbus-send --print-reply --dest=com.deepin.ScreenRecorder /com/deepin/ScreenRecorder com.deepin.ScreenRecorder.stopRecord", - "system-monitor": "/usr/bin/deepin-system-monitor", + "system-monitor": "deepin-system-monitor", "color-picker": "dbus-send --print-reply --dest=com.deepin.Picker /com/deepin/Picker com.deepin.Picker.Show", // screenshot actions: "screenshot": screenshotCmdPrefix + "StartScreenshot", @@ -104,7 +104,7 @@ var defaultSysActionCmdMap = map[string]string{ "global-search": "/usr/libexec/dde-daemon/keybinding/shortcut-dde-grand-search.sh", "switch-next-kbd-layout": "dbus-send --print-reply --dest=com.deepin.daemon.Keybinding /com/deepin/daemon/InputDevice/Keyboard com.deepin.daemon.InputDevice.Keyboard.ToggleNextLayout", // cmd - "calculator": "/usr/bin/deepin-calculator", + "calculator": "deepin-calculator", "search": "/usr/libexec/dde-daemon/keybinding/shortcut-dde-grand-search.sh", } diff --git a/keybinding/special_keycode.go b/keybinding/special_keycode.go index d18c9a66..9704b241 100644 --- a/keybinding/special_keycode.go +++ b/keybinding/special_keycode.go @@ -276,7 +276,7 @@ func (m *Manager) handlePower() { } m.systemTurnOffScreen() case powerActionShowUI: - cmd := "originmap=$(setxkbmap -query | grep option | awk -F ' ' '{print $2}');/usr/bin/setxkbmap -option grab:break_actions&&/usr/bin/xdotool key XF86Ungrab&&dbus-send --print-reply --dest=com.deepin.dde.lockFront /com/deepin/dde/shutdownFront com.deepin.dde.shutdownFront.Show&&/usr/bin/setxkbmap -option; setxkbmap -option $originmap" + cmd := "originmap=$(setxkbmap -query | grep option | awk -F ' ' '{print $2}');setxkbmap -option grab:break_actions&&xdotool key XF86Ungrab&&dbus-send --print-reply --dest=com.deepin.dde.lockFront /com/deepin/dde/shutdownFront com.deepin.dde.shutdownFront.Show&&setxkbmap -option; setxkbmap -option $originmap" go func() { locked, err := m.sessionManager.Locked().Get(0) if err != nil { diff --git a/keybinding/utils.go b/keybinding/utils.go index 8e531369..261c88e8 100644 --- a/keybinding/utils.go +++ b/keybinding/utils.go @@ -311,7 +311,7 @@ func readTinyFile(file string) ([]byte, error) { } func shouldUseDDEKwin() bool { - _, err := os.Stat("/usr/bin/kwin_no_scale") + _, err := exec.LookPath("kwin_no_scale") return err == nil } diff --git a/launcher/manager_ifc.go b/launcher/manager_ifc.go index 440aa8e5..ad74f99f 100644 --- a/launcher/manager_ifc.go +++ b/launcher/manager_ifc.go @@ -24,7 +24,7 @@ const ( dbusObjPath = "/com/deepin/dde/daemon/Launcher" dbusInterface = dbusServiceName desktopMainSection = "Desktop Entry" - launcherExecPath = "/usr/bin/dde-launcher" + launcherExecPath = "dde-launcher" ) var errorInvalidID = errors.New("invalid ID") diff --git a/misc/dde-daemon/keybinding/system_actions.json b/misc/dde-daemon/keybinding/system_actions.json index 8de3f111..8048048e 100644 --- a/misc/dde-daemon/keybinding/system_actions.json +++ b/misc/dde-daemon/keybinding/system_actions.json @@ -13,7 +13,7 @@ "Action": "dbus-send --print-reply --dest=com.deepin.ScreenRecorder /com/deepin/ScreenRecorder com.deepin.ScreenRecorder.stopRecord" }, { - "Action": "/usr/bin/deepin-system-monitor", + "Action": "deepin-system-monitor", "Key": "system-monitor" }, { @@ -21,7 +21,7 @@ "Action": "dbus-send --print-reply --dest=com.deepin.Picker /com/deepin/Picker com.deepin.Picker.Show" }, { - "Action": "originmap=$(setxkbmap -query | grep option | awk -F ' ' '{print $2}');/usr/bin/setxkbmap -option grab:break_actions&&/usr/bin/xdotool key XF86Ungrab&&dbus-send --print-reply --dest=com.deepin.dde.lockFront /com/deepin/dde/lockFront com.deepin.dde.lockFront.Show&&/usr/bin/setxkbmap -option; setxkbmap -option $originmap", + "Action": "originmap=$(setxkbmap -query | grep option | awk -F ' ' '{print $2}');setxkbmap -option grab:break_actions&&xdotool key XF86Ungrab&&dbus-send --print-reply --dest=com.deepin.dde.lockFront /com/deepin/dde/lockFront com.deepin.dde.lockFront.Show&&setxkbmap -option; setxkbmap -option $originmap", "Key": "lock-screen" }, { diff --git a/misc/etc/acpi/powerbtn.sh b/misc/etc/acpi/powerbtn.sh index 5c536b9e..39c28987 100755 --- a/misc/etc/acpi/powerbtn.sh +++ b/misc/etc/acpi/powerbtn.sh @@ -58,4 +58,4 @@ elif test "$XUSER" != "" && test -x /usr/bin/qdbus; then fi # If all else failed, just initiate a plain shutdown. -/sbin/shutdown -h now "Power button pressed" +shutdown -h now "Power button pressed" diff --git a/misc/udev-rules/80-deepin-fprintd.rules b/misc/udev-rules/80-deepin-fprintd.rules index d3d3554a..9163b91c 100644 --- a/misc/udev-rules/80-deepin-fprintd.rules +++ b/misc/udev-rules/80-deepin-fprintd.rules @@ -1 +1 @@ -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", ACTION=="add|remove", ENV{LIBFPRINT_DRIVER}!="" RUN+="/usr/bin/dbus-send --system --dest=com.deepin.daemon.Fprintd --print-reply /com/deepin/daemon/Fprintd com.deepin.daemon.Fprintd.TriggerUDevEvent" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", ACTION=="add|remove", ENV{LIBFPRINT_DRIVER}!="" RUN+="@dbus@/bin/dbus-send --system --dest=com.deepin.daemon.Fprintd --print-reply /com/deepin/daemon/Fprintd com.deepin.daemon.Fprintd.TriggerUDevEvent" diff --git a/system/display/displaycfg.go b/system/display/displaycfg.go index 57b5871a..5b7757b4 100644 --- a/system/display/displaycfg.go +++ b/system/display/displaycfg.go @@ -255,7 +255,7 @@ func (d *Display) doDetectSupportWayland(sender dbus.Sender) (bool, error) { return false, err } var cmd *exec.Cmd - if execPath == "/usr/bin/lightdm-deepin-greeter" { + if strings.Contains(execPath, "lightdm-deepin-greeter") { cmd = exec.Command("runuser", "-u", "lightdm", "glxinfo") // runuser -u lightdm glxinfo } else { cmd = exec.Command("glxinfo") diff --git a/system/power/manager_lmt.go b/system/power/manager_lmt.go index e2bdb2af..baf32fbd 100644 --- a/system/power/manager_lmt.go +++ b/system/power/manager_lmt.go @@ -8,6 +8,7 @@ import ( "bufio" "io/ioutil" "os" + "os/exec" "path/filepath" "strings" @@ -28,7 +29,7 @@ const ( const lowBatteryThreshold = 20.0 func isLaptopModeBinOk() bool { - _, err := os.Stat(laptopModeBin) + _, err := exec.LookPath("laptop_mode") return err == nil } diff --git a/system/power_manager/utils.go b/system/power_manager/utils.go index 93f433c2..ef603c96 100644 --- a/system/power_manager/utils.go +++ b/system/power_manager/utils.go @@ -33,7 +33,7 @@ func canSuspend() bool { } func detectVirtualMachine() (string, error) { - out, err := exec.Command("/usr/bin/systemd-detect-virt").Output() + out, err := exec.Command("systemd-detect-virt").Output() if err != nil { return "", err } diff --git a/system/systeminfo/manager.go b/system/systeminfo/manager.go index 5525ae36..daab2c44 100644 --- a/system/systeminfo/manager.go +++ b/system/systeminfo/manager.go @@ -205,7 +205,7 @@ func filterUnNumber(value string) string { //执行命令:/usr/bin/getconf LONG_BIT 获取系统位数 func (m *Manager) systemBit() string { - output, err := exec.Command("/usr/bin/getconf", "LONG_BIT").Output() + output, err := exec.Command("getconf", "LONG_BIT").Output() if err != nil { return "64" } diff --git a/systeminfo/utils.go b/systeminfo/utils.go index ed17aeb8..e919fb53 100644 --- a/systeminfo/utils.go +++ b/systeminfo/utils.go @@ -39,7 +39,7 @@ func getMemoryFromFile(file string) (uint64, error) { //执行命令:/usr/bin/getconf LONG_BIT 获取系统位数 func systemBit() string { - output, err := exec.Command("/usr/bin/getconf", "LONG_BIT").Output() + output, err := exec.Command("getconf", "LONG_BIT").Output() if err != nil { return "64" } -- 2.39.2 Loading
pkgs/desktops/deepin/default.nix +1 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ let go-gir-generator = callPackage ./go-package/go-gir-generator { }; go-dbus-factory = callPackage ./go-package/go-dbus-factory { }; dde-api = callPackage ./go-package/dde-api { inherit replaceAll; }; dde-daemon = callPackage ./go-package/dde-daemon { }; deepin-pw-check = callPackage ./go-package/deepin-pw-check { }; deepin-desktop-schemas = callPackage ./go-package/deepin-desktop-schemas { }; Loading
pkgs/desktops/deepin/go-package/dde-daemon/0001-fix-wrapped-name-for-verifyExe.patch 0 → 100644 +33 −0 Original line number Diff line number Diff line From ad18742c699a08cd82f8926a31da9a19b2aef329 Mon Sep 17 00:00:00 2001 From: rewine <lhongxu@outlook.com> Date: Wed, 5 Apr 2023 23:37:24 +0800 Subject: [PATCH 1/4] fix-wrapped-name-for-verifyExe --- dock/process_info.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dock/process_info.go b/dock/process_info.go index 83c61d58..e2970f3a 100644 --- a/dock/process_info.go +++ b/dock/process_info.go @@ -119,6 +119,16 @@ func verifyExe(exe, cwd, firstArg string) bool { return false } logger.Debugf("firstArgPath: %q", firstArgPath) + if exe == firstArgPath { + return true + } + if strings.HasSuffix(exe, "-wrapped") { + exeBase := filepath.Base(exe) + if (len(exeBase) <= 9) { + return false + } + exe = exe[0:len(exe)-len(exeBase)] + exeBase[1:len(exeBase)-8] + } return exe == firstArgPath } -- 2.39.2
pkgs/desktops/deepin/go-package/dde-daemon/0002-dont-set-PATH.patch 0 → 100644 +40 −0 Original line number Diff line number Diff line From 7fe41aac7c31f6143b5f5887dbefa41fdf4c252b Mon Sep 17 00:00:00 2001 From: rewine <lhongxu@outlook.com> Date: Wed, 5 Apr 2023 23:37:49 +0800 Subject: [PATCH 2/4] dont-set-PATH --- bin/dde-system-daemon/main.go | 4 ---- grub2/modify_manger.go | 1 - 2 files changed, 5 deletions(-) diff --git a/bin/dde-system-daemon/main.go b/bin/dde-system-daemon/main.go index 03d2a415..cf92f065 100644 --- a/bin/dde-system-daemon/main.go +++ b/bin/dde-system-daemon/main.go @@ -77,10 +77,6 @@ func main() { // fix no PATH when was launched by dbus if os.Getenv("PATH") == "" { logger.Warning("No PATH found, manual special") - err = os.Setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin") - if err != nil { - logger.Warning(err) - } } // 系统级服务,无需设置LANG和LANGUAGE,保证翻译不受到影响 diff --git a/grub2/modify_manger.go b/grub2/modify_manger.go index a811770b..30e9561e 100644 --- a/grub2/modify_manger.go +++ b/grub2/modify_manger.go @@ -21,7 +21,6 @@ const ( ) func init() { - _ = os.Setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin") } type modifyManager struct { -- 2.39.2
pkgs/desktops/deepin/go-package/dde-daemon/0003-search-in-XDG-directories.patch 0 → 100644 +257 −0 Original line number Diff line number Diff line From 528f590c0c81728c324444fd76e0f7113a2e3dc4 Mon Sep 17 00:00:00 2001 From: rewine <lhongxu@outlook.com> Date: Wed, 5 Apr 2023 23:41:25 +0800 Subject: [PATCH 3/4] search-in-XDG-directories --- accounts/manager.go | 5 ++++- accounts/user.go | 8 +++++++- appearance/fsnotify.go | 21 +++++++++++++++++---- apps/utils.go | 3 ++- dock/desktop_file_path.go | 6 ++++++ gesture/config.go | 4 ++-- keybinding/shortcuts/system_shortcut.go | 4 +++- mime/app_info.go | 7 ++++++- system/gesture/config.go | 4 +++- 9 files changed, 50 insertions(+), 12 deletions(-) diff --git a/accounts/manager.go b/accounts/manager.go index a5abb157..3fd7c153 100644 --- a/accounts/manager.go +++ b/accounts/manager.go @@ -15,6 +15,7 @@ import ( "sync" "syscall" + "github.com/adrg/xdg" dbus "github.com/godbus/dbus" "github.com/linuxdeepin/dde-daemon/accounts/users" "github.com/linuxdeepin/dde-daemon/common/sessionmsg" @@ -35,8 +36,10 @@ const ( actConfigFile = actConfigDir + "/accounts.ini" actConfigGroupGroup = "Accounts" actConfigKeyGuest = "AllowGuest" +) - interfacesFile = "/usr/share/dde-daemon/accounts/dbus-udcp.json" +var ( + interfacesFile, _ = xdg.SearchDataFile("dde-daemon/accounts/dbus-udcp.json") ) type InterfaceConfig struct { diff --git a/accounts/user.go b/accounts/user.go index 99138941..56a7731a 100644 --- a/accounts/user.go +++ b/accounts/user.go @@ -15,6 +15,7 @@ import ( "strings" "sync" + "github.com/adrg/xdg" dbus "github.com/godbus/dbus" "github.com/linuxdeepin/dde-daemon/accounts/users" authenticate "github.com/linuxdeepin/go-dbus-factory/com.deepin.daemon.authenticate" @@ -645,7 +646,12 @@ func getUserSession(homeDir string) string { } func getSessionList() []string { - fileInfoList, err := ioutil.ReadDir("/usr/share/xsessions") + xsessionPath, err := xdg.SearchDataFile("xsessions") + if err != nil { + return nil; + } + + fileInfoList, err := ioutil.ReadDir(xsessionPath) if err != nil { return nil } diff --git a/appearance/fsnotify.go b/appearance/fsnotify.go index a409d0ba..ff674600 100644 --- a/appearance/fsnotify.go +++ b/appearance/fsnotify.go @@ -5,12 +5,15 @@ package appearance import ( + "errors" + "io/fs" "os" "path" "path/filepath" "strings" "time" + "github.com/adrg/xdg" "github.com/fsnotify/fsnotify" "github.com/linuxdeepin/dde-daemon/appearance/background" "github.com/linuxdeepin/dde-daemon/appearance/subthemes" @@ -100,9 +103,14 @@ func (m *Manager) watchGtkDirs() { gtkDirs = []string{ path.Join(home, ".local/share/themes"), path.Join(home, ".themes"), - "/usr/local/share/themes", - "/usr/share/themes", } + for _, dataPath := range xdg.DataDirs { + gtkPath := filepath.Join(dataPath, "themes"); + if _, err := os.Stat(gtkPath); err != nil && errors.Is(err, fs.ErrNotExist) { + continue + } + gtkDirs = append(gtkDirs, gtkPath); + } m.watchDirs(gtkDirs) } @@ -112,9 +120,14 @@ func (m *Manager) watchIconDirs() { iconDirs = []string{ path.Join(home, ".local/share/icons"), path.Join(home, ".icons"), - "/usr/local/share/icons", - "/usr/share/icons", } + for _, dataPath := range xdg.DataDirs { + iconPath := filepath.Join(dataPath, "icons"); + if _, err := os.Stat(iconPath); err != nil && errors.Is(err, fs.ErrNotExist) { + continue + } + iconDirs = append(iconDirs, iconPath); + } m.watchDirs(iconDirs) } diff --git a/apps/utils.go b/apps/utils.go index 8863d6c2..dd6f8e16 100644 --- a/apps/utils.go +++ b/apps/utils.go @@ -11,6 +11,7 @@ import ( "strconv" "strings" "syscall" + "github.com/adrg/xdg" ) func intSliceContains(slice []int, a int) bool { @@ -96,7 +97,7 @@ func removeDesktopExt(name string) string { } func getSystemDataDirs() []string { - return []string{"/usr/share", "/usr/local/share"} + return xdg.DataDirs } // get user home diff --git a/dock/desktop_file_path.go b/dock/desktop_file_path.go index 7adc9f55..e1a97679 100644 --- a/dock/desktop_file_path.go +++ b/dock/desktop_file_path.go @@ -7,6 +7,8 @@ package dock import ( "path/filepath" "strings" + + "github.com/adrg/xdg" ) var pathDirCodeMap map[string]string @@ -20,6 +22,10 @@ func initPathDirCodeMap() { "/usr/local/share/applications/": "/L@", } + for _, dataPath := range xdg.DataDirs { + pathDirCodeMap[dataPath] = "/S@" + } + dir := filepath.Join(homeDir, ".local/share/applications") dir = addDirTrailingSlash(dir) pathDirCodeMap[dir] = "/H@" diff --git a/gesture/config.go b/gesture/config.go index bfbd4db7..4ce9d641 100644 --- a/gesture/config.go +++ b/gesture/config.go @@ -10,6 +10,7 @@ import ( "io/ioutil" "path/filepath" + "github.com/adrg/xdg" "github.com/linuxdeepin/go-lib/xdg/basedir" ) @@ -21,11 +22,10 @@ const ( var ( configUserPath = filepath.Join(basedir.GetUserConfigDir(), "deepin/dde-daemon/gesture.json") + configSystemPath, _ = xdg.SearchDataFile("dde-daemon/gesture.json") ) const ( - configSystemPath = "/usr/share/dde-daemon/gesture.json" - gestureSchemaId = "com.deepin.dde.gesture" gsKeyTouchPadEnabled = "touch-pad-enabled" gsKeyTouchScreenEnabled = "touch-screen-enabled" diff --git a/keybinding/shortcuts/system_shortcut.go b/keybinding/shortcuts/system_shortcut.go index d33a69f6..c3138099 100644 --- a/keybinding/shortcuts/system_shortcut.go +++ b/keybinding/shortcuts/system_shortcut.go @@ -10,6 +10,7 @@ import ( "path" "sync" + "github.com/adrg/xdg" dutils "github.com/linuxdeepin/go-lib/utils" ) @@ -152,5 +153,6 @@ func getSystemActionsFile() string { return file } - return "" + filepath, _ := xdg.SearchDataFile(systemActionsFile) + return filepath; } diff --git a/mime/app_info.go b/mime/app_info.go index 63fcdcc0..18436164 100644 --- a/mime/app_info.go +++ b/mime/app_info.go @@ -9,6 +9,7 @@ import ( "os" "path" + "github.com/adrg/xdg" "github.com/linuxdeepin/go-lib/appinfo/desktopappinfo" "github.com/linuxdeepin/go-lib/mime" dutils "github.com/linuxdeepin/go-lib/utils" @@ -162,5 +163,9 @@ func findFilePath(file string) string { return data } - return path.Join("/usr/share", file) + filepath, err := xdg.SearchDataFile(file) + if err != nil { + return path.Join("/usr/share", file) + } + return filepath; } diff --git a/system/gesture/config.go b/system/gesture/config.go index d4aebaac..f3fc92c3 100644 --- a/system/gesture/config.go +++ b/system/gesture/config.go @@ -8,6 +8,7 @@ import ( "encoding/json" "io/ioutil" + "github.com/adrg/xdg" "github.com/linuxdeepin/go-lib/utils" ) @@ -35,5 +36,6 @@ func getConfigPath() string { if utils.IsFileExist(filename) { return filename } - return "/usr/share/" + suffix + filepath, _ := xdg.SearchDataFile(suffix) + return filepath; } -- 2.39.2
pkgs/desktops/deepin/go-package/dde-daemon/0004-aviod-use-hardcode-path.patch 0 → 100644 +323 −0 Original line number Diff line number Diff line From 12a5ccce245f82c334e78d48354e55311c15fb0c Mon Sep 17 00:00:00 2001 From: rewine <lhongxu@outlook.com> Date: Wed, 5 Apr 2023 23:51:58 +0800 Subject: [PATCH 4/4] aviod-use-hardcode-path --- accounts/user.go | 2 +- accounts/user_chpwd_union_id.go | 9 ++++----- bin/backlight_helper/ddcci/ddcci.go | 20 +++++-------------- bin/dde-authority/fprint_transaction.go | 2 +- inputdevices/keyboard.go | 5 +++-- keybinding/shortcuts/system_shortcut.go | 6 +++--- keybinding/special_keycode.go | 2 +- keybinding/utils.go | 2 +- launcher/manager_ifc.go | 2 +- .../dde-daemon/keybinding/system_actions.json | 4 ++-- misc/etc/acpi/powerbtn.sh | 2 +- misc/udev-rules/80-deepin-fprintd.rules | 2 +- system/display/displaycfg.go | 2 +- system/power/manager_lmt.go | 3 ++- system/power_manager/utils.go | 2 +- system/systeminfo/manager.go | 2 +- systeminfo/utils.go | 2 +- 17 files changed, 30 insertions(+), 39 deletions(-) diff --git a/accounts/user.go b/accounts/user.go index f8827fb2..ff604f38 100644 --- a/accounts/user.go +++ b/accounts/user.go @@ -450,7 +450,7 @@ func (u *User) checkIsControlCenter(sender dbus.Sender) bool { return false } - if exe == controlCenterPath { + if strings.Contains(exe, "dde-control-center") { return true } diff --git a/accounts/user_chpwd_union_id.go b/accounts/user_chpwd_union_id.go index b0ba9cb9..e8aa1a1e 100644 --- a/accounts/user_chpwd_union_id.go +++ b/accounts/user_chpwd_union_id.go @@ -107,14 +107,13 @@ func newCaller(service *dbusutil.Service, sender dbus.Sender) (ret *caller, err // 只允许来自控制中心, 锁屏和 greetter 的调用 var app string - switch exe { - case "/usr/bin/dde-control-center": + if (strings.Contains(exe, "dde-control-center")) { app = "control-center" - case "/usr/bin/dde-lock": + } else if (strings.Contains(exe, "dde-lock")) { app = "lock" - case "/usr/bin/lightdm-deepin-greeter": + } else if (strings.Contains(exe, "lightdm-deepin-greeter")) { app = "greeter" - default: + } else { err = fmt.Errorf("set password with Union ID called by %s, which is not allow", exe) return } diff --git a/bin/backlight_helper/ddcci/ddcci.go b/bin/backlight_helper/ddcci/ddcci.go index 21653459..01a67e91 100644 --- a/bin/backlight_helper/ddcci/ddcci.go +++ b/bin/backlight_helper/ddcci/ddcci.go @@ -15,10 +15,7 @@ import ( "bytes" "encoding/base64" "fmt" - "os/exec" - "path/filepath" "reflect" - "strings" "sync" "unsafe" @@ -113,18 +110,11 @@ func newDDCCI() (*ddcci, error) { return nil, err } - content, err := exec.Command("/usr/bin/dpkg-architecture", "-qDEB_HOST_MULTIARCH").Output() // TODO: arch和rpm打包需要通过patch修改获取路径的方式 - if err != nil { - logger.Warning(err) - } else { - path := filepath.Join("/usr/lib", strings.TrimSpace(string(content)), "libddcutil.so.0") - logger.Debug("so path:", path) - cStr := C.CString(path) - defer C.free(unsafe.Pointer(cStr)) - ret := C.InitDDCCISo(cStr) - if ret == -2 { - logger.Debug("failed to initialize ddca_free_all_displays sym") - } + cStr := C.CString("libddcutil.so.0") + defer C.free(unsafe.Pointer(cStr)) + ret := C.InitDDCCISo(cStr) + if ret == -2 { + logger.Debug("failed to initialize ddca_free_all_displays sym") } return ddc, nil diff --git a/bin/dde-authority/fprint_transaction.go b/bin/dde-authority/fprint_transaction.go index 0e460ec3..b803d1c9 100644 --- a/bin/dde-authority/fprint_transaction.go +++ b/bin/dde-authority/fprint_transaction.go @@ -461,7 +461,7 @@ func (tx *FPrintTransaction) End(sender dbus.Sender) *dbus.Error { func killFPrintDaemon() { logger.Debug("kill fprintd") - err := exec.Command("pkill", "-f", "/usr/lib/fprintd/fprintd").Run() + err := exec.Command("pkill", "fprintd").Run() if err != nil { logger.Warning("failed to kill fprintd:", err) } diff --git a/inputdevices/keyboard.go b/inputdevices/keyboard.go index 6d05f662..ca29cecc 100644 --- a/inputdevices/keyboard.go +++ b/inputdevices/keyboard.go @@ -10,6 +10,7 @@ import ( "fmt" "os" "os/user" + "os/exec" "path" "regexp" "strings" @@ -51,7 +52,7 @@ const ( kbdSystemConfig = "/etc/default/keyboard" qtDefaultConfig = ".config/Trolltech.conf" - cmdSetKbd = "/usr/bin/setxkbmap" + cmdSetKbd = "setxkbmap" ) type Keyboard struct { @@ -704,7 +705,7 @@ func (kbd *Keyboard) handlePropertyNotifyEvent(ev *x.PropertyNotifyEvent) { } func (kbd *Keyboard) shouldUseDDEKwin() bool { - _, err := os.Stat("/usr/bin/kwin_no_scale") + _, err := exec.LookPath("kwin_no_scale") return err == nil } diff --git a/keybinding/shortcuts/system_shortcut.go b/keybinding/shortcuts/system_shortcut.go index 95e1b222..95d82db7 100644 --- a/keybinding/shortcuts/system_shortcut.go +++ b/keybinding/shortcuts/system_shortcut.go @@ -83,10 +83,10 @@ var defaultSysActionCmdMap = map[string]string{ "launcher": "dbus-send --print-reply --dest=com.deepin.dde.Launcher /com/deepin/dde/Launcher com.deepin.dde.Launcher.Toggle", "terminal": "/usr/lib/deepin-daemon/default-terminal", "terminal-quake": "deepin-terminal --quake-mode", - "lock-screen": "originmap=$(setxkbmap -query | grep option | awk -F ' ' '{print $2}');/usr/bin/setxkbmap -option grab:break_actions&&/usr/bin/xdotool key XF86Ungrab&&dbus-send --print-reply --dest=com.deepin.dde.lockFront /com/deepin/dde/lockFront com.deepin.dde.lockFront.Show&&/usr/bin/setxkbmap -option; setxkbmap -option $originmap", + "lock-screen": "originmap=$(setxkbmap -query | grep option | awk -F ' ' '{print $2}');setxkbmap -option grab:break_actions&&xdotool key XF86Ungrab&&dbus-send --print-reply --dest=com.deepin.dde.lockFront /com/deepin/dde/lockFront com.deepin.dde.lockFront.Show&&/usr/bin/setxkbmap -option; setxkbmap -option $originmap", "logout": "dbus-send --print-reply --dest=com.deepin.dde.shutdownFront /com/deepin/dde/shutdownFront com.deepin.dde.shutdownFront.Show", "deepin-screen-recorder": "dbus-send --print-reply --dest=com.deepin.ScreenRecorder /com/deepin/ScreenRecorder com.deepin.ScreenRecorder.stopRecord", - "system-monitor": "/usr/bin/deepin-system-monitor", + "system-monitor": "deepin-system-monitor", "color-picker": "dbus-send --print-reply --dest=com.deepin.Picker /com/deepin/Picker com.deepin.Picker.Show", // screenshot actions: "screenshot": screenshotCmdPrefix + "StartScreenshot", @@ -104,7 +104,7 @@ var defaultSysActionCmdMap = map[string]string{ "global-search": "/usr/libexec/dde-daemon/keybinding/shortcut-dde-grand-search.sh", "switch-next-kbd-layout": "dbus-send --print-reply --dest=com.deepin.daemon.Keybinding /com/deepin/daemon/InputDevice/Keyboard com.deepin.daemon.InputDevice.Keyboard.ToggleNextLayout", // cmd - "calculator": "/usr/bin/deepin-calculator", + "calculator": "deepin-calculator", "search": "/usr/libexec/dde-daemon/keybinding/shortcut-dde-grand-search.sh", } diff --git a/keybinding/special_keycode.go b/keybinding/special_keycode.go index d18c9a66..9704b241 100644 --- a/keybinding/special_keycode.go +++ b/keybinding/special_keycode.go @@ -276,7 +276,7 @@ func (m *Manager) handlePower() { } m.systemTurnOffScreen() case powerActionShowUI: - cmd := "originmap=$(setxkbmap -query | grep option | awk -F ' ' '{print $2}');/usr/bin/setxkbmap -option grab:break_actions&&/usr/bin/xdotool key XF86Ungrab&&dbus-send --print-reply --dest=com.deepin.dde.lockFront /com/deepin/dde/shutdownFront com.deepin.dde.shutdownFront.Show&&/usr/bin/setxkbmap -option; setxkbmap -option $originmap" + cmd := "originmap=$(setxkbmap -query | grep option | awk -F ' ' '{print $2}');setxkbmap -option grab:break_actions&&xdotool key XF86Ungrab&&dbus-send --print-reply --dest=com.deepin.dde.lockFront /com/deepin/dde/shutdownFront com.deepin.dde.shutdownFront.Show&&setxkbmap -option; setxkbmap -option $originmap" go func() { locked, err := m.sessionManager.Locked().Get(0) if err != nil { diff --git a/keybinding/utils.go b/keybinding/utils.go index 8e531369..261c88e8 100644 --- a/keybinding/utils.go +++ b/keybinding/utils.go @@ -311,7 +311,7 @@ func readTinyFile(file string) ([]byte, error) { } func shouldUseDDEKwin() bool { - _, err := os.Stat("/usr/bin/kwin_no_scale") + _, err := exec.LookPath("kwin_no_scale") return err == nil } diff --git a/launcher/manager_ifc.go b/launcher/manager_ifc.go index 440aa8e5..ad74f99f 100644 --- a/launcher/manager_ifc.go +++ b/launcher/manager_ifc.go @@ -24,7 +24,7 @@ const ( dbusObjPath = "/com/deepin/dde/daemon/Launcher" dbusInterface = dbusServiceName desktopMainSection = "Desktop Entry" - launcherExecPath = "/usr/bin/dde-launcher" + launcherExecPath = "dde-launcher" ) var errorInvalidID = errors.New("invalid ID") diff --git a/misc/dde-daemon/keybinding/system_actions.json b/misc/dde-daemon/keybinding/system_actions.json index 8de3f111..8048048e 100644 --- a/misc/dde-daemon/keybinding/system_actions.json +++ b/misc/dde-daemon/keybinding/system_actions.json @@ -13,7 +13,7 @@ "Action": "dbus-send --print-reply --dest=com.deepin.ScreenRecorder /com/deepin/ScreenRecorder com.deepin.ScreenRecorder.stopRecord" }, { - "Action": "/usr/bin/deepin-system-monitor", + "Action": "deepin-system-monitor", "Key": "system-monitor" }, { @@ -21,7 +21,7 @@ "Action": "dbus-send --print-reply --dest=com.deepin.Picker /com/deepin/Picker com.deepin.Picker.Show" }, { - "Action": "originmap=$(setxkbmap -query | grep option | awk -F ' ' '{print $2}');/usr/bin/setxkbmap -option grab:break_actions&&/usr/bin/xdotool key XF86Ungrab&&dbus-send --print-reply --dest=com.deepin.dde.lockFront /com/deepin/dde/lockFront com.deepin.dde.lockFront.Show&&/usr/bin/setxkbmap -option; setxkbmap -option $originmap", + "Action": "originmap=$(setxkbmap -query | grep option | awk -F ' ' '{print $2}');setxkbmap -option grab:break_actions&&xdotool key XF86Ungrab&&dbus-send --print-reply --dest=com.deepin.dde.lockFront /com/deepin/dde/lockFront com.deepin.dde.lockFront.Show&&setxkbmap -option; setxkbmap -option $originmap", "Key": "lock-screen" }, { diff --git a/misc/etc/acpi/powerbtn.sh b/misc/etc/acpi/powerbtn.sh index 5c536b9e..39c28987 100755 --- a/misc/etc/acpi/powerbtn.sh +++ b/misc/etc/acpi/powerbtn.sh @@ -58,4 +58,4 @@ elif test "$XUSER" != "" && test -x /usr/bin/qdbus; then fi # If all else failed, just initiate a plain shutdown. -/sbin/shutdown -h now "Power button pressed" +shutdown -h now "Power button pressed" diff --git a/misc/udev-rules/80-deepin-fprintd.rules b/misc/udev-rules/80-deepin-fprintd.rules index d3d3554a..9163b91c 100644 --- a/misc/udev-rules/80-deepin-fprintd.rules +++ b/misc/udev-rules/80-deepin-fprintd.rules @@ -1 +1 @@ -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", ACTION=="add|remove", ENV{LIBFPRINT_DRIVER}!="" RUN+="/usr/bin/dbus-send --system --dest=com.deepin.daemon.Fprintd --print-reply /com/deepin/daemon/Fprintd com.deepin.daemon.Fprintd.TriggerUDevEvent" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", ACTION=="add|remove", ENV{LIBFPRINT_DRIVER}!="" RUN+="@dbus@/bin/dbus-send --system --dest=com.deepin.daemon.Fprintd --print-reply /com/deepin/daemon/Fprintd com.deepin.daemon.Fprintd.TriggerUDevEvent" diff --git a/system/display/displaycfg.go b/system/display/displaycfg.go index 57b5871a..5b7757b4 100644 --- a/system/display/displaycfg.go +++ b/system/display/displaycfg.go @@ -255,7 +255,7 @@ func (d *Display) doDetectSupportWayland(sender dbus.Sender) (bool, error) { return false, err } var cmd *exec.Cmd - if execPath == "/usr/bin/lightdm-deepin-greeter" { + if strings.Contains(execPath, "lightdm-deepin-greeter") { cmd = exec.Command("runuser", "-u", "lightdm", "glxinfo") // runuser -u lightdm glxinfo } else { cmd = exec.Command("glxinfo") diff --git a/system/power/manager_lmt.go b/system/power/manager_lmt.go index e2bdb2af..baf32fbd 100644 --- a/system/power/manager_lmt.go +++ b/system/power/manager_lmt.go @@ -8,6 +8,7 @@ import ( "bufio" "io/ioutil" "os" + "os/exec" "path/filepath" "strings" @@ -28,7 +29,7 @@ const ( const lowBatteryThreshold = 20.0 func isLaptopModeBinOk() bool { - _, err := os.Stat(laptopModeBin) + _, err := exec.LookPath("laptop_mode") return err == nil } diff --git a/system/power_manager/utils.go b/system/power_manager/utils.go index 93f433c2..ef603c96 100644 --- a/system/power_manager/utils.go +++ b/system/power_manager/utils.go @@ -33,7 +33,7 @@ func canSuspend() bool { } func detectVirtualMachine() (string, error) { - out, err := exec.Command("/usr/bin/systemd-detect-virt").Output() + out, err := exec.Command("systemd-detect-virt").Output() if err != nil { return "", err } diff --git a/system/systeminfo/manager.go b/system/systeminfo/manager.go index 5525ae36..daab2c44 100644 --- a/system/systeminfo/manager.go +++ b/system/systeminfo/manager.go @@ -205,7 +205,7 @@ func filterUnNumber(value string) string { //执行命令:/usr/bin/getconf LONG_BIT 获取系统位数 func (m *Manager) systemBit() string { - output, err := exec.Command("/usr/bin/getconf", "LONG_BIT").Output() + output, err := exec.Command("getconf", "LONG_BIT").Output() if err != nil { return "64" } diff --git a/systeminfo/utils.go b/systeminfo/utils.go index ed17aeb8..e919fb53 100644 --- a/systeminfo/utils.go +++ b/systeminfo/utils.go @@ -39,7 +39,7 @@ func getMemoryFromFile(file string) (uint64, error) { //执行命令:/usr/bin/getconf LONG_BIT 获取系统位数 func systemBit() string { - output, err := exec.Command("/usr/bin/getconf", "LONG_BIT").Output() + output, err := exec.Command("getconf", "LONG_BIT").Output() if err != nil { return "64" } -- 2.39.2