Skip to content

feat: support start sessions other than treeland#558

Merged
zccrs merged 1 commit intolinuxdeepin:masterfrom
calsys456:master
Sep 26, 2025
Merged

feat: support start sessions other than treeland#558
zccrs merged 1 commit intolinuxdeepin:masterfrom
calsys456:master

Conversation

@calsys456
Copy link
Collaborator

@calsys456 calsys456 commented Sep 16, 2025

This commit fixed the SessionModel and SessionList, and enabled session selection by adding a button to ControlAction.qml. Thus treeland can act as a greeter of ddm, guide the start of other desktop environment.

Summary by Sourcery

Enable treeland to serve as a greeter for the display manager by adding UI and model support for selecting and launching non-treeland sessions

New Features:

  • Add a session selection button to the lock screen control panel for choosing desktop sessions
  • Enable session list popup with scrollable entries to switch between available sessions

Bug Fixes:

  • Remove single-mode restriction in SessionModel to include all executable sessions
  • Fix last session lookup in SessionModel to match on exec command instead of file name

Enhancements:

  • Increase session list popup height and introduce a vertical scrollbar for better usability
  • Automatically close the session list popup upon session selection

@deepin-ci-robot
Copy link

Hi @apr3vau. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sourcery-ai
Copy link

sourcery-ai bot commented Sep 16, 2025

Reviewer's Guide

Introduces a session‐selection button in the lockscreen UI to choose non-Treeland sessions, enhances the session list popup with styling and a scrollbar, and updates SessionModel to include all executable sessions and match last session by exec identifier.

Sequence diagram for session selection interaction in lockscreen

sequenceDiagram
    actor User
    participant "Session Selection Button"
    participant "SessionList Popup"
    participant SessionModel
    User->>"Session Selection Button": Click
    "Session Selection Button"->>"SessionList Popup": open()
    User->>"SessionList Popup": Select session
    "SessionList Popup"->>SessionModel: updateCurrentSession(index)
    "SessionList Popup"->>"SessionList Popup": close()
Loading

Class diagram for updated SessionModel and SessionList

classDiagram
    class SessionModel {
        +populate(type, dirPaths)
        -displayNames: QStringList
        -sessions: QList<SessionInfo*>
        -lastIndex: int
    }
    class SessionInfo {
        +displayName()
        +exec()
        +fileName()
        +isSingleMode()
    }
    SessionModel "1" *-- "many" SessionInfo
    class SessionList {
        +open()
        +close()
        +updateCurrentSession(index)
        +currentIndex: int
    }
    SessionList o-- SessionModel
Loading

File-Level Changes

Change Details Files
Add session selection button in ControlAction.qml
  • Insert D.Button with icon label showing current session name
  • Embed SessionList component under the button
  • Define blurred circular background for the button
  • Handle onClicked to open the session list popup
src/plugins/lockscreen/qml/ControlAction.qml
Enhance SessionList.qml popup and delegate
  • Assign id to Popup and increase height to 280
  • Add always-on vertical ScrollBar to the list
  • Add required 'index' property to delegate
  • Use delegate index for updateCurrentSession and close popup on select
src/plugins/lockscreen/qml/SessionList.qml
Refine session filtering and last-session lookup in SessionModel
  • Remove single-mode restriction so all execAllowed sessions are listed
  • Match last session using exec() value instead of fileName()
src/greeter/sessionmodel.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • Use QML anchors or layouts instead of manual x/y offsets for positioning the sessionList popup to ensure it adapts to different screen sizes and resolutions.
  • Bind the sessionItem label to GreeterModel.currentSession so that the button text updates immediately when a new session is selected.
  • Replace the hardcoded Popup height in SessionList.qml with implicitHeight or calculate it based on the model count to support dynamic content sizing.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Use QML anchors or layouts instead of manual x/y offsets for positioning the sessionList popup to ensure it adapts to different screen sizes and resolutions.
- Bind the sessionItem label to GreeterModel.currentSession so that the button text updates immediately when a new session is selected.
- Replace the hardcoded Popup height in SessionList.qml with implicitHeight or calculate it based on the model count to support dynamic content sizing.

## Individual Comments

### Comment 1
<location> `src/plugins/lockscreen/qml/SessionList.qml:39` </location>
<code_context>
         clip: true
         model: SessionModel
+
+        ScrollBar.vertical: ScrollBar {
+            id: verticalScrollBar
+            anchors.right: parent.right
+            anchors.top: parent.top
+            anchors.bottom: parent.bottom
+            policy: ScrollBar.AlwaysOn
+        }
+
</code_context>

<issue_to_address>
**suggestion:** Always-on vertical scrollbar may impact visual clarity.

Using 'ScrollBar.AlwaysOn' may unnecessarily clutter the UI if the content fits. Consider 'ScrollBar.AsNeeded' unless always-on is required by design.

```suggestion
            policy: ScrollBar.AsNeeded
```
</issue_to_address>

### Comment 2
<location> `src/plugins/lockscreen/qml/SessionList.qml:44` </location>
<code_context>
+
         delegate: Item {
             required property string name
+            required property int index
             width: parent.width
             height: 60
</code_context>

<issue_to_address>
**suggestion:** Passing index to delegate may introduce maintenance complexity.

Using ListView's built-in 'index' property within the delegate is preferable, as it reduces the risk of errors if the model changes or the delegate is reused.

Suggested implementation:

```

```

```
                    updateCurrentSession(index)

```

The built-in `index` property is automatically available in ListView delegates, so you can use it directly without declaring it as a required property or passing it from the model. If the model or delegate is reused elsewhere, ensure that any references to `index` are using the built-in property and not expecting it from the model.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables treeland to function as a display manager greeter by adding session selection capabilities, allowing users to choose and launch different desktop environments beyond just treeland.

  • Adds a session selection button to the lock screen control panel for choosing available desktop sessions
  • Fixes SessionModel to include all executable sessions instead of only single-mode sessions
  • Introduces UI improvements including a scrollable session list popup and proper session switching logic

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/plugins/lockscreen/qml/SessionList.qml Enhanced popup with scrollbar support and improved session selection handling
src/plugins/lockscreen/qml/ControlAction.qml Added session selection button with popup integration
src/greeter/sessionmodel.cpp Removed single-mode restriction and fixed last session lookup logic
src/greeter/greeterproxy.h Added isLoggedIn property declaration
src/greeter/greeterproxy.cpp Implemented isLoggedIn property with proper state management
misc/wayland-sessions/treeland-user.desktop.in Updated display name for clarity

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@calsys456 calsys456 force-pushed the master branch 3 times, most recently from fa3147d to 91c0a18 Compare September 18, 2025 03:12
@deepin-bot
Copy link

deepin-bot bot commented Sep 18, 2025

TAG Bot

New tag: 0.7.1
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #560

@github-actions
Copy link

github-actions bot commented Sep 18, 2025

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@deepin-bot
Copy link

deepin-bot bot commented Sep 19, 2025

TAG Bot

New tag: 0.7.2
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #562

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: apr3vau, zccrs

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-bot
Copy link

deepin-bot bot commented Sep 23, 2025

TAG Bot

New tag: 0.7.3
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #569

This commit fixed the SessionModel and SessionList, and enabled session
selection by adding a button to ControlAction.qml. Thus treeland can act
as a greeter of ddm, guide the start of other desktop environment.
@zccrs zccrs merged commit 8fdd570 into linuxdeepin:master Sep 26, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants