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 readonly property bool locked: LightDM.Greeter.active && !LightDM.Greeter.authenticated
53 property bool sideStageEnabled: shell.width >= units.gu(100)
54 readonly property string focusedApplicationId: ApplicationManager.focusedApplicationId
56 function activateApplication(appId) {
57 if (ApplicationManager.findApplication(appId)) {
58 ApplicationManager.requestFocusApplication(appId);
60 var execFlags = shell.sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
61 ApplicationManager.startApplication(appId, execFlags);
67 property: "applicationManager"
68 value: ApplicationManager
71 Component.onCompleted: {
72 Theme.name = "Ubuntu.Components.Themes.SuruGradient"
76 id: backgroundSettings
77 schema.id: "org.gnome.desktop.background"
79 property url gSettingsPicture: backgroundSettings.pictureUri != undefined && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : shell.defaultBackground
80 onGSettingsPictureChanged: {
81 shell.background = gSettingsPicture
90 objectName: "dashCommunicator"
94 // Handle but do not filter out volume keys
95 Keys.onVolumeUpPressed: { volumeControl.volumeUp(); event.accepted = false; }
96 Keys.onVolumeDownPressed: { volumeControl.volumeDown(); event.accepted = false; }
99 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
100 dialogs.onPowerKeyPressed();
101 event.accepted = true;
103 event.accepted = false;
108 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
109 dialogs.onPowerKeyReleased();
110 event.accepted = true;
112 event.accepted = false;
121 height: parent.height
122 visible: !ApplicationManager.empty
125 target: ApplicationManager
127 if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== appId) {
133 onFocusedApplicationIdChanged: {
134 if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== ApplicationManager.focusedApplicationId) {
137 panel.indicators.hide();
140 onApplicationAdded: {
141 if (greeter.shown && appId != "unity8-dash") {
148 id: applicationsDisplayLoader
151 source: shell.sideStageEnabled ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
154 target: applicationsDisplayLoader.item
155 property: "objectName"
159 target: applicationsDisplayLoader.item
160 property: "dragAreaWidth"
161 value: shell.edgeSize
164 target: applicationsDisplayLoader.item
165 property: "maximizedAppTopMargin"
166 // Not just using panel.panelHeight as that changes depending on the focused app.
167 value: panel.indicators.panelHeight
170 target: applicationsDisplayLoader.item
171 property: "interactive"
172 value: edgeDemo.stagesEnabled && !greeter.shown && !lockscreen.shown && panel.indicators.fullyClosed && launcher.progress == 0
175 target: applicationsDisplayLoader.item
176 property: "spreadEnabled"
177 value: edgeDemo.stagesEnabled && greeter.fakeActiveForApp === "" // to support emergency dialer hack
180 target: applicationsDisplayLoader.item
181 property: "inverseProgress"
182 value: launcher.progress
189 objectName: "inputMethod"
190 anchors { fill: parent; topMargin: panel.panelHeight }
191 z: notifications.useModal || panel.indicators.shown ? overlay.z + 1 : overlay.z - 1
195 target: SurfaceManager
197 if (surface.type == MirSurfaceItem.InputMethod) {
198 inputMethod.surface = surface;
202 onSurfaceDestroyed: {
203 if (inputMethod.surface == surface) {
204 inputMethod.surface = null;
205 surface.parent = null;
207 if (!surface.parent) {
208 // there's no one displaying it. delete it right away
216 objectName: "lockscreen"
218 readonly property int backgroundTopMargin: -panel.panelHeight
220 hides: [launcher, panel.indicators]
223 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
224 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
228 height: parent.height - panel.panelHeight
229 background: shell.background
230 alphaNumeric: AccountsService.passwordDisplayHint === AccountsService.Keyboard
234 onEntered: LightDM.Greeter.respond(passphrase);
235 onCancel: greeter.show()
237 greeter.fakeActiveForApp = "dialer-app"
238 shell.activateApplication("dialer-app")
242 onShownChanged: if (shown) greeter.fakeActiveForApp = ""
244 Component.onCompleted: {
245 if (greeter.narrowMode) {
246 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
252 target: LightDM.Greeter
254 onShowGreeter: greeter.show()
257 if (greeter.narrowMode) {
258 lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text.toLowerCase());
263 onPromptlessChanged: {
264 if (LightDM.Greeter.promptless) {
272 onAuthenticationComplete: {
273 if (LightDM.Greeter.promptless) {
276 if (LightDM.Greeter.authenticated) {
280 lockscreen.clear(true);
281 if (greeter.narrowMode) {
282 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
289 target: LightDM.Greeter
291 value: greeter.shown || lockscreen.shown || greeter.fakeActiveForApp != ""
297 opacity: greeterWrapper.showProgress * 0.8
301 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
306 height: parent.height - panel.panelHeight
309 enabled: !launcher.dashSwipe
313 property bool fullyShown: showProgress === 1.0
314 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
315 onShowProgressChanged: if (LightDM.Greeter.promptless && showProgress === 0) greeter.login()
319 objectName: "greeter"
321 signal sessionStarted() // helpful for tests
323 property string fakeActiveForApp: ""
326 hides: [launcher, panel.indicators]
328 loadContent: required || lockscreen.required // keeps content in memory for quick show()
330 defaultBackground: shell.background
333 height: parent.height
335 dragHandleWidth: shell.edgeSize
339 if (LightDM.Greeter.startSessionSync()) {
350 if (greeter.narrowMode) {
351 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
353 if (!LightDM.Greeter.promptless) {
357 greeter.fakeActiveForApp = "";
358 greeter.forceActiveFocus();
362 onUnlocked: greeter.hide()
364 // Update launcher items for new user
365 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
366 AccountsService.user = user;
367 LauncherModel.setUser(user);
370 onTease: launcher.tease()
373 target: ApplicationManager
374 property: "suspended"
375 value: greeter.shown && greeterWrapper.showProgress == 1
384 onDisplayPowerStateChange: {
385 // We ignore any display-off signals when the proximity sensor
386 // is active. This usually indicates something like a phone call.
387 if (status == Powerd.Off && reason != Powerd.Proximity && !edgeDemo.running) {
391 // No reason to chew demo CPU when user isn't watching
392 if (status == Powerd.Off) {
393 edgeDemo.paused = true;
394 } else if (status == Powerd.On) {
395 edgeDemo.paused = false;
400 function showHome() {
401 if (edgeDemo.running) {
405 if (LightDM.Greeter.active) {
406 if (!LightDM.Greeter.promptless) {
412 var animate = !LightDM.Greeter.active && !stages.shown
413 dash.setCurrentScope("clickscope", animate, false)
414 ApplicationManager.requestFocusApplication("unity8-dash")
417 function showDash() {
426 ApplicationManager.requestFocusApplication("unity8-dash")
439 anchors.fill: parent //because this draws indicator menus
442 available: edgeDemo.panelEnabled && !shell.locked
443 contentEnabled: edgeDemo.panelContentEnabled
444 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
445 panelHeight: units.gu(3)
448 property bool topmostApplicationIsFullscreen:
449 ApplicationManager.focusedApplicationId &&
450 ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
452 fullscreenMode: (topmostApplicationIsFullscreen && !LightDM.Greeter.active && launcher.progress == 0)
453 || greeter.fakeActiveForApp !== ""
458 objectName: "launcher"
460 readonly property bool dashSwipe: progress > 0
462 anchors.top: parent.top
463 anchors.bottom: parent.bottom
465 dragAreaWidth: shell.edgeSize
466 available: edgeDemo.launcherEnabled && !shell.locked
468 onShowDashHome: showHome()
470 onDashSwipeChanged: {
471 if (dashSwipe && ApplicationManager.focusedApplicationId !== "unity8-dash") {
472 dash.setCurrentScope("clickscope", false, true)
475 onLauncherApplicationSelected: {
476 if (greeter.fakeActiveForApp !== "") {
479 if (!edgeDemo.running)
480 shell.activateApplication(appId)
484 panel.indicators.hide()
490 id: modalNotificationBackground
492 visible: notifications.useModal && !greeter.shown && (notifications.state == "narrow")
505 model: NotificationBackend.Model
510 height: parent.height - panel.panelHeight
515 when: overlay.width <= units.gu(60)
516 AnchorChanges { target: notifications; anchors.left: parent.left }
520 when: overlay.width > units.gu(60)
521 AnchorChanges { target: notifications; anchors.left: undefined }
522 PropertyChanges { target: notifications; width: units.gu(38) }
539 shutdownFadeOutRectangle.enabled = true;
540 shutdownFadeOutRectangle.visible = true;
541 shutdownFadeOut.start();
546 id: alphaDisclaimerLabel
547 anchors.centerIn: parent
548 visible: ApplicationManager.fake ? ApplicationManager.fake : false
550 text: "EARLY ALPHA\nNOT READY FOR USE"
553 font.weight: Font.Black
554 horizontalAlignment: Text.AlignHCenter
555 verticalAlignment: Text.AlignVCenter
556 fontSizeMode: Text.Fit
558 scale: Math.min(parent.width, parent.height) / width
563 z: alphaDisclaimerLabel.z + 10
566 indicators: panel.indicators
571 target: SessionBroadcast
572 onShowHome: showHome()
576 id: shutdownFadeOutRectangle
583 NumberAnimation on opacity {
588 if (shutdownFadeOutRectangle.enabled && shutdownFadeOutRectangle.visible) {
589 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