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
24import LightDM 0.1 as LightDM
26import SessionBroadcast 0.1
33import Unity.Notifications 1.0 as NotificationBackend
34import Unity.Session 0.1
39 // this is only here to select the width / height of the window if not running fullscreen
40 property bool tablet: false
41 width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
42 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
44 property real edgeSize: units.gu(2)
45 property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg")
46 property url background
47 readonly property real panelHeight: panel.panelHeight
49 property bool dashShown: dash.shown
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 if (stages.locked && ApplicationManager.focusedApplicationId == appId) {
59 applicationsDisplayLoader.item.select(appId);
62 var execFlags = shell.sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
63 ApplicationManager.startApplication(appId, execFlags);
70 property: "applicationManager"
71 value: ApplicationManager
74 Component.onCompleted: {
75 Theme.name = "Ubuntu.Components.Themes.SuruGradient"
79 id: backgroundSettings
80 schema.id: "org.gnome.desktop.background"
82 property url gSettingsPicture: backgroundSettings.pictureUri != undefined && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : shell.defaultBackground
83 onGSettingsPictureChanged: {
84 shell.background = gSettingsPicture
91 Keys.onVolumeUpPressed: volumeControl.volumeUp()
92 Keys.onVolumeDownPressed: volumeControl.volumeDown()
97 anchors.rightMargin: stages.overlayWidth
98 clip: stages.overlayMode && !stages.painting
102 blockInput: parent.clip
107 objectName: "underlay"
109 anchors.rightMargin: -parent.anchors.rightMargin
111 // Whether the underlay is fully covered by opaque UI elements.
112 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
114 // Whether the user should see the topmost application surface (if there's one at all).
115 readonly property bool applicationSurfaceShouldBeSeen: stages.shown && !stages.painting && !stages.overlayMode
117 // NB! Application surfaces are stacked behind the shell one. So they can only be seen by the user
118 // through the translucent parts of the shell surface.
119 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
124 opacity: dash.disappearingAnimationProgress
129 source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
130 fillMode: Image.PreserveAspectCrop
131 horizontalAlignment: Image.AlignRight
132 verticalAlignment: Image.AlignTop
139 available: !LightDM.Greeter.active
140 hides: [stages, launcher, panel.indicators]
141 shown: disappearingAnimationProgress !== 1.0 && greeterWrapper.showProgress !== 1.0
142 enabled: disappearingAnimationProgress === 0.0 && greeterWrapper.showProgress === 0.0 && edgeDemo.dashEnabled
146 topMargin: panel.panelHeight
149 contentScale: 1.0 - 0.2 * disappearingAnimationProgress
150 opacity: 1.0 - disappearingAnimationProgress
151 property real disappearingAnimationProgress: {
152 if (stages.overlayMode) {
155 return stages.showProgress
159 // FIXME: only necessary because stages.showProgress is not animated
160 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
167 direction: Direction.Leftwards
169 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
170 width: shell.edgeSize
172 property real progress: stages.width
175 if (status == DirectionalDragArea.Recognized) {
176 if (ApplicationManager.count == 0) {
177 progress = Math.max(stages.width - stagesDragHandle.width + touchX, stages.width * .3)
179 progress = stages.width - stagesDragHandle.width + touchX
186 if (ApplicationManager.count > 0 && progress < stages.width - units.gu(10)) {
189 stagesDragHandle.progress = stages.width;
198 height: parent.height
202 if (overlayMode || locked || greeter.fakeActiveForApp !== "") {
205 return launcher.progress
207 return stagesDragHandle.progress
211 Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
213 property bool shown: false
215 property real showProgress: overlayMode ? 0 : MathUtils.clamp(1 - x / shell.width, 0, 1)
217 property bool fullyShown: x == 0
218 property bool fullyHidden: x == width
220 property bool painting: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.painting : false
221 property bool fullscreen: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.fullscreen : false
222 property bool overlayMode: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayMode : false
223 property int overlayWidth: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayWidth : false
224 property bool locked: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.locked : false
226 function show(focusApp) {
228 panel.indicators.hide();
231 if (!ApplicationManager.focusedApplicationId && ApplicationManager.count > 0 && focusApp) {
232 ApplicationManager.focusApplication(ApplicationManager.get(0).appId);
238 if (ApplicationManager.focusedApplicationId) {
239 ApplicationManager.unfocusCurrentApplication();
244 target: ApplicationManager
247 if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== appId) {
254 onFocusedApplicationIdChanged: {
255 if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== ApplicationManager.focusedApplicationId) {
258 if (ApplicationManager.focusedApplicationId.length > 0) {
261 if (!stages.overlayMode) {
267 onApplicationAdded: {
271 onApplicationRemoved: {
272 if (ApplicationManager.focusedApplicationId.length == 0) {
279 target: DBusUnitySessionService
281 function closeAllApps() {
283 var app = ApplicationManager.get(0);
287 ApplicationManager.stopApplication(app.appId);
292 // TODO: Display a dialog to ask the user to confirm.
293 DBusUnitySessionService.Logout();
303 id: applicationsDisplayLoader
306 source: shell.sideStageEnabled ? "Stages/StageWithSideStage.qml" : "Stages/PhoneStage.qml"
309 target: applicationsDisplayLoader.item
310 property: "objectName"
314 target: applicationsDisplayLoader.item
316 value: !stages.fullyShown
319 target: applicationsDisplayLoader.item
324 target: applicationsDisplayLoader.item
325 property: "dragAreaWidth"
326 value: shell.edgeSize
329 target: applicationsDisplayLoader.item
330 property: "spreadEnabled"
331 value: greeter.fakeActiveForApp === "" // to support emergency dialer hack
338 objectName: "lockscreen"
340 readonly property int backgroundTopMargin: -panel.panelHeight
342 hides: [launcher, panel.indicators]
345 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
346 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
348 x: required ? 0 : - width
350 height: parent.height - panel.panelHeight
351 background: shell.background
352 alphaNumeric: AccountsService.passwordDisplayHint === AccountsService.Keyboard
356 onEntered: LightDM.Greeter.respond(passphrase);
357 onCancel: greeter.show()
359 greeter.fakeActiveForApp = "dialer-app"
360 shell.activateApplication("dialer-app")
364 onShownChanged: if (shown) greeter.fakeActiveForApp = ""
366 Component.onCompleted: {
367 if (greeter.narrowMode) {
368 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
374 target: LightDM.Greeter
376 onShowGreeter: greeter.show()
379 if (greeter.narrowMode) {
380 lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text.toLowerCase());
385 onAuthenticationComplete: {
386 if (LightDM.Greeter.promptless) {
389 if (LightDM.Greeter.authenticated) {
393 lockscreen.clear(true);
394 if (greeter.narrowMode) {
395 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
402 target: LightDM.Greeter
404 value: greeter.shown || lockscreen.shown || greeter.fakeActiveForApp != ""
410 opacity: greeterWrapper.showProgress * 0.8
414 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
419 height: parent.height - panel.panelHeight
422 enabled: !launcher.dashSwipe
426 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
427 onShowProgressChanged: if (LightDM.Greeter.promptless && showProgress === 0) greeter.login()
431 objectName: "greeter"
433 signal sessionStarted() // helpful for tests
435 property string fakeActiveForApp: ""
438 hides: [launcher, panel.indicators]
441 defaultBackground: shell.background
444 height: parent.height
446 dragHandleWidth: shell.edgeSize
450 if (LightDM.Greeter.startSessionSync()) {
462 if (!LightDM.Greeter.promptless) {
465 if (greeter.narrowMode) {
466 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
468 greeter.fakeActiveForApp = "";
469 greeter.forceActiveFocus();
473 onUnlocked: greeter.hide()
475 // Update launcher items for new user
476 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
477 AccountsService.user = user;
478 LauncherModel.setUser(user);
481 onTease: launcher.tease()
484 target: ApplicationManager
485 property: "suspended"
486 value: greeter.shown && greeterWrapper.showProgress == 1
493 blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
494 || panel.indicators.shown
501 onDisplayPowerStateChange: {
502 // We ignore any display-off signals when the proximity sensor
503 // is active. This usually indicates something like a phone call.
504 if (status == Powerd.Off && reason != Powerd.Proximity) {
508 // No reason to chew demo CPU when user isn't watching
509 if (status == Powerd.Off) {
510 edgeDemo.paused = true;
511 } else if (status == Powerd.On) {
512 edgeDemo.paused = false;
517 function showHome() {
518 if (edgeDemo.running)
521 if (LightDM.Greeter.active) {
522 if (!LightDM.Greeter.promptless)
527 var animate = !LightDM.Greeter.active && !stages.shown
528 dash.setCurrentScope("clickscope", animate, false)
532 function showDash() {
533 if (LightDM.Greeter.active && !LightDM.Greeter.promptless)
536 if (stages.shown && !stages.overlayMode) {
537 if (!stages.locked) {
548 function hideIndicatorMenu(delay) {
549 panel.hideIndicatorMenu(delay);
560 anchors.fill: parent //because this draws indicator menus
561 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
564 available: edgeDemo.panelEnabled && greeter.fakeActiveForApp === ""
565 contentEnabled: edgeDemo.panelContentEnabled
567 property string focusedAppId: ApplicationManager.focusedApplicationId
568 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
569 fullscreenMode: (focusedApplication && stages.fullscreen && !LightDM.Greeter.active) || greeter.fakeActiveForApp !== ""
570 searchVisible: !LightDM.Greeter.active && dash.shown && dash.searchable
578 height: (panel.fullscreenMode) ? shell.edgeSize : panel.panelHeight
584 blockInput: launcher.shown
587 bottom: parent.bottom
590 width: launcher.width
595 objectName: "launcher"
597 readonly property bool dashSwipe: progress > 0
599 anchors.top: parent.top
600 anchors.bottom: parent.bottom
602 dragAreaWidth: shell.edgeSize
603 available: edgeDemo.launcherEnabled && greeter.fakeActiveForApp === ""
605 onShowDashHome: showHome()
607 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("clickscope", false, true)
608 onLauncherApplicationSelected: {
609 if (greeter.fakeActiveForApp !== "")
611 if (!edgeDemo.running)
612 shell.activateApplication(appId)
616 panel.indicators.hide()
622 id: modalNotificationBackground
624 visible: notifications.useModal && !greeter.shown && (notifications.state == "narrow")
635 blockInput: modalNotificationBackground.visible
642 model: NotificationBackend.Model
648 bottom: parent.bottom
649 topMargin: panel.panelHeight
654 when: overlay.width <= units.gu(60)
655 AnchorChanges { target: notifications; anchors.left: parent.left }
659 when: overlay.width > units.gu(60)
660 AnchorChanges { target: notifications; anchors.left: undefined }
661 PropertyChanges { target: notifications; width: units.gu(38) }
666 anchors { left: parent.left; right: parent.right }
667 height: parent.contentHeight
668 blockInput: height > 0
674 onFocusChanged: if (!focus) forceActiveFocus();
679 bottom: parent.bottom
682 width: shell.edgeSize
689 bottom: parent.bottom
692 width: shell.edgeSize
703 anchors.topMargin: panel.panelHeight
704 anchors.fill: parent // as needs to know the geometry of the shell
707 //FIXME: This should be handled in the input stack, keyboard shouldnt propagate
709 anchors.bottom: parent.bottom
710 anchors.left: parent.left
711 anchors.right: parent.right
712 height: ApplicationManager.keyboardVisible ? ApplicationManager.keyboardHeight : 0
714 enabled: ApplicationManager.keyboardVisible
718 anchors.centerIn: parent
719 visible: ApplicationManager.fake ? ApplicationManager.fake : false
720 text: "EARLY ALPHA\nNOT READY FOR USE"
723 font.weight: Font.Black
724 horizontalAlignment: Text.AlignHCenter
725 verticalAlignment: Text.AlignVCenter
726 fontSizeMode: Text.Fit
728 scale: Math.min(parent.width, parent.height) / width
736 indicators: panel.indicators
741 target: SessionBroadcast
742 onShowHome: showHome()
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