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
247 alphaNumeric: AccountsService.passwordDisplayHint === AccountsService.Keyboard
251 onEntered: LightDM.Greeter.respond(passphrase);
252 onCancel: greeter.show()
254 greeter.fakeActiveForApp = "dialer-app"
255 shell.activateApplication("dialer-app")
259 onShownChanged: if (shown) greeter.fakeActiveForApp = ""
261 Component.onCompleted: {
262 if (greeter.narrowMode) {
263 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
269 target: LightDM.Greeter
271 onShowGreeter: greeter.show()
274 if (greeter.narrowMode) {
275 lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text.toLowerCase());
280 onPromptlessChanged: {
281 if (LightDM.Greeter.promptless) {
289 onAuthenticationComplete: {
290 if (LightDM.Greeter.promptless) {
293 if (LightDM.Greeter.authenticated) {
297 lockscreen.clear(true);
298 if (greeter.narrowMode) {
299 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
306 target: LightDM.Greeter
308 value: greeter.shown || lockscreen.shown || greeter.fakeActiveForApp != ""
314 opacity: greeterWrapper.showProgress * 0.8
318 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
323 height: parent.height - panel.panelHeight
326 enabled: !launcher.dashSwipe
330 property bool fullyShown: showProgress === 1.0
331 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
332 onShowProgressChanged: if (LightDM.Greeter.promptless && showProgress === 0) greeter.login()
336 objectName: "greeter"
338 signal sessionStarted() // helpful for tests
340 property string fakeActiveForApp: ""
343 hides: [launcher, panel.indicators]
346 defaultBackground: shell.background
349 height: parent.height
351 dragHandleWidth: shell.edgeSize
355 if (LightDM.Greeter.startSessionSync()) {
366 if (greeter.narrowMode) {
367 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
369 if (!LightDM.Greeter.promptless) {
373 greeter.fakeActiveForApp = "";
374 greeter.forceActiveFocus();
378 onUnlocked: greeter.hide()
380 // Update launcher items for new user
381 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
382 AccountsService.user = user;
383 LauncherModel.setUser(user);
386 onTease: launcher.tease()
389 target: ApplicationManager
390 property: "suspended"
391 value: greeter.shown && greeterWrapper.showProgress == 1
400 onDisplayPowerStateChange: {
401 // We ignore any display-off signals when the proximity sensor
402 // is active. This usually indicates something like a phone call.
403 if (status == Powerd.Off && reason != Powerd.Proximity) {
407 // No reason to chew demo CPU when user isn't watching
408 if (status == Powerd.Off) {
409 edgeDemo.paused = true;
410 } else if (status == Powerd.On) {
411 edgeDemo.paused = false;
416 function showHome() {
417 if (edgeDemo.running) {
421 if (LightDM.Greeter.active) {
422 if (!LightDM.Greeter.promptless) {
428 var animate = !LightDM.Greeter.active && !stages.shown
429 dash.setCurrentScope("clickscope", animate, false)
430 ApplicationManager.requestFocusApplication("unity8-dash")
433 function showDash() {
434 if (LightDM.Greeter.active && !LightDM.Greeter.promptless) {
442 ApplicationManager.requestFocusApplication("unity8-dash")
455 anchors.fill: parent //because this draws indicator menus
458 available: edgeDemo.panelEnabled && greeter.fakeActiveForApp === ""
459 contentEnabled: edgeDemo.panelContentEnabled
460 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
461 panelHeight: units.gu(3)
464 property bool topmostApplicationIsFullscreen:
465 ApplicationManager.focusedApplicationId &&
466 ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
468 fullscreenMode: (topmostApplicationIsFullscreen && !LightDM.Greeter.active && launcher.progress == 0)
469 || greeter.fakeActiveForApp !== ""
474 objectName: "launcher"
476 readonly property bool dashSwipe: progress > 0
478 anchors.top: parent.top
479 anchors.bottom: parent.bottom
481 dragAreaWidth: shell.edgeSize
482 available: edgeDemo.launcherEnabled && greeter.fakeActiveForApp === ""
484 onShowDashHome: showHome()
486 onDashSwipeChanged: {
487 if (dashSwipe && ApplicationManager.focusedApplicationId !== "unity8-dash") {
488 dash.setCurrentScope("clickscope", false, true)
491 onLauncherApplicationSelected: {
492 if (greeter.fakeActiveForApp !== "") {
495 if (!edgeDemo.running)
496 shell.activateApplication(appId)
500 panel.indicators.hide()
506 id: modalNotificationBackground
508 visible: notifications.useModal && !greeter.shown && (notifications.state == "narrow")
521 model: NotificationBackend.Model
526 height: parent.height - panel.panelHeight
531 when: overlay.width <= units.gu(60)
532 AnchorChanges { target: notifications; anchors.left: parent.left }
536 when: overlay.width > units.gu(60)
537 AnchorChanges { target: notifications; anchors.left: undefined }
538 PropertyChanges { target: notifications; width: units.gu(38) }
555 shutdownFadeOutRectangle.enabled = true;
556 shutdownFadeOutRectangle.visible = true;
557 shutdownFadeOut.start();
562 id: alphaDisclaimerLabel
563 anchors.centerIn: parent
564 visible: ApplicationManager.fake ? ApplicationManager.fake : false
566 text: "EARLY ALPHA\nNOT READY FOR USE"
569 font.weight: Font.Black
570 horizontalAlignment: Text.AlignHCenter
571 verticalAlignment: Text.AlignVCenter
572 fontSizeMode: Text.Fit
574 scale: Math.min(parent.width, parent.height) / width
579 z: alphaDisclaimerLabel.z + 10
582 indicators: panel.indicators
587 target: SessionBroadcast
588 onShowHome: showHome()
592 id: shutdownFadeOutRectangle
599 NumberAnimation on opacity {
604 if (shutdownFadeOutRectangle.enabled && shutdownFadeOutRectangle.visible) {
605 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