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;
117 objectName: "underlay"
120 // Whether the underlay is fully covered by opaque UI elements.
121 property bool fullyCovered: (panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth)
122 || stages.fullyShown || greeterWrapper.fullyShown
123 visible: !fullyCovered
126 anchors.fill: underlay
127 source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
128 fillMode: Image.PreserveAspectCrop
129 horizontalAlignment: Image.AlignRight
130 verticalAlignment: Image.AlignTop
138 height: parent.height
139 visible: !ApplicationManager.empty
142 target: ApplicationManager
144 if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== appId) {
150 onFocusedApplicationIdChanged: {
151 if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== ApplicationManager.focusedApplicationId) {
154 panel.indicators.hide();
157 onApplicationAdded: {
158 if (greeter.shown && appId != "unity8-dash") {
165 id: applicationsDisplayLoader
168 source: shell.sideStageEnabled ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
171 target: applicationsDisplayLoader.item
172 property: "objectName"
176 target: applicationsDisplayLoader.item
177 property: "dragAreaWidth"
178 value: shell.edgeSize
181 target: applicationsDisplayLoader.item
182 property: "maximizedAppTopMargin"
183 // Not just using panel.panelHeight as that changes depending on the focused app.
184 value: panel.indicators.panelHeight
187 target: applicationsDisplayLoader.item
188 property: "interactive"
189 value: !greeter.shown && !lockscreen.shown && panel.indicators.fullyClosed && launcher.progress == 0
192 target: applicationsDisplayLoader.item
193 property: "spreadEnabled"
194 value: greeter.fakeActiveForApp === "" // to support emergency dialer hack
197 target: applicationsDisplayLoader.item
198 property: "inverseProgress"
199 value: launcher.progress
206 objectName: "inputMethod"
207 anchors { fill: parent; topMargin: panel.panelHeight }
208 z: notifications.useModal || panel.indicators.shown ? overlay.z + 1 : overlay.z - 1
212 target: SurfaceManager
214 if (surface.type == MirSurfaceItem.InputMethod) {
215 inputMethod.surface = surface;
219 onSurfaceDestroyed: {
220 if (inputMethod.surface == surface) {
221 inputMethod.surface = null;
222 surface.parent = null;
224 if (!surface.parent) {
225 // there's no one displaying it. delete it right away
233 objectName: "lockscreen"
235 readonly property int backgroundTopMargin: -panel.panelHeight
237 hides: [launcher, panel.indicators]
240 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
241 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
245 height: parent.height - panel.panelHeight
246 background: shell.background
250 onEntered: LightDM.Greeter.respond(passphrase);
251 onCancel: greeter.show()
253 greeter.fakeActiveForApp = "dialer-app"
254 shell.activateApplication("dialer-app")
258 onShownChanged: if (shown) greeter.fakeActiveForApp = ""
260 Component.onCompleted: {
261 if (LightDM.Users.count == 1) {
262 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
268 target: LightDM.Greeter
270 onShowGreeter: greeter.show()
273 if (LightDM.Users.count == 1) {
274 // TODO: There's no better way for now to determine if its a PIN or a passphrase.
276 lockscreen.alphaNumeric = false
278 lockscreen.alphaNumeric = true
280 lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text);
285 onAuthenticationComplete: {
286 if (LightDM.Greeter.promptless) {
289 if (LightDM.Greeter.authenticated) {
293 lockscreen.clear(true);
299 target: LightDM.Greeter
301 value: greeter.shown || lockscreen.shown || greeter.fakeActiveForApp != ""
307 opacity: greeterWrapper.showProgress * 0.8
311 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
316 height: parent.height - panel.panelHeight
319 enabled: !launcher.dashSwipe
323 property bool fullyShown: showProgress === 1.0
324 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
325 onShowProgressChanged: if (LightDM.Greeter.promptless && showProgress === 0) greeter.login()
329 objectName: "greeter"
331 signal sessionStarted() // helpful for tests
333 property string fakeActiveForApp: ""
336 hides: [launcher, panel.indicators]
339 defaultBackground: shell.background
342 height: parent.height
344 dragHandleWidth: shell.edgeSize
348 LightDM.Greeter.startSessionSync();
359 if (!LightDM.Greeter.promptless) {
362 // If there is only one user, we start authenticating with that one here.
363 // If there are more users, the Greeter will handle that
364 if (LightDM.Users.count == 1) {
365 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
367 greeter.fakeActiveForApp = "";
368 greeter.forceActiveFocus();
372 onUnlocked: greeter.hide()
374 // Update launcher items for new user
375 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
376 AccountsService.user = user;
377 LauncherModel.setUser(user);
380 onTease: launcher.tease()
383 target: ApplicationManager
384 property: "suspended"
385 value: greeter.shown && greeterWrapper.showProgress == 1
394 onDisplayPowerStateChange: {
395 // We ignore any display-off signals when the proximity sensor
396 // is active. This usually indicates something like a phone call.
397 if (status == Powerd.Off && reason != Powerd.Proximity) {
401 // No reason to chew demo CPU when user isn't watching
402 if (status == Powerd.Off) {
403 edgeDemo.paused = true;
404 } else if (status == Powerd.On) {
405 edgeDemo.paused = false;
410 function showHome() {
411 if (edgeDemo.running) {
415 if (LightDM.Greeter.active) {
416 if (!LightDM.Greeter.promptless) {
422 var animate = !LightDM.Greeter.active && !stages.shown
423 dash.setCurrentScope("clickscope", animate, false)
424 ApplicationManager.requestFocusApplication("unity8-dash")
427 function showDash() {
428 if (LightDM.Greeter.active && !LightDM.Greeter.promptless) {
432 ApplicationManager.requestFocusApplication("unity8-dash")
450 anchors.fill: parent //because this draws indicator menus
453 available: edgeDemo.panelEnabled && greeter.fakeActiveForApp === ""
454 contentEnabled: edgeDemo.panelContentEnabled
455 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
456 panelHeight: units.gu(3)
459 property bool topmostApplicationIsFullscreen:
460 ApplicationManager.focusedApplicationId &&
461 ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
463 fullscreenMode: (topmostApplicationIsFullscreen && !LightDM.Greeter.active && launcher.progress == 0)
464 || greeter.fakeActiveForApp !== ""
469 objectName: "launcher"
471 readonly property bool dashSwipe: progress > 0
473 anchors.top: parent.top
474 anchors.bottom: parent.bottom
476 dragAreaWidth: shell.edgeSize
477 available: edgeDemo.launcherEnabled && greeter.fakeActiveForApp === ""
479 onShowDashHome: showHome()
481 onDashSwipeChanged: {
482 if (dashSwipe && ApplicationManager.focusedApplicationId !== "unity8-dash") {
483 dash.setCurrentScope("clickscope", false, true)
486 onLauncherApplicationSelected: {
487 if (greeter.fakeActiveForApp !== "") {
490 if (!edgeDemo.running)
491 shell.activateApplication(appId)
495 panel.indicators.hide()
501 id: modalNotificationBackground
503 visible: notifications.useModal && !greeter.shown && (notifications.state == "narrow")
516 model: NotificationBackend.Model
521 height: parent.height - panel.panelHeight
526 when: overlay.width <= units.gu(60)
527 AnchorChanges { target: notifications; anchors.left: parent.left }
531 when: overlay.width > units.gu(60)
532 AnchorChanges { target: notifications; anchors.left: undefined }
533 PropertyChanges { target: notifications; width: units.gu(38) }
550 shutdownFadeOutRectangle.enabled = true;
551 shutdownFadeOutRectangle.visible = true;
552 shutdownFadeOut.start();
557 id: alphaDisclaimerLabel
558 anchors.centerIn: parent
559 visible: ApplicationManager.fake ? ApplicationManager.fake : false
561 text: "EARLY ALPHA\nNOT READY FOR USE"
564 font.weight: Font.Black
565 horizontalAlignment: Text.AlignHCenter
566 verticalAlignment: Text.AlignVCenter
567 fontSizeMode: Text.Fit
569 scale: Math.min(parent.width, parent.height) / width
574 z: alphaDisclaimerLabel.z + 10
577 indicators: panel.indicators
582 target: SessionBroadcast
583 onShowHome: showHome()
587 id: shutdownFadeOutRectangle
594 NumberAnimation on opacity {
599 if (shutdownFadeOutRectangle.enabled && shutdownFadeOutRectangle.visible) {
600 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