diff options
author | rewine <luhongxu@deepin.org> | 2023-01-12 15:53:51 +0800 |
---|---|---|
committer | rewine <luhongxu@deepin.org> | 2023-04-06 17:28:19 +0800 |
commit | 9ee68d484a442c6f79d5f0e077fc3b644008b06f (patch) | |
tree | 275480334f8194a4f606382301bec6d106a4226e /pkgs/desktops/deepin | |
parent | 7b835852bb7afb25fddb109923567ef801cf2aa8 (diff) |
deepin.dde-daemon: init at 5.14.122
Diffstat (limited to 'pkgs/desktops/deepin')
7 files changed, 1095 insertions, 0 deletions
diff --git a/pkgs/desktops/deepin/default.nix b/pkgs/desktops/deepin/default.nix index de924812f7a9d..a770a270033c4 100644 --- a/pkgs/desktops/deepin/default.nix +++ b/pkgs/desktops/deepin/default.nix @@ -57,6 +57,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 { }; diff --git a/pkgs/desktops/deepin/go-package/dde-daemon/0001-fix-wrapped-name-for-verifyExe.patch b/pkgs/desktops/deepin/go-package/dde-daemon/0001-fix-wrapped-name-for-verifyExe.patch new file mode 100644 index 0000000000000..6eb7ad2c362fe --- /dev/null +++ b/pkgs/desktops/deepin/go-package/dde-daemon/0001-fix-wrapped-name-for-verifyExe.patch @@ -0,0 +1,33 @@ +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 + diff --git a/pkgs/desktops/deepin/go-package/dde-daemon/0002-dont-set-PATH.patch b/pkgs/desktops/deepin/go-package/dde-daemon/0002-dont-set-PATH.patch new file mode 100644 index 0000000000000..cf69496105c5b --- /dev/null +++ b/pkgs/desktops/deepin/go-package/dde-daemon/0002-dont-set-PATH.patch @@ -0,0 +1,40 @@ +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 + diff --git a/pkgs/desktops/deepin/go-package/dde-daemon/0003-search-in-XDG-directories.patch b/pkgs/desktops/deepin/go-package/dde-daemon/0003-search-in-XDG-directories.patch new file mode 100644 index 0000000000000..29d86e3fa957d --- /dev/null +++ b/pkgs/desktops/deepin/go-package/dde-daemon/0003-search-in-XDG-directories.patch @@ -0,0 +1,257 @@ +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 + diff --git a/pkgs/desktops/deepin/go-package/dde-daemon/0004-aviod-use-hardcode-path.patch b/pkgs/desktops/deepin/go-package/dde-daemon/0004-aviod-use-hardcode-path.patch new file mode 100644 index 0000000000000..f47bed99b293c --- /dev/null +++ b/pkgs/desktops/deepin/go-package/dde-daemon/0004-aviod-use-hardcode-path.patch @@ -0,0 +1,323 @@ +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 + diff --git a/pkgs/desktops/deepin/go-package/dde-daemon/default.nix b/pkgs/desktops/deepin/go-package/dde-daemon/default.nix new file mode 100644 index 0000000000000..c97e6ca3c4e38 --- /dev/null +++ b/pkgs/desktops/deepin/go-package/dde-daemon/default.nix @@ -0,0 +1,151 @@ +{ stdenv +, lib +, fetchFromGitHub +, substituteAll +, buildGoPackage +, pkg-config +, deepin-gettext-tools +, gettext +, python3 +, wrapGAppsHook +, go-dbus-factory +, go-gir-generator +, go-lib +, dde-api +, ddcutil +, alsa-lib +, glib +, gtk3 +, libgudev +, libinput +, libnl +, librsvg +, linux-pam +, libxcrypt +, networkmanager +, pulseaudio +, gdk-pixbuf-xlib +, tzdata +, xkeyboard_config +, runtimeShell +, xorg +, xdotool +, getconf +, dbus +}: + +buildGoPackage rec { + pname = "dde-daemon"; + version = "5.14.122"; + + goPackagePath = "github.com/linuxdeepin/dde-daemon"; + + src = fetchFromGitHub { + owner = "linuxdeepin"; + repo = pname; + rev = version; + sha256 = "sha256-KoYMv4z4IGBH0O422PuFHrIgDBEkU08Vepax+00nrGE="; + }; + + patches = [ + ./0001-fix-wrapped-name-for-verifyExe.patch + ./0002-dont-set-PATH.patch + ./0003-search-in-XDG-directories.patch + (substituteAll { + src = ./0004-aviod-use-hardcode-path.patch; + inherit dbus; + }) + ]; + + postPatch = '' + substituteInPlace session/eventlog/{app_event.go,login_event.go} accounts/users/users_test.go \ + --replace "/bin/bash" "${runtimeShell}" + + substituteInPlace inputdevices/layout_list.go \ + --replace "/usr/share/X11/xkb" "${xkeyboard_config}/share/X11/xkb" + + substituteInPlace appearance/background/{background.go,custom_wallpapers.go} accounts/user.go bin/dde-system-daemon/wallpaper.go \ + --replace "/usr/share/wallpapers" "/run/current-system/sw/share/wallpapers" + + substituteInPlace appearance/manager.go timedate/zoneinfo/zone.go \ + --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo" + + substituteInPlace accounts/image_blur.go grub2/modify_manger.go \ + --replace "/usr/lib/deepin-api" "/run/current-system/sw/lib/deepin-api" + + substituteInPlace accounts/user_chpwd_union_id.go \ + --replace "/usr/lib/dde-control-center" "/run/current-system/sw/lib/dde-control-center" + + for file in $(grep "/usr/lib/deepin-daemon" * -nR |awk -F: '{print $1}') + do + sed -i 's|/usr/lib/deepin-daemon|/run/current-system/sw/lib/deepin-daemon|g' $file + done + + patchShebangs . + ''; + + goDeps = ./deps.nix; + + nativeBuildInputs = [ + pkg-config + deepin-gettext-tools + gettext + python3 + wrapGAppsHook + ]; + + buildInputs = [ + go-dbus-factory + go-gir-generator + go-lib + dde-api + ddcutil + linux-pam + libxcrypt + alsa-lib + glib + libgudev + gtk3 + gdk-pixbuf-xlib + networkmanager + libinput + libnl + librsvg + pulseaudio + tzdata + xkeyboard_config + ]; + + buildPhase = '' + runHook preBuild + addToSearchPath GOPATH "${go-dbus-factory}/share/gocode" + addToSearchPath GOPATH "${go-gir-generator}/share/gocode" + addToSearchPath GOPATH "${go-lib}/share/gocode" + addToSearchPath GOPATH "${dde-api}/share/gocode" + make -C go/src/${goPackagePath} + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + make install DESTDIR="$out" PREFIX="/" -C go/src/${goPackagePath} + runHook postInstall + ''; + + postFixup = '' + for f in "$out"/lib/deepin-daemon/*; do + echo "Wrapping $f" + wrapGApp "$f" + done + mv $out/run/current-system/sw/lib/deepin-daemon/service-trigger $out/lib/deepin-daemon/ + rm -r $out/run + ''; + + meta = with lib; { + description = "Daemon for handling the deepin session settings"; + homepage = "https://github.com/linuxdeepin/dde-daemon"; + license = licenses.gpl3Plus; + platforms = platforms.linux; + maintainers = teams.deepin.members; + }; +} diff --git a/pkgs/desktops/deepin/go-package/dde-daemon/deps.nix b/pkgs/desktops/deepin/go-package/dde-daemon/deps.nix new file mode 100644 index 0000000000000..16eaa254c2ff4 --- /dev/null +++ b/pkgs/desktops/deepin/go-package/dde-daemon/deps.nix @@ -0,0 +1,290 @@ +[ + { + goPackagePath = "github.com/fsnotify/fsnotify"; + fetch = { + type = "git"; + url = "https://github.com/fsnotify/fsnotify"; + rev = "v1.5.1"; + sha256 = "sha256-B8kZ8yiWgallT7R2j1kSRJcJkSGFVf9ise+TpXa+7XY="; + }; + } + { + goPackagePath = "github.com/godbus/dbus"; + fetch = { + type = "git"; + url = "https://github.com/godbus/dbus"; + rev = "v5.1.0"; + sha256 = "sha256-JSPtmkGEStBEVrKGszeLCb7P38SzQKgMiDC3eDppXs0="; + }; + } + { + goPackagePath = "github.com/stretchr/testify"; + fetch = { + type = "git"; + url = "https://github.com/stretchr/testify"; + rev = "v1.7.1"; + sha256 = "sha256-disUVIHiIDSj/go3APtJH8awSl8QwKRRFLKI7LRnl0w="; + }; + } + { + goPackagePath = "golang.org/x/sys"; + fetch = { + type = "git"; + url = "https://github.com/golang/sys"; + rev = "289d7a0edf712062d9f1484b07bdf2383f48802f"; + sha256 = "sha256-AzS/J3OocI7mA0xsIfQzyskNKVija7F2yvuts+EFJBs="; + }; + } + { + goPackagePath = "golang.org/x/xerrors"; + fetch = { + type = "git"; + url = "https://github.com/golang/xerrors"; + rev = "2f41105eb62f341cfe208d06de4ee3bdd3a083da"; + sha256 = "sha256-yZNeG+jcarcw/aOFhrhxWWE20r0P+/VJF4i/0JQfv1c="; + }; + } + { + goPackagePath = "gopkg.in/yaml.v3"; + fetch = { + type = "git"; + url = "https://github.com/go-yaml/yaml"; + rev = "496545a6307b2a7d7a710fd516e5e16e8ab62dbc"; + sha256 = "sha256-j8yDji+vqsitpRZirpb4w/Em8nstgf28wpwkcrOlxBk="; + }; + } + { + goPackagePath = "github.com/davecgh/go-spew"; + fetch = { + type = "git"; + url = "https://github.com/davecgh/go-spew"; + rev = "v1.1.1"; + sha256 = "sha256-nhzSUrE1fCkN0+RL04N4h8jWmRFPPPWbCuDc7Ss0akI="; + }; + } + { + goPackagePath = "github.com/stretchr/objx"; + fetch = { + type = "git"; + url = "https://github.com/stretchr/objx"; + rev = "v0.3.0"; + sha256 = "sha256-T753/EiD5Cpk6H2JFhd+s1gFvpNptG2XlEHxZF6dQaw="; + }; + } + { + goPackagePath = "github.com/linuxdeepin/go-x11-client"; + fetch = { + type = "git"; + url = "https://github.com/linuxdeepin/go-x11-client"; + rev = "0.6.9"; + sha256 = "sha256-xXNaXpFFHJN1fCFLoVrQFCXQ4ya+Kga55QWcJL/InkA="; + }; + } + { + goPackagePath = "github.com/pmezard/go-difflib"; + fetch = { + type = "git"; + url = "https://github.com/pmezard/go-difflib"; + rev = "5d4384ee4fb2527b0a1256a821ebfc92f91efefc"; + sha256 = "sha256-XA4Oj1gdmdV/F/+8kMI+DBxKPthZ768hbKsO3d9Gx90="; + }; + } + { + goPackagePath = "github.com/axgle/mahonia"; + fetch = { + type = "git"; + url = "https://github.com/axgle/mahonia"; + rev = "3358181d7394e26beccfae0ffde05193ef3be33a"; + sha256 = "0b8wsrxmv8a0cqbnsg55lpf29pxy2zw8azvgh3ck664lqpcfybhq"; + }; + } + { + goPackagePath = "golang.org/x/text"; + fetch = { + type = "git"; + url = "https://github.com/golang/text"; + rev = "v0.3.7"; + sha256 = "sha256-XpIbgE6MxWwDQQcPXr2NIsE2cev2+CIabi566TYGfHY="; + }; + } + { + goPackagePath = "golang.org/x/image"; + fetch = { + type = "git"; + url = "https://github.com/golang/image"; + rev = "70e8d0d3baa9a699c3865c753cbfa8ae65bd86ce"; + sha256 = "sha256-oMbDIke/qQ6cp7JLNsMusf7EIUfuj0WavFVfI0lxTDs="; + }; + } + { + goPackagePath = "github.com/nfnt/resize"; + fetch = { + type = "git"; + url = "https://github.com/nfnt/resize"; + rev = "83c6a9932646f83e3267f353373d47347b6036b2"; + sha256 = "005cpiwq28krbjf0zjwpfh63rp4s4is58700idn24fs3g7wdbwya"; + }; + } + { + goPackagePath = "github.com/Lofanmi/pinyin-golang"; + fetch = { + type = "git"; + url = "https://github.com/Lofanmi/pinyin-golang"; + rev = "1db892057f20c56a3286cc1517e0642dacbff54c"; + sha256 = "sha256-nhO6AYZ3vc7nwgmmfTlE6m33caY9gGZoKiSYvFLqHQc="; + }; + } + { + goPackagePath = "github.com/mozillazg/go-pinyin"; + fetch = { + type = "git"; + url = "https://github.com/mozillazg/go-pinyin"; + rev = "8930bc1fcb5693689dc35d98ad2a4153662e34b1"; + sha256 = "sha256-kuMNiWpPeqsIsFgYIOsffxUfwcLPaMZWdZRBJAMDVvA="; + }; + } + { + goPackagePath = "github.com/kelvins/sunrisesunset"; + fetch = { + type = "git"; + url = "https://github.com/kelvins/sunrisesunset"; + rev = "39fa1bd816d52927b4cfcab0a1535b17eafe0a3d"; + sha256 = "sha256-awklKAW1YM3sWM21irbyu2sUMIo3kCOj12lzyVzDefw="; + }; + } + { + goPackagePath = "github.com/cryptix/wav"; + fetch = { + type = "git"; + url = "https://github.com/cryptix/wav"; + rev = "8bdace674401f0bd3b63c65479b6a6ff1f9d5e44"; + sha256 = "18nyqv0ic35fs9fny8sj84c00vbxs8mnric6vr6yl42624fh5id6"; + }; + } + { + goPackagePath = "github.com/rickb777/date"; + fetch = { + type = "git"; + url = "https://github.com/rickb777/date"; + rev = "v1.18"; + sha256 = "sha256-8r8eFOF5dKtowE3dnjpSMIXJ/yX2IjiR7nZ/EApUZbA="; + }; + } + { + goPackagePath = "github.com/rickb777/plural"; + fetch = { + type = "git"; + url = "https://github.com/rickb777/plural"; + rev = "v1.4.1"; + sha256 = "sha256-nhN+ApdfUie45L+M2OZAPtSoiIZ1pZ2UpDX/DePS6Yw="; + }; + } + { + goPackagePath = "github.com/gosexy/gettext"; + fetch = { + type = "git"; + url = "https://github.com/gosexy/gettext"; + rev = "v0.9"; + sha256 = "0asphx8nd7zmp88wk6aakk5292np7yw73akvfdvlvs9q5r5ahkgi"; + }; + } + { + goPackagePath = "github.com/msteinert/pam"; + fetch = { + type = "git"; + url = "https://github.com/msteinert/pam"; + rev = "v1.0.0"; + sha256 = "sha256-Ji13ckPyZUBAovhK2hRHgf2LB1ieglX/XrIJBxVcsXc="; + }; + } + { + goPackagePath = "github.com/youpy/go-wav"; + fetch = { + type = "git"; + url = "https://github.com/youpy/go-wav"; + rev = "v0.3.2"; + sha256 = "sha256-jNqXW3F3fcgjT47+d2MVXauWkA7+1KfYVu3ZZpRCTkM="; + }; + } + { + goPackagePath = "github.com/zaf/g711"; + fetch = { + type = "git"; + url = "https://github.com/zaf/g711"; + rev = "v1.2"; + sha256 = "sha256-G+0cgGw/fcOUFVn32AeqUE0YjyOS82Z5MTcn6IANhCY="; + }; + } + { + goPackagePath = "github.com/youpy/go-riff"; + fetch = { + type = "git"; + url = "https://github.com/youpy/go-riff"; + rev = "v0.1.0"; + sha256 = "sha256-d/3rkxDeRTPveZblArKc61gB4LJVV08n7g0THieuhx8="; + }; + } + { + goPackagePath = "google.golang.org/protobuf"; + fetch = { + type = "git"; + url = "https://github.com/protocolbuffers/protobuf-go"; + rev = "v1.28.1"; + sha256 = "sha256-7Cg7fByLR9jX3OSCqJfLw5PAHDQi/gopkjtkbobnyWM"; + }; + } + { + goPackagePath = "github.com/mdlayher/netlink"; + fetch = { + type = "git"; + url = "https://github.com/mdlayher/netlink"; + rev = "v1.6.0"; + sha256 = "sha256-3pVOXscdUVerFlRW9aGz7/5YL2OWFkvm8AJGSxygkEs="; + }; + } + { + goPackagePath = "github.com/josharian/native"; + fetch = { + type = "git"; + url = "https://github.com/josharian/native"; + rev = "a938fb150d47536d63d6bb2f0c4433091cb8c223"; + sha256 = "sha256-KYeAFKKzRt+e7Zy0sp4VW65HQL90hF/wjXP3R5dXaww="; + }; + } + { + goPackagePath = "github.com/mdlayher/socket"; + fetch = { + type = "git"; + url = "https://github.com/mdlayher/socket"; + rev = "v0.2.3"; + sha256 = "sha256-EDaSQ621SJ2OK2WycMtybuJ2KpaH86JHknqsiduuCtQ="; + }; + } + { + goPackagePath = "golang.org/x/net"; + fetch = { + type = "git"; + url = "https://github.com/golang/net"; + rev = "83b083e8dc8b4507e702ce59208711115b23ec25"; + sha256 = "sha256-50A1EeE7HxKbnLBy1vdxtrbH+7d6/mnZA0cOwHJr5XA="; + }; + } + { + goPackagePath = "golang.org/x/sync"; + fetch = { + type = "git"; + url = "https://github.com/golang/sync"; + rev = "7fc1605a5dde7535a0fc1770ca44238629ff29ac"; + sha256 = "sha256-5EOxO8FRdaLW9v/DhwBmWiT2G34A2ofxSCaC7ovvpb0="; + }; + } + { + goPackagePath = "github.com/adrg/xdg"; + fetch = { + type = "git"; + url = "https://github.com/adrg/xdg"; + rev = "v0.4.0"; + sha256 = "sha256-zGjkdUQmrVqD6rMO9oDY+TeJCpuqnHyvkPCaXDlac/U="; + }; + } +] |