2 * Copyright (C) 2013 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18import AccountsService 0.1
20import Unity.Application 0.1
21import Ubuntu.Components 0.1
22import Ubuntu.Gestures 0.1
23import Ubuntu.Telephony 0.1 as Telephony
24import Unity.Launcher 0.1
26import LightDM 0.1 as LightDM
28import SessionBroadcast 0.1
35import Unity.Notifications 1.0 as NotificationBackend
36import Unity.Session 0.1
37import Unity.DashCommunicator 0.1
42 // this is only here to select the width / height of the window if not running fullscreen
43 property bool tablet: false
44 width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
45 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
47 property real edgeSize: units.gu(2)
48 property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg")
49 property url background
50 readonly property real panelHeight: panel.panelHeight
52 property bool sideStageEnabled: shell.width >= units.gu(100)
53 readonly property string focusedApplicationId: ApplicationManager.focusedApplicationId
55 function activateApplication(appId) {
56 if (ApplicationManager.findApplication(appId)) {
57 ApplicationManager.requestFocusApplication(appId);
59 var execFlags = shell.sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
60 ApplicationManager.startApplication(appId, execFlags);
66 property: "applicationManager"
67 value: ApplicationManager
70 Component.onCompleted: {
71 Theme.name = "Ubuntu.Components.Themes.SuruGradient"
75 id: backgroundSettings
76 schema.id: "org.gnome.desktop.background"
78 property url gSettingsPicture: backgroundSettings.pictureUri != undefined && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : shell.defaultBackground
79 onGSettingsPictureChanged: {
80 shell.background = gSettingsPicture
89 objectName: "dashCommunicator"
93 // Handle but do not filter out volume keys
94 Keys.onVolumeUpPressed: { volumeControl.volumeUp(); event.accepted = false; }
95 Keys.onVolumeDownPressed: { volumeControl.volumeDown(); event.accepted = false; }
98 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
99 dialogs.onPowerKeyPressed();
100 event.accepted = true;
102 event.accepted = false;
107 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
108 dialogs.onPowerKeyReleased();
109 event.accepted = true;
111 event.accepted = false;
120 height: parent.height
121 visible: !ApplicationManager.empty
124 target: ApplicationManager
126 if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== appId) {
132 onFocusedApplicationIdChanged: {
133 if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== ApplicationManager.focusedApplicationId) {
136 panel.indicators.hide();
139 onApplicationAdded: {
140 if (greeter.shown && appId != "unity8-dash") {
147 id: applicationsDisplayLoader
150 source: shell.sideStageEnabled ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
153 target: applicationsDisplayLoader.item
154 property: "objectName"
158 target: applicationsDisplayLoader.item
159 property: "dragAreaWidth"
160 value: shell.edgeSize
163 target: applicationsDisplayLoader.item
164 property: "maximizedAppTopMargin"
165 // Not just using panel.panelHeight as that changes depending on the focused app.
166 value: panel.indicators.panelHeight
169 target: applicationsDisplayLoader.item
170 property: "interactive"
171 value: edgeDemo.stagesEnabled && !greeter.shown && !lockscreen.shown && panel.indicators.fullyClosed && launcher.progress == 0
174 target: applicationsDisplayLoader.item
175 property: "spreadEnabled"
176 value: edgeDemo.stagesEnabled && greeter.fakeActiveForApp === "" // to support emergency dialer hack
179 target: applicationsDisplayLoader.item
180 property: "inverseProgress"
181 value: launcher.progress
188 objectName: "inputMethod"
189 anchors { fill: parent; topMargin: panel.panelHeight }
190 z: notifications.useModal || panel.indicators.shown ? overlay.z + 1 : overlay.z - 1
194 target: SurfaceManager
196 if (surface.type == MirSurfaceItem.InputMethod) {
197 inputMethod.surface = surface;
201 onSurfaceDestroyed: {
202 if (inputMethod.surface == surface) {
203 inputMethod.surface = null;
204 surface.parent = null;
206 if (!surface.parent) {
207 // there's no one displaying it. delete it right away
215 objectName: "lockscreen"
217 readonly property int backgroundTopMargin: -panel.panelHeight
219 hides: [launcher, panel.indicators]
222 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
223 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
227 height: parent.height - panel.panelHeight
228 background: shell.background
229 alphaNumeric: AccountsService.passwordDisplayHint === AccountsService.Keyboard
233 onEntered: LightDM.Greeter.respond(passphrase);
234 onCancel: greeter.show()
236 greeter.fakeActiveForApp = "dialer-app"
237 shell.activateApplication("dialer-app")
241 onShownChanged: if (shown) greeter.fakeActiveForApp = ""
243 Component.onCompleted: {
244 if (greeter.narrowMode) {
245 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
251 target: LightDM.Greeter
253 onShowGreeter: greeter.show()
256 if (greeter.narrowMode) {
257 lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text.toLowerCase());
262 onPromptlessChanged: {
263 if (LightDM.Greeter.promptless) {
271 onAuthenticationComplete: {
272 if (LightDM.Greeter.promptless) {
275 if (LightDM.Greeter.authenticated) {
279 lockscreen.clear(true);
280 if (greeter.narrowMode) {
281 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
288 target: LightDM.Greeter
290 value: greeter.shown || lockscreen.shown || greeter.fakeActiveForApp != ""
296 opacity: greeterWrapper.showProgress * 0.8
300 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
305 height: parent.height - panel.panelHeight
308 enabled: !launcher.dashSwipe
312 property bool fullyShown: showProgress === 1.0
313 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
314 onShowProgressChanged: if (LightDM.Greeter.promptless && showProgress === 0) greeter.login()
318 objectName: "greeter"
320 signal sessionStarted() // helpful for tests
322 property string fakeActiveForApp: ""
325 hides: [launcher, panel.indicators]
328 defaultBackground: shell.background
331 height: parent.height
333 dragHandleWidth: shell.edgeSize
337 if (LightDM.Greeter.startSessionSync()) {
348 if (greeter.narrowMode) {
349 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
351 if (!LightDM.Greeter.promptless) {
355 greeter.fakeActiveForApp = "";
356 greeter.forceActiveFocus();
360 onUnlocked: greeter.hide()
362 // Update launcher items for new user
363 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
364 AccountsService.user = user;
365 LauncherModel.setUser(user);
368 onTease: launcher.tease()
371 target: ApplicationManager
372 property: "suspended"
373 value: greeter.shown && greeterWrapper.showProgress == 1
383 if (Powerd.status === Powerd.Off && !callManager.hasCalls && !edgeDemo.running) {
387 // No reason to chew demo CPU when user isn't watching
388 if (Powerd.status === Powerd.Off) {
389 edgeDemo.paused = true;
390 } else if (Powerd.status === Powerd.On) {
391 edgeDemo.paused = false;
396 function showHome() {
397 if (edgeDemo.running) {
401 if (LightDM.Greeter.active) {
402 if (!LightDM.Greeter.promptless) {
408 var animate = !LightDM.Greeter.active && !stages.shown
409 dash.setCurrentScope("clickscope", animate, false)
410 ApplicationManager.requestFocusApplication("unity8-dash")
413 function showDash() {
414 if (LightDM.Greeter.active && !LightDM.Greeter.promptless) {
422 ApplicationManager.requestFocusApplication("unity8-dash")
435 anchors.fill: parent //because this draws indicator menus
438 available: edgeDemo.panelEnabled && greeter.fakeActiveForApp === ""
439 contentEnabled: edgeDemo.panelContentEnabled
440 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
441 panelHeight: units.gu(3)
444 property bool topmostApplicationIsFullscreen:
445 ApplicationManager.focusedApplicationId &&
446 ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
448 fullscreenMode: (topmostApplicationIsFullscreen && !LightDM.Greeter.active && launcher.progress == 0)
449 || greeter.fakeActiveForApp !== ""
454 objectName: "launcher"
456 readonly property bool dashSwipe: progress > 0
458 anchors.top: parent.top
459 anchors.bottom: parent.bottom
461 dragAreaWidth: shell.edgeSize
462 available: edgeDemo.launcherEnabled && greeter.fakeActiveForApp === ""
464 onShowDashHome: showHome()
466 onDashSwipeChanged: {
467 if (dashSwipe && ApplicationManager.focusedApplicationId !== "unity8-dash") {
468 dash.setCurrentScope("clickscope", false, true)
471 onLauncherApplicationSelected: {
472 if (greeter.fakeActiveForApp !== "") {
475 if (!edgeDemo.running)
476 shell.activateApplication(appId)
480 panel.indicators.hide()
486 id: modalNotificationBackground
488 visible: notifications.useModal && !greeter.shown && (notifications.state == "narrow")
501 model: NotificationBackend.Model
506 height: parent.height - panel.panelHeight
511 when: overlay.width <= units.gu(60)
512 AnchorChanges { target: notifications; anchors.left: parent.left }
516 when: overlay.width > units.gu(60)
517 AnchorChanges { target: notifications; anchors.left: undefined }
518 PropertyChanges { target: notifications; width: units.gu(38) }
535 shutdownFadeOutRectangle.enabled = true;
536 shutdownFadeOutRectangle.visible = true;
537 shutdownFadeOut.start();
542 id: alphaDisclaimerLabel
543 anchors.centerIn: parent
544 visible: ApplicationManager.fake ? ApplicationManager.fake : false
546 text: "EARLY ALPHA\nNOT READY FOR USE"
549 font.weight: Font.Black
550 horizontalAlignment: Text.AlignHCenter
551 verticalAlignment: Text.AlignVCenter
552 fontSizeMode: Text.Fit
554 scale: Math.min(parent.width, parent.height) / width
559 z: alphaDisclaimerLabel.z + 10
562 indicators: panel.indicators
567 target: SessionBroadcast
568 onShowHome: showHome()
572 id: shutdownFadeOutRectangle
579 NumberAnimation on opacity {
584 if (shutdownFadeOutRectangle.enabled && shutdownFadeOutRectangle.visible) {
585 DBusUnitySessionService.Shutdown();
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list