@@ -12,8 +12,7 @@ Item {
1212
1313 property var screensProxy: Screens.createProxy();
1414
15− property var lastClickedWorkspace: null
16− property var activeWorkspace: null
15+ property QtObject activeWorkspace: null
1716 onActiveWorkspaceChanged: print("********************* active workspace changed:", activeWorkspace)
1817
1918 signal closeSpread();
@@ -23,9 +22,9 @@ Item {
2322 anchors.bottom: parent.bottom
2423 anchors.horizontalCenter: parent.horizontalCenter
2524 Behavior on anchors.horizontalCenterOffset { NumberAnimation { duration: UbuntuAnimation.SlowDuration } }
26−// anchors.left: parent.left
2725 spacing: units.gu(1)
2826
27+ property var selectedIndex: undefined
2928
3029 Repeater {
3130 model: screensProxy
@@ -34,13 +33,39 @@ Item {
3433 height: root.height - units.gu(6)
3534 width: workspaces.width
3635
37− UbuntuShape {
36+ Item {
3837 id: header
3938 anchors { left: parent.left; top: parent.top; right: parent.right }
4039 height: units.gu(7)
41− backgroundColor: "white"
4240 z: 1
4341
42+ property bool isCurrent: {
43+ // another screen is selected.
44+ if (row.selectedIndex != undefined && row.selectedIndex != index) return false;
45+
46+ // this screen is active.
47+ if (WMScreen.active && WMScreen.isSameAs(model.screen) && WMScreen.currentWorkspace.isSameAs(activeWorkspace)) return true;
48+ if (model.screen.workspaces.indexOf(activeWorkspace) >= 0) return true;
49+
50+ // not active.
51+ return false;
52+ }
53+
54+ property bool isSelected: screenMA.containsMouse
55+ onIsSelectedChanged: {
56+ if (isSelected) {
57+ row.selectedIndex = Qt.binding(function() { return index; });
58+ } else if (row.selectedIndex === index) {
59+ row.selectedIndex = undefined;
60+ }
61+ }
62+
63+ UbuntuShape {
64+ anchors.fill: parent
65+ backgroundColor: "white"
66+ opacity: header.isCurrent || header.isSelected ? 1.0 : 0.5
67+ }
68+
4469 DropArea {
4570 anchors.fill: parent
4671 keys: ["workspace"]
@@ -66,23 +91,38 @@ Item {
6691
6792 Label {
6893 text: model.screen.name
69− color: "black"
94+ color: header.isCurrent || header.isSelected ? "black" : "white"
7095 }
7196
7297 Label {
7398 text: model.screen.outputTypeName
74− color: "black"
99+ color: header.isCurrent || header.isSelected ? "black" : "white"
75100 fontSize: "x-small"
76101 }
77102
78103 Label {
79104 text: screen.availableModes[screen.currentModeIndex].size.width + "x" + screen.availableModes[screen.currentModeIndex].size.height
80− color: "black"
105+ color: header.isCurrent || header.isSelected ? "black" : "white"
81106 fontSize: "x-small"
82107 }
83108 }
84109
110+ Icon {
111+ anchors {
112+ top: parent.top
113+ right: parent.right
114+ margins: units.gu(1)
115+ }
116+ width: units.gu(3)
117+ height: width
118+ source: "image://theme/select"
119+ color: header.isCurrent || header.isSelected ? "black" : "white"
120+ visible: model.screen.active
121+ }
122+
85123 MouseArea {
124+ id: screenMA
125+ hoverEnabled: true
86126 anchors.fill: parent
87127
88128 onClicked: {
@@ -161,7 +201,7 @@ Item {
161201 onCloseSpread: root.closeSpread();
162202
163203 onClicked: {
164− root.lastClickedWorkspace = workspace;
204+ root.activeWorkspace = workspace;
165205 }
166206 }
167207 }