Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deepin.startdde: init at 5.10.1 #225400

Merged
merged 1 commit into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkgs/desktops/deepin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ let
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 { };
startdde = callPackage ./go-package/startdde { };

#### TOOLS
dde-device-formatter = callPackage ./tools/dde-device-formatter { };
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
From 47a700c64329f76ab91ac01d83a93f43bebe638b Mon Sep 17 00:00:00 2001
From: rewine <lhongxu@outlook.com>
Date: Sun, 9 Apr 2023 17:14:00 +0800
Subject: [PATCH] avoid use hardcode path

---
display/wayland.go | 4 ++--
main.go | 10 +++++-----
misc/auto_launch/chinese.json | 4 ++--
session.go | 15 +++++++++------
4 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/display/wayland.go b/display/wayland.go
index b980425..e44342a 100644
--- a/display/wayland.go
+++ b/display/wayland.go
@@ -556,7 +556,7 @@ func (mm *kMonitorManager) applyByWLOutput(monitorMap map[uint32]*Monitor) error

if len(args_enable) > 0 {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
- cmdline := exec.CommandContext(ctx, "/usr/bin/dde_wloutput", "set")
+ cmdline := exec.CommandContext(ctx, "dde_wloutput", "set")
cmdline.Args = append(cmdline.Args, args_enable...)
logger.Info("cmd line args_enable:", cmdline.Args)

@@ -572,7 +572,7 @@ func (mm *kMonitorManager) applyByWLOutput(monitorMap map[uint32]*Monitor) error
}
if len(args_disable) > 0 {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
- cmdline := exec.CommandContext(ctx, "/usr/bin/dde_wloutput", "set")
+ cmdline := exec.CommandContext(ctx, "dde_wloutput", "set")
cmdline.Args = append(cmdline.Args, args_disable...)
logger.Info("cmd line args_disable:", cmdline.Args)

diff --git a/main.go b/main.go
index 77b4e78..30aa3fd 100644
--- a/main.go
+++ b/main.go
@@ -96,17 +96,17 @@ func shouldUseDDEKWin() bool {
}

end:
- _, err = os.Stat("/usr/bin/kwin_no_scale")
+ _, err = exec.LookPath("kwin_no_scale")
return err == nil
}

const (
- cmdKWin = "/usr/bin/kwin_no_scale"
+ cmdKWin = "kwin_no_scale"
cmdDdeSessionDaemon = "/usr/lib/deepin-daemon/dde-session-daemon"
- cmdDdeDock = "/usr/bin/dde-dock"
- cmdDdeDesktop = "/usr/bin/dde-desktop"
+ cmdDdeDock = "dde-dock"
+ cmdDdeDesktop = "dde-desktop"
cmdLoginReminderHelper = "/usr/libexec/deepin/login-reminder-helper"
- cmdDdeHintsDialog = "/usr/bin/dde-hints-dialog"
+ cmdDdeHintsDialog = "dde-hints-dialog"

loginReminderTimeout = 5 * time.Second
loginReminderTimeFormat = "2006-01-02 15:04:05"
diff --git a/misc/auto_launch/chinese.json b/misc/auto_launch/chinese.json
index 079a521..1856ab1 100644
--- a/misc/auto_launch/chinese.json
+++ b/misc/auto_launch/chinese.json
@@ -13,7 +13,7 @@
"Priority": 9,
"Group": [
{
- "Command": "/usr/bin/dde-file-manager",
+ "Command": "dde-file-manager",
"Wait": false,
"Args": [
"-d"
@@ -39,7 +39,7 @@
"Priority": 7,
"Group": [
{
- "Command": "/usr/bin/dde-shutdown",
+ "Command": "dde-shutdown",
"Wait": false,
"Args": [
"-d"
diff --git a/session.go b/session.go
index 26f89ef..f412ca4 100644
--- a/session.go
+++ b/session.go
@@ -18,6 +18,7 @@ import (
"syscall"
"time"

+ "github.com/adrg/xdg"
"github.com/godbus/dbus"
"github.com/linuxdeepin/dde-api/soundutils"
daemon "github.com/linuxdeepin/go-dbus-factory/com.deepin.daemon.daemon"
@@ -53,8 +54,10 @@ const (

xsKeyQtFontName = "Qt/FontName"
xsKeyQtMonoFontName = "Qt/MonoFontName"
+)

- ddeLockDesktopFile = "/usr/share/applications/dde-lock.desktop"
+var (
+ ddeLockDesktopFile, _ = xdg.SearchDataFile("applications/dde-lock.desktop");
)

type SessionManager struct {
@@ -90,7 +93,7 @@ type SessionManager struct {
}

const (
- cmdShutdown = "/usr/bin/dde-shutdown"
+ cmdShutdown = "dde-shutdown"
lockFrontDest = "com.deepin.dde.lockFront"
lockFrontIfc = lockFrontDest
lockFrontObjPath = "/com/deepin/dde/lockFront"
@@ -471,7 +474,7 @@ func (m *SessionManager) SetLocked(sender dbus.Sender, value bool) *dbus.Error {
return dbusutil.ToError(err)
}

- if exe == "/usr/bin/dde-lock" {
+ if strings.Contains(exe, "dde-lock") {
m.setLocked(value)
return nil
}
@@ -491,7 +494,7 @@ func (m *SessionManager) SetLocked(sender dbus.Sender, value bool) *dbus.Error {
return dbusutil.ToError(fmt.Errorf("desktop file %q is invalid", desktopFile))
}
exe = info.GetExecutable()
- if exe != "/usr/bin/dde-lock" {
+ if strings.Contains(exe, "dde-lock") {
return dbusutil.ToError(fmt.Errorf("exe %q of desktop file %q is invalid", exe, desktopFile))
}

@@ -798,7 +801,7 @@ func setupEnvironments2() {
// man gnome-keyring-daemon:
// The daemon will print out various environment variables which should be set
// in the user's environment, in order to interact with the daemon.
- gnomeKeyringOutput, err := exec.Command("/usr/bin/gnome-keyring-daemon", "--start",
+ gnomeKeyringOutput, err := exec.Command("gnome-keyring-daemon", "--start",
"--components=secrets,pkcs11,ssh").Output()
if err == nil {
lines := bytes.Split(gnomeKeyringOutput, []byte{'\n'})
@@ -1389,4 +1392,4 @@ func initXEventMonitor() {
setDPMSMode(true)
}
})
-}
\ No newline at end of file
+}
--
2.39.2

102 changes: 102 additions & 0 deletions pkgs/desktops/deepin/go-package/startdde/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{ stdenv
, lib
, fetchFromGitHub
, buildGoPackage
, pkg-config
, go-dbus-factory
, go-gir-generator
, go-lib
, gettext
, dde-api
, libgnome-keyring
, gtk3
, alsa-lib
, libpulseaudio
, libgudev
, libsecret
, jq
, wrapGAppsHook
, runtimeShell
, dde-polkit-agent
}:

buildGoPackage rec {
pname = "startdde";
version = "5.10.1";

goPackagePath = "github.com/linuxdeepin/startdde";

src = fetchFromGitHub {
owner = "linuxdeepin";
repo = pname;
rev = version;
sha256 = "sha256-dbTcYS7dEvT0eP45jKE8WiG9Pm4LU6jvR8hjMQv/yxU=";
};

patches = [
./0001-avoid-use-hardcode-path.patch
];

postPatch = ''
substituteInPlace display/manager.go session.go \
--replace "/bin/bash" "${runtimeShell}"
substituteInPlace display/manager.go main.go utils.go session.go \
--replace "/usr/lib/deepin-daemon" "/run/current-system/sw/lib/deepin-daemon"
substituteInPlace misc/xsessions/deepin.desktop.in --subst-var-by PREFIX $out
substituteInPlace watchdog/dde_polkit_agent.go misc/auto_launch/{default.json,chinese.json} \
--replace "/usr/lib/polkit-1-dde/dde-polkit-agent" "${dde-polkit-agent}/lib/polkit-1-dde/dde-polkit-agent"
substituteInPlace startmanager.go launch_group.go memchecker/config.go \
--replace "/usr/share/startdde" "$out/share/startdde"
substituteInPlace misc/lightdm.conf --replace "/usr" "$out"
'';

goDeps = ./deps.nix;

nativeBuildInputs = [
gettext
pkg-config
jq
wrapGAppsHook
];

buildInputs = [
go-dbus-factory
go-gir-generator
go-lib
dde-api
libgnome-keyring
gtk3
alsa-lib
libpulseaudio
libgudev
libsecret
];

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 = ''
make install DESTDIR="$out" PREFIX="/" -C go/src/${goPackagePath}
'';

passthru.providedSessions = [ "deepin" ];

meta = with lib; {
description = "Starter of deepin desktop environment";
longDescription = ''
Startdde is used for launching DDE components and invoking user's
custom applications which compliant with xdg autostart specification
'';
homepage = "https://github.com/linuxdeepin/startdde";
license = licenses.gpl3Plus;
platforms = platforms.linux;
maintainers = teams.deepin.members;
};
}
Loading