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 Unity.Launcher 0.1
25import LightDM 0.1 as LightDM
27import SessionBroadcast 0.1
34import Unity.Notifications 1.0 as NotificationBackend
35import Unity.Session 0.1
36import Unity.DashCommunicator 0.1
41 // this is only here to select the width / height of the window if not running fullscreen
42 property bool tablet: false
43 width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
44 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
46 property real edgeSize: units.gu(2)
47 property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg")
48 property url background
49 readonly property real panelHeight: panel.panelHeight
51 property bool sideStageEnabled: shell.width >= units.gu(100)
52 readonly property string focusedApplicationId: ApplicationManager.focusedApplicationId
54 function activateApplication(appId) {
55 if (ApplicationManager.findApplication(appId)) {
56 ApplicationManager.requestFocusApplication(appId);
58 var execFlags = shell.sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
59 ApplicationManager.startApplication(appId, execFlags);
65 property: "applicationManager"
66 value: ApplicationManager
69 Component.onCompleted: {
70 Theme.name = "Ubuntu.Components.Themes.SuruGradient"
74 id: backgroundSettings
75 schema.id: "org.gnome.desktop.background"
77 property url gSettingsPicture: backgroundSettings.pictureUri != undefined && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : shell.defaultBackground
78 onGSettingsPictureChanged: {
79 shell.background = gSettingsPicture
88 objectName: "dashCommunicator"
92 // Handle but do not filter out volume keys
93 Keys.onVolumeUpPressed: { volumeControl.volumeUp(); event.accepted = false; }
94 Keys.onVolumeDownPressed: { volumeControl.volumeDown(); event.accepted = false; }
97 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
98 dialogs.onPowerKeyPressed();
99 event.accepted = true;
101 event.accepted = false;
106 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
107 dialogs.onPowerKeyReleased();
108 event.accepted = true;
110 event.accepted = false;
119 height: parent.height
120 visible: !ApplicationManager.empty
123 target: ApplicationManager
125 if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== appId) {
131 onFocusedApplicationIdChanged: {
132 if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== ApplicationManager.focusedApplicationId) {
135 panel.indicators.hide();
138 onApplicationAdded: {
139 if (greeter.shown && appId != "unity8-dash") {
146 id: applicationsDisplayLoader
149 source: shell.sideStageEnabled ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
152 target: applicationsDisplayLoader.item
153 property: "objectName"
157 target: applicationsDisplayLoader.item
158 property: "dragAreaWidth"
159 value: shell.edgeSize
162 target: applicationsDisplayLoader.item
163 property: "maximizedAppTopMargin"
164 // Not just using panel.panelHeight as that changes depending on the focused app.
165 value: panel.indicators.panelHeight
168 target: applicationsDisplayLoader.item
169 property: "interactive"
170 value: edgeDemo.stagesEnabled && !greeter.shown && !lockscreen.shown && panel.indicators.fullyClosed && launcher.progress == 0
173 target: applicationsDisplayLoader.item
174 property: "spreadEnabled"
175 value: edgeDemo.stagesEnabled && greeter.fakeActiveForApp === "" // to support emergency dialer hack
178 target: applicationsDisplayLoader.item
179 property: "inverseProgress"
180 value: launcher.progress
187 objectName: "inputMethod"
188 anchors { fill: parent; topMargin: panel.panelHeight }
189 z: notifications.useModal || panel.indicators.shown ? overlay.z + 1 : overlay.z - 1
193 target: SurfaceManager
195 if (surface.type == MirSurfaceItem.InputMethod) {
196 inputMethod.surface = surface;
200 onSurfaceDestroyed: {
201 if (inputMethod.surface == surface) {
202 inputMethod.surface = null;
203 surface.parent = null;
205 if (!surface.parent) {
206 // there's no one displaying it. delete it right away
214 objectName: "lockscreen"
216 readonly property int backgroundTopMargin: -panel.panelHeight
218 hides: [launcher, panel.indicators]
221 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
222 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
226 height: parent.height - panel.panelHeight
227 background: shell.background
228 alphaNumeric: AccountsService.passwordDisplayHint === AccountsService.Keyboard
232 onEntered: LightDM.Greeter.respond(passphrase);
233 onCancel: greeter.show()
235 greeter.fakeActiveForApp = "dialer-app"
236 shell.activateApplication("dialer-app")
240 onShownChanged: if (shown) greeter.fakeActiveForApp = ""
242 Component.onCompleted: {
243 if (greeter.narrowMode) {
244 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
250 target: LightDM.Greeter
252 onShowGreeter: greeter.show()
255 if (greeter.narrowMode) {
256 lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text.toLowerCase());
261 onPromptlessChanged: {
262 if (LightDM.Greeter.promptless) {
270 onAuthenticationComplete: {
271 if (LightDM.Greeter.promptless) {
274 if (LightDM.Greeter.authenticated) {
278 lockscreen.clear(true);
279 if (greeter.narrowMode) {
280 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
287 target: LightDM.Greeter
289 value: greeter.shown || lockscreen.shown || greeter.fakeActiveForApp != ""
295 opacity: greeterWrapper.showProgress * 0.8
299 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
304 height: parent.height - panel.panelHeight
307 enabled: !launcher.dashSwipe
311 property bool fullyShown: showProgress === 1.0
312 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
313 onShowProgressChanged: if (LightDM.Greeter.promptless && showProgress === 0) greeter.login()
317 objectName: "greeter"
319 signal sessionStarted() // helpful for tests
321 property string fakeActiveForApp: ""
324 hides: [launcher, panel.indicators]
327 defaultBackground: shell.background
330 height: parent.height
332 dragHandleWidth: shell.edgeSize
336 if (LightDM.Greeter.startSessionSync()) {
347 if (greeter.narrowMode) {
348 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
350 if (!LightDM.Greeter.promptless) {
354 greeter.fakeActiveForApp = "";
355 greeter.forceActiveFocus();
359 onUnlocked: greeter.hide()
361 // Update launcher items for new user
362 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
363 AccountsService.user = user;
364 LauncherModel.setUser(user);
367 onTease: launcher.tease()
370 target: ApplicationManager
371 property: "suspended"
372 value: greeter.shown && greeterWrapper.showProgress == 1
381 onDisplayPowerStateChange: {
382 // We ignore any display-off signals when the proximity sensor
383 // is active. This usually indicates something like a phone call.
384 if (status == Powerd.Off && reason != Powerd.Proximity && !edgeDemo.running) {
388 // No reason to chew demo CPU when user isn't watching
389 if (status == Powerd.Off) {
390 edgeDemo.paused = true;
391 } else if (status == Powerd.On) {
392 edgeDemo.paused = false;
397 function showHome() {
398 if (edgeDemo.running) {
402 if (LightDM.Greeter.active) {
403 if (!LightDM.Greeter.promptless) {
409 var animate = !LightDM.Greeter.active && !stages.shown
410 dash.setCurrentScope("clickscope", animate, false)
411 ApplicationManager.requestFocusApplication("unity8-dash")
414 function showDash() {
415 if (LightDM.Greeter.active && !LightDM.Greeter.promptless) {
423 ApplicationManager.requestFocusApplication("unity8-dash")
436 anchors.fill: parent //because this draws indicator menus
439 available: edgeDemo.panelEnabled && greeter.fakeActiveForApp === ""
440 contentEnabled: edgeDemo.panelContentEnabled
441 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
442 panelHeight: units.gu(3)
445 property bool topmostApplicationIsFullscreen:
446 ApplicationManager.focusedApplicationId &&
447 ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
449 fullscreenMode: (topmostApplicationIsFullscreen && !LightDM.Greeter.active && launcher.progress == 0)
450 || greeter.fakeActiveForApp !== ""
455 objectName: "launcher"
457 readonly property bool dashSwipe: progress > 0
459 anchors.top: parent.top
460 anchors.bottom: parent.bottom
462 dragAreaWidth: shell.edgeSize
463 available: edgeDemo.launcherEnabled && greeter.fakeActiveForApp === ""
465 onShowDashHome: showHome()
467 onDashSwipeChanged: {
468 if (dashSwipe && ApplicationManager.focusedApplicationId !== "unity8-dash") {
469 dash.setCurrentScope("clickscope", false, true)
472 onLauncherApplicationSelected: {
473 if (greeter.fakeActiveForApp !== "") {
476 if (!edgeDemo.running)
477 shell.activateApplication(appId)
481 panel.indicators.hide()
487 id: modalNotificationBackground
489 visible: notifications.useModal && !greeter.shown && (notifications.state == "narrow")
502 model: NotificationBackend.Model
507 height: parent.height - panel.panelHeight
512 when: overlay.width <= units.gu(60)
513 AnchorChanges { target: notifications; anchors.left: parent.left }
517 when: overlay.width > units.gu(60)
518 AnchorChanges { target: notifications; anchors.left: undefined }
519 PropertyChanges { target: notifications; width: units.gu(38) }
536 shutdownFadeOutRectangle.enabled = true;
537 shutdownFadeOutRectangle.visible = true;
538 shutdownFadeOut.start();
543 id: alphaDisclaimerLabel
544 anchors.centerIn: parent
545 visible: ApplicationManager.fake ? ApplicationManager.fake : false
547 text: "EARLY ALPHA\nNOT READY FOR USE"
550 font.weight: Font.Black
551 horizontalAlignment: Text.AlignHCenter
552 verticalAlignment: Text.AlignVCenter
553 fontSizeMode: Text.Fit
555 scale: Math.min(parent.width, parent.height) / width
560 z: alphaDisclaimerLabel.z + 10
563 indicators: panel.indicators
568 target: SessionBroadcast
569 onShowHome: showHome()
573 id: shutdownFadeOutRectangle
580 NumberAnimation on opacity {
585 if (shutdownFadeOutRectangle.enabled && shutdownFadeOutRectangle.visible) {
586 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