├── .gitignore
├── modules
├── CMakeLists.txt
└── Papyros
│ ├── Material
│ ├── qmldir
│ ├── plugin.cpp
│ ├── plugin.h
│ ├── CMakeLists.txt
│ ├── PlatformExtensions.qml
│ ├── windowdecorations.cpp
│ └── windowdecorations.h
│ ├── Network
│ ├── qmldir
│ ├── debug.cpp
│ ├── enums.cpp
│ ├── debug.h
│ ├── enums.h
│ ├── appletproxymodel.h
│ ├── networkstatus.h
│ ├── plugin.cpp
│ ├── networkitemslist.h
│ ├── CMakeLists.txt
│ └── trafficmonitor.h
│ ├── Components
│ ├── CMakeLists.txt
│ ├── qmldir
│ ├── PagedGrid.qml
│ └── PanelItem.qml
│ ├── CMakeLists.txt
│ ├── Desktop
│ ├── qmldir
│ ├── plugin.h
│ ├── mixer
│ │ ├── alsamixer.h
│ │ ├── pulseaudiomixer.h
│ │ ├── sound.h
│ │ └── alsamixer.cpp
│ ├── CMakeLists.txt
│ ├── qml
│ │ └── ShellSettings.qml.in
│ ├── plugin.cpp
│ ├── mpris
│ │ ├── mprisconnection.h
│ │ ├── mpris2player.h
│ │ └── mprisconnection.cpp
│ ├── hardware
│ │ ├── storagedevice.h
│ │ └── hardwareengine.h
│ ├── notifications
│ │ └── notificationserver.h
│ ├── launcher
│ │ └── application.cpp
│ ├── session
│ │ └── sessionmanager.h
│ └── desktop
│ │ ├── desktopfile.h
│ │ └── desktopfiles.h
│ └── Indicators
│ ├── CMakeLists.txt
│ ├── images
│ ├── logout.svg
│ ├── reload.svg
│ ├── harddisk.svg
│ └── sleep.svg
│ ├── qmldir
│ ├── DateTimeIndicator.qml
│ ├── Indicator.qml
│ ├── NotificationsIndicator.qml
│ ├── StorageIndicator.qml
│ └── SoundIndicator.qml
├── 3rdparty
├── CMakeLists.txt
└── sigwatch
│ ├── CMakeLists.txt
│ ├── LICENSE
│ └── sigwatch.h
├── decorations
├── material.json
├── icons.qrc
├── window-maximize.svg
├── window-restore.svg
├── window-close.svg
├── CMakeLists.txt
└── window-minimize.svg
├── shell
├── metadata.desktop
├── launcher
│ ├── Dot.qml
│ ├── AppsIcon.qml
│ └── AppDrawerDelegate.qml
├── icons
│ ├── av_volume_mute.svg
│ ├── alert_warning.svg
│ ├── file_file_download.svg
│ ├── navigation_check.svg
│ ├── av_volume_down.svg
│ ├── device_signal_wifi_0_bar.svg
│ ├── communication_email.svg
│ ├── communication_message.svg
│ ├── navigation_apps.svg
│ ├── device_battery_charging_full.svg
│ ├── device_battery_20.svg
│ ├── av_volume_up.svg
│ ├── device_battery_50.svg
│ ├── device_battery_60.svg
│ ├── device_signal_wifi_1_bar.svg
│ ├── device_signal_wifi_2_bar.svg
│ ├── device_network_wifi.svg
│ ├── device_signal_wifi_3_bar.svg
│ ├── action_power_settings_new.svg
│ ├── action_account_circle.svg
│ ├── action_lock.svg
│ ├── communication_call.svg
│ ├── action_alarm.svg
│ ├── av_volume_off.svg
│ └── icons.qrc
├── main.qml
├── system
│ ├── DateTime.qml
│ └── Sound.qml
├── desktop
│ ├── Workspace.qml
│ ├── Splash.qml
│ └── Desktop.qml
├── icons.yml
├── base
│ ├── BaseDesktop.qml
│ ├── IdleDimmer.qml
│ ├── Keyboard.qml
│ ├── OutputConfiguration.qml
│ ├── WindowPreview.qml
│ ├── OutputWindow.qml
│ └── BaseOutput.qml
├── papyros.qrc
├── Compositor.qml
├── notifications
│ ├── SystemNotification.qml
│ └── SystemNotifications.qml
├── error
│ └── ErrorCompositor.qml
└── panel
│ └── AppsRow.qml
├── data
├── papyros.desktop.in
├── CMakeLists.txt
└── papyros-session.in
├── headers
├── CMakeLists.txt
├── gitsha1.h.in
├── config.h.in
└── cmakedirs.h.in
├── compositor
├── processlauncher
│ ├── io.papyros.ProcessLauncher.xml
│ └── processlauncher.h
├── sessionmanager
│ ├── powermanager
│ │ ├── powermanagerbackend.cpp
│ │ ├── upowerpowerbackend.h
│ │ ├── powermanagerbackend.h
│ │ ├── systemdpowerbackend.h
│ │ ├── powermanager.h
│ │ └── upowerpowerbackend.cpp
│ ├── screensaver
│ │ ├── org.freedesktop.ScreenSaver.xml
│ │ ├── screensaver.h
│ │ └── screensaver.cpp
│ ├── loginmanager
│ │ ├── fakebackend.h
│ │ ├── fakebackend.cpp
│ │ ├── loginmanagerbackend.cpp
│ │ ├── loginmanager.h
│ │ ├── loginmanagerbackend.h
│ │ ├── logindsessioninfo.h
│ │ ├── logindbackend.h
│ │ └── loginmanager.cpp
│ ├── authenticator.h
│ └── authenticator.cpp
├── application.h
└── CMakeLists.txt
├── scripts
└── qrc.py
├── cmake
├── FindMobileBroadbandProviderInfo.cmake
├── FindModemManager.cmake
├── FindPAM.cmake
├── FindNetworkManager.cmake
└── GetGitRevision.cmake
└── CMakeLists.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 |
--------------------------------------------------------------------------------
/modules/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(Papyros)
2 |
--------------------------------------------------------------------------------
/3rdparty/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(sigwatch)
2 |
--------------------------------------------------------------------------------
/decorations/material.json:
--------------------------------------------------------------------------------
1 | {
2 | "Keys": [ "material" ]
3 | }
4 |
--------------------------------------------------------------------------------
/shell/metadata.desktop:
--------------------------------------------------------------------------------
1 | [Shell]
2 | MainScript=Compositor.qml
3 |
--------------------------------------------------------------------------------
/3rdparty/sigwatch/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(PapyrosSigWatch STATIC sigwatch.cpp)
2 | target_link_libraries(PapyrosSigWatch Qt5::Core)
3 |
--------------------------------------------------------------------------------
/modules/Papyros/Material/qmldir:
--------------------------------------------------------------------------------
1 | module Papyros.Material
2 | plugin papyrosmaterial
3 | PlatformExtensions 0.1 PlatformExtensions.qml
4 |
--------------------------------------------------------------------------------
/modules/Papyros/Network/qmldir:
--------------------------------------------------------------------------------
1 | module Papyros.Network
2 | plugin nmplugin
3 | classname NetworkManagerPlugin
4 | typeinfo plugins.qmltypes
5 |
--------------------------------------------------------------------------------
/shell/launcher/Dot.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 |
3 | Rectangle {
4 | width: iconSize/5
5 | height: width
6 | radius: width/2
7 | }
8 |
--------------------------------------------------------------------------------
/shell/icons/av_volume_mute.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/modules/Papyros/Components/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | file(GLOB_RECURSE QML_FILES *.qml)
2 |
3 | install(FILES qmldir ${QML_FILES} DESTINATION ${QML_INSTALL_DIR}/Papyros/Components)
4 |
--------------------------------------------------------------------------------
/shell/icons/alert_warning.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/modules/Papyros/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(Components)
2 | add_subdirectory(Desktop)
3 | add_subdirectory(Indicators)
4 | add_subdirectory(Material)
5 | add_subdirectory(Network)
6 |
--------------------------------------------------------------------------------
/shell/icons/file_file_download.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/navigation_check.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/data/papyros.desktop.in:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Name=Papyros
3 | Comment=QtQuick and Wayland based desktop environment
4 | Exec=@CMAKE_INSTALL_FULL_BINDIR@/papyros-session
5 | Icon=start-here
6 | Type=Application
7 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/qmldir:
--------------------------------------------------------------------------------
1 | module Papyros.Desktop
2 |
3 | plugin papyrosdesktop
4 |
5 | ListUtils 0.1 listutils.js
6 | DateUtils 0.1 dateutils.js
7 |
8 | singleton ShellSettings 0.1 ShellSettings.qml
9 |
--------------------------------------------------------------------------------
/shell/icons/av_volume_down.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/modules/Papyros/Components/qmldir:
--------------------------------------------------------------------------------
1 | module Papyros.Components
2 | AppIcon 0.1 AppIcon.qml
3 | CrossFadeImage 0.1 CrossFadeImage.qml
4 | PagedGrid 0.1 PagedGrid.qml
5 | PanelItem 0.1 PanelItem.qml
6 | ProgressListItem 0.1 ProgressListItem.qml
7 |
--------------------------------------------------------------------------------
/headers/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Create the cmakedirs.h header file
2 | configure_file(cmakedirs.h.in ${CMAKE_CURRENT_BINARY_DIR}/cmakedirs.h)
3 |
4 | # Create the config.h header file
5 | configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
6 |
--------------------------------------------------------------------------------
/modules/Papyros/Indicators/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | file(GLOB_RECURSE QML_FILES *.qml)
2 |
3 | install(FILES qmldir ${QML_FILES} DESTINATION ${QML_INSTALL_DIR}/Papyros/Indicators)
4 | install(DIRECTORY images DESTINATION ${QML_INSTALL_DIR}/Papyros/Indicators)
5 |
--------------------------------------------------------------------------------
/shell/icons/device_signal_wifi_0_bar.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/communication_email.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/communication_message.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/navigation_apps.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/decorations/icons.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | window-close.svg
4 | window-minimize.svg
5 | window-maximize.svg
6 | window-restore.svg
7 |
8 |
9 |
--------------------------------------------------------------------------------
/shell/main.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.6
2 | import Material 0.3
3 |
4 | MainView {
5 | id: shell
6 |
7 | theme {
8 | primaryColor: "blue"
9 | accentColor: "blue"
10 | }
11 |
12 | Desktop {
13 | anchors.fill: parent
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/shell/system/DateTime.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import Material 0.3
3 |
4 | Object {
5 | property var now: new Date()
6 |
7 | Timer {
8 | interval: 1000
9 | repeat: true
10 | running: true
11 | onTriggered: now = new Date()
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/shell/icons/device_battery_charging_full.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/device_battery_20.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/av_volume_up.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/device_battery_50.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/device_battery_60.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/decorations/window-maximize.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/device_signal_wifi_1_bar.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/device_signal_wifi_2_bar.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/modules/Papyros/Material/plugin.cpp:
--------------------------------------------------------------------------------
1 | #include "plugin.h"
2 |
3 | #include "windowdecorations.h"
4 |
5 | void MaterialPlugin::registerTypes(const char *uri)
6 | {
7 | // @uri Papyros.Material
8 | Q_ASSERT(uri == QStringLiteral("Papyros.Material"));
9 |
10 | qmlRegisterType(uri, 0, 1, "WindowDecorations");
11 | }
12 |
--------------------------------------------------------------------------------
/shell/icons/device_network_wifi.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/device_signal_wifi_3_bar.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/action_power_settings_new.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/decorations/window-restore.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/action_account_circle.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/action_lock.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/communication_call.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/action_alarm.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/data/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | configure_file(papyros.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/papyros.desktop)
2 | configure_file(papyros-session.in ${CMAKE_CURRENT_BINARY_DIR}/papyros-session @ONLY)
3 |
4 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/papyros.desktop
5 | DESTINATION ${CMAKE_INSTALL_DATADIR}/wayland-sessions)
6 | install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/papyros-session
7 | DESTINATION ${BIN_INSTALL_DIR})
8 |
--------------------------------------------------------------------------------
/decorations/window-close.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/plugin.h:
--------------------------------------------------------------------------------
1 | #ifndef DESKTOP_PLUGIN_H
2 | #define DESKTOP_PLUGIN_H
3 |
4 | #include
5 | #include
6 |
7 | class DesktopPlugin : public QQmlExtensionPlugin
8 | {
9 | Q_OBJECT
10 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
11 |
12 | public:
13 | void registerTypes(const char *uri);
14 | };
15 |
16 | #endif // DESKTOP_PLUGIN_H
17 |
--------------------------------------------------------------------------------
/modules/Papyros/Material/plugin.h:
--------------------------------------------------------------------------------
1 | #ifndef MATERIAL_PLUGIN_H
2 | #define MATERIAL_PLUGIN_H
3 |
4 | #include
5 | #include
6 |
7 | class MaterialPlugin : public QQmlExtensionPlugin
8 | {
9 | Q_OBJECT
10 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
11 |
12 | public:
13 | void registerTypes(const char *uri);
14 | };
15 |
16 | #endif // MATERIAL_PLUGIN_H
17 |
--------------------------------------------------------------------------------
/modules/Papyros/Indicators/images/logout.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/icons/av_volume_off.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/desktop/Workspace.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 |
3 | Item {
4 | property alias surfacesLayer: surfacesLayer
5 |
6 | anchors.fill: parent
7 |
8 | Image {
9 | id: backgroundLayer
10 |
11 | anchors.fill: parent
12 |
13 | fillMode: Image.PreserveAspectCrop
14 | source: "file:///usr/share/wallpapers/Next/contents/images/1440x900.png"
15 | }
16 |
17 | Item {
18 | id: surfacesLayer
19 |
20 | anchors.fill: parent
21 | anchors.bottomMargin: panel.height
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/modules/Papyros/Indicators/images/reload.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shell/launcher/AppsIcon.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 |
3 | Grid {
4 | columns: 3
5 | spacing: iconSize/5
6 |
7 | property color lightColor: Qt.rgba(1,1,1,0.40)
8 | property color mediumColor: Qt.rgba(1,1,1,0.70)
9 | property color darkColor: Qt.rgba(1,1,1,1)
10 |
11 | Dot { color: lightColor }
12 | Dot { color: mediumColor }
13 | Dot { color: lightColor }
14 |
15 | Dot { color: mediumColor }
16 | Dot { color: darkColor }
17 | Dot { color: mediumColor }
18 |
19 | Dot { color: lightColor }
20 | Dot { color: mediumColor }
21 | Dot { color: lightColor }
22 | }
23 |
--------------------------------------------------------------------------------
/decorations/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SOURCES main.cpp icons.qrc)
2 |
3 | include_directories(
4 | ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
5 | ${Qt5WaylandClient_PRIVATE_INCLUDE_DIRS}
6 | )
7 |
8 | add_library(material SHARED ${SOURCES})
9 | add_library(Papyros::MaterialDecorations ALIAS material)
10 | target_link_libraries(material
11 | Qt5::Core
12 | Qt5::Gui
13 | Qt5::WaylandClient)
14 |
15 | install(TARGETS material
16 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/qt/plugins/wayland-decoration-client)
17 |
18 | message("${Qt5WaylandClient_INCLUDE_DIRS} ${Qt5WaylandClient_PRIVATE_INCLUDE_DIRS}")
19 |
--------------------------------------------------------------------------------
/modules/Papyros/Indicators/qmldir:
--------------------------------------------------------------------------------
1 | module Papyros.Indicators
2 | ActionCenterIndicator 0.1 ActionCenterIndicator.qml
3 | BatteryIndicator 0.1 BatteryIndicator.qml
4 | ConnectionListItem 0.1 ConnectionListItem.qml
5 | DateTimeIndicator 0.1 DateTimeIndicator.qml
6 | Indicator 0.1 Indicator.qml
7 | IndicatorView 0.1 IndicatorView.qml
8 | MusicPlayerListItem 0.1 MusicPlayerListItem.qml
9 | NetworkIndicator 0.1 NetworkIndicator.qml
10 | NotificationsIndicator 0.1 NotificationsIndicator.qml
11 | OperationsIndicator 0.1 OperationsIndicator.qml
12 | SoundIndicator 0.1 SoundIndicator.qml
13 | StorageIndicator 0.1 StorageIndicator.qml
14 | SystemIndicator 0.1 SystemIndicator.qml
15 |
--------------------------------------------------------------------------------
/shell/icons.yml:
--------------------------------------------------------------------------------
1 | icons:
2 | - action/account_circle
3 | - action/alarm
4 | - action/lock
5 | - action/power_settings_new
6 | - alert/warning
7 | - av/volume_down
8 | - av/volume_up
9 | - av/volume_off
10 | - av/volume_mute
11 | - communication/call
12 | - communication/email
13 | - communication/message
14 | - device/network_wifi
15 | - device/battery_charging_full
16 | - device/battery_20
17 | - device/battery_50
18 | - device/battery_60
19 | - device/signal_wifi_0_bar
20 | - device/signal_wifi_1_bar
21 | - device/signal_wifi_2_bar
22 | - device/signal_wifi_3_bar
23 | - file/file_download
24 | - navigation/apps
25 | - navigation/check
26 |
--------------------------------------------------------------------------------
/modules/Papyros/Indicators/images/harddisk.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/modules/Papyros/Material/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | file(GLOB_RECURSE SOURCES *.cpp *.h)
2 | file(GLOB_RECURSE QML_FILES *.qml)
3 |
4 | include_directories(
5 | ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
6 | ${Qt5WaylandClient_PRIVATE_INCLUDE_DIRS}
7 | )
8 |
9 | link_directories(${CMAKE_INSTALL_PREFIX}/lib/qt/plugins/wayland-decoration-client)
10 | add_library(papyrosmaterial SHARED ${SOURCES})
11 | target_link_libraries(papyrosmaterial
12 | Qt5::Core
13 | Qt5::Qml
14 | Qt5::Quick
15 | Qt5::Gui
16 | Qt5::WaylandClient
17 | Papyros::MaterialDecorations)
18 |
19 | install(FILES qmldir ${QML_FILES}
20 | DESTINATION ${QML_INSTALL_DIR}/Papyros/Material)
21 | install(TARGETS papyrosmaterial
22 | DESTINATION ${QML_INSTALL_DIR}/Papyros/Material)
23 |
--------------------------------------------------------------------------------
/modules/Papyros/Indicators/images/sleep.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/compositor/processlauncher/io.papyros.ProcessLauncher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/shell/base/BaseDesktop.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 |
3 | Item {
4 | signal wake()
5 | signal idle()
6 | signal keyPressed(var event)
7 | signal keyReleased(var event)
8 |
9 | property var insets: {
10 | 'left': 0,
11 | 'right': 0,
12 | 'top': 0,
13 | 'bottom': 0
14 | }
15 |
16 | readonly property var windows: {
17 | var windows = [];
18 |
19 | for (var i = 0; i < windowsModel.count; i++) {
20 | var window = windowsModel.get(i).window;
21 |
22 | if (window.designedOutput === output)
23 | windows.push(window);
24 | }
25 |
26 | return windows;
27 | }
28 |
29 | onInsetsChanged: updateGeometry()
30 |
31 | function updateGeometry() {
32 | output.availableGeometry = Qt.rect(
33 | output.geometry.x + insets.left,
34 | output.geometry.y + insets.top,
35 | output.geometry.width - insets.left - insets.right,
36 | output.geometry.height - insets.top - insets.bottom)
37 | console.log(output.availableGeometry, output.geometry)
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/shell/system/Sound.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import Papyros.Desktop 0.1
3 |
4 | Sound {
5 | id: sound
6 |
7 | property string iconName: sound.muted || sound.master == 0
8 | ? "av/volume_off"
9 | : sound.master <= 33 ? "av/volume_mute"
10 | : sound.master >= 67 ? "av/volume_up"
11 | : "av/volume_down"
12 |
13 | property int notificationId: 0
14 |
15 | onMasterChanged: {
16 | soundTimer.restart()
17 | }
18 |
19 | // The master volume often has random or duplicate change signals, so this helps to
20 | // smooth out the signals into only real changes
21 | Timer {
22 | id: soundTimer
23 | interval: 10
24 | onTriggered: {
25 | if (sound.master !== volume && volume !== -1) {
26 | sound.notificationId = notifyServer.notify("Sound", sound.notificationId,
27 | "icon://" + sound.iconName, "Volume changed", "", [], {}, 0,
28 | sound.master).id
29 | }
30 | volume = sound.master
31 | }
32 |
33 | property int volume: -1
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/3rdparty/sigwatch/LICENSE:
--------------------------------------------------------------------------------
1 | Unix signal watcher for Qt.
2 |
3 | Copyright (C) 2014 Simon Knopp
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/shell/launcher/AppDrawerDelegate.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import Material 0.3
3 | import Papyros.Components 0.1
4 |
5 | Item {
6 | id: appIcon
7 |
8 | Ink {
9 | anchors.fill: parent
10 | onClicked: {
11 | model.launch([])
12 | desktop.overlayLayer.currentOverlay.close()
13 | }
14 | }
15 |
16 | Column {
17 | anchors.centerIn: parent
18 | spacing: dp(8)
19 | width: parent.width - dp(16)
20 |
21 | AppIcon {
22 | anchors.horizontalCenter: parent.horizontalCenter
23 | height: dp(40)
24 | width: dp(40)
25 | iconName: model.iconName
26 | name: model.name
27 | hasIcon: model.hasIcon
28 | asynchronous: true
29 | }
30 |
31 | Label {
32 | text: model.name
33 | anchors.horizontalCenter: parent.horizontalCenter
34 | width: parent.width
35 | height: dp(30)
36 | horizontalAlignment: Text.AlignHCenter
37 | elide: Text.ElideRight
38 | wrapMode: Text.Wrap
39 | maximumLineCount: 2
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/modules/Papyros/Network/debug.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2014 Jan Grulich
3 | Copyright 2015-2016 Pier Luigi Fiorini
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) version 3, or any
9 | later version accepted by the membership of KDE e.V. (or its
10 | successor approved by the membership of KDE e.V.), which shall
11 | act as a proxy defined in Section 6 of version 3 of the license.
12 |
13 | This library is distributed in the hope that it will be useful,
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | Lesser General Public License for more details.
17 |
18 | You should have received a copy of the GNU Lesser General Public
19 | License along with this library. If not, see .
20 | */
21 |
22 | #include "debug.h"
23 |
24 | Q_LOGGING_CATEGORY(NM, "hawaii.qml.networkmanager")
25 |
--------------------------------------------------------------------------------
/modules/Papyros/Indicators/DateTimeIndicator.qml:
--------------------------------------------------------------------------------
1 | /*
2 | * Papyros Shell - The desktop shell for Papyros following Material Design
3 | * Copyright (C) 2015 Michael Spencer
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | import QtQuick 2.0
19 | import Material 0.2
20 | import Papyros.Desktop 0.1
21 |
22 | Indicator {
23 | id: indicator
24 |
25 | text: Qt.formatTime(dateTime.now)
26 | tooltip: Qt.formatDate(dateTime.now, Locale.LongFormat)
27 |
28 | view: DatePicker {
29 | frameVisible: false
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/data/papyros-session.in:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # This file is part of Hawaii.
4 | #
5 | # Copyright (C) 2013-2016 Pier Luigi Fiorini
6 | #
7 | # Author(s):
8 | # Pier Luigi Fiorini
9 | #
10 | # $BEGIN_LICENSE:GPL2+$
11 | #
12 | # This program is free software: you can redistribute it and/or modify
13 | # it under the terms of the GNU General Public License as published by
14 | # the Free Software Foundation, either version 2 of the License, or
15 | # (at your option) any later version.
16 | #
17 | # This program is distributed in the hope that it will be useful,
18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | # GNU General Public License for more details.
21 | #
22 | # You should have received a copy of the GNU General Public License
23 | # along with this program. If not, see .
24 | #
25 | # $END_LICENSE$
26 | #
27 |
28 | # Start the actual session
29 | cmd="@CMAKE_INSTALL_FULL_BINDIR@/greenisland-launcher --execute @CMAKE_INSTALL_FULL_BINDIR@/papyros-shell $@"
30 | if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
31 | exec dbus-launch --exit-with-session $cmd
32 | else
33 | exec $cmd
34 | fi
35 |
--------------------------------------------------------------------------------
/shell/base/IdleDimmer.qml:
--------------------------------------------------------------------------------
1 | Rectangle {
2 | id: blackRect
3 | parent: window.overlay
4 | anchors.fill: parent
5 | color: "black"
6 | opacity: 0.0
7 | z: 1000
8 |
9 | onOpacityChanged: {
10 | if (opacity == 1.0)
11 | output.powerState = GreenIsland.ExtendedOutput.PowerStateStandby;
12 | }
13 |
14 | OpacityAnimator {
15 | id: blackRectAnimator
16 | target: blackRect
17 | easing.type: Easing.OutSine
18 | duration: FluidUi.Units.longDuration
19 | }
20 |
21 | Timer {
22 | id: blackRectTimer
23 | interval: 1000
24 | onTriggered: {
25 | blackRectAnimator.from = 1.0;
26 | blackRectAnimator.to = 0.0;
27 | blackRectAnimator.start();
28 | }
29 | }
30 |
31 | function fadeIn() {
32 | if (blackRect.opacity == 1.0)
33 | return;
34 | blackRectAnimator.from = 0.0;
35 | blackRectAnimator.to = 1.0;
36 | blackRectAnimator.start();
37 | }
38 |
39 | function fadeOut() {
40 | if (blackRect.opacity == 0.0)
41 | return;
42 | // Use a timer to compensate for power on time
43 | blackRectTimer.start();
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/modules/Papyros/Network/enums.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Jan Grulich
3 | Copyright 2015-2016 Pier Luigi Fiorini
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) version 3, or any
9 | later version accepted by the membership of KDE e.V. (or its
10 | successor approved by the membership of KDE e.V.), which shall
11 | act as a proxy defined in Section 6 of version 3 of the license.
12 |
13 | This library is distributed in the hope that it will be useful,
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | Lesser General Public License for more details.
17 |
18 | You should have received a copy of the GNU Lesser General Public
19 | License along with this library. If not, see .
20 | */
21 |
22 | #include "enums.h"
23 |
24 | Enums::Enums(QObject* parent)
25 | : QObject(parent)
26 | {
27 | }
28 |
29 | Enums::~Enums()
30 | {
31 | }
32 |
--------------------------------------------------------------------------------
/shell/papyros.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Compositor.qml
6 | base/BaseCompositor.qml
7 | base/BaseDesktop.qml
8 | base/BaseOutput.qml
9 | base/IdleDimmer.qml
10 | base/Keyboard.qml
11 | base/OutputConfiguration.qml
12 | base/OutputWindow.qml
13 | base/WindowPreview.qml
14 | desktop/Desktop.qml
15 | desktop/Splash.qml
16 | desktop/WindowTooltip.qml
17 | desktop/Workspace.qml
18 | error/ErrorCompositor.qml
19 | launcher/AppDrawer.qml
20 | launcher/AppDrawerDelegate.qml
21 | launcher/AppsIcon.qml
22 | launcher/Dot.qml
23 | main.qml
24 | notifications/NotificationCard.qml
25 | notifications/NotificationsView.qml
26 | notifications/SystemNotification.qml
27 | notifications/SystemNotifications.qml
28 | panel/AppLauncher.qml
29 | panel/AppsRow.qml
30 | panel/Panel.qml
31 | system/DateTime.qml
32 | system/Sound.qml
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/headers/gitsha1.h.in:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2012-2015 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #undef GIT_REV
28 | #undef GIT_REV_
29 |
30 | #define STR_EXPAND(x) #x
31 | #define STR(x) STR_EXPAND(x)
32 | #define GIT_REV STR(GIT_REV_)
33 | #define GIT_REV_ \
34 |
--------------------------------------------------------------------------------
/modules/Papyros/Network/debug.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2014 Jan Grulich
3 | Copyright 2015-2016 Pier Luigi Fiorini
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) version 3, or any
9 | later version accepted by the membership of KDE e.V. (or its
10 | successor approved by the membership of KDE e.V.), which shall
11 | act as a proxy defined in Section 6 of version 3 of the license.
12 |
13 | This library is distributed in the hope that it will be useful,
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | Lesser General Public License for more details.
17 |
18 | You should have received a copy of the GNU Lesser General Public
19 | License along with this library. If not, see .
20 | */
21 |
22 | #ifndef HAWAII_NM_DEBUG_H
23 | #define HAWAII_NM_DEBUG_H
24 |
25 | #include
26 |
27 | Q_DECLARE_LOGGING_CATEGORY(NM)
28 |
29 | #endif // HAWAII_NM_DEBUG_H
30 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/powermanager/powermanagerbackend.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii Shell.
3 | *
4 | * Copyright (C) 2013-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #include "powermanagerbackend.h"
28 |
29 | PowerManagerBackend::PowerManagerBackend()
30 | {
31 | }
32 |
33 | PowerManagerBackend::~PowerManagerBackend()
34 | {
35 | }
36 |
--------------------------------------------------------------------------------
/shell/base/Keyboard.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | import QtQuick 2.5
28 | import QtQuick.Enterprise.VirtualKeyboard 1.3
29 |
30 | InputPanel {
31 | id: keyboard
32 | anchors.left: parent.left
33 | anchors.right: parent.right
34 | visible: active
35 | }
36 |
--------------------------------------------------------------------------------
/shell/Compositor.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import Material 0.3
3 | import Papyros.Desktop 0.1
4 | import Papyros.Indicators 0.1
5 | import org.kde.kcoreaddons 1.0 as KCoreAddons
6 | import "base"
7 | import "desktop"
8 | import "system"
9 |
10 | BaseCompositor {
11 | id: compositor
12 |
13 | desktopComponent: Desktop {}
14 |
15 | property list indicators: [
16 | StorageIndicator {},
17 | NetworkIndicator {},
18 | SoundIndicator {},
19 | BatteryIndicator {},
20 | SystemIndicator {}
21 | ]
22 |
23 | Connections {
24 | target: ShellSettings.desktop
25 |
26 | Component.onCompleted: updateSettings()
27 |
28 | onValueChanged: updateSettings()
29 |
30 | function updateSettings() {
31 | Theme.accentColor = Palette.colors[ShellSettings.desktop.accentColor]['500']
32 | DesktopFiles.iconTheme = ShellSettings.desktop.iconTheme
33 | }
34 | }
35 |
36 | Component.onCompleted: {
37 | Theme.primaryColor = Palette.colors['blue']['500']
38 | Theme.iconsRoot = Qt.resolvedUrl('icons')
39 | }
40 |
41 | KCoreAddons.KUser { id: currentUser }
42 | MprisConnection { id: musicPlayer }
43 | Sound { id: sound }
44 | HardwareEngine { id: hardware }
45 | NotificationServer { id: notifyServer }
46 | DateTime { id: dateTime }
47 | }
48 |
--------------------------------------------------------------------------------
/scripts/qrc.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 |
3 | # Generate a Qt Resource file from the contents of a list of directories
4 | # qrc.py ...
5 |
6 | import os
7 | import os.path
8 | import sys
9 |
10 |
11 | def create_qrc(dirname, prefix=None, basename=None):
12 | if not basename:
13 | basename = os.path.basename(dirname)
14 |
15 | file_list = []
16 |
17 | for root, dirs, files in os.walk(dirname):
18 | file_list += [os.path.relpath(os.path.join(root, filename), dirname)
19 | for filename in files]
20 |
21 | file_list.sort()
22 |
23 | contents = '\n\n\n'
24 |
25 | if prefix:
26 | contents += '\n'.format(prefix)
27 | else:
28 | contents += '\n'
29 |
30 | for filename in file_list:
31 | if (filename.endswith('.js') or filename.endswith('.qml') or
32 | filename.endswith('.otf') or filename.endswith('.ttf') or
33 | filename.endswith('.png') or
34 | filename == 'qmldir'):
35 | contents += '\t' + filename + '\n'
36 |
37 | contents += '\n\n\n'
38 |
39 | with open(os.path.join(dirname, basename + '.qrc'), 'w') as f:
40 | f.write(contents)
41 |
42 |
43 | if __name__ == '__main__':
44 | create_qrc(sys.argv[1], None, sys.argv[2])
45 |
--------------------------------------------------------------------------------
/headers/config.h.in:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2012-2015 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:LGPL2.1+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU Lesser General Public License as published by
13 | * the Free Software Foundation, either version 2.1 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU Lesser General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU Lesser General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #ifndef PAPYROS_SHELL_CONFIG_H
28 | #define PAPYROS_SHELL_CONFIG_H
29 |
30 | #define PAPYROS_SHELL_VERSION_STRING "@PROJECT_VERSION@"
31 | #cmakedefine01 DEVELOPMENT_BUILD
32 | #cmakedefine01 HAVE_SYS_PRCTL_H
33 | #cmakedefine01 HAVE_PR_SET_DUMPABLE
34 |
35 | #endif // PAPYROS_SHELL_CONFIG_H
36 |
--------------------------------------------------------------------------------
/modules/Papyros/Indicators/Indicator.qml:
--------------------------------------------------------------------------------
1 | /*
2 | * Papyros Shell - The desktop shell for Papyros following Material Design
3 | * Copyright (C) 2015 Michael Spencer
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | import QtQuick 2.0
19 | import Material 0.2
20 |
21 | Object {
22 | id: indicator
23 |
24 | property string iconName
25 | property url iconSource: "icon://" + iconName
26 | property string text
27 | property string badge
28 | property string tooltip
29 | property bool hidden: false
30 | property bool visible: true
31 | property bool userSensitive: false
32 | property color color: "transparent"
33 | property bool circleClipIcon
34 |
35 | property Component iconView
36 |
37 | property Component view
38 |
39 | signal close()
40 | }
41 |
--------------------------------------------------------------------------------
/shell/notifications/SystemNotification.qml:
--------------------------------------------------------------------------------
1 | /*
2 | * Papyros Shell - The desktop shell for Papyros following Material Design
3 | * Copyright (C) 2015 Michael Spencer
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | import QtQuick 2.0
20 | import Material 0.2
21 |
22 | Object {
23 | id: notification
24 |
25 | property int notificationId
26 |
27 | property string summary
28 | property string body
29 | property real percent
30 | property string iconName
31 | property string iconSource: "image://material/" + iconName
32 |
33 | property alias timer: __timer
34 | property alias duration: __timer.interval
35 |
36 | Timer {
37 | id: __timer
38 |
39 | running: true
40 | interval: 2000
41 |
42 | onTriggered: notifications.remove(notification)
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/headers/cmakedirs.h.in:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2012-2015 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:LGPL2.1+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU Lesser General Public License as published by
13 | * the Free Software Foundation, either version 2.1 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU Lesser General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU Lesser General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #ifndef CMAKEDIRS_H
28 | #define CMAKEDIRS_H
29 |
30 | #define INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
31 | #define INSTALL_BINDIR "@CMAKE_INSTALL_FULL_BINDIR@"
32 | #define INSTALL_DATADIR "@CMAKE_INSTALL_FULL_DATADIR@"
33 | #define INSTALL_CONFIGDIR "@KDE_INSTALL_FULL_CONFDIR@"
34 | #define INSTALL_QMLDIR "@CMAKE_INSTALL_FULL_QMLDIR@"
35 | #define INSTALL_PLUGINDIR "@CMAKE_INSTALL_FULL_PLUGINDIR@"
36 |
37 | #endif // CMAKEDIRS_H
38 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/screensaver/org.freedesktop.ScreenSaver.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/modules/Papyros/Indicators/NotificationsIndicator.qml:
--------------------------------------------------------------------------------
1 | /*
2 | * Papyros Shell - The desktop shell for Papyros following Material Design
3 | * Copyright (C) 2015 Michael Spencer
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | import QtQuick 2.0
19 | import Material 0.2
20 | import Material.ListItems 0.1 as ListItem
21 | import Papyros.Desktop 0.1
22 |
23 | Indicator {
24 | id: indicator
25 |
26 | iconName: config.silentMode ? "social/notifications_off"
27 | : hasNotifications ? "social/notifications"
28 | : "social/notifications_none"
29 |
30 | tooltip: config.silentMode ? "Notifications silenced"
31 | : hasNotifications ? "%1 notifications".arg(notificationsCount)
32 | : "No notifications"
33 |
34 | badge: notificationsCount
35 |
36 | property bool hasNotifications: badge > 0
37 | property int notificationsCount: 4
38 | }
39 |
--------------------------------------------------------------------------------
/cmake/FindMobileBroadbandProviderInfo.cmake:
--------------------------------------------------------------------------------
1 | # - Try to find mobile-broadband-provider-info
2 | # Once done this will define
3 | #
4 | # MOBILEBROADBANDPROVIDERINFO_FOUND - system has mobile-broadband-provider-info
5 | # MOBILEBROADBANDPROVIDERINFO_CFLAGS - the mobile-broadband-provider-info directory
6 |
7 | # Copyright (c) 2011, Lamarque Souza
8 | #
9 | # Redistribution and use is allowed according to the terms of the BSD license.
10 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
11 |
12 |
13 | IF (MOBILEBROADBANDPROVIDERINFO_CFLAGS)
14 | # in cache already
15 | SET(MobileBroadbandProviderInfo_FIND_QUIETLY TRUE)
16 | ENDIF (MOBILEBROADBANDPROVIDERINFO_CFLAGS)
17 |
18 | IF (NOT WIN32)
19 | # use pkg-config to get the directories and then use these values
20 | # in the FIND_PATH() and FIND_LIBRARY() calls
21 | find_package(PkgConfig)
22 | PKG_SEARCH_MODULE( MOBILEBROADBANDPROVIDERINFO mobile-broadband-provider-info )
23 | ENDIF (NOT WIN32)
24 |
25 | IF (MOBILEBROADBANDPROVIDERINFO_FOUND)
26 | IF (NOT MobileBroadbandProviderInfo_FIND_QUIETLY)
27 | MESSAGE(STATUS "Found mobile-broadband-provider-info ${MOBILEBROADBANDPROVIDERINFO_VERSION}: ${MOBILEBROADBANDPROVIDERINFO_CFLAGS}")
28 | ENDIF (NOT MobileBroadbandProviderInfo_FIND_QUIETLY)
29 | ELSE (MOBILEBROADBANDPROVIDERINFO_FOUND)
30 | IF (MobileBroadbandProviderInfo_FIND_REQUIRED)
31 | MESSAGE(FATAL_ERROR "Could NOT find mobile-broadband-provider-info, check FindPkgConfig output above!")
32 | ENDIF (MobileBroadbandProviderInfo_FIND_REQUIRED)
33 | ENDIF (MOBILEBROADBANDPROVIDERINFO_FOUND)
34 |
35 | MARK_AS_ADVANCED(MOBILEBROADBANDPROVIDERINFO_CFLAGS)
36 |
37 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/loginmanager/fakebackend.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #ifndef FAKEBACKEND_H
28 | #define FAKEBACKEND_H
29 |
30 | #include "loginmanagerbackend.h"
31 |
32 | class FakeBackend : public LoginManagerBackend
33 | {
34 | public:
35 | static FakeBackend *create();
36 |
37 | QString name() const;
38 |
39 | void setIdle(bool value);
40 |
41 | void lockSession();
42 | void unlockSession();
43 |
44 | void locked();
45 | void unlocked();
46 |
47 | void switchToVt(int index);
48 |
49 | private:
50 | FakeBackend();
51 | };
52 |
53 | #endif // FAKEBACKEND_H
54 |
--------------------------------------------------------------------------------
/shell/base/OutputConfiguration.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | import QtQuick 2.0
28 | import GreenIsland 1.0 as GreenIsland
29 |
30 | GreenIsland.OutputConfiguration {
31 | id: config
32 | onChangeRequested: {
33 | var i, changeset;
34 | for (i = 0; i < config.changes.length; i++) {
35 | changeset = config.changes[i];
36 | if (!changeset.output.nativeScreen.applyChangeset(changeset)) {
37 | changeset.output.nativeScreen.discardChangeset(changeset);
38 | config.setFailed();
39 | break;
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/mixer/alsamixer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Giulio Camuffo
3 | *
4 | * This file is part of Orbital. Originally licensed under the GPLv3, relicensed
5 | * with permission for use in Papyros.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation, either version 2.1 of the
10 | * License, or (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef ALSAMIXER_H
22 | #define ALSAMIXER_H
23 |
24 | #include
25 |
26 | #include "sound.h"
27 |
28 | class AlsaMixer : public Backend
29 | {
30 | public:
31 | ~AlsaMixer();
32 |
33 | static AlsaMixer *create(Sound *mixer);
34 |
35 | void getBoundaries(int *min, int *max) const override;
36 |
37 | int rawVol() const override;
38 | void setRawVol(int vol) override;
39 | bool muted() const override;
40 | void setMuted(bool muted) override;
41 |
42 | private:
43 | AlsaMixer(Sound *mixer);
44 |
45 | Sound *m_mixer;
46 | snd_mixer_t *m_handle;
47 | snd_mixer_selem_id_t *m_sid;
48 | snd_mixer_elem_t *m_elem;
49 | long m_min;
50 | long m_max;
51 | };
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/shell/base/WindowPreview.qml:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Green Island
3 | *
4 | * Copyright (C) 2015 Michael Spencer
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as
8 | * published by the Free Software Foundation, either version 2.1 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | import QtQuick 2.3
20 | import GreenIsland 1.0 as GreenIsland
21 |
22 | Item {
23 | property var window
24 |
25 | property real windowScale: {
26 | var widthScale = width/window.surface.size.width
27 | var heightScale = height/window.surface.size.height
28 |
29 | return Math.min(widthScale, heightScale)
30 | }
31 |
32 | implicitWidth: height * desktop.width / desktop.height
33 |
34 | function activate() {
35 | windowManager.moveFront(item)
36 | }
37 |
38 | GreenIsland.WaylandQuickItem {
39 | id: windowItem
40 |
41 | anchors.centerIn: parent
42 |
43 | width: window.surface.size.width * windowScale
44 | height: window.surface.size.height * windowScale
45 |
46 | surface: window.surface
47 | sizeFollowsSurface: false
48 | inputEventsEnabled: false
49 | view.discardFrontBuffers: true
50 | z: 0
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/decorations/window-minimize.svg:
--------------------------------------------------------------------------------
1 |
2 |
55 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/loginmanager/fakebackend.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #include "fakebackend.h"
28 |
29 | FakeBackend::FakeBackend()
30 | : LoginManagerBackend()
31 | {
32 | }
33 |
34 | QString FakeBackend::name() const
35 | {
36 | return QStringLiteral("fake");
37 | }
38 |
39 | FakeBackend *FakeBackend::create()
40 | {
41 | return new FakeBackend();
42 | }
43 |
44 | void FakeBackend::setIdle(bool value)
45 | {
46 | Q_UNUSED(value)
47 | }
48 |
49 | void FakeBackend::lockSession()
50 | {
51 | }
52 |
53 | void FakeBackend::unlockSession()
54 | {
55 | }
56 |
57 | void FakeBackend::locked()
58 | {
59 | }
60 |
61 | void FakeBackend::unlocked()
62 | {
63 | }
64 |
65 | void FakeBackend::switchToVt(int index)
66 | {
67 | Q_UNUSED(index)
68 | }
69 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/powermanager/upowerpowerbackend.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii Shell.
3 | *
4 | * Copyright (C) 2013-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #ifndef UPOWERPOWERBACKEND_H
28 | #define UPOWERPOWERBACKEND_H
29 |
30 | #include
31 |
32 | #include "powermanagerbackend.h"
33 |
34 | class UPowerPowerBackend : public PowerManagerBackend
35 | {
36 | public:
37 | UPowerPowerBackend();
38 | virtual ~UPowerPowerBackend();
39 |
40 | static QString service();
41 |
42 | QString name() const;
43 |
44 | PowerManager::Capabilities capabilities() const;
45 |
46 | void powerOff();
47 | void restart();
48 | void suspend();
49 | void hibernate();
50 | void hybridSleep();
51 |
52 | private:
53 | QDBusInterface *m_interface;
54 | };
55 |
56 | #endif // UPOWERPOWERBACKEND_H
57 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/powermanager/powermanagerbackend.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii Shell.
3 | *
4 | * Copyright (C) 2013-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #ifndef POWERMANAGERBACKEND_H
28 | #define POWERMANAGERBACKEND_H
29 |
30 | #include
31 | #include
32 |
33 | #include "powermanager.h"
34 |
35 | class PowerManagerBackend : public QObject
36 | {
37 | public:
38 | explicit PowerManagerBackend();
39 | virtual ~PowerManagerBackend();
40 |
41 | virtual QString name() const = 0;
42 |
43 | virtual PowerManager::Capabilities capabilities() const = 0;
44 |
45 | virtual void powerOff() = 0;
46 | virtual void restart() = 0;
47 | virtual void suspend() = 0;
48 | virtual void hibernate() = 0;
49 | virtual void hybridSleep() = 0;
50 | };
51 |
52 | #endif // POWERMANAGERBACKEND_H
53 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/powermanager/systemdpowerbackend.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii Shell.
3 | *
4 | * Copyright (C) 2013-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #ifndef SYSTEMDPOWERBACKEND_H
28 | #define SYSTEMDPOWERBACKEND_H
29 |
30 | #include
31 |
32 | #include "powermanagerbackend.h"
33 |
34 | class SystemdPowerBackend : public PowerManagerBackend
35 | {
36 | public:
37 | SystemdPowerBackend();
38 | virtual ~SystemdPowerBackend();
39 |
40 | static QString service();
41 |
42 | QString name() const;
43 |
44 | PowerManager::Capabilities capabilities() const;
45 |
46 | void powerOff();
47 | void restart();
48 | void suspend();
49 | void hibernate();
50 | void hybridSleep();
51 |
52 | private:
53 | QDBusInterface *m_interface;
54 | };
55 |
56 | #endif // SYSTEMDPOWERBACKEND_H
57 |
--------------------------------------------------------------------------------
/cmake/FindModemManager.cmake:
--------------------------------------------------------------------------------
1 | # - Try to find ModemManager
2 | # Once done this will define
3 | #
4 | # MODEMMANAGER_FOUND - system has ModemManager
5 | # MODEMMANAGER_INCLUDE_DIRS - the ModemManager include directories
6 | # MODEMMANAGER_LIBRARIES - the libraries needed to use ModemManager
7 | # MODEMMANAGER_CFLAGS - Compiler switches required for using ModemManager
8 | # MODEMMANAGER_VERSION - version number of ModemManager
9 |
10 | # Copyright (c) 2006, Alexander Neundorf,
11 | # Copyright (c) 2007, Will Stephenson,
12 | #
13 | # Redistribution and use is allowed according to the terms of the BSD license.
14 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
15 |
16 |
17 | IF (MODEMMANAGER_INCLUDE_DIRS)
18 | # in cache already
19 | SET(ModemManager_FIND_QUIETLY TRUE)
20 | ENDIF (MODEMMANAGER_INCLUDE_DIRS)
21 |
22 | IF (NOT WIN32)
23 | # use pkg-config to get the directories and then use these values
24 | # in the FIND_PATH() and FIND_LIBRARY() calls
25 | find_package(PkgConfig)
26 | PKG_SEARCH_MODULE( MODEMMANAGER ModemManager )
27 | ENDIF (NOT WIN32)
28 |
29 | IF (MODEMMANAGER_FOUND)
30 | IF (ModemManager_FIND_VERSION AND ("${MODEMMANAGER_VERSION}" VERSION_LESS "${ModemManager_FIND_VERSION}"))
31 | MESSAGE(FATAL_ERROR "ModemManager ${MODEMMANAGER_VERSION} is too old, need at least ${ModemManager_FIND_VERSION}")
32 | ELSEIF (NOT ModemManager_FIND_QUIETLY)
33 | MESSAGE(STATUS "Found ModemManager ${MODEMMANAGER_VERSION}: ${MODEMMANAGER_LIBRARY_DIRS}")
34 | ENDIF()
35 | ELSE (MODEMMANAGER_FOUND)
36 | IF (ModemManager_FIND_REQUIRED)
37 | MESSAGE(FATAL_ERROR "Could NOT find ModemManager, check FindPkgConfig output above!")
38 | ENDIF (ModemManager_FIND_REQUIRED)
39 | ENDIF (MODEMMANAGER_FOUND)
40 |
41 | MARK_AS_ADVANCED(MODEMMANAGER_INCLUDE_DIRS NM-UTIL_INCLUDE_DIRS)
42 |
43 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/authenticator.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #ifndef AUTHENTICATOR_H
28 | #define AUTHENTICATOR_H
29 |
30 | #include
31 |
32 | struct pam_message;
33 | struct pam_response;
34 |
35 | class Authenticator : public QObject
36 | {
37 | Q_OBJECT
38 | public:
39 | Authenticator(QObject *parent = 0);
40 | ~Authenticator();
41 |
42 | public Q_SLOTS:
43 | void authenticate(const QString &password);
44 |
45 | Q_SIGNALS:
46 | void authenticationSucceded();
47 | void authenticationFailed();
48 | void authenticationError();
49 |
50 | private:
51 | pam_response *m_response;
52 |
53 | static int conversationHandler(int num, const pam_message **message,
54 | pam_response **response, void *data);
55 | };
56 |
57 | #endif // AUTHENTICATOR_H
58 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/loginmanager/loginmanagerbackend.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #include "loginmanagerbackend.h"
28 |
29 | LoginManagerBackend::LoginManagerBackend(QObject *parent)
30 | : QObject(parent)
31 | , m_sessionControl(false)
32 | {
33 | }
34 |
35 | LoginManagerBackend::~LoginManagerBackend()
36 | {
37 | }
38 |
39 | bool LoginManagerBackend::hasSessionControl() const
40 | {
41 | return m_sessionControl;
42 | }
43 |
44 | void LoginManagerBackend::takeControl()
45 | {
46 | }
47 |
48 | void LoginManagerBackend::releaseControl()
49 | {
50 | }
51 |
52 | int LoginManagerBackend::takeDevice(const QString &path)
53 | {
54 | Q_UNUSED(path)
55 | return false;
56 | }
57 |
58 | void LoginManagerBackend::releaseDevice(int fd)
59 | {
60 | Q_UNUSED(fd)
61 | }
62 |
63 | #include "moc_loginmanagerbackend.cpp"
64 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | file(GLOB_RECURSE SOURCES *.cpp *.h)
2 | file(GLOB_RECURSE QML_SOURCES *.js *.qml)
3 |
4 | configure_file(qml/ShellSettings.qml.in ShellSettings.qml)
5 |
6 | if(ENABLE_ALSA)
7 | find_package(ALSA)
8 |
9 | if(NOT ALSA_FOUND)
10 | message(WARNING "Alsa was not found!")
11 | endif()
12 | endif()
13 | if(ENABLE_PULSEAUDIO)
14 | pkg_check_modules(PulseAudio libpulse)
15 | pkg_check_modules(PulseAudioGLib libpulse-mainloop-glib)
16 |
17 | if(NOT PulseAudio_FOUND)
18 | message(WARNING "PulseAudio was not found!")
19 | endif()
20 | endif()
21 |
22 | if(!PulseAudio_FOUND)
23 | list(REMOVE_ITEM SOURCES mixer/pulseaudiomixer.cpp)
24 | endif()
25 |
26 | if(!ALSA_FOUND)
27 | list(REMOVE_ITEM SOURCES mixer/alsamixer.cpp)
28 | endif()
29 |
30 | add_library(papyrosdesktop SHARED ${SOURCES})
31 | target_link_libraries(papyrosdesktop
32 | Qt5::Core
33 | Qt5::Qml
34 | Qt5::DBus
35 | Qt5::Quick
36 | KF5::Solid
37 | GreenIsland::Server
38 | Qt5Xdg
39 | Papyros::Core
40 | ${PAM_LIBRARIES})
41 |
42 | if(ALSA_FOUND)
43 | include_directories(${ALSA_INCLUDE_DIRS})
44 | add_definitions(-DHAVE_ALSA)
45 | target_link_libraries(papyrosdesktop ${ALSA_LIBRARIES})
46 | endif()
47 |
48 | if(PulseAudio_FOUND)
49 | include_directories(${PulseAudioGLib_INCLUDE_DIRS})
50 | add_definitions(-DHAVE_PULSEAUDIO)
51 | target_link_libraries(papyrosdesktop ${PulseAudio_LIBRARIES} ${PulseAudioGLib_LIBRARIES})
52 | endif()
53 |
54 | install(FILES qmldir ${CMAKE_CURRENT_BINARY_DIR}/ShellSettings.qml ${QML_SOURCES}
55 | DESTINATION ${QML_INSTALL_DIR}/Papyros/Desktop)
56 | install(TARGETS papyrosdesktop
57 | DESTINATION ${QML_INSTALL_DIR}/Papyros/Desktop)
58 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/qml/ShellSettings.qml.in:
--------------------------------------------------------------------------------
1 | /*
2 | * Papyros Shell - The desktop shell for Papyros following Material Design
3 | * Copyright (C) 2015 Michael Spencer
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | import QtQuick 2.0
19 | import Material 0.3
20 | import Papyros.Core 0.2
21 |
22 | pragma Singleton
23 |
24 | Object {
25 | id: settings
26 |
27 | property alias appShelf: __appShelf
28 | property alias desktop: __desktop
29 | property alias session: __session
30 |
31 | KQuickConfig {
32 | id: __appShelf
33 |
34 | file: "papyros-shell"
35 | group: "appshelf"
36 | defaults: {
37 | "transparentShelf": true
38 | }
39 | }
40 |
41 | KQuickConfig {
42 | id: __desktop
43 |
44 | file: "papyros-shell"
45 | group: "desktop"
46 | defaults: {
47 | "silentMode": false,
48 | "accentColor": "teal",
49 | "backgroundUrl": "qrc:/images/papyros-wallpaper.png",
50 | "iconTheme": "Paper"
51 | }
52 | }
53 |
54 | KQuickConfig {
55 | id: __session
56 |
57 | file: "papyros-shell"
58 | group: "session"
59 |
60 | defaults: {
61 | 'idleDelay': "60"
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/mixer/pulseaudiomixer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2014 Giulio Camuffo
3 | *
4 | * This file is part of Orbital. Originally licensed under the GPLv3, relicensed
5 | * with permission for use in Papyros.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation, either version 2.1 of the
10 | * License, or (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef PULSEAUDIOMIXER_H
22 | #define PULSEAUDIOMIXER_H
23 |
24 | #include
25 |
26 | #include "sound.h"
27 |
28 | struct pa_glib_mainloop;
29 |
30 | struct Sink;
31 |
32 | class PulseAudioMixer : public Backend
33 | {
34 | public:
35 | ~PulseAudioMixer();
36 |
37 | static PulseAudioMixer *create(Sound *sound);
38 |
39 | void getBoundaries(int *min, int *max) const override;
40 |
41 | int rawVol() const override;
42 | void setRawVol(int vol) override;
43 | bool muted() const override;
44 | void setMuted(bool muted) override;
45 |
46 | private:
47 | PulseAudioMixer(Sound *sound);
48 |
49 | void contextStateCallback(pa_context *c);
50 | void subscribeCallback(pa_context *c, pa_subscription_event_type_t t, uint32_t index);
51 | void sinkCallback(pa_context *c, const pa_sink_info *i, int eol);
52 | void cleanup();
53 |
54 | Sound *m_mixer;
55 | pa_glib_mainloop *m_mainLoop;
56 | pa_mainloop_api *m_mainloopApi;
57 | pa_context *m_context;
58 | Sink *m_sink;
59 | };
60 |
61 | #endif
62 |
--------------------------------------------------------------------------------
/shell/icons/icons.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | communication_call.svg
6 | communication_email.svg
7 | communication_message.svg
8 |
9 |
10 |
11 | alert_warning.svg
12 |
13 |
14 |
15 | device_network_wifi.svg
16 | device_battery_charging_full.svg
17 | device_battery_20.svg
18 | device_battery_50.svg
19 | device_battery_60.svg
20 | device_signal_wifi_0_bar.svg
21 | device_signal_wifi_1_bar.svg
22 | device_signal_wifi_2_bar.svg
23 | device_signal_wifi_3_bar.svg
24 |
25 |
26 |
27 | file_file_download.svg
28 |
29 |
30 |
31 | av_volume_down.svg
32 | av_volume_up.svg
33 | av_volume_off.svg
34 | av_volume_mute.svg
35 |
36 |
37 |
38 | action_account_circle.svg
39 | action_alarm.svg
40 | action_lock.svg
41 | action_power_settings_new.svg
42 |
43 |
44 |
45 | navigation_apps.svg
46 | navigation_check.svg
47 |
48 |
49 |
--------------------------------------------------------------------------------
/shell/error/ErrorCompositor.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import Material 0.3
3 | import "../base"
4 |
5 | BaseCompositor {
6 | desktopComponent: BaseDesktop {
7 | function dp(dp) {
8 | return dp * Units.dp
9 | }
10 |
11 | Rectangle {
12 | anchors.fill: parent
13 | color: "#2196f3"
14 | }
15 |
16 | Wave {
17 | id: wave
18 | color:"#f44336"
19 | }
20 |
21 | Column {
22 | id: errorView
23 |
24 | anchors.centerIn: parent
25 | width: parent.width * 0.7
26 |
27 | opacity: wave.opened ? 1 : 0
28 |
29 | Behavior on opacity {
30 | NumberAnimation { duration: 500 }
31 | }
32 |
33 | Icon {
34 | size: dp(100)
35 | name: "alert/warning"
36 | color: "white"
37 |
38 | anchors.horizontalCenter: parent.horizontalCenter
39 | }
40 |
41 | Item {
42 | width: parent.width
43 | height: dp(20)
44 | }
45 |
46 | Label {
47 | anchors.horizontalCenter: parent.horizontalCenter
48 | style: "display1"
49 | text: "Oh no! "
50 | color: "white"
51 | }
52 |
53 | Item {
54 | width: parent.width
55 | height: dp(20)
56 | }
57 |
58 | Label {
59 | anchors.horizontalCenter: parent.horizontalCenter
60 |
61 | horizontalAlignment: Text.AlignHCenter
62 | width: parent.width
63 | wrapMode: Text.Wrap
64 |
65 | style: "title"
66 | color: "white"
67 |
68 | text: "The desktop failed to materialize"
69 | }
70 | }
71 |
72 | Timer {
73 | interval: 100
74 | running: true
75 | onTriggered: wave.open(width/2, height/2)
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/shell/desktop/Splash.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import Material 0.3
3 |
4 | Item {
5 | anchors.fill: parent
6 |
7 | function show() {
8 | background.open(width/2, height/2)
9 | }
10 |
11 | function hide() {
12 | background.close(width/2, height/2)
13 | }
14 |
15 | Wave {
16 | id: background
17 |
18 | color: "#2196f3"
19 | size: diameter
20 | }
21 |
22 | Column {
23 | id: welcomeView
24 |
25 | anchors.centerIn: parent
26 |
27 | opacity: desktop.state == "splash" ? 1 : 0
28 | spacing: dp(15)
29 |
30 | Behavior on opacity {
31 | NumberAnimation { duration: 300 }
32 | }
33 |
34 | populate: Transition {
35 | id: populateTransition
36 | SequentialAnimation {
37 | PropertyAction {
38 | property: "opacity"; value: 0
39 | }
40 |
41 | PauseAnimation {
42 | duration: (populateTransition.ViewTransition.index -
43 | populateTransition.ViewTransition.targetIndexes[0]) * 250 + 100
44 | }
45 |
46 | ParallelAnimation {
47 | NumberAnimation {
48 | property: "opacity"; duration: 250
49 | from: 0; to: 1
50 | }
51 |
52 | NumberAnimation {
53 | property: "y"; duration: 250
54 | from: populateTransition.ViewTransition.destination.y + dp(50);
55 | easing.type: Easing.OutQuad
56 | }
57 | }
58 | }
59 | }
60 |
61 | ProgressCircle {
62 | color: "white"
63 | anchors.horizontalCenter: parent.horizontalCenter
64 | }
65 |
66 | Label {
67 | anchors.horizontalCenter: parent.horizontalCenter
68 |
69 | style: "display1"
70 | text: "Welcome"
71 | color: "white"
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/3rdparty/sigwatch/sigwatch.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Unix signal watcher for Qt.
3 | *
4 | * Copyright (C) 2014 Simon Knopp
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | #ifndef SIGWATCH_H
26 | #define SIGWATCH_H
27 |
28 | #include
29 | #include
30 |
31 | class UnixSignalWatcherPrivate;
32 |
33 |
34 | /*!
35 | * \brief The UnixSignalWatcher class converts Unix signals to Qt signals.
36 | *
37 | * To watch for a given signal, e.g. \c SIGINT, call \c watchForSignal(SIGINT)
38 | * and \c connect() your handler to unixSignal().
39 | */
40 |
41 | class UnixSignalWatcher : public QObject
42 | {
43 | Q_OBJECT
44 | public:
45 | explicit UnixSignalWatcher(QObject *parent = 0);
46 | ~UnixSignalWatcher();
47 |
48 | void watchForSignal(int signal);
49 |
50 | signals:
51 | void unixSignal(int signal);
52 |
53 | private:
54 | UnixSignalWatcherPrivate * const d_ptr;
55 | Q_DECLARE_PRIVATE(UnixSignalWatcher)
56 | Q_PRIVATE_SLOT(d_func(), void _q_onNotify(int))
57 | };
58 |
59 | #endif // SIGWATCH_H
60 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/screensaver/screensaver.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2014-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #ifndef SCREENSAVER_H
28 | #define SCREENSAVER_H
29 |
30 | #include
31 | #include
32 |
33 | Q_DECLARE_LOGGING_CATEGORY(SCREENSAVER)
34 |
35 | class SessionManager;
36 |
37 | class ScreenSaver : public QObject
38 | {
39 | Q_OBJECT
40 | public:
41 | ScreenSaver(QObject *parent = Q_NULLPTR);
42 | ~ScreenSaver();
43 |
44 | bool GetActive();
45 | bool SetActive(bool state);
46 |
47 | uint GetActiveTime();
48 | uint GetSessionIdleTime();
49 |
50 | void SimulateUserActivity();
51 |
52 | uint Inhibit(const QString &appName, const QString &reason);
53 | void UnInhibit(uint cookie);
54 |
55 | void Lock();
56 |
57 | uint Throttle(const QString &appName, const QString &reason);
58 | void UnThrottle(uint cookie);
59 |
60 | Q_SIGNALS:
61 | void ActiveChanged(bool in);
62 |
63 | private:
64 | bool m_active;
65 | SessionManager *m_sessionManager;
66 | };
67 |
68 | #endif // SCREENSAVER_H
69 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/loginmanager/loginmanager.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #ifndef LOGINMANAGER_H
28 | #define LOGINMANAGER_H
29 |
30 | #include
31 | #include
32 |
33 | #include "loginmanagerbackend.h"
34 |
35 | Q_DECLARE_LOGGING_CATEGORY(LOGINMANAGER)
36 |
37 | class SessionManager;
38 |
39 | class LoginManager : public QObject
40 | {
41 | Q_OBJECT
42 | public:
43 | LoginManager(SessionManager *sm, QObject *parent = 0);
44 | ~LoginManager();
45 |
46 | void setIdle(bool value);
47 |
48 | void takeControl();
49 | void releaseControl();
50 |
51 | int takeDevice(const QString &path);
52 | void releaseDevice(int fd);
53 |
54 | void lockSession();
55 | void unlockSession();
56 |
57 | void switchToVt(int index);
58 |
59 | public Q_SLOTS:
60 | void locked();
61 | void unlocked();
62 |
63 | Q_SIGNALS:
64 | void logOutRequested();
65 | void sessionLocked();
66 | void sessionUnlocked();
67 |
68 | private:
69 | LoginManagerBackend *m_backend;
70 | };
71 |
72 | #endif // LOGINMANAGER_H
73 |
--------------------------------------------------------------------------------
/cmake/FindPAM.cmake:
--------------------------------------------------------------------------------
1 | # - Try to find the PAM libraries
2 | # Once done this will define
3 | #
4 | # PAM_FOUND - system has pam
5 | # PAM_INCLUDE_DIR - the pam include directory
6 | # PAM_LIBRARIES - libpam library
7 |
8 | if (PAM_INCLUDE_DIR AND PAM_LIBRARY)
9 | # Already in cache, be silent
10 | set(PAM_FIND_QUIETLY TRUE)
11 | endif (PAM_INCLUDE_DIR AND PAM_LIBRARY)
12 |
13 | find_path(PAM_INCLUDE_DIR NAMES security/pam_appl.h pam/pam_appl.h)
14 | find_library(PAM_LIBRARY pam)
15 | find_library(DL_LIBRARY dl)
16 |
17 | if (PAM_INCLUDE_DIR AND PAM_LIBRARY)
18 | set(PAM_FOUND TRUE)
19 | if (DL_LIBRARY)
20 | set(PAM_LIBRARIES ${PAM_LIBRARY} ${DL_LIBRARY})
21 | else (DL_LIBRARY)
22 | set(PAM_LIBRARIES ${PAM_LIBRARY})
23 | endif (DL_LIBRARY)
24 |
25 | if (EXISTS ${PAM_INCLUDE_DIR}/pam/pam_appl.h)
26 | # darwin claims to be something special
27 | set(HAVE_PAM_PAM_APPL_H 1)
28 | endif (EXISTS ${PAM_INCLUDE_DIR}/pam/pam_appl.h)
29 |
30 | if (NOT DEFINED PAM_MESSAGE_CONST)
31 | include(CheckCXXSourceCompiles)
32 | # XXX does this work with plain c?
33 | check_cxx_source_compiles("
34 | #if ${HAVE_PAM_PAM_APPL_H}+0
35 | # include
36 | #else
37 | # include
38 | #endif
39 |
40 | static int PAM_conv(
41 | int num_msg,
42 | const struct pam_message **msg, /* this is the culprit */
43 | struct pam_response **resp,
44 | void *ctx)
45 | {
46 | return 0;
47 | }
48 |
49 | int main(void)
50 | {
51 | struct pam_conv PAM_conversation = {
52 | &PAM_conv, /* this bombs out if the above does not match */
53 | 0
54 | };
55 |
56 | return 0;
57 | }
58 | " PAM_MESSAGE_CONST)
59 | endif (NOT DEFINED PAM_MESSAGE_CONST)
60 | set(PAM_MESSAGE_CONST ${PAM_MESSAGE_CONST} CACHE BOOL "PAM expects a conversation function with const pam_message")
61 |
62 | endif (PAM_INCLUDE_DIR AND PAM_LIBRARY)
63 |
64 | if (PAM_FOUND)
65 | if (NOT PAM_FIND_QUIETLY)
66 | message(STATUS "Found PAM: ${PAM_LIBRARIES}")
67 | endif (NOT PAM_FIND_QUIETLY)
68 | else (PAM_FOUND)
69 | if (PAM_FIND_REQUIRED)
70 | message(FATAL_ERROR "PAM was not found")
71 | endif(PAM_FIND_REQUIRED)
72 | endif (PAM_FOUND)
73 |
74 | mark_as_advanced(PAM_INCLUDE_DIR PAM_LIBRARY DL_LIBRARY PAM_MESSAGE_CONST)
--------------------------------------------------------------------------------
/compositor/application.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2012-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #ifndef APPLICATION_H
28 | #define APPLICATION_H
29 |
30 | #include
31 |
32 | #include
33 |
34 | using namespace GreenIsland::Server;
35 |
36 | class ProcessLauncher;
37 | class ScreenSaver;
38 | class SessionManager;
39 |
40 | class Application : public QObject
41 | {
42 | Q_OBJECT
43 | public:
44 | Application(QObject *parent = Q_NULLPTR);
45 |
46 | void setScreenConfiguration(const QString &fakeScreenData);
47 | void setUrl(const QUrl &url);
48 |
49 | protected:
50 | void customEvent(QEvent *event) Q_DECL_OVERRIDE;
51 |
52 | private:
53 | QUrl m_url;
54 | HomeApplication *m_homeApp;
55 | ProcessLauncher *m_launcher;
56 | SessionManager *m_sessionManager;
57 | bool m_failSafe;
58 | bool m_started;
59 |
60 | private Q_SLOTS:
61 | void startup();
62 | void shutdown();
63 | void unixSignal();
64 | void objectCreated(QObject *object, const QUrl &);
65 | };
66 |
67 | class StartupEvent : public QEvent
68 | {
69 | public:
70 | StartupEvent();
71 | };
72 |
73 | #endif // APPLICATION_H
74 |
--------------------------------------------------------------------------------
/modules/Papyros/Components/PagedGrid.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 |
3 | Item {
4 | id: pagedGrid
5 |
6 | property var model
7 |
8 | property int rows
9 | property int columns
10 |
11 | property Component delegate
12 |
13 | readonly property var count: model.rowCount()
14 |
15 | readonly property int pageCount: rows * columns
16 | readonly property alias pages: pageView.count
17 | property alias currentPage: pageView.currentIndex
18 |
19 | // Scroll through pages using the mouse weel
20 | MouseArea {
21 | anchors.fill: parent
22 | propagateComposedEvents: true
23 |
24 | onWheel: {
25 | if (wheel.angleDelta.y > 0)
26 | pageView.decrementCurrentIndex();
27 | else
28 | pageView.incrementCurrentIndex();
29 | }
30 | }
31 |
32 | ListView {
33 | id: pageView
34 |
35 | anchors.fill: parent
36 |
37 | orientation: Qt.Horizontal
38 | snapMode: ListView.SnapOneItem
39 | highlightFollowsCurrentItem: true
40 | highlightRangeMode: ListView.StrictlyEnforceRange
41 | highlightMoveDuration: 500
42 | currentIndex: 0
43 |
44 | model: Math.ceil(pagedGrid.count/pageCount)
45 |
46 | delegate: Grid {
47 | id: page
48 |
49 | readonly property int pageIndex: index
50 |
51 | width: pagedGrid.width
52 | height: pagedGrid.height
53 |
54 | columns: pagedGrid.columns
55 |
56 | Repeater {
57 | model: pageIndex == pageView.count - 1
58 | ? pagedGrid.count % pagedGrid.pageCount
59 | : pagedGrid.pageCount
60 |
61 | delegate: Loader {
62 | width: pagedGrid.width/pagedGrid.rows
63 | height: pagedGrid.height/pagedGrid.columns
64 |
65 | sourceComponent: pagedGrid.delegate
66 |
67 | readonly property int pageIndex: page.pageIndex
68 |
69 | readonly property var model: pagedGrid.model.get(index + pageIndex * pagedGrid.pageCount)
70 | }
71 | }
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/plugin.cpp:
--------------------------------------------------------------------------------
1 | #include "plugin.h"
2 |
3 | #include "mpris/mprisconnection.h"
4 | #include "mpris/mpris2player.h"
5 |
6 | #include "notifications/notification.h"
7 | #include "notifications/notificationserver.h"
8 |
9 | #include "mixer/sound.h"
10 |
11 | #include "desktop/desktopfile.h"
12 | #include "desktop/desktopfiles.h"
13 |
14 | #include "hardware/hardwareengine.h"
15 |
16 | #include "launcher/application.h"
17 | #include "launcher/launchermodel.h"
18 |
19 | #include "session/sessionmanager.h"
20 |
21 | void DesktopPlugin::registerTypes(const char *uri)
22 | {
23 | // @uri Papyros.Desktop
24 | Q_ASSERT(uri == QStringLiteral("Papyros.Desktop"));
25 |
26 | qmlRegisterType(uri, 0, 1, "MprisConnection");
27 | qmlRegisterUncreatableType(uri, 0, 1, "Mpris2Player", "Player class");
28 |
29 | qmlRegisterType(uri, 0, 1, "NotificationServer");
30 | qmlRegisterUncreatableType(uri, 0, 1, "Notification",
31 | "A notification from NotificationServer");
32 |
33 | qmlRegisterType(uri, 0, 1, "Sound");
34 |
35 | qmlRegisterType(uri, 0, 1, "DesktopFile");
36 | qmlRegisterSingletonType(uri, 0, 1, "DesktopFiles", DesktopFiles::qmlSingleton);
37 | qmlRegisterUncreatableType(uri, 0, 1, "Application",
38 | "Applications are managed by the launcher model");
39 | qmlRegisterType(uri, 0, 1, "LauncherModel");
40 |
41 | // Hardware (battery and storage)
42 |
43 | qmlRegisterType(uri, 0, 1, "HardwareEngine");
44 | qmlRegisterUncreatableType(uri, 0, 1, "Battery",
45 | QStringLiteral("Cannot create Battery object"));
46 | qmlRegisterUncreatableType(uri, 0, 1, "StorageDevice",
47 | QStringLiteral("Cannot create StorageDevice object"));
48 |
49 | // Session management
50 |
51 | qmlRegisterSingletonType(uri, 0, 1, "SessionManager",
52 | SessionManager::qmlSingleton);
53 | }
54 |
--------------------------------------------------------------------------------
/compositor/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | find_package(PAM REQUIRED)
2 |
3 | include_directories(
4 | ${CMAKE_SOURCE_DIR}/headers
5 | ${CMAKE_BINARY_DIR}/headers
6 | ${CMAKE_SOURCE_DIR}/3rdparty
7 | ${CMAKE_CURRENT_BINARY_DIR}/sessionmanager/screensaver
8 | )
9 |
10 | set(SOURCES
11 | application.cpp
12 | main.cpp
13 | processlauncher/processlauncher.cpp
14 | sessionmanager/authenticator.cpp
15 | sessionmanager/sessionmanager.cpp
16 | sessionmanager/loginmanager/loginmanager.cpp
17 | sessionmanager/loginmanager/loginmanagerbackend.cpp
18 | sessionmanager/loginmanager/logindbackend.cpp
19 | sessionmanager/loginmanager/fakebackend.cpp
20 | sessionmanager/powermanager/powermanager.cpp
21 | sessionmanager/powermanager/powermanager.h
22 | sessionmanager/powermanager/powermanagerbackend.cpp
23 | sessionmanager/powermanager/powermanagerbackend.h
24 | sessionmanager/powermanager/systemdpowerbackend.cpp
25 | sessionmanager/powermanager/systemdpowerbackend.h
26 | sessionmanager/powermanager/upowerpowerbackend.cpp
27 | sessionmanager/powermanager/upowerpowerbackend.h
28 | sessionmanager/screensaver/screensaver.cpp
29 | )
30 |
31 | qt5_add_dbus_adaptor(SOURCES processlauncher/io.papyros.ProcessLauncher.xml
32 | processlauncher/processlauncher.h ProcessLauncher
33 | processlauncheradaptor ProcessLauncherAdaptor)
34 | qt5_add_dbus_adaptor(SOURCES sessionmanager/screensaver/org.freedesktop.ScreenSaver.xml
35 | sessionmanager/screensaver/screensaver.h ScreenSaver
36 | sessionmanager/screensaver/screensaveradaptor ScreenSaverAdaptor)
37 |
38 | qt5_add_resources(RESOURCES ${CMAKE_SOURCE_DIR}/shell/papyros.qrc ${CMAKE_SOURCE_DIR}/shell/icons/icons.qrc)
39 |
40 | add_executable(papyros-shell ${SOURCES} ${RESOURCES})
41 | target_link_libraries(papyros-shell
42 | Qt5::Core
43 | Qt5::DBus
44 | Qt5::Gui
45 | Qt5::Widgets
46 | GreenIsland::Server
47 | PapyrosSigWatch
48 | Qt5Xdg
49 | ${PAM_LIBRARIES}
50 | )
51 |
52 | # Git revision
53 | include(GetGitRevision)
54 | create_git_head_revision_file(gitsha1.h papyros-shell)
55 |
56 | install(TARGETS papyros-shell DESTINATION ${BIN_INSTALL_DIR})
57 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/mixer/sound.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Giulio Camuffo
3 | *
4 | * This file is part of Orbital. Originally licensed under the GPLv3, relicensed
5 | * with permission for use in Papyros.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation, either version 2.1 of the
10 | * License, or (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef VOLUMECONTROL_H
22 | #define VOLUMECONTROL_H
23 |
24 | #include
25 |
26 |
27 | class Backend
28 | {
29 | public:
30 | virtual ~Backend() {}
31 |
32 | virtual void getBoundaries(int *min, int *max) const = 0;
33 | virtual int rawVol() const = 0;
34 | virtual void setRawVol(int vol) = 0;
35 | virtual bool muted() const = 0;
36 | virtual void setMuted(bool muted) = 0;
37 | };
38 |
39 | class Sound : public QQuickItem
40 | {
41 | Q_OBJECT
42 |
43 | Q_PROPERTY(int master READ master WRITE setMaster NOTIFY masterChanged)
44 | Q_PROPERTY(bool muted READ muted WRITE setMuted NOTIFY mutedChanged)
45 |
46 | public:
47 | Sound(QQuickItem *parent = 0);
48 | ~Sound();
49 |
50 | void init();
51 |
52 | int master() const;
53 | bool muted() const;
54 | void setMuted(bool muted);
55 |
56 | public slots:
57 | void increaseMaster();
58 | void decreaseMaster();
59 | void setMaster(int master);
60 | void changeMaster(int change);
61 | void toggleMuted();
62 |
63 | signals:
64 | void masterChanged();
65 | void mutedChanged();
66 | void bindingTriggered();
67 |
68 | private:
69 | int m_min;
70 | int m_max;
71 | int m_step;
72 |
73 | Backend *m_backend;
74 | };
75 |
76 | #endif
77 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/loginmanager/loginmanagerbackend.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #ifndef LOGINMANAGERBACKEND_H
28 | #define LOGINMANAGERBACKEND_H
29 |
30 | #include
31 |
32 | class LoginManagerBackend : public QObject
33 | {
34 | Q_OBJECT
35 | public:
36 | LoginManagerBackend(QObject *parent = 0);
37 | virtual ~LoginManagerBackend();
38 |
39 | virtual QString name() const = 0;
40 |
41 | bool hasSessionControl() const;
42 |
43 | virtual void setIdle(bool value) = 0;
44 |
45 | virtual void takeControl();
46 | virtual void releaseControl();
47 |
48 | virtual int takeDevice(const QString &path);
49 | virtual void releaseDevice(int fd);
50 |
51 | virtual void lockSession() = 0;
52 | virtual void unlockSession() = 0;
53 |
54 | virtual void locked() = 0;
55 | virtual void unlocked() = 0;
56 |
57 | virtual void switchToVt(int index) = 0;
58 |
59 | Q_SIGNALS:
60 | void logOutRequested();
61 | void sessionControlChanged(bool value);
62 | void sessionLocked();
63 | void sessionUnlocked();
64 |
65 | protected:
66 | bool m_sessionControl;
67 | };
68 |
69 | #endif // LOGINMANAGERBACKEND_H
70 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/mpris/mprisconnection.h:
--------------------------------------------------------------------------------
1 | /*
2 | * QML Desktop - Set of tools written in C++ for QML
3 | *
4 | * Copyright (C) 2014 Bogdan Cuza
5 | * 2014 Ricardo Vieira
6 | * 2015 Michael Spencer
7 | *
8 | * This program is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as
10 | * published by the Free Software Foundation, either version 2.1 of the
11 | * License, or (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public License
19 | * along with this program. If not, see .
20 | */
21 |
22 | #ifndef MPRISCONNECTION_H
23 | #define MPRISCONNECTION_H
24 |
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include "mpris2player.h"
31 | #include
32 |
33 | class MprisConnection : public QQuickItem
34 | {
35 | Q_OBJECT
36 | Q_DISABLE_COPY(MprisConnection)
37 |
38 | Q_PROPERTY(QQmlListProperty playerList READ getPlayerList NOTIFY playerListChanged)
39 |
40 | public:
41 | MprisConnection(QQuickItem *parent = 0);
42 | ~MprisConnection();
43 |
44 | QQmlListProperty getPlayerList() {
45 | return QQmlListProperty(this, playerList);
46 | }
47 |
48 | public slots:
49 | void serviceOwnerChanged(const QString &serviceName,
50 | const QString &oldOwner,
51 | const QString &newOwner);
52 |
53 | signals:
54 | QQmlListProperty playerListChanged(QQmlListProperty playerList);
55 |
56 |
57 | private:
58 | QDBusServiceWatcher *watcher;
59 | QList playerList;
60 |
61 | };
62 |
63 | #endif // MPRISCONNECTION_H
64 |
--------------------------------------------------------------------------------
/modules/Papyros/Network/enums.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Jan Grulich
3 | Copyright 2015-2016 Pier Luigi Fiorini
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) version 3, or any
9 | later version accepted by the membership of KDE e.V. (or its
10 | successor approved by the membership of KDE e.V.), which shall
11 | act as a proxy defined in Section 6 of version 3 of the license.
12 |
13 | This library is distributed in the hope that it will be useful,
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | Lesser General Public License for more details.
17 |
18 | You should have received a copy of the GNU Lesser General Public
19 | License along with this library. If not, see .
20 | */
21 |
22 | #ifndef HAWAII_NM_ENUMS_H
23 | #define HAWAII_NM_ENUMS_H
24 |
25 | #include
26 |
27 | class Enums : public QObject
28 | {
29 | Q_OBJECT
30 | Q_ENUMS(ConnectionStatus)
31 | Q_ENUMS(ConnectionType)
32 | Q_ENUMS(SecurityType)
33 |
34 | public:
35 | explicit Enums(QObject* parent = 0);
36 | virtual ~Enums();
37 |
38 | enum ConnectionStatus {
39 | UnknownState = 0,
40 | Activating,
41 | Activated,
42 | Deactivating,
43 | Deactivated
44 | };
45 |
46 | enum ConnectionType {
47 | UnknownConnectionType = 0,
48 | Adsl,
49 | Bluetooth,
50 | Bond,
51 | Bridge,
52 | Cdma,
53 | Gsm,
54 | Infiniband,
55 | OLPCMesh,
56 | Pppoe,
57 | Vlan,
58 | Vpn,
59 | Wimax,
60 | Wired,
61 | Wireless
62 | };
63 |
64 | enum SecurityType {
65 | UnknownSecurity = -1,
66 | NoneSecurity = 0,
67 | StaticWep,
68 | DynamicWep,
69 | Leap,
70 | WpaPsk,
71 | WpaEap,
72 | Wpa2Psk,
73 | Wpa2Eap
74 | };
75 | };
76 |
77 | #endif // HAWAII_NM_ENUMS_H
78 |
--------------------------------------------------------------------------------
/modules/Papyros/Indicators/StorageIndicator.qml:
--------------------------------------------------------------------------------
1 | /*
2 | * Papyros Shell - The desktop shell for Papyros following Material Design
3 | * Copyright (C) 2015 Michael Spencer
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | import QtQuick 2.0
19 | import Material 0.2
20 | import Material.ListItems 0.1 as ListItem
21 | import Papyros.Desktop 0.1
22 |
23 | Indicator {
24 | id: indicator
25 |
26 | iconSource: Qt.resolvedUrl("images/harddisk.svg")
27 | tooltip: qsTr("%1 storage devices").arg(deviceCount)
28 | visible: deviceCount > 0
29 | userSensitive: true
30 |
31 | property int deviceCount: ListUtils.filteredCount(hardware.storageDevices, function(device) {
32 | return !device.ignored
33 | })
34 |
35 | view: Column {
36 |
37 | Repeater {
38 | model: hardware.storageDevices
39 | delegate: ListItem.Standard {
40 | text: modelData.name
41 | visible: !modelData.ignored
42 |
43 | iconSource: {
44 | if (modelData.iconName.indexOf("harddisk") !== -1) {
45 | return Qt.resolvedUrl("images/harddisk.svg")
46 | } else if (modelData.iconName.indexOf("usb") !== -1) {
47 | return "icon://device/usb"
48 | } else {
49 | return Qt.resolvedUrl("images/harddisk.svg")
50 | }
51 | }
52 |
53 | onClicked: {
54 | Qt.openUrlExternally(modelData.filePath)
55 | indicator.close()
56 | }
57 | }
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/modules/Papyros/Material/PlatformExtensions.qml:
--------------------------------------------------------------------------------
1 | /*
2 | * Papyros Shell - The desktop shell for Papyros following Material Design
3 | * Copyright (C) 2015 Michael Spencer
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | import QtQuick 2.0
19 | import Material 0.2
20 | import Papyros.Material 0.1
21 | import Papyros.Desktop 0.1
22 |
23 | Object {
24 | id: platformExtensions
25 |
26 | property color decorationColor: Theme.primaryDarkColor
27 | property var window: null
28 |
29 | readonly property real multiplier: Number(displaySettings.multiplier)
30 |
31 | Component.onCompleted: {
32 | if (decorationColor != "#000000")
33 | updateDecorationColor()
34 | }
35 |
36 | onDecorationColorChanged: {
37 | if (decorationColor != "#000000") {
38 | updateDecorationColor();
39 | }
40 | }
41 |
42 | function updateDecorationColor() {
43 | decorations.backgroundColor = decorationColor
44 | decorations.iconColor = Theme.lightDark(decorationColor, Theme.light.subTextColor,
45 | Theme.dark.subTextColor)
46 | decorations.textColor = Theme.lightDark(decorationColor, Theme.light.textColor,
47 | Theme.dark.textColor)
48 | decorations.update()
49 | }
50 |
51 | KQuickConfig {
52 | id: displaySettings
53 |
54 | file: "papyros-shell"
55 | group: "display"
56 | defaults: {
57 | "multiplier": "1.0"
58 | }
59 | }
60 |
61 | WindowDecorations {
62 | id: decorations
63 | window: platformExtensions.window
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/shell/desktop/Desktop.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import Material 0.3
3 | import "../base"
4 | import "../panel"
5 | import "../notifications"
6 |
7 | BaseDesktop {
8 | id: desktop
9 |
10 | property alias surfacesArea: workspace.surfacesLayer
11 | property alias overlayLayer: desktopOverlayLayer
12 |
13 | property bool hasFullscreenWindow: {
14 | for (var i = 0; i < windows.length; i++) {
15 | var window = windows[i]
16 |
17 | if (window.maximized)
18 | return true
19 | }
20 |
21 | return false
22 | }
23 |
24 | insets: {
25 | 'left': 0,
26 | 'right': 0,
27 | 'top': 0,
28 | 'bottom': panel.height
29 | }
30 |
31 | state: 'splash'
32 |
33 | onStateChanged: {
34 | if (state != 'splash') {
35 | splash.hide()
36 | }
37 | }
38 |
39 | function dp(dp) {
40 | return dp * Units.dp
41 | }
42 |
43 | function updateTooltip(item, containsMouse) {
44 | if (containsMouse) {
45 | if (item.tooltip) {
46 | tooltip.text = Qt.binding(function() { return item.tooltip })
47 | tooltip.open(item, 0, dp(16))
48 | }
49 | } else if (tooltip.showing) {
50 | tooltip.close()
51 | }
52 | }
53 |
54 | Tooltip {
55 | id: tooltip
56 | overlayLayer: "desktopTooltipOverlayLayer"
57 | }
58 |
59 | Workspace { id: workspace }
60 |
61 | NotificationsView { id: notificationsView }
62 |
63 | OverlayLayer {
64 | id: desktopOverlayLayer
65 | objectName: "desktopOverlayLayer"
66 |
67 | // FIXME: shell
68 | // onCurrentOverlayChanged: {
69 | // if (currentOverlay && shell.state !== "default" && shell.state !== "locked")
70 | // shell.state = "default"
71 | // }
72 | }
73 |
74 | OverlayLayer {
75 | id: tooltipOverlayLayer
76 | objectName: "desktopTooltipOverlayLayer"
77 | enabled: desktopOverlayLayer.currentOverlay == null
78 | }
79 |
80 | Panel { id: panel }
81 |
82 | Splash { id: splash }
83 |
84 | Timer {
85 | interval: 2000
86 | running: true
87 | onTriggered: desktop.state = "session"
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/modules/Papyros/Network/appletproxymodel.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013-2014 Jan Grulich
3 | Copyright 2015-2016 Pier Luigi Fiorini
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) version 3, or any
9 | later version accepted by the membership of KDE e.V. (or its
10 | successor approved by the membership of KDE e.V.), which shall
11 | act as a proxy defined in Section 6 of version 3 of the license.
12 |
13 | This library is distributed in the hope that it will be useful,
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | Lesser General Public License for more details.
17 |
18 | You should have received a copy of the GNU Lesser General Public
19 | License along with this library. If not, see .
20 | */
21 |
22 | #ifndef HAWAII_NM_APPLET_PROXY_MODEL_H
23 | #define HAWAII_NM_APPLET_PROXY_MODEL_H
24 |
25 | #include
26 |
27 | #include "networkmodelitem.h"
28 |
29 | class Q_DECL_EXPORT AppletProxyModel : public QSortFilterProxyModel
30 | {
31 | Q_OBJECT
32 | public:
33 | enum SortedConnectionType {
34 | Wired,
35 | Wireless,
36 | Wimax,
37 | Gsm,
38 | Cdma,
39 | Pppoe,
40 | Adsl,
41 | Infiniband,
42 | OLPCMesh,
43 | Bluetooth,
44 | Vpn,
45 | Vlan,
46 | Bridge,
47 | Bond,
48 | #if NM_CHECK_VERSION(0, 9, 10)
49 | Team,
50 | #endif
51 | Unknown };
52 |
53 | static SortedConnectionType connectionTypeToSortedType(NetworkManager::ConnectionSettings::ConnectionType type);
54 |
55 | explicit AppletProxyModel(QObject* parent = 0);
56 | virtual ~AppletProxyModel();
57 |
58 | protected:
59 | bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const Q_DECL_OVERRIDE;
60 | bool lessThan(const QModelIndex& left, const QModelIndex& right) const Q_DECL_OVERRIDE;
61 | };
62 |
63 |
64 | #endif // HAWAII_NM_APPLET_PROXY_MODEL_H
65 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/hardware/storagedevice.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2015 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:LGPL2.1+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU Lesser General Public License as published by
13 | * the Free Software Foundation, either version 2.1 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU Lesser General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU Lesser General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #ifndef STORAGEDEVICE_H
28 | #define STORAGEDEVICE_H
29 |
30 | #include
31 | #include
32 |
33 | #include
34 |
35 | Q_DECLARE_LOGGING_CATEGORY(DEVICE)
36 |
37 | class StorageDevice : public QObject
38 | {
39 | Q_OBJECT
40 | Q_PROPERTY(QString udi READ udi CONSTANT)
41 | Q_PROPERTY(QString name READ name CONSTANT)
42 | Q_PROPERTY(QString iconName READ iconName CONSTANT)
43 | Q_PROPERTY(QString filePath READ filePath CONSTANT)
44 | Q_PROPERTY(bool mounted READ isMounted NOTIFY mountedChanged)
45 | Q_PROPERTY(bool ignored READ isIgnored CONSTANT)
46 |
47 | public:
48 | StorageDevice(const QString &udi, QObject *parent = 0);
49 | ~StorageDevice();
50 |
51 | QString udi() const;
52 | QString name() const;
53 | QString iconName() const;
54 | QString filePath() const;
55 |
56 | bool isMounted() const;
57 | bool isIgnored() const;
58 |
59 | Q_INVOKABLE void mount();
60 | Q_INVOKABLE void unmount();
61 |
62 | Q_SIGNALS:
63 | void mountedChanged();
64 |
65 | private:
66 | Solid::Device m_device;
67 | };
68 |
69 | #endif // STORAGEDEVICE_H
70 |
--------------------------------------------------------------------------------
/shell/notifications/SystemNotifications.qml:
--------------------------------------------------------------------------------
1 | /*
2 | * Papyros Shell - The desktop shell for Papyros following Material Design
3 | * Copyright (C) 2015 Michael Spencer
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | import QtQuick 2.0
20 | import Material 0.2
21 |
22 | Object {
23 | property int soundVolume: sound.master
24 | property real batteryLevel: upower.primaryDevice
25 | ? upower.primaryDevice.percentage : 0
26 |
27 | onSoundVolumeChanged: notifications.add(soundNotification.createObject())
28 |
29 | property int lastLevel: 100
30 |
31 | onBatteryLevelChanged: {
32 | print("Battery level changed!")
33 | if (batteryLevel <= 30 && batteryLevel < lastLevel - 5) {
34 | lastLevel = batteryLevel
35 | notifications.add(batteryNotification.createObject())
36 | }
37 |
38 | if (batteryLevel > lastLevel) {
39 | lastLevel += 5
40 | }
41 | }
42 |
43 | Component {
44 | id: soundNotification
45 |
46 | SystemNotification {
47 | notificationId: -1
48 | iconName: sound.iconName
49 | percent: sound.master/100
50 | }
51 | }
52 |
53 | Component {
54 | id: batteryNotification
55 |
56 | SystemNotification {
57 | notificationId: -2
58 | iconName: upower.deviceIcon(upower.primaryDevice)
59 | summary: batteryLevel < 10 ? "Critically low battery!"
60 | : "Low battery!"
61 | body: upower.deviceSummary(upower.primaryDevice)
62 |
63 | duration: 5000
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/modules/Papyros/Components/PanelItem.qml:
--------------------------------------------------------------------------------
1 | /*
2 | * Papyros Shell - The desktop shell for Papyros following Material Design
3 | * Copyright (C) 2015 Michael Spencer
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | import QtQuick 2.3
19 | import QtQuick.Layouts 1.0
20 | import Material 0.2
21 |
22 | View {
23 | id: item
24 |
25 | tintColor: ink.containsMouse || selected ? Qt.rgba(0,0,0,0.2) : Qt.rgba(0,0,0,0)
26 |
27 | height: parent.height
28 | width: height
29 |
30 | property bool selected: indicator.selected
31 | property string tooltip
32 | property alias highlightColor: highlight.color
33 | property alias highlightOpacity: highlight.opacity
34 | property alias containsMouse: ink.containsMouse
35 |
36 | signal clicked()
37 | signal rightClicked()
38 |
39 | Ink {
40 | id: ink
41 |
42 | anchors.fill: parent
43 | color: Qt.rgba(0,0,0,0.3)
44 | z: 0
45 |
46 | acceptedButtons: Qt.LeftButton | Qt.RightButton
47 |
48 | onClicked: {
49 | if (mouse.button == Qt.RightButton)
50 | item.rightClicked()
51 | else
52 | item.clicked()
53 | }
54 |
55 | onContainsMouseChanged: desktop.updateTooltip(item, containsMouse)
56 | }
57 |
58 | Rectangle {
59 | id: highlight
60 | anchors {
61 | left: parent.left
62 | right: parent.right
63 | bottom: parent.bottom
64 | }
65 |
66 | height: dp(2)
67 | color: Theme.dark.accentColor
68 |
69 | opacity: item.selected ? 1 : 0
70 |
71 | Behavior on opacity {
72 | NumberAnimation { duration: 200 }
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/modules/Papyros/Network/networkstatus.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Jan Grulich
3 | Copyright 2015-2016 Pier Luigi Fiorini
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) version 3, or any
9 | later version accepted by the membership of KDE e.V. (or its
10 | successor approved by the membership of KDE e.V.), which shall
11 | act as a proxy defined in Section 6 of version 3 of the license.
12 |
13 | This library is distributed in the hope that it will be useful,
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | Lesser General Public License for more details.
17 |
18 | You should have received a copy of the GNU Lesser General Public
19 | License along with this library. If not, see .
20 | */
21 |
22 | #ifndef HAWAII_NM_NETWORK_STATUS_H
23 | #define HAWAII_NM_NETWORK_STATUS_H
24 |
25 | #include
26 |
27 | #include
28 |
29 | class NetworkStatus : public QObject
30 | {
31 | /**
32 | * Returns a formated list of active connections or NM status when there is no active connection
33 | */
34 | Q_PROPERTY(QString activeConnections READ activeConnections NOTIFY activeConnectionsChanged)
35 | /**
36 | * Returns the current status of NetworkManager
37 | */
38 | Q_PROPERTY(QString networkStatus READ networkStatus NOTIFY networkStatusChanged)
39 | Q_OBJECT
40 | public:
41 | explicit NetworkStatus(QObject* parent = 0);
42 | virtual ~NetworkStatus();
43 |
44 | QString activeConnections() const;
45 | QString networkStatus() const;
46 |
47 | private Q_SLOTS:
48 | void activeConnectionsChanged();
49 | void defaultChanged();
50 | void statusChanged(NetworkManager::Status status);
51 | void changeActiveConnections();
52 |
53 | Q_SIGNALS:
54 | void activeConnectionsChanged(const QString & activeConnections);
55 | void networkStatusChanged(const QString & status);
56 |
57 | private:
58 | QString m_activeConnections;
59 | QString m_networkStatus;
60 |
61 | QString checkUnknownReason() const;
62 | };
63 |
64 | #endif // PLAMA_NM_NETWORK_STATUS_H
65 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/notifications/notificationserver.h:
--------------------------------------------------------------------------------
1 | /*
2 | * QML Desktop - Set of tools written in C++ for QML
3 | * Copyright (C) 2014 Bogdan Cuza
4 | * 2015 Michael Spencer
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as
8 | * published by the Free Software Foundation, either version 2.1 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifndef NOTIFICATIONSERVER_H
21 | #define NOTIFICATIONSERVER_H
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | #include
30 |
31 | #include "notification.h"
32 |
33 | class NotificationAdaptor;
34 |
35 | class NotificationServer : public QQuickItem
36 | {
37 | Q_OBJECT
38 | Q_DISABLE_COPY(NotificationServer)
39 |
40 | Q_PROPERTY(QObjectListModel *notifications READ notifications CONSTANT)
41 |
42 | public:
43 | explicit NotificationServer(QQuickItem *parent = new QQuickItem());
44 |
45 | QObjectListModel *notifications()
46 | {
47 | return notificationsList.getModel();
48 | }
49 |
50 | public slots:
51 | Notification *notify(QString app_name, uint replaces_id, QString app_icon,
52 | QString summary, QString body, QStringList actions, QVariantMap hints,
53 | int expire_timeout = 0, int progress = -1);
54 |
55 | void closeNotification(uint id);
56 | void onNotificationUpdated(uint id, Notification *notification);
57 | void onNotificationAdded(uint id, Notification *notification);
58 | void onNotificationRemoved(uint id);
59 |
60 | private slots:
61 | void forTimer(QString id);
62 |
63 | private:
64 | uint availableId = 1;
65 | NotificationAdaptor *adaptor;
66 | QQuickList notificationsList;
67 | };
68 |
69 | #endif // NOTIFICATIONSERVER_H
70 |
--------------------------------------------------------------------------------
/shell/base/OutputWindow.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick.Window 2.0
3 | import GreenIsland 1.0 as GreenIsland
4 |
5 | Window {
6 | id: window
7 |
8 | property int minKeyboardWidth: 768
9 |
10 | property alias desktop: desktopLoader.item
11 | property alias idleDimmer: idleLoader.item
12 |
13 | property alias idleDimmerComponent: idleLoader.sourceComponent
14 | property alias desktopComponent: desktopLoader.sourceComponent
15 |
16 | property var output
17 |
18 | minimumWidth: 1024
19 | minimumHeight: 768
20 | maximumWidth: nativeScreen.width
21 | maximumHeight: nativeScreen.height
22 |
23 | // Idle dimmer
24 | Loader {
25 | id: idleLoader
26 | anchors.fill: parent
27 | }
28 |
29 | // Virtual keyboard
30 | Loader {
31 | // FIXME: Window doesn't have overlay
32 | parent: window.overlay
33 | source: "Keyboard.qml"
34 |
35 | x: (parent.width - width) / 2
36 | y: parent.height - height
37 | // TODO: No Fluid UI
38 | width: Math.max(parent.width / 2, minKeyboardWidth)
39 |
40 | z: 999
41 | }
42 |
43 | // Keyboard handling
44 | GreenIsland.KeyEventFilter {
45 | Keys.onPressed: {
46 | // Input wakes the output
47 | compositor.wake();
48 |
49 | desktop.keyPressed(event)
50 | }
51 |
52 | Keys.onReleased: {
53 | // Input wakes the output
54 | compositor.wake();
55 |
56 | desktop.keyReleased(event)
57 | }
58 | }
59 |
60 | GreenIsland.WaylandMouseTracker {
61 | id: localPointerTracker
62 |
63 | anchors.fill: parent
64 | enableWSCursor: true
65 |
66 | // Input wakes the output
67 | onMouseXChanged: compositor.wake()
68 | onMouseYChanged: compositor.wake()
69 |
70 | Loader {
71 | id: desktopLoader
72 | anchors.fill: parent
73 |
74 | readonly property var output: window.output
75 | }
76 |
77 | GreenIsland.WaylandCursorItem {
78 | id: cursor
79 | inputDevice: output.compositor.defaultInputDevice
80 | x: localPointerTracker.mouseX - hotspotX
81 | y: localPointerTracker.mouseY - hotspotY
82 | visible: localPointerTracker.containsMouse &&
83 | output.powerState === GreenIsland.ExtendedOutput.PowerStateOn
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/modules/Papyros/Network/plugin.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2015 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:LGPL2.1+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU Lesser General Public License as published by
13 | * the Free Software Foundation, either version 2.1 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU Lesser General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU Lesser General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #include
28 |
29 | #include "availabledevices.h"
30 | #include "appletproxymodel.h"
31 | #include "connectionicon.h"
32 | #include "enabledconnections.h"
33 | #include "enums.h"
34 | #include "handler.h"
35 | #include "networkmodel.h"
36 | #include "networkstatus.h"
37 |
38 | class NetworkManagerPlugin : public QQmlExtensionPlugin
39 | {
40 | Q_OBJECT
41 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
42 | public:
43 | void registerTypes(const char *uri)
44 | {
45 | // @uri Papyros.Network
46 | Q_ASSERT(uri == QStringLiteral("Papyros.Network"));
47 |
48 | qmlRegisterType(uri, 0, 1, "AppletProxyModel");
49 | qmlRegisterType(uri, 0, 1, "AvailableDevices");
50 | qmlRegisterType(uri, 0, 1, "ConnectionIcon");
51 | qmlRegisterType(uri, 0, 1, "EnabledConnections");
52 | qmlRegisterUncreatableType(uri, 0, 1, "Enums",
53 | QStringLiteral("Can't instantiate Enums objects"));
54 | qmlRegisterType(uri, 0, 1, "Handler");
55 | qmlRegisterType(uri, 0, 1, "NetworkModel");
56 | qmlRegisterType(uri, 0, 1, "NetworkStatus");
57 | }
58 | };
59 |
60 | #include "plugin.moc"
61 |
--------------------------------------------------------------------------------
/modules/Papyros/Network/networkitemslist.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013-2014 Jan Grulich
3 | Copyright 2015-2016 Pier Luigi Fiorini
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) version 3, or any
9 | later version accepted by the membership of KDE e.V. (or its
10 | successor approved by the membership of KDE e.V.), which shall
11 | act as a proxy defined in Section 6 of version 3 of the license.
12 |
13 | This library is distributed in the hope that it will be useful,
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | Lesser General Public License for more details.
17 |
18 | You should have received a copy of the GNU Lesser General Public
19 | License along with this library. If not, see .
20 | */
21 |
22 | #ifndef HAWAII_NM_MODEL_NETWORK_ITEMS_LIST_H
23 | #define HAWAII_NM_MODEL_NETWORK_ITEMS_LIST_H
24 |
25 | #include
26 |
27 | #include
28 |
29 | class NetworkModelItem;
30 |
31 | class NetworkItemsList : public QObject
32 | {
33 | Q_OBJECT
34 | public:
35 | enum FilterType {
36 | ActiveConnection,
37 | Connection,
38 | Device,
39 | Name,
40 | Nsp,
41 | Ssid,
42 | Uuid,
43 | Type
44 | };
45 |
46 | explicit NetworkItemsList(QObject* parent = 0);
47 | virtual ~NetworkItemsList();
48 |
49 | bool contains(const FilterType type, const QString& parameter) const;
50 | int count() const;
51 | int indexOf(NetworkModelItem * item) const;
52 | NetworkModelItem * itemAt(int index) const;
53 | QList items() const;
54 | QList returnItems(const FilterType type, const QString& parameter, const QString& additionalParameter = QString()) const;
55 | QList returnItems(const FilterType type, NetworkManager::ConnectionSettings::ConnectionType typeParameter) const;
56 |
57 | void insertItem(NetworkModelItem * item);
58 | void removeItem(NetworkModelItem * item);
59 | private:
60 | QList m_items;
61 | };
62 |
63 | #endif // HAWAII_NM_MODEL_NETWORK_ITEMS_LIST_H
64 |
--------------------------------------------------------------------------------
/modules/Papyros/Network/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Network)
2 |
3 | find_package(KF5ModemManagerQt 5.9.0)
4 | set_package_properties(KF5ModemManagerQt PROPERTIES
5 | TYPE OPTIONAL)
6 |
7 | find_package(NetworkManager 0.9.8.4)
8 | set_package_properties(NetworkManager PROPERTIES
9 | TYPE REQUIRED)
10 |
11 | find_package(ModemManager 1.0.0)
12 | set_package_properties(ModemManager PROPERTIES
13 | TYPE OPTIONAL)
14 |
15 | find_package(MobileBroadbandProviderInfo)
16 | set_package_properties(MobileBroadbandProviderInfo PROPERTIES
17 | DESCRIPTION "Database of mobile broadband service providers"
18 | URL "http://live.gnome.org/NetworkManager/MobileBroadband/ServiceProviders"
19 | TYPE OPTIONAL)
20 |
21 | if(NOT ENABLE_MODEMMANAGER_SUPPORT)
22 | message(STATUS "Disabling ModemManager support")
23 | set(WITH_MODEMMANAGER_SUPPORT 0)
24 | else()
25 | if(KF5ModemManagerQt_FOUND)
26 | message(STATUS "Enabling ModemManager support")
27 | set(WITH_MODEMMANAGER_SUPPORT 1)
28 | else()
29 | message(STATUS "ModemManager or ModemManagerQt not found")
30 | set(WITH_MODEMMANAGER_SUPPORT 0)
31 | endif()
32 | endif()
33 |
34 | add_definitions(-DWITH_MODEMMANAGER_SUPPORT=${WITH_MODEMMANAGER_SUPPORT})
35 |
36 | include_directories(
37 | ${CMAKE_BINARY_DIR}/headers
38 | )
39 |
40 | add_definitions(-DQT_NO_KEYWORDS)
41 |
42 | set(SOURCES
43 | appletproxymodel.cpp
44 | availabledevices.cpp
45 | connectionicon.cpp
46 | debug.cpp
47 | enabledconnections.cpp
48 | enums.cpp
49 | handler.cpp
50 | networkitemslist.cpp
51 | networkmodel.cpp
52 | networkmodelitem.cpp
53 | networkstatus.cpp
54 | plugin.cpp
55 | uiutils.cpp
56 | )
57 |
58 | add_library(nmplugin SHARED ${SOURCES})
59 | target_link_libraries(nmplugin
60 | Qt5::Core
61 | Qt5::DBus
62 | Qt5::Network
63 | Qt5::Gui
64 | Qt5::Qml
65 | Qt5::Quick
66 | KF5::NetworkManagerQt)
67 | if(WITH_MODEMMANAGER_SUPPORT)
68 | target_link_libraries(nmplugin KF5::ModemManagerQt)
69 | endif()
70 |
71 | install(FILES qmldir
72 | DESTINATION ${QML_INSTALL_DIR}/Papyros/Network)
73 | install(TARGETS nmplugin
74 | DESTINATION ${QML_INSTALL_DIR}/Papyros/Network)
75 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/powermanager/powermanager.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii Shell.
3 | *
4 | * Copyright (C) 2013-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #ifndef POWERMANAGER_H
28 | #define POWERMANAGER_H
29 |
30 | #include
31 |
32 | class PowerManagerBackend;
33 |
34 | class PowerManager : public QObject
35 | {
36 | Q_OBJECT
37 | Q_ENUMS(Capability)
38 | Q_PROPERTY(Capabilities capabilities READ capabilities NOTIFY capabilitiesChanged)
39 | public:
40 | enum Capability {
41 | None = 0x00,
42 | PowerOff = 0x01,
43 | Restart = 0x02,
44 | Suspend = 0x04,
45 | Hibernate = 0x08,
46 | HybridSleep = 0x10
47 | };
48 |
49 | Q_DECLARE_FLAGS(Capabilities, Capability)
50 | Q_FLAGS(Capabilities)
51 |
52 | explicit PowerManager(QObject *parent = 0);
53 | ~PowerManager();
54 |
55 | Capabilities capabilities() const;
56 |
57 | Q_SIGNALS:
58 | void capabilitiesChanged();
59 |
60 | public Q_SLOTS:
61 | void powerOff();
62 | void restart();
63 | void suspend();
64 | void hibernate();
65 | void hybridSleep();
66 |
67 | private Q_SLOTS:
68 | void serviceRegistered(const QString &service);
69 | void serviceUnregistered(const QString &service);
70 |
71 | private:
72 | Q_DISABLE_COPY(PowerManager)
73 |
74 | QList m_backends;
75 | };
76 |
77 | Q_DECLARE_METATYPE(PowerManager *)
78 | Q_DECLARE_OPERATORS_FOR_FLAGS(PowerManager::Capabilities)
79 |
80 | #endif // POWERMANAGER_H
81 |
--------------------------------------------------------------------------------
/cmake/FindNetworkManager.cmake:
--------------------------------------------------------------------------------
1 | # - Try to find NetworkManager
2 | # Once done this will define
3 | #
4 | # NETWORKMANAGER_FOUND - system has NetworkManager
5 | # NETWORKMANAGER_INCLUDE_DIRS - the NetworkManager include directories
6 | # NETWORKMANAGER_LIBRARIES - the libraries needed to use NetworkManager
7 | # NETWORKMANAGER_CFLAGS - Compiler switches required for using NetworkManager
8 | # NETWORKMANAGER_VERSION - version number of NetworkManager
9 |
10 | # Copyright (c) 2006, Alexander Neundorf,
11 | # Copyright (c) 2007, Will Stephenson,
12 | # Copyright (c) 2015, Jan Grulich,
13 |
14 | # Redistribution and use is allowed according to the terms of the BSD license.
15 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
16 |
17 |
18 | IF (NETWORKMANAGER_INCLUDE_DIRS AND NM-CORE_INCLUDE_DIRS)
19 | # in cache already
20 | SET(NetworkManager_FIND_QUIETLY TRUE)
21 | ENDIF (NETWORKMANAGER_INCLUDE_DIRS AND NM-CORE_INCLUDE_DIRS)
22 |
23 | IF (NOT WIN32)
24 | # use pkg-config to get the directories and then use these values
25 | # in the FIND_PATH() and FIND_LIBRARY() calls
26 | find_package(PkgConfig)
27 | PKG_SEARCH_MODULE( NETWORKMANAGER NetworkManager )
28 |
29 | IF (NETWORKMANAGER_FOUND)
30 | IF (NetworkManager_FIND_VERSION AND ("${NETWORKMANAGER_VERSION}" VERSION_LESS "${NetworkManager_FIND_VERSION}"))
31 | MESSAGE(FATAL_ERROR "NetworkManager ${NETWORKMANAGER_VERSION} is too old, need at least ${NetworkManager_FIND_VERSION}")
32 | ELSE ()
33 | # Since NetworkManager 1.0.0 we need to find different libraries
34 | IF (NetworkManager_FIND_VERSION AND ("${NETWORKMANAGER_VERSION}" VERSION_GREATER "1.0.0" OR "${NETWORKMANAGER_VERSION}" VERSION_EQUAL "1.0.0"))
35 | PKG_SEARCH_MODULE( NM-CORE libnm )
36 | IF (NM-CORE_FOUND)
37 | IF (NOT NetworkManager_FIND_QUIETLY)
38 | MESSAGE(STATUS "Found libnm-core: ${NM-CORE_LIBRARY_DIRS}")
39 | ENDIF ()
40 | ELSE ()
41 | MESSAGE(FATAL_ERROR "Could NOT find libnm-core, check FindPkgConfig output above!")
42 | ENDIF ()
43 | ENDIF ()
44 | ENDIF ()
45 | ELSE ()
46 | MESSAGE(FATAL_ERROR "Could NOT find NetworkManager, check FindPkgConfig output above!")
47 | ENDIF ()
48 | ENDIF (NOT WIN32)
49 |
50 | MARK_AS_ADVANCED(NETWORKMANAGER_INCLUDE_DIRS NM-UTIL_INCLUDE_DIRS NM-GLIB_INCLUDE_DIRS NM-CORE_INCLUDE_DIRS)
51 |
52 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/hardware/hardwareengine.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2015 Pier Luigi Fiorini
5 | * 2015 Michael Spencer
6 | *
7 | * Author(s):
8 | * Pier Luigi Fiorini
9 | * Michael Spencer
10 | *
11 | * $BEGIN_LICENSE:LGPL2.1+$
12 | *
13 | * This program is free software: you can redistribute it and/or modify
14 | * it under the terms of the GNU Lesser General Public License as published by
15 | * the Free Software Foundation, either version 2.1 of the License, or
16 | * (at your option) any later version.
17 | *
18 | * This program is distributed in the hope that it will be useful,
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | * GNU Lesser General Public License for more details.
22 | *
23 | * You should have received a copy of the GNU Lesser General Public License
24 | * along with this program. If not, see .
25 | *
26 | * $END_LICENSE$
27 | ***************************************************************************/
28 |
29 | #ifndef HARDWAREENGINE_H
30 | #define HARDWAREENGINE_H
31 |
32 | #include
33 | #include
34 | #include
35 |
36 | #include "battery.h"
37 | #include "storagedevice.h"
38 |
39 | Q_DECLARE_LOGGING_CATEGORY(HARDWARE)
40 |
41 | class HardwareEngine : public QObject
42 | {
43 | Q_OBJECT
44 | Q_PROPERTY(Battery *primaryBattery READ primaryBattery NOTIFY batteriesChanged)
45 | Q_PROPERTY(QQmlListProperty batteries READ batteries NOTIFY batteriesChanged)
46 | Q_PROPERTY(QQmlListProperty storageDevices READ storageDevices NOTIFY storageDevicesChanged)
47 | public:
48 | HardwareEngine(QObject *parent = 0);
49 | ~HardwareEngine();
50 |
51 | Battery *primaryBattery() const;
52 | QQmlListProperty batteries();
53 | QQmlListProperty storageDevices();
54 |
55 | Q_SIGNALS:
56 | void storageDeviceAdded(StorageDevice *device);
57 | void storageDeviceRemoved(StorageDevice *device);
58 | void storageDevicesChanged();
59 |
60 | void batteryAdded(Battery *battery);
61 | void batteryRemoved(Battery *battery);
62 | void batteriesChanged();
63 |
64 | private:
65 | QMap m_batteries;
66 | QMap m_storageDevices;
67 | };
68 |
69 | #endif // HARDWAREENGINE_H
70 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/loginmanager/logindsessioninfo.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #ifndef LOGINDSESSIONINFO_H
28 | #define LOGINDSESSIONINFO_H
29 |
30 | #include
31 | #include
32 |
33 | struct LogindSessionInfo
34 | {
35 | QString sessionId;
36 | uint userId;
37 | QString userName;
38 | QString seatId;
39 | QDBusObjectPath sessionPath;
40 | };
41 |
42 | Q_DECLARE_TYPEINFO(LogindSessionInfo, Q_PRIMITIVE_TYPE);
43 | Q_DECLARE_METATYPE(LogindSessionInfo)
44 |
45 | typedef QList LogindSessionInfoList;
46 |
47 | Q_DECLARE_METATYPE(LogindSessionInfoList)
48 |
49 | inline QDBusArgument &operator<<(QDBusArgument &argument, const LogindSessionInfo &sessionInfo)
50 | {
51 | argument.beginStructure();
52 | argument << sessionInfo.sessionId;
53 | argument << sessionInfo.userId;
54 | argument << sessionInfo.userName;
55 | argument << sessionInfo.seatId;
56 | argument << sessionInfo.sessionPath;
57 | argument.endStructure();
58 |
59 | return argument;
60 | }
61 |
62 | inline const QDBusArgument &operator>>(const QDBusArgument &argument, LogindSessionInfo &sessionInfo)
63 | {
64 | argument.beginStructure();
65 | argument >> sessionInfo.sessionId;
66 | argument >> sessionInfo.userId;
67 | argument >> sessionInfo.userName;
68 | argument >> sessionInfo.seatId;
69 | argument >> sessionInfo.sessionPath;
70 | argument.endStructure();
71 |
72 | return argument;
73 | }
74 |
75 | #endif // LOGINDSESSIONINFO_H
76 |
77 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/mpris/mpris2player.h:
--------------------------------------------------------------------------------
1 | /*
2 | * QML Desktop - Set of tools written in C++ for QML
3 | *
4 | * Copyright (C) 2014 Bogdan Cuza
5 | * 2014 Ricardo Vieira
6 | * 2015 Michael Spencer
7 | *
8 | * This program is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as
10 | * published by the Free Software Foundation, either version 2.1 of the
11 | * License, or (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public License
19 | * along with this program. If not, see .
20 | */
21 |
22 | #ifndef MPRIS2PLAYER_H
23 | #define MPRIS2PLAYER_H
24 |
25 | #include
26 | #include
27 | #include
28 | #include
29 |
30 | class Mpris2Player : public QObject
31 | {
32 | Q_OBJECT
33 |
34 | Q_PROPERTY(QVariantMap metadata READ metadata NOTIFY metadataNotify)
35 | Q_PROPERTY(QString name MEMBER name CONSTANT)
36 | Q_PROPERTY(QString playbackStatus READ playbackStatus NOTIFY playbackStatusChanged)
37 | Q_PROPERTY(QVariant canSeek MEMBER m_canSeek CONSTANT)
38 | Q_PROPERTY(QVariant canGoNext MEMBER m_canGoNext CONSTANT)
39 | Q_PROPERTY(QVariant canGoPrevious MEMBER m_canGoPrevious CONSTANT)
40 |
41 | public:
42 | explicit Mpris2Player(QString serviceName, QObject *parent = 0);
43 |
44 | QVariantMap metadata() const;
45 |
46 | QString playbackStatus() const;
47 |
48 | Q_INVOKABLE void playPause();
49 | Q_INVOKABLE void next();
50 | Q_INVOKABLE void previous();
51 | Q_INVOKABLE void stop();
52 | Q_INVOKABLE void seek(const QVariant &position);
53 | Q_INVOKABLE void openUri(const QVariant &uri);
54 | Q_INVOKABLE void raise();
55 | Q_INVOKABLE void quit();
56 |
57 | QDBusInterface iface;
58 | QDBusInterface playerInterface;
59 | QString name;
60 | QVariant m_canGoNext;
61 | QVariant m_canSeek;
62 | QVariant m_canGoPrevious;
63 |
64 | signals:
65 | void metadataNotify();
66 | void playbackStatusChanged();
67 |
68 | private slots:
69 | void metadataReceived(QDBusMessage msg);
70 |
71 | };
72 |
73 | #endif // MPRIS2PLAYER_H
74 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/mpris/mprisconnection.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * QML Desktop - Set of tools written in C++ for QML
3 | *
4 | * Copyright (C) 2014 Bogdan Cuza
5 | * 2014 Ricardo Vieira
6 | * 2015 Michael Spencer
7 | *
8 | * This program is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as
10 | * published by the Free Software Foundation, either version 2.1 of the
11 | * License, or (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public License
19 | * along with this program. If not, see .
20 | */
21 |
22 | #include "mprisconnection.h"
23 |
24 | MprisConnection::MprisConnection(QQuickItem *parent):
25 | QQuickItem(parent)
26 | {
27 | QDBusConnection bus = QDBusConnection::sessionBus();
28 | const QStringList services = bus.interface()->registeredServiceNames();
29 |
30 | foreach(QString name, services.filter("org.mpris.MediaPlayer2")) {
31 | playerList.append(new Mpris2Player(name));
32 | }
33 | watcher = new QDBusServiceWatcher(QString(), bus);
34 |
35 | connect(watcher, SIGNAL(serviceOwnerChanged(QString, QString, QString)),
36 | this, SLOT(serviceOwnerChanged(QString,QString,QString)));
37 | }
38 |
39 | MprisConnection::~MprisConnection(){
40 | delete watcher;
41 | while (!playerList.isEmpty())
42 | delete playerList.takeFirst();
43 | }
44 |
45 | void MprisConnection::serviceOwnerChanged(const QString &serviceName,
46 | const QString &oldOwner, const QString &newOwner)
47 | {
48 | if (oldOwner.isEmpty() && serviceName.startsWith("org.mpris.MediaPlayer2.")) {
49 | playerList.append(new Mpris2Player(serviceName));
50 | emit playerListChanged(QQmlListProperty(this, playerList));
51 | } else if (newOwner.isEmpty() && serviceName.startsWith("org.mpris.MediaPlayer2.")) {
52 | for (int i = 0; i < playerList.size(); ++i) {
53 | if (playerList.at(i)->iface.service() == serviceName) {
54 | playerList.removeAt(i);
55 | emit playerListChanged(QQmlListProperty(this, playerList));
56 | }
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/modules/Papyros/Indicators/SoundIndicator.qml:
--------------------------------------------------------------------------------
1 | /*
2 | * Papyros Shell - The desktop shell for Papyros following Material Design
3 | * Copyright (C) 2015 Michael Spencer
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | import QtQuick 2.0
19 | import Material 0.2
20 | import Material.ListItems 0.1 as ListItem
21 |
22 | Indicator {
23 | id: indicator
24 |
25 | iconName: sound.iconName
26 | tooltip: sound.muted || sound.master == 0 ? "Muted" : "Volume at %1%".arg(sound.master)
27 |
28 | view: Column {
29 |
30 | ListItem.Subtitled {
31 | text: qsTr("Volume")
32 | valueText: sound.muted || sound.master == 0 ? qsTr("Muted") : sound.master + "%"
33 | content: Slider {
34 | id: soundslider
35 |
36 | width: parent.width
37 | anchors.verticalCenter: parent.verticalCenter
38 | anchors.verticalCenterOffset: dp(7)
39 |
40 | minimumValue: 0
41 | maximumValue: 100
42 |
43 | value: sound.muted ? 0 : sound.master
44 |
45 | onValueChanged: {
46 | if (value != sound.master) {
47 | sound.muted = value == 0
48 | sound.master = value
49 | value = Qt.binding(function() {
50 | return sound.muted ? 0 : sound.master
51 | })
52 | }
53 | }
54 | }
55 |
56 | showDivider: musicRepeater.count > 0
57 | }
58 |
59 | Repeater {
60 | id: musicRepeater
61 | model: musicPlayer.playerList
62 | delegate: Column {
63 | width: parent.width
64 | visible: model.metadata["xesam:title"] != undefined
65 |
66 | ListItem.Subheader {
67 | text: name
68 | }
69 |
70 | MusicPlayerListItem {}
71 | }
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/shell/panel/AppsRow.qml:
--------------------------------------------------------------------------------
1 | /*
2 | * Papyros Shell - The desktop shell for Papyros following Material Design
3 | * Copyright (C) 2015 Michael Spencer
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 | import QtQuick 2.3
19 | import QtQuick.Layouts 1.0
20 | import Material 0.2
21 | import Papyros.Components 0.1
22 | import Papyros.Desktop 0.1
23 | import Papyros.Indicators 0.1
24 |
25 | import "../launcher"
26 | import "../desktop"
27 |
28 | ListView {
29 | Layout.fillWidth: true
30 | Layout.fillHeight: true
31 |
32 | orientation: Qt.Horizontal
33 |
34 | interactive: contentWidth > width
35 |
36 | model: LauncherModel {
37 | applicationManager: compositor.applicationManager
38 | includePinnedApplications: true
39 | }
40 |
41 | delegate: AppLauncher {
42 | width: parent.height
43 | height: width
44 | }
45 |
46 | remove: Transition {
47 | ParallelAnimation {
48 | NumberAnimation { property: "opacity"; to: 0; duration: 250 }
49 | NumberAnimation { properties: "y"; to: height; duration: 250 }
50 | }
51 | }
52 |
53 | removeDisplaced: Transition {
54 | SequentialAnimation {
55 | PauseAnimation { duration: 250 }
56 | NumberAnimation { properties: "x,y"; duration: 250 }
57 | }
58 | }
59 |
60 | move: Transition {
61 | SequentialAnimation {
62 | PauseAnimation { duration: 250 }
63 | NumberAnimation { properties: "x,y"; duration: 250 }
64 | }
65 | }
66 |
67 | moveDisplaced: Transition {
68 | SequentialAnimation {
69 | PauseAnimation { duration: 250 }
70 | NumberAnimation { properties: "x,y"; duration: 250 }
71 | }
72 | }
73 |
74 | add: Transition {
75 | ParallelAnimation {
76 | NumberAnimation { property: "opacity"; to: 1; from: 0; duration: 250 }
77 | NumberAnimation { properties: "y"; to: 0; from: height; duration: 250 }
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/launcher/application.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * QML Desktop - Set of tools written in C++ for QML
3 | *
4 | * Copyright (C) 2015-2016 Michael Spencer
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as
8 | * published by the Free Software Foundation, either version 2.1 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 |
26 | #include "application.h"
27 |
28 | #include "launchermodel.h"
29 |
30 | using namespace GreenIsland::Server;
31 |
32 | Application::Application(const QString &appId, bool pinned, LauncherModel *launcherModel)
33 | : QObject(launcherModel), m_launcherModel(launcherModel), m_appId(appId), m_focused(false),
34 | m_pinned(pinned), m_state(Application::NotRunning)
35 | {
36 | m_desktopFile = new DesktopFile(appId, this);
37 | }
38 |
39 | Application::Application(const QString &appId, LauncherModel *launcherModel)
40 | : Application(appId, false, launcherModel)
41 | {
42 | }
43 |
44 | void Application::setPinned(bool pinned)
45 | {
46 | if (pinned == m_pinned)
47 | return;
48 |
49 | m_pinned = pinned;
50 | emit pinnedChanged();
51 | }
52 |
53 | void Application::setState(State state)
54 | {
55 | if (state == m_state)
56 | return;
57 |
58 | m_state = state;
59 | emit stateChanged();
60 | }
61 |
62 | void Application::setFocused(bool focused)
63 | {
64 | if (focused == m_focused)
65 | return;
66 |
67 | m_focused = focused;
68 | emit focusedChanged();
69 | }
70 |
71 | bool Application::launch(const QStringList &urls)
72 | {
73 | if (isRunning())
74 | return true;
75 |
76 | desktopFile()->launch(urls);
77 |
78 | setState(Application::Starting);
79 |
80 | Q_EMIT launched();
81 |
82 | return true;
83 | }
84 |
85 | bool Application::quit()
86 | {
87 | if (!isRunning())
88 | return false;
89 |
90 | m_launcherModel->applicationManager()->quit(appId());
91 |
92 | return true;
93 | }
94 |
--------------------------------------------------------------------------------
/modules/Papyros/Material/windowdecorations.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Papyros Shell - The desktop shell for Papyros following Material Design
3 | * Copyright (C) 2015 Michael Spencer
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | #include "windowdecorations.h"
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 | using namespace QtWaylandClient;
26 |
27 | WindowDecorations::WindowDecorations(QObject *parent)
28 | : QObject(parent), mBackgroundColor("#455a64"), mTextColor("#ffffff"),
29 | mIconColor("#b4ffffff"), mWindow(nullptr)
30 | {
31 | }
32 |
33 | void WindowDecorations::update()
34 | {
35 | if (!mWindow) return;
36 |
37 | QPlatformWindow *platformWindow = mWindow->handle();
38 |
39 | if (platformWindow == nullptr) {
40 | qDebug() << "No platform window yet, trying later";
41 | QTimer::singleShot(10, this, &WindowDecorations::update);
42 | return;
43 | }
44 |
45 | QWaylandWindow *waylandWindow = dynamic_cast(platformWindow);
46 |
47 | if (waylandWindow == nullptr) {
48 | qDebug() << "Not running on wayland, no custom window decorations!";
49 | return;
50 | }
51 |
52 | QWaylandAbstractDecoration *decoration = waylandWindow->decoration();
53 |
54 | if (decoration == nullptr) {
55 | qDebug() << "No window decorations yet, trying later";
56 | QTimer::singleShot(10, this, &WindowDecorations::update);
57 | return;
58 | }
59 |
60 | QWaylandMaterialDecoration *materialDecorations = dynamic_cast(decoration);
61 |
62 | if (materialDecorations == nullptr) {
63 | qDebug() << "Not using Material decorations, no customization possible!";
64 | return;
65 | }
66 |
67 | materialDecorations->setBackgroundColor(mBackgroundColor);
68 | materialDecorations->setTextColor(mTextColor);
69 | materialDecorations->setIconColor(mIconColor);
70 | materialDecorations->update();
71 | }
72 |
--------------------------------------------------------------------------------
/compositor/processlauncher/processlauncher.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #ifndef PROCESSLAUNCHER_H
28 | #define PROCESSLAUNCHER_H
29 |
30 | #include
31 | #include
32 | #include
33 |
34 | Q_DECLARE_LOGGING_CATEGORY(LAUNCHER)
35 |
36 | class QProcess;
37 | class XdgDesktopFile;
38 |
39 | typedef QMap ApplicationMap;
40 | typedef QMutableMapIterator ApplicationMapIterator;
41 |
42 | class ProcessLauncher : public QObject
43 | {
44 | Q_OBJECT
45 | Q_PROPERTY(QString waylandSocketName READ waylandSocketName WRITE setWaylandSocketName NOTIFY
46 | waylandSocketNameChanged)
47 | public:
48 | ProcessLauncher(QObject *parent = 0);
49 | ~ProcessLauncher();
50 |
51 | QString waylandSocketName() const;
52 | void setWaylandSocketName(const QString &name);
53 |
54 | void closeApplications();
55 |
56 | static bool registerWithDBus(ProcessLauncher *instance);
57 |
58 | Q_SIGNALS : void waylandSocketNameChanged();
59 |
60 | public Q_SLOTS:
61 | bool launchApplication(const QString &appId, const QStringList &urls);
62 | bool launchDesktopFile(const QString &fileName, const QStringList &urls);
63 |
64 | bool closeApplication(const QString &appId);
65 | bool closeDesktopFile(const QString &fileName);
66 |
67 | private:
68 | QString m_waylandSocketName;
69 | ApplicationMap m_apps;
70 |
71 | bool launchEntry(XdgDesktopFile *entry, const QStringList &urls);
72 | bool closeEntry(const QString &fileName);
73 |
74 | private Q_SLOTS:
75 | void finished(int exitCode);
76 | };
77 |
78 | #endif // PROCESSLAUNCHER_H
79 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/loginmanager/logindbackend.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #ifndef LOGINDBACKEND_H
28 | #define LOGINDBACKEND_H
29 |
30 | #include
31 | #include
32 |
33 | #include "loginmanagerbackend.h"
34 |
35 | Q_DECLARE_LOGGING_CATEGORY(LOGIND_BACKEND)
36 |
37 | class QDBusInterface;
38 | class QDBusPendingCallWatcher;
39 |
40 | class SessionManager;
41 |
42 | class LogindBackend : public LoginManagerBackend
43 | {
44 | Q_OBJECT
45 | public:
46 | ~LogindBackend();
47 |
48 | static LogindBackend *create(SessionManager *sm,
49 | const QDBusConnection &connection = QDBusConnection::systemBus());
50 |
51 | QString name() const;
52 |
53 | void setIdle(bool value);
54 |
55 | void takeControl();
56 | void releaseControl();
57 |
58 | int takeDevice(const QString &path);
59 | void releaseDevice(int fd);
60 |
61 | void lockSession();
62 | void unlockSession();
63 |
64 | void requestLockSession();
65 | void requestUnlockSession();
66 |
67 | void locked();
68 | void unlocked();
69 |
70 | void switchToVt(int index);
71 |
72 | private:
73 | LogindBackend();
74 |
75 | SessionManager *m_sessionManager;
76 | QDBusInterface *m_interface;
77 | QString m_sessionPath;
78 | int m_inhibitFd;
79 |
80 | void setupInhibitors();
81 |
82 | private Q_SLOTS:
83 | void prepareForSleep(bool arg);
84 | void prepareForShutdown(bool arg);
85 | void getSession(QDBusPendingCallWatcher *watcher);
86 | void devicePaused(quint32 devMajor, quint32 devMinor, const QString &type);
87 | };
88 |
89 | #endif // LOGINDBACKEND_H
90 |
--------------------------------------------------------------------------------
/modules/Papyros/Network/trafficmonitor.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2010 Sebastian Kügler
3 | Copyright 2010-2013 Lamarque V. Souza
4 | Copyright 2013 Jan Grulich
5 |
6 | This library is free software; you can redistribute it and/or
7 | modify it under the terms of the GNU Lesser General Public
8 | License as published by the Free Software Foundation; either
9 | version 2.1 of the License, or (at your option) version 3, or any
10 | later version accepted by the membership of KDE e.V. (or its
11 | successor approved by the membership of KDE e.V.), which shall
12 | act as a proxy defined in Section 6 of version 3 of the license.
13 |
14 | This library is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 | Lesser General Public License for more details.
18 |
19 | You should have received a copy of the GNU Lesser General Public
20 | License along with this library. If not, see .
21 | */
22 |
23 | #ifndef HAWAII_NM_TRAFFIC_MONITOR_H
24 | #define HAWAII_NM_TRAFFIC_MONITOR_H
25 |
26 | #include
27 |
28 | #include
29 | #include
30 |
31 | #include
32 | #include
33 | #include
34 |
35 | class TrafficMonitor : public QGraphicsWidget
36 | {
37 | Q_PROPERTY(QString device READ device WRITE setDevice)
38 | Q_PROPERTY(qreal height READ height NOTIFY heightChanged)
39 | Q_OBJECT
40 | public:
41 | explicit TrafficMonitor(QGraphicsItem * parent = 0);
42 | virtual ~TrafficMonitor();
43 |
44 | void setDevice(const QString & device);
45 | QString device() const;
46 |
47 | qreal height() const;
48 |
49 | public Q_SLOTS:
50 | void dataUpdated(const QString & sourceName, const Plasma::DataEngine::Data & data);
51 |
52 | private:
53 | void resetMonitor();
54 | void updateTraffic();
55 | void setUpdateEnabled(bool enable);
56 |
57 | NetworkManager::Device::Ptr m_device;
58 |
59 | Plasma::DataEngine * m_engine;
60 | Plasma::SignalPlotter *m_trafficPlotter;
61 | Plasma::Label * m_traffic;
62 |
63 | QString m_tx;
64 | QString m_txSource;
65 | QString m_txTotalSource;
66 | QString m_txUnit;
67 | QString m_rx;
68 | QString m_rxSource;
69 | QString m_rxTotalSource;
70 | QString m_rxUnit;
71 | QColor m_txColor;
72 | QColor m_rxColor;
73 | qlonglong m_txTotal;
74 | qlonglong m_rxTotal;
75 |
76 | bool m_updateEnabled;
77 | int m_speedUnit;
78 |
79 | Q_SIGNALS:
80 | void heightChanged();
81 | };
82 |
83 | #endif // HAWAII_NM_TRAFFIC_MONITOR_H
84 |
--------------------------------------------------------------------------------
/shell/base/BaseOutput.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2014-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | import QtQuick 2.5
28 | import QtQuick.Window 2.2
29 | import GreenIsland 1.0 as GreenIsland
30 |
31 | GreenIsland.ExtendedOutput {
32 | id: output
33 |
34 | property alias idleDimmerComponent: outputWindow.idleDimmerComponent
35 | property alias desktopComponent: outputWindow.desktopComponent
36 |
37 | readonly property bool primary: compositor.primaryScreen === nativeScreen
38 | readonly property Item surfacesArea: desktop.hasOwnProperty("surfacesArea")
39 | ? desktop.surfacesArea : null
40 |
41 | property alias desktop: outputWindow.desktop
42 | property alias idleDimmer: outputWindow.idleDimmer
43 |
44 | property QtObject activeWindow: null
45 | property int idleInhibit: 0
46 |
47 | manufacturer: nativeScreen.manufacturer
48 | model: nativeScreen.model
49 | position: nativeScreen.position
50 | currentModeId: nativeScreen.currentMode
51 | physicalSize: nativeScreen.physicalSize
52 | subpixel: nativeScreen.subpixel
53 | transform: nativeScreen.transform
54 | scaleFactor: nativeScreen.scaleFactor
55 | sizeFollowsWindow: false
56 | automaticFrameCallback: powerState === GreenIsland.ExtendedOutput.PowerStateOn
57 |
58 | window: OutputWindow {
59 | id: outputWindow
60 |
61 | output: output
62 | }
63 |
64 | onGeometryChanged: desktop.updateGeometry()
65 |
66 | /*
67 | * Methods
68 | */
69 |
70 | function wake() {
71 | if (idleDimmer)
72 | idleDimmer.fadeOut();
73 | output.powerState = GreenIsland.ExtendedOutput.PowerStateOn;
74 | }
75 |
76 | function idle() {
77 | if (idleDimmer)
78 | idleDimmer.fadeIn();
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(io.papyros.Shell)
2 |
3 | cmake_minimum_required(VERSION 3.0.0)
4 |
5 | set(CMAKE_AUTORCC ON)
6 |
7 | # Set version
8 | set(PROJECT_VERSION "0.1.0")
9 | set(PROJECT_VERSION_MAJOR 0)
10 | set(PROJECT_SOVERSION 0)
11 |
12 | # Options
13 | option(DEVELOPMENT_BUILD "Enable options for developers" OFF)
14 | option(ENABLE_ALSA "Enables Alsa mixer backend" ON)
15 | option(ENABLE_PULSEAUDIO "Enables PulseAudio mixer backend" ON)
16 |
17 | # ECM setup
18 | find_package(ECM 1.4.0 REQUIRED NO_MODULE)
19 | set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} "${CMAKE_SOURCE_DIR}/cmake")
20 |
21 | # Macros
22 | include(FeatureSummary)
23 | include(KDEInstallDirs)
24 | include(KDECompilerSettings)
25 | include(KDECMakeSettings)
26 | include(CheckIncludeFile)
27 | include(CheckSymbolExists)
28 |
29 | # Build flags
30 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -Werror -Wall -Wextra -Wformat -Wswitch-default -Wunused-parameter -pedantic -std=c++11")
31 |
32 | add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
33 | remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_STRICT_ITERATORS -DQT_NO_CAST_FROM_BYTEARRAY)
34 |
35 | # Minimum version requirements
36 | set(QT_MIN_VERSION "5.6.0")
37 | set(KF5_MIN_VERSION "5.8.0")
38 |
39 | find_package(PAM REQUIRED)
40 | find_package(GreenIsland 0.7.90 REQUIRED COMPONENTS Server)
41 |
42 | # Find Qt5
43 | find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
44 | Core
45 | DBus
46 | Xml
47 | Gui
48 | Widgets
49 | Qml
50 | Quick
51 | WaylandClient)
52 |
53 | # Find KF5
54 | find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
55 | Solid Declarative NetworkManagerQt)
56 |
57 | find_package(QT5XDG REQUIRED)
58 | find_package(Papyros REQUIRED)
59 |
60 | # Check for prctl
61 | check_include_file("sys/prctl.h" HAVE_SYS_PRCTL_H)
62 | check_symbol_exists(PR_SET_DUMPABLE "sys/prctl.h" HAVE_PR_SET_DUMPABLE)
63 | add_feature_info("prctl-dumpable" HAVE_PR_SET_DUMPABLE "Required to prevent ptrace on the compositor process")
64 |
65 | # Hack because QtWayland doesn't set this at all
66 | set(Qt5WaylandClient_PRIVATE_INCLUDE_DIRS
67 | "${_qt5WaylandClient_install_prefix}/include/qt/QtWaylandClient/${Qt5WaylandClient_VERSION}"
68 | "${_qt5WaylandClient_install_prefix}/include/qt/QtWaylandClient/${Qt5WaylandClient_VERSION}/QtWaylandClient"
69 | )
70 |
71 | add_subdirectory(3rdparty)
72 | add_subdirectory(compositor)
73 | add_subdirectory(data)
74 | add_subdirectory(decorations)
75 | add_subdirectory(headers)
76 | add_subdirectory(modules)
77 |
78 | if(DEVELOPMENT_BUILD)
79 | greenisland_install_shell(io.papyros.shell shell)
80 | endif()
81 |
82 | # Display featute summary
83 | feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
84 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/mixer/alsamixer.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Giulio Camuffo
3 | *
4 | * This file is part of Orbital. Originally licensed under the GPLv3, relicensed
5 | * with permission for use in Papyros.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation, either version 2.1 of the
10 | * License, or (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #include "alsamixer.h"
22 |
23 | static const char *card = "default";
24 | static const char *selem_name = "Master";
25 |
26 | AlsaMixer::AlsaMixer(Sound *m)
27 | : Backend()
28 | , m_mixer(m)
29 | {
30 | }
31 |
32 | AlsaMixer *AlsaMixer::create(Sound *m)
33 | {
34 | AlsaMixer *alsa = new AlsaMixer(m);
35 | if (!alsa) {
36 | return nullptr;
37 | }
38 |
39 | snd_mixer_open(&alsa->m_handle, 0);
40 | snd_mixer_attach(alsa->m_handle, card);
41 | snd_mixer_selem_register(alsa->m_handle, NULL, NULL);
42 | snd_mixer_load(alsa->m_handle);
43 |
44 | snd_mixer_selem_id_alloca(&alsa->m_sid);
45 | snd_mixer_selem_id_set_index(alsa->m_sid, 0);
46 | snd_mixer_selem_id_set_name(alsa->m_sid, selem_name);
47 | alsa->m_elem = snd_mixer_find_selem(alsa->m_handle, alsa->m_sid);
48 | if (!alsa->m_elem) {
49 | delete alsa;
50 | return nullptr;
51 | }
52 |
53 | snd_mixer_selem_get_playback_volume_range(alsa->m_elem, &alsa->m_min, &alsa->m_max);
54 | return alsa;
55 | }
56 |
57 | AlsaMixer::~AlsaMixer()
58 | {
59 | snd_mixer_close(m_handle);
60 | }
61 |
62 | void AlsaMixer::getBoundaries(int *min, int *max) const
63 | {
64 | *min = m_min;
65 | *max = m_max;
66 | }
67 |
68 | void AlsaMixer::setRawVol(int volume)
69 | {
70 | snd_mixer_selem_set_playback_volume_all(m_elem, volume);
71 | emit m_mixer->masterChanged();
72 | }
73 |
74 | int AlsaMixer::rawVol() const
75 | {
76 | long vol;
77 | snd_mixer_selem_get_playback_volume(m_elem, SND_MIXER_SCHN_UNKNOWN, &vol);
78 | return vol;
79 | }
80 |
81 | bool AlsaMixer::muted() const
82 | {
83 | int mute;
84 | snd_mixer_selem_get_playback_switch(m_elem, SND_MIXER_SCHN_UNKNOWN, &mute);
85 | return !mute;
86 | }
87 |
88 | void AlsaMixer::setMuted(bool muted)
89 | {
90 | snd_mixer_selem_set_playback_switch_all(m_elem, !muted);
91 | emit m_mixer->mutedChanged();
92 | }
93 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/session/sessionmanager.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Papyros Shell - The desktop shell for Papyros following Material Design
3 | *
4 | * Copyright (C) 2015 Bogdan Cuza
5 | * 2015 Michael Spencer
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation, either version 2.1 of the
10 | * License, or (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef SESSIONMANAGER_H
22 | #define SESSIONMANAGER_H
23 |
24 | #include
25 |
26 | #include
27 | #include
28 | #include
29 | #include
30 |
31 | struct pam_message;
32 | struct pam_response;
33 |
34 | class SessionManager : public QObject
35 | {
36 | Q_OBJECT
37 | Q_PROPERTY(bool canPowerOff MEMBER m_canPowerOff CONSTANT)
38 | Q_PROPERTY(bool canRestart MEMBER m_canRestart CONSTANT)
39 | Q_PROPERTY(bool canSuspend MEMBER m_canSuspend CONSTANT)
40 | Q_PROPERTY(bool canHibernate MEMBER m_canHibernate CONSTANT)
41 | Q_PROPERTY(bool canLogOut MEMBER m_canLogOut CONSTANT)
42 |
43 | public:
44 | SessionManager(QObject *parent = 0);
45 |
46 | static QObject *qmlSingleton(QQmlEngine *engine, QJSEngine *scriptEngine);
47 |
48 | public slots:
49 | bool canPowerOff() const { return m_canPowerOff; }
50 | bool canRestart() const { return m_canRestart; }
51 | bool canSuspend() const { return m_canSuspend; }
52 | bool canHibernate() const { return m_canHibernate; }
53 | bool canLogOut() const { return m_canLogOut; }
54 |
55 | void powerOff();
56 | void restart();
57 | void suspend();
58 | void hibernate();
59 | void logOut();
60 |
61 | void authenticate(const QString &password);
62 |
63 | signals:
64 | void authenticationSucceeded();
65 | void authenticationFailed();
66 | void authenticationError();
67 |
68 | private:
69 | QDBusInterface m_interface;
70 | pam_response *m_response;
71 | bool m_canPowerOff;
72 | bool m_canRestart;
73 | bool m_canSuspend;
74 | bool m_canHibernate;
75 | bool m_canLogOut;
76 |
77 | bool canDoAction(const QString &action);
78 |
79 | static int conversationHandler(int num, const pam_message **message,
80 | pam_response **response, void *data);
81 |
82 | };
83 |
84 | #endif // SESSIONMANAGER_H
85 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/desktop/desktopfile.h:
--------------------------------------------------------------------------------
1 | /*
2 | * QML Desktop - Set of tools written in C++ for QML
3 | *
4 | * Copyright (C) 2014 Bogdan Cuza
5 | * 2015-2016 Michael Spencer
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation, either version 2.1 of the
10 | * License, or (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef DESKTOPFILE_H
22 | #define DESKTOPFILE_H
23 |
24 | #include
25 |
26 | #include
27 |
28 | class DesktopFile : public QObject
29 | {
30 | Q_OBJECT
31 |
32 | Q_PROPERTY(QString name READ name NOTIFY dataChanged)
33 | Q_PROPERTY(QString iconName READ iconName NOTIFY dataChanged)
34 | Q_PROPERTY(bool hasIcon READ hasIcon NOTIFY dataChanged)
35 | Q_PROPERTY(QString comment READ comment NOTIFY dataChanged)
36 | Q_PROPERTY(QString darkColor MEMBER m_darkColor NOTIFY dataChanged)
37 |
38 | Q_PROPERTY(QString appId MEMBER m_appId WRITE setAppId NOTIFY appIdChanged)
39 | Q_PROPERTY(QString path MEMBER m_path WRITE setPath NOTIFY pathChanged)
40 |
41 | Q_PROPERTY(bool isValid READ isValid NOTIFY dataChanged)
42 | Q_PROPERTY(bool isShown READ isShown NOTIFY dataChanged)
43 |
44 | public:
45 | explicit DesktopFile(QString path = "", QObject *parent = 0);
46 |
47 | static QString getEnvVar(int pid);
48 |
49 | Q_INVOKABLE bool launch(const QStringList &urls) const;
50 |
51 | QString m_appId;
52 | QString m_path;
53 | QString m_darkColor;
54 |
55 | QString name() const;
56 | QString iconName() const;
57 | bool hasIcon() const;
58 | QString comment() const;
59 | bool isValid() const;
60 | bool isShown(const QString &environment = QString()) const;
61 |
62 | static QString canonicalAppId(QString appId);
63 |
64 | public slots:
65 | void setAppId(QString appId);
66 | void setPath(QString path);
67 | void load();
68 |
69 | signals:
70 | void dataChanged();
71 | void isValidChanged();
72 | void pathChanged();
73 | void appIdChanged();
74 |
75 | private:
76 | static QString pathFromAppId(QString appId);
77 | static QString findFileInPaths(QString fileName, QStringList paths);
78 | static QVariant localizedValue(const QSettings &desktopFile, QString key);
79 |
80 | XdgDesktopFile *m_desktopFile;
81 | };
82 |
83 | #endif // DESKTOPFILE_H
84 |
--------------------------------------------------------------------------------
/modules/Papyros/Desktop/desktop/desktopfiles.h:
--------------------------------------------------------------------------------
1 | /*
2 | * QML Desktop - Set of tools written in C++ for QML
3 | *
4 | * Copyright (C) 2014 Bogdan Cuza
5 | * 2015-2016 Michael Spencer
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as
9 | * published by the Free Software Foundation, either version 2.1 of the
10 | * License, or (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef DESKTOP_FILES_H
22 | #define DESKTOP_FILES_H
23 |
24 | #include
25 | #include
26 | #include
27 |
28 | #include
29 |
30 | #include "desktopfile.h"
31 |
32 | class DesktopFiles : public QObject
33 | {
34 | Q_OBJECT
35 |
36 | Q_PROPERTY(QObjectListModel *desktopFiles READ desktopFiles NOTIFY desktopFilesChanged)
37 | Q_PROPERTY(QString iconTheme READ iconTheme WRITE setIconTheme NOTIFY iconThemeChanged)
38 |
39 | public:
40 | DesktopFiles(QObject *parent = 0);
41 |
42 | QObjectListModel *desktopFiles() { return desktopList.getModel(); }
43 |
44 | QString iconTheme() const { return QIcon::themeName(); }
45 |
46 | static bool compare(const DesktopFile *a, const DesktopFile *b);
47 |
48 | Q_INVOKABLE int indexOfName(QString name);
49 |
50 | static DesktopFiles *sharedInstance();
51 | static QObject *qmlSingleton(QQmlEngine *engine, QJSEngine *scriptEngine);
52 |
53 | public slots:
54 | void setIconTheme(const QString &name)
55 | {
56 | QIcon::setThemeName(name);
57 | iconThemeChanged(name);
58 | }
59 |
60 | bool launchApplication(const QString &appId, const QStringList &urls);
61 | bool launchDesktopFile(const QString &fileName, const QStringList &urls);
62 |
63 | bool closeApplication(const QString &appId);
64 | bool closeDesktopFile(const QString &fileName);
65 |
66 | signals:
67 | void desktopFilesChanged(QObjectListModel *);
68 | void iconThemeChanged(const QString &name);
69 |
70 | private slots:
71 | void onFileChanged(const QString &path);
72 | void onDirectoryChanged(const QString &directory);
73 |
74 | private:
75 | QDBusInterface m_interface;
76 | QFileSystemWatcher *fileWatcher;
77 | QFileSystemWatcher *dirWatcher;
78 | QQuickList desktopList;
79 | DesktopFile *desktopFileForPath(const QString &path);
80 | QStringList filesInPaths(QStringList paths, QStringList filters);
81 | };
82 |
83 | #endif // DESKTOP_FILES_H
84 |
--------------------------------------------------------------------------------
/modules/Papyros/Material/windowdecorations.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Papyros Shell - The desktop shell for Papyros following Material Design
3 | * Copyright (C) 2015 Michael Spencer
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | #ifndef WINDOWDECORATIONS_H
20 | #define WINDOWDECORATIONS_H
21 |
22 | #include
23 | #include
24 | #include "materialdecoration.h"
25 |
26 | class WindowDecorations : public QObject
27 | {
28 | Q_OBJECT
29 |
30 | Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor
31 | NOTIFY backgroundColorChanged)
32 | Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor
33 | NOTIFY textColorChanged)
34 | Q_PROPERTY(QColor iconColor READ textColor WRITE setIconColor
35 | NOTIFY iconColorChanged)
36 | Q_PROPERTY(QWindow *window READ window WRITE setWindow NOTIFY windowChanged)
37 |
38 | public:
39 | WindowDecorations(QObject *parent = 0);
40 |
41 | QColor backgroundColor() const { return mBackgroundColor; }
42 | QColor textColor() const { return mTextColor; }
43 | QColor iconColor() const { return mIconColor; }
44 | QWindow *window() const { return mWindow; }
45 |
46 | public slots:
47 | void update();
48 |
49 | void setBackgroundColor(QColor color) {
50 | if (mBackgroundColor != color) {
51 | mBackgroundColor = color;
52 | emit backgroundColorChanged();
53 | }
54 | }
55 |
56 | void setTextColor(QColor color) {
57 | if (mTextColor != color) {
58 | mTextColor = color;
59 | emit textColorChanged();
60 | }
61 | }
62 |
63 | void setIconColor(QColor color) {
64 | if (mIconColor != color) {
65 | mIconColor = color;
66 | emit iconColorChanged();
67 | }
68 | }
69 |
70 | void setWindow(QWindow *window) {
71 | if (mWindow != window) {
72 | mWindow = window;
73 | emit windowChanged();
74 | update();
75 | }
76 | }
77 |
78 | signals:
79 | void backgroundColorChanged();
80 | void textColorChanged();
81 | void iconColorChanged();
82 | void windowChanged();
83 |
84 | private:
85 | QColor mBackgroundColor;
86 | QColor mTextColor;
87 | QColor mIconColor;
88 | QWindow *mWindow;
89 | };
90 |
91 | #endif // WINDOWDECORATIONS_H
92 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/screensaver/screensaver.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2014-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #include
28 | #include
29 |
30 | #include "screensaver.h"
31 | #include "sessionmanager/sessionmanager.h"
32 |
33 | Q_LOGGING_CATEGORY(SCREENSAVER, "hawaii.screensaver")
34 |
35 | ScreenSaver::ScreenSaver(QObject *parent)
36 | : QObject(parent)
37 | , m_active(false)
38 | , m_sessionManager(qobject_cast(parent))
39 | {
40 | }
41 |
42 | ScreenSaver::~ScreenSaver()
43 | {
44 | }
45 |
46 | bool ScreenSaver::GetActive()
47 | {
48 | return m_active;
49 | }
50 |
51 | bool ScreenSaver::SetActive(bool state)
52 | {
53 | if (state) {
54 | Lock();
55 | return true;
56 | }
57 |
58 | return false;
59 | }
60 |
61 | uint ScreenSaver::GetActiveTime()
62 | {
63 | return 0;
64 | }
65 |
66 | uint ScreenSaver::GetSessionIdleTime()
67 | {
68 | return 0;
69 | }
70 |
71 | void ScreenSaver::SimulateUserActivity()
72 | {
73 | }
74 |
75 | uint ScreenSaver::Inhibit(const QString &appName, const QString &reason)
76 | {
77 | Q_UNUSED(appName)
78 | Q_UNUSED(reason)
79 |
80 | static uint cookieSeed = 0;
81 | int newCookie = cookieSeed++;
82 |
83 | Q_EMIT m_sessionManager->idleInhibitRequested();
84 |
85 | return newCookie;
86 | }
87 |
88 | void ScreenSaver::UnInhibit(uint cookie)
89 | {
90 | Q_UNUSED(cookie)
91 |
92 | m_sessionManager->idleUninhibitRequested();
93 | }
94 |
95 | void ScreenSaver::Lock()
96 | {
97 | //SessionManager::instance()->setLocked(true);
98 | }
99 |
100 | uint ScreenSaver::Throttle(const QString &appName, const QString &reason)
101 | {
102 | // TODO:
103 | Q_UNUSED(appName);
104 | Q_UNUSED(reason);
105 | return 0;
106 | }
107 |
108 | void ScreenSaver::UnThrottle(uint cookie)
109 | {
110 | // TODO:
111 | Q_UNUSED(cookie);
112 | }
113 |
114 | #include "moc_screensaver.cpp"
115 |
--------------------------------------------------------------------------------
/cmake/GetGitRevision.cmake:
--------------------------------------------------------------------------------
1 | #=============================================================================
2 | # Copyright (C) 2012-2016 Pier Luigi Fiorini
3 | # All rights reserved.
4 | #
5 | # Redistribution and use in source and binary forms, with or without
6 | # modification, are permitted provided that the following conditions
7 | # are met:
8 | #
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | #
12 | # * Redistributions in binary form must reproduce the above copyright
13 | # notice, this list of conditions and the following disclaimer in the
14 | # documentation and/or other materials provided with the distribution.
15 | #
16 | # * Neither the name of Pier Luigi Fiorini nor the names of his
17 | # contributors may be used to endorse or promote products derived
18 | # from this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | #=============================================================================
32 |
33 | function(create_git_head_revision_file _file _target)
34 | if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
35 | if(NOT GIT_FOUND)
36 | find_package(Git QUIET)
37 | endif()
38 |
39 | add_custom_target(gitsha1-${_target}
40 | ${CMAKE_COMMAND} -E remove -f ${CMAKE_CURRENT_BINARY_DIR}/${_file}
41 | COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/headers/${_file}.in ${CMAKE_CURRENT_BINARY_DIR}/${_file}
42 | COMMAND "${GIT_EXECUTABLE}" rev-parse HEAD >> ${CMAKE_CURRENT_BINARY_DIR}/${_file}
43 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
44 | VERBATIM)
45 | add_dependencies(${_target} gitsha1-${_target})
46 | else()
47 | add_custom_target(gitsha1-${_target}
48 | ${CMAKE_COMMAND} -E remove -f ${CMAKE_CURRENT_BINARY_DIR}/${_file}
49 | COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/headers/${_file}.in ${CMAKE_CURRENT_BINARY_DIR}/${_file}
50 | COMMAND echo tarball >> ${CMAKE_CURRENT_BINARY_DIR}/${_file}
51 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
52 | VERBATIM)
53 | add_dependencies(${_target} gitsha1-${_target})
54 | endif()
55 | endfunction()
56 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/powermanager/upowerpowerbackend.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii Shell.
3 | *
4 | * Copyright (C) 2013-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #include
28 | #include
29 |
30 | #include "upowerpowerbackend.h"
31 |
32 | #define UPOWER_SERVICE QStringLiteral("org.freedesktop.UPower")
33 | #define UPOWER_PATH QStringLiteral("/org/freedesktop/UPower")
34 | #define UPOWER_OBJECT QStringLiteral("org.freedesktop.UPower")
35 |
36 | QString UPowerPowerBackend::service()
37 | {
38 | return UPOWER_SERVICE;
39 | }
40 |
41 | UPowerPowerBackend::UPowerPowerBackend()
42 | {
43 | m_interface = new QDBusInterface(UPOWER_SERVICE, UPOWER_PATH,
44 | UPOWER_OBJECT, QDBusConnection::systemBus());
45 | }
46 |
47 | UPowerPowerBackend::~UPowerPowerBackend()
48 | {
49 | m_interface->deleteLater();
50 | }
51 |
52 | QString UPowerPowerBackend::name() const
53 | {
54 | return QStringLiteral("upower");
55 | }
56 |
57 | PowerManager::Capabilities UPowerPowerBackend::capabilities() const
58 | {
59 | PowerManager::Capabilities caps = PowerManager::None;
60 |
61 | QDBusReply reply;
62 |
63 | reply = m_interface->call(QStringLiteral("SuspendAllowed"));
64 | if (reply.isValid() && reply.value() == QStringLiteral("yes"))
65 | caps |= PowerManager::Suspend;
66 |
67 | reply = m_interface->call(QStringLiteral("HibernateAllowed"));
68 | if (reply.isValid() && reply.value() == QStringLiteral("yes"))
69 | caps |= PowerManager::Hibernate;
70 |
71 | return caps;
72 | }
73 |
74 | void UPowerPowerBackend::powerOff()
75 | {
76 | QProcess::execute(QStringLiteral("/sbin/poweroff"));
77 | }
78 |
79 | void UPowerPowerBackend::restart()
80 | {
81 | QProcess::execute(QStringLiteral("/sbin/reboot"));
82 | }
83 |
84 | void UPowerPowerBackend::suspend()
85 | {
86 | m_interface->call(QStringLiteral("Suspend"));
87 | }
88 |
89 | void UPowerPowerBackend::hibernate()
90 | {
91 | m_interface->call(QStringLiteral("Hibernate"));
92 | }
93 |
94 | void UPowerPowerBackend::hybridSleep()
95 | {
96 | }
97 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/authenticator.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #include "authenticator.h"
28 |
29 | #include
30 | #include
31 | #include
32 |
33 | Authenticator::Authenticator(QObject *parent)
34 | : QObject(parent)
35 | , m_response(Q_NULLPTR)
36 | {
37 | }
38 |
39 | Authenticator::~Authenticator()
40 | {
41 | }
42 |
43 | void Authenticator::authenticate(const QString &password)
44 | {
45 | const pam_conv conversation = { conversationHandler, this };
46 | pam_handle_t *handle = Q_NULLPTR;
47 |
48 | passwd *pwd = getpwuid(getuid());
49 | if (!pwd) {
50 | Q_EMIT authenticationError();
51 | return;
52 | }
53 |
54 | int retval = pam_start("su", pwd->pw_name, &conversation, &handle);
55 | if (retval != PAM_SUCCESS) {
56 | qWarning("pam_start returned %d", retval);
57 | Q_EMIT authenticationError();
58 | return;
59 | }
60 |
61 | m_response = new pam_response;
62 | m_response[0].resp = strdup(qPrintable(password));
63 | m_response[0].resp_retcode = 0;
64 |
65 | retval = pam_authenticate(handle, 0);
66 | if (retval != PAM_SUCCESS) {
67 | if (retval == PAM_AUTH_ERR) {
68 | Q_EMIT authenticationFailed();
69 | } else {
70 | qWarning("pam_authenticate returned %d", retval);
71 | Q_EMIT authenticationError();
72 | }
73 |
74 | return;
75 | }
76 |
77 | retval = pam_end(handle, retval);
78 | if (retval != PAM_SUCCESS) {
79 | qWarning("pam_end returned %d", retval);
80 | Q_EMIT authenticationError();
81 | return;
82 | }
83 |
84 | Q_EMIT authenticationSucceded();
85 | }
86 |
87 | int Authenticator::conversationHandler(int num, const pam_message **message,
88 | pam_response **response, void *data)
89 | {
90 | Q_UNUSED(num);
91 | Q_UNUSED(message);
92 |
93 | Authenticator *self = static_cast(data);
94 | *response = self->m_response;
95 | return PAM_SUCCESS;
96 | }
97 |
98 | #include "moc_authenticator.cpp"
99 |
--------------------------------------------------------------------------------
/compositor/sessionmanager/loginmanager/loginmanager.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * This file is part of Hawaii.
3 | *
4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini
5 | *
6 | * Author(s):
7 | * Pier Luigi Fiorini
8 | *
9 | * $BEGIN_LICENSE:GPL2+$
10 | *
11 | * This program is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program. If not, see .
23 | *
24 | * $END_LICENSE$
25 | ***************************************************************************/
26 |
27 | #include "fakebackend.h"
28 | #include "loginmanager.h"
29 | #include "logindbackend.h"
30 |
31 | Q_LOGGING_CATEGORY(LOGINMANAGER, "hawaii.loginmanager")
32 |
33 | LoginManager::LoginManager(SessionManager *sm, QObject *parent)
34 | : QObject(parent)
35 | {
36 | // Create backend
37 | m_backend = LogindBackend::create(sm);
38 | if (!m_backend)
39 | m_backend = FakeBackend::create();
40 | qCDebug(LOGINMANAGER) << "Using" << m_backend->name() << "login manager backend";
41 |
42 | // Relay backend signals
43 | connect(m_backend, SIGNAL(logOutRequested()),
44 | this, SIGNAL(logOutRequested()));
45 | connect(m_backend, SIGNAL(sessionLocked()),
46 | this, SIGNAL(sessionLocked()));
47 | connect(m_backend, SIGNAL(sessionUnlocked()),
48 | this, SIGNAL(sessionUnlocked()));
49 | }
50 |
51 | LoginManager::~LoginManager()
52 | {
53 | if (m_backend)
54 | m_backend->deleteLater();
55 | }
56 |
57 | void LoginManager::setIdle(bool value)
58 | {
59 | m_backend->setIdle(value);
60 | }
61 |
62 | void LoginManager::takeControl()
63 | {
64 | m_backend->takeControl();
65 | }
66 |
67 | void LoginManager::releaseControl()
68 | {
69 | m_backend->releaseControl();
70 | }
71 |
72 | int LoginManager::takeDevice(const QString &path)
73 | {
74 | return m_backend->takeDevice(path);
75 | }
76 |
77 | void LoginManager::releaseDevice(int fd)
78 | {
79 | m_backend->releaseDevice(fd);
80 | }
81 |
82 | void LoginManager::lockSession()
83 | {
84 | m_backend->lockSession();
85 | }
86 |
87 | void LoginManager::unlockSession()
88 | {
89 | m_backend->unlockSession();
90 | }
91 |
92 | void LoginManager::switchToVt(int index)
93 | {
94 | m_backend->switchToVt(index);
95 | }
96 |
97 | void LoginManager::locked()
98 | {
99 | m_backend->locked();
100 | }
101 |
102 | void LoginManager::unlocked()
103 | {
104 | m_backend->unlocked();
105 | }
106 |
107 | #include "moc_loginmanager.cpp"
108 |
--------------------------------------------------------------------------------