├── .gitignore ├── .travis.yml ├── CMakeLists.txt ├── docs ├── CNAME ├── COPYING ├── COPYING.LIB ├── ChangeLog.md ├── LICENSE ├── README.md ├── _config.yml ├── _layouts │ └── default.html ├── assets │ └── images │ │ └── sprite_download.png └── images │ ├── screenshot-01.jpg │ ├── screenshot-02.jpg │ ├── screenshot-03.jpg │ ├── screenshot-04.jpg │ ├── screenshot-05.jpg │ ├── screenshot-06.jpg │ ├── screenshot-07.jpg │ ├── screenshot-08.jpg │ ├── screenshot-09.jpg │ └── screenshot-10.jpg ├── share ├── applications │ ├── settings-x11.desktop.in │ └── settings.desktop.in ├── autostart │ ├── org.dracolinux.Power.desktop.in │ └── org.dracolinux.Storage.desktop.in ├── cmake │ └── FindXCB.cmake ├── daemon │ ├── conf.in │ └── service.in ├── obs │ ├── _service │ └── draco.spec ├── share.qrc ├── slackware │ ├── doinst.sh │ ├── draco.SlackBuild │ ├── git.SlackBuild │ ├── slack-desc │ └── slack-required ├── theme │ ├── draco.qss │ ├── gtkrc-2.0 │ ├── qt5ct.conf │ ├── rc.xml │ └── settings.ini ├── xinit │ └── xinitrc.draco └── xsessions │ └── draco.desktop └── src ├── desktop ├── AppMenu.cpp ├── AppMenu.h ├── LDesktop.cpp ├── LDesktop.h ├── LDesktopBackground.cpp ├── LDesktopBackground.h ├── LDesktopPluginSpace.cpp ├── LDesktopPluginSpace.h ├── LPanel.cpp ├── LPanel.h ├── LSession.cpp ├── LSession.h ├── LWinInfo.cpp ├── LWinInfo.h ├── LXcbEventFilter.cpp ├── LXcbEventFilter.h ├── SystemWindow.cpp ├── SystemWindow.h ├── SystemWindow.ui ├── defaults │ ├── draco-desktop.jpg │ └── draco-logo.png ├── desktop-plugins │ ├── LDPlugin.cpp │ ├── LDPlugin.h │ ├── NewDP.h │ └── applauncher │ │ ├── AppLauncherPlugin.cpp │ │ ├── AppLauncherPlugin.h │ │ └── OutlineToolButton.h ├── desktop.qrc ├── logo.qrc ├── main.cpp └── panel-plugins │ ├── LPPlugin.h │ ├── LTBWidget.h │ ├── NewPP.h │ ├── RotateToolButton.h │ ├── applauncher │ ├── AppLaunchButton.cpp │ └── AppLaunchButton.h │ ├── appmenu │ ├── LAppMenuPlugin.cpp │ └── LAppMenuPlugin.h │ ├── clock │ ├── LClock.cpp │ └── LClock.h │ ├── desktopswitcher │ ├── LDesktopSwitcher.cpp │ └── LDesktopSwitcher.h │ ├── line │ └── LLine.h │ ├── showdesktop │ ├── LHomeButton.cpp │ └── LHomeButton.h │ ├── spacer │ └── LSpacer.h │ ├── systemtray │ ├── LSysTray.cpp │ ├── LSysTray.h │ ├── TrayIcon.cpp │ └── TrayIcon.h │ └── taskmanager │ ├── LTaskButton.cpp │ ├── LTaskButton.h │ ├── LTaskManagerPlugin.cpp │ └── LTaskManagerPlugin.h ├── lib ├── draco.cpp ├── draco.h ├── hotkey │ ├── qhotkey.cpp │ ├── qhotkey.h │ ├── qhotkey_p.h │ └── qhotkey_x11.cpp ├── keyboard_common.h ├── lumina │ ├── AppDialog.h │ ├── AppDialog.ui │ ├── DesktopSettings.cpp │ ├── DesktopSettings.h │ ├── LDesktopUtils.cpp │ ├── LDesktopUtils.h │ ├── LFileInfo.cpp │ ├── LFileInfo.h │ ├── LIconCache.cpp │ ├── LIconCache.h │ ├── LInputDevice.cpp │ ├── LInputDevice.h │ ├── LUtils.cpp │ ├── LUtils.h │ ├── LuminaRandR-X11.cpp │ ├── LuminaRandR.h │ ├── LuminaX11.cpp │ ├── LuminaX11.h │ ├── LuminaXDG.cpp │ ├── LuminaXDG.h │ ├── ResizeMenu.cpp │ ├── ResizeMenu.h │ ├── XDGMime.cpp │ └── XDGMime.h ├── org.dracolinux.Disks.cpp ├── org.dracolinux.Disks.h ├── org.dracolinux.Power.Client.cpp ├── org.dracolinux.Power.Client.h ├── org.dracolinux.Power.Device.cpp ├── org.dracolinux.Power.Device.h ├── org.dracolinux.Power.HotPlugX11.cpp ├── org.dracolinux.Power.HotPlugX11.h ├── org.dracolinux.Power.Manager.cpp ├── org.dracolinux.Power.Manager.h ├── org.dracolinux.Power.ScreenX11.cpp ├── org.dracolinux.Power.ScreenX11.h ├── org.dracolinux.Power.Settings.cpp ├── org.dracolinux.Power.Settings.h ├── org.dracolinux.Power.SettingsWidget.cpp ├── org.dracolinux.Power.SettingsWidget.h ├── org.dracolinux.Powerd.Manager.Backlight.cpp ├── org.dracolinux.Powerd.Manager.Backlight.h ├── org.dracolinux.Powerd.Manager.CPU.cpp ├── org.dracolinux.Powerd.Manager.CPU.h ├── org.dracolinux.Powerd.Manager.RTC.cpp ├── org.dracolinux.Powerd.Manager.RTC.h ├── org.dracolinux.Powerd.Manager.cpp ├── org.dracolinux.Powerd.Manager.h ├── org.freedesktop.PowerManagement.cpp ├── org.freedesktop.PowerManagement.h ├── org.freedesktop.ScreenSaver.cpp ├── org.freedesktop.ScreenSaver.h ├── org.freedesktop.UDisks2.cpp ├── org.freedesktop.UDisks2.h ├── power_def.h ├── powerkit_theme.cpp ├── powerkit_theme.h └── qtcopydialog │ ├── qtcopydialog.cpp │ ├── qtcopydialog.h │ ├── qtcopydialog.ui │ ├── qtfilecopier.cpp │ ├── qtfilecopier.h │ ├── qtotherdialog.ui │ └── qtoverwritedialog.ui ├── power ├── org.dracolinux.Power.Tray.cpp ├── org.dracolinux.Power.Tray.h ├── org.dracolinux.Power.cpp └── org.dracolinux.Powerd.cpp ├── session ├── main.cpp ├── session.cpp ├── session.h └── xdg.cpp ├── settings ├── config │ ├── GetPluginDialog.cpp │ ├── GetPluginDialog.h │ ├── GetPluginDialog.ui │ ├── LPlugins.cpp │ ├── LPlugins.h │ ├── PanelWidget.cpp │ ├── PanelWidget.h │ ├── PanelWidget.ui │ ├── hooks.txt │ ├── main.cpp │ ├── mainWindow.cpp │ ├── mainWindow.h │ ├── mainWindow.ui │ └── pages │ │ ├── PageWidget.h │ │ ├── getPage.cpp │ │ ├── getPage.h │ │ ├── page_autostart.cpp │ │ ├── page_autostart.h │ │ ├── page_autostart.ui │ │ ├── page_defaultapps.cpp │ │ ├── page_defaultapps.h │ │ ├── page_defaultapps.ui │ │ ├── page_interface_panels.cpp │ │ ├── page_interface_panels.h │ │ ├── page_interface_panels.ui │ │ ├── page_keyboard.cpp │ │ ├── page_keyboard.h │ │ ├── page_keyboard.ui │ │ ├── page_main.cpp │ │ ├── page_main.h │ │ ├── page_main.ui │ │ ├── page_power.cpp │ │ ├── page_power.h │ │ ├── page_power.ui │ │ ├── page_session_locale.cpp │ │ ├── page_session_locale.h │ │ ├── page_session_locale.ui │ │ ├── page_session_options.cpp │ │ ├── page_session_options.h │ │ ├── page_session_options.ui │ │ ├── page_wallpaper.cpp │ │ ├── page_wallpaper.h │ │ └── page_wallpaper.ui └── xconf │ ├── MainUI.cpp │ ├── MainUI.h │ ├── MainUI.ui │ ├── ScreenSettings.cpp │ ├── ScreenSettings.h │ ├── lumina-xconfig.1 │ └── main.cpp └── storage ├── org.dracolinux.Storage.Tray.cpp ├── org.dracolinux.Storage.Tray.h └── org.dracolinux.Storage.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | *.user* 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | sudo: required 3 | dist: xenial 4 | compiler: 5 | - clang 6 | - g++ 7 | 8 | before_install: 9 | - sudo apt-get update 10 | 11 | install: 12 | - sudo apt-get install tree build-essential cmake pkg-config qtbase5-dev libqt5x11extras5-dev libx11-dev libxss-dev libxdamage-dev libxrandr-dev libxfixes-dev libxcb1-dev libx11-xcb-dev libxcb-randr0-dev libxcb-ewmh-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-composite0-dev libxcb-damage0-dev libxcb-util0-dev libxcb-shm0-dev openbox-dev 13 | 14 | script: 15 | - export CWD=`pwd` 16 | - mkdir $CWD/build-release 17 | - cd $CWD/build-release 18 | - cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib64 -DCMAKE_INSTALL_LIBEXECDIR=bin -DCMAKE_BUILD_TYPE=Release .. 19 | - make 20 | - make DESTDIR=`pwd`/pkg install 21 | - tree pkg 22 | - mkdir $CWD/build-debug 23 | - cd $CWD/build-debug 24 | - cmake -DCMAKE_BUILD_TYPE=Debug .. 25 | - make 26 | 27 | -------------------------------------------------------------------------------- /docs/CNAME: -------------------------------------------------------------------------------- 1 | www.dracolinux.org -------------------------------------------------------------------------------- /docs/ChangeLog.md: -------------------------------------------------------------------------------- 1 | # Draco 0.9.1 (TBA) 2 | 3 | This is a feature and patch release. 4 | 5 | - Fixed keyboard layout detection 6 | - Fixed autostart settings/launcher 7 | - Added ``--version`` to ``start-draco`` 8 | - Fixed storage detection on the desktop for Ubuntu and compatible 9 | - Added new power management tray 10 | - Added support for Intel ``pstate`` 11 | 12 | # Draco 0.9.0 (20190522) 13 | 14 | First stable release. 15 | 16 | ## Changes since RC2 17 | 18 | - Added support for display hotplug *(not enabled as default)* 19 | 20 | # Draco 0.9.0 RC 2 (20190518) 21 | 22 | Second release candidate from the 0.9 branch. 23 | 24 | ## Changes since RC 1 25 | 26 | - Build on Slackware 14.2 27 | - Power had wrong default setting for disableLidOnExternalMonitors 28 | - Show power settings from system tray 29 | - Allow only one instance of settings 30 | 31 | # Draco 0.9.0 RC 1 (20190515) 32 | 33 | First public *(pre-release)* version of the Draco Desktop Environment. Forked from Lumina in January 2019, Draco aims to create a small and stable desktop environment that confirms to the XDG and freedesktop.org specifications. Draco is developed on and for Slackware Linux, but should work on any modern distribution. 34 | 35 | ## Changes compared to Lumina 1.5.0 36 | 37 | - Stripped-down, includes only essential desktop features 38 | - Improved XDG support 39 | - Includes many bug fixes 40 | - Uses Openbox as window manager *(better standards and desktop support)* 41 | - Power management *(Draco has merged with ``powerkit``)* 42 | - Storage management *(Draco includes several features taken from ``qtfm``)* 43 | - freedesktop.org integration 44 | - UPower 45 | - UDisks2 46 | - ConsoleKit/logind 47 | - ScreenSaver 48 | - PowerManagement 49 | - Improved Linux support 50 | - Improved display detection 51 | - The theme engine has been removed in favor of using *(upstream)* ``qt5ct`` 52 | - CMake support 53 | - Internal hotkey support *(does not depend on WM for shortcuts)* 54 | - Desktop has proper file copy support on drag-and-drop 55 | - GTK icon theme and font integration 56 | 57 | There is still a lot to do ... some features may still be under development. 58 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate 2 | title: Draco 3 | description: Desktop Environment 4 | show_downloads: false 5 | github: 6 | zip_url: https://sourceforge.net/projects/draco/files/live/draco-live-20190522.iso/download 7 | tar_url: https://github.com/rodlie/draco/archive/0.9.0/draco-0.9.0.tar.gz 8 | -------------------------------------------------------------------------------- /docs/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {% seo %} 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 | {% if site.github.is_project_page %} 19 | View on GitHub 20 | {% endif %} 21 | 22 |
23 |

{{ site.title | default: site.github.repository_name }}

24 |

{{ site.description | default: site.github.project_tagline }}

25 |
26 | 27 | {% if site.show_downloads %} 28 |
29 | Download this project as a .zip file 30 | Download this project as a tar.gz file 31 |
32 | {% endif %} 33 |
34 |
35 | 36 | 37 |
38 |
39 | {{ content }} 40 |
41 |
42 | 43 | 44 | 52 | 53 | {% if site.google_analytics %} 54 | 62 | {% endif %} 63 | 64 | 65 | -------------------------------------------------------------------------------- /docs/assets/images/sprite_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodlie/draco/a5dbb30d8cc16dcb76e74f386287ad218597596c/docs/assets/images/sprite_download.png -------------------------------------------------------------------------------- /docs/images/screenshot-01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodlie/draco/a5dbb30d8cc16dcb76e74f386287ad218597596c/docs/images/screenshot-01.jpg -------------------------------------------------------------------------------- /docs/images/screenshot-02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodlie/draco/a5dbb30d8cc16dcb76e74f386287ad218597596c/docs/images/screenshot-02.jpg -------------------------------------------------------------------------------- /docs/images/screenshot-03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodlie/draco/a5dbb30d8cc16dcb76e74f386287ad218597596c/docs/images/screenshot-03.jpg -------------------------------------------------------------------------------- /docs/images/screenshot-04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodlie/draco/a5dbb30d8cc16dcb76e74f386287ad218597596c/docs/images/screenshot-04.jpg -------------------------------------------------------------------------------- /docs/images/screenshot-05.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodlie/draco/a5dbb30d8cc16dcb76e74f386287ad218597596c/docs/images/screenshot-05.jpg -------------------------------------------------------------------------------- /docs/images/screenshot-06.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodlie/draco/a5dbb30d8cc16dcb76e74f386287ad218597596c/docs/images/screenshot-06.jpg -------------------------------------------------------------------------------- /docs/images/screenshot-07.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodlie/draco/a5dbb30d8cc16dcb76e74f386287ad218597596c/docs/images/screenshot-07.jpg -------------------------------------------------------------------------------- /docs/images/screenshot-08.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodlie/draco/a5dbb30d8cc16dcb76e74f386287ad218597596c/docs/images/screenshot-08.jpg -------------------------------------------------------------------------------- /docs/images/screenshot-09.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodlie/draco/a5dbb30d8cc16dcb76e74f386287ad218597596c/docs/images/screenshot-09.jpg -------------------------------------------------------------------------------- /docs/images/screenshot-10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodlie/draco/a5dbb30d8cc16dcb76e74f386287ad218597596c/docs/images/screenshot-10.jpg -------------------------------------------------------------------------------- /share/applications/settings-x11.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Exec=@PROJECT_NAME@-settings-x11 3 | Icon=video-display 4 | Terminal=false 5 | Type=Application 6 | StartupNotify=false 7 | Categories=Settings; 8 | Name=Monitor Settings 9 | OnlyShowIn=Draco; 10 | 11 | -------------------------------------------------------------------------------- /share/applications/settings.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Exec=@PROJECT_NAME@-settings 3 | Icon=preferences-desktop 4 | Terminal=false 5 | Type=Application 6 | StartupNotify=false 7 | Categories=Settings; 8 | Name=Desktop 9 | OnlyShowIn=Draco; 10 | 11 | [Desktop Action applications] 12 | Name=Default Applications 13 | Icon=preferences-desktop-default-applications 14 | Exec=@PROJECT_NAME@-settings --page defaultapps 15 | 16 | [Desktop Action session] 17 | Name=General Settings 18 | Icon=preferences-system 19 | Exec=@PROJECT_NAME@-settings --page session-options 20 | 21 | [Desktop Action panels] 22 | Name=Panels Settings 23 | Icon=preferences-desktop-display 24 | Exec=@PROJECT_NAME@-settings --page interface-panel 25 | 26 | [Desktop Action wallpaper] 27 | Name=Wallpaper Settings 28 | Icon=preferences-desktop-wallpaper 29 | Exec=@PROJECT_NAME@-settings --page wallpaper 30 | 31 | [Desktop Action autostart] 32 | Name=Autostart Settings 33 | Icon=applications-other 34 | Exec=@PROJECT_NAME@-settings --page autostart 35 | 36 | [Desktop Action keyboard] 37 | Name=Keyboard Settings 38 | Icon=input-keyboard 39 | Exec=@PROJECT_NAME@-settings --page keyboard 40 | 41 | [Desktop Action power] 42 | Name=Power Settings 43 | Icon=ac-adapter 44 | Exec=@PROJECT_NAME@-settings --page power 45 | 46 | [Desktop Action monitors] 47 | Name=Monitor Settings 48 | Icon=video-display 49 | Exec=@PROJECT_NAME@-settings-x11 50 | 51 | [Desktop Action theme] 52 | Name=Theme Settings 53 | Icon=preferences-desktop-theme 54 | Exec=qt5ct 55 | 56 | -------------------------------------------------------------------------------- /share/autostart/org.dracolinux.Power.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Draco Power Manager 3 | Comment=Draco Power Manager 4 | Icon=ac-adapter 5 | Exec=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/@POWER_SERVICE_NAME@ 6 | Terminal=false 7 | Type=Application 8 | OnlyShowIn=Draco 9 | StartupNotify=false 10 | -------------------------------------------------------------------------------- /share/autostart/org.dracolinux.Storage.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Draco Storage Manager 3 | Comment=Draco Storage Manager 4 | Icon=drive-removable-media 5 | Exec=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/@STORAGE_SERVICE_NAME@ 6 | Terminal=false 7 | Type=Application 8 | OnlyShowIn=Draco 9 | StartupNotify=false 10 | -------------------------------------------------------------------------------- /share/cmake/FindXCB.cmake: -------------------------------------------------------------------------------- 1 | # - FindXCB 2 | # Modified for Draco 3 | # Copyright 2015 Valve Coporation 4 | 5 | find_package(PkgConfig) 6 | 7 | #option(USE_XINPUT "Use xcb-xinput" OFF) 8 | if(NOT XCB_FIND_COMPONENTS) 9 | set(XCB_FIND_COMPONENTS 10 | xcb 11 | xcb-util 12 | xcb-randr 13 | xcb-ewmh 14 | xcb-icccm 15 | xcb-image 16 | xcb-composite 17 | xcb-damage 18 | xcb-shm 19 | ) 20 | # if(USE_XINPUT) 21 | # message("-- Using XINPUT") 22 | # set(XCB_FIND_COMPONENTS "${XCB_FIND_COMPONENTS};xcb-xinput") 23 | # endif() 24 | endif() 25 | #message("-- Find XCB Components: ${XCB_FIND_COMPONENTS}") 26 | 27 | include(FindPackageHandleStandardArgs) 28 | set(XCB_FOUND true) 29 | set(XCB_INCLUDE_DIRS "") 30 | set(XCB_LIBRARIES "") 31 | foreach(comp ${XCB_FIND_COMPONENTS}) 32 | # component name 33 | string(TOUPPER ${comp} compname) 34 | string(REPLACE "-" "_" compname ${compname}) 35 | # header name 36 | string(REPLACE "xcb-" "" headername xcb/${comp}.h) 37 | # library name 38 | set(libname ${comp}) 39 | # fixes 40 | if(comp STREQUAL "xcb-ewmh" OR 41 | comp STREQUAL "xcb-icccm" OR 42 | comp STREQUAL "xcb-image" OR 43 | comp STREQUAL "xcb-util") 44 | string(REPLACE "-" "_" headername xcb/${comp}.h) 45 | endif() 46 | 47 | # message("check for ${comp} ${compname} ${headername} ${libname}") 48 | 49 | pkg_check_modules(PC_${comp} QUIET ${comp}) 50 | 51 | find_path(${compname}_INCLUDE_DIR NAMES ${headername} 52 | HINTS 53 | ${PC_${comp}_INCLUDEDIR} 54 | ${PC_${comp}_INCLUDE_DIRS} 55 | ) 56 | 57 | find_library(${compname}_LIBRARY NAMES ${libname} 58 | HINTS 59 | ${PC_${comp}_LIBDIR} 60 | ${PC_${comp}_LIBRARY_DIRS} 61 | ) 62 | 63 | find_package_handle_standard_args(${comp} 64 | FOUND_VAR ${comp}_FOUND 65 | REQUIRED_VARS ${compname}_INCLUDE_DIR ${compname}_LIBRARY) 66 | mark_as_advanced(${compname}_INCLUDE_DIR ${compname}_LIBRARY) 67 | 68 | list(APPEND XCB_INCLUDE_DIRS ${${compname}_INCLUDE_DIR}) 69 | list(APPEND XCB_LIBRARIES ${${compname}_LIBRARY}) 70 | 71 | if(NOT ${comp}_FOUND) 72 | set(XCB_FOUND false) 73 | endif() 74 | endforeach() 75 | 76 | list(REMOVE_DUPLICATES XCB_INCLUDE_DIRS) 77 | -------------------------------------------------------------------------------- /share/daemon/conf.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /share/daemon/service.in: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=@POWERD_SERVICE_NAME@ 3 | Exec=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/@POWERD_SERVICE_NAME@ 4 | User=@POWERD_SERVICE_USER@ 5 | -------------------------------------------------------------------------------- /share/obs/_service: -------------------------------------------------------------------------------- 1 | 2 | 3 | git 4 | git://github.com/rodlie/draco.git 5 | @PARENT_TAG@.@TAG_OFFSET@ 6 | master 7 | draco 8 | share/obs/draco.spec 9 | 10 | 11 | *.tar 12 | */obs/*.spec 13 | 14 | 15 | *.tar 16 | gz 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /share/obs/draco.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Name: draco 4 | Version: 0.9 5 | Release: 1%{?dist} 6 | Summary: Draco Desktop Environment 7 | 8 | License: GPL-2.0 9 | URL: https://dracolinux.org 10 | Source0: %{name}-%{version}.tar.gz 11 | 12 | BuildRequires: qt5-qtbase-devel qt5-qtx11extras-devel cmake3 gcc-c++ pkg-config libXScrnSaver-devel libXdamage-devel libXrandr-devel libxcb-devel xcb-util-devel xcb-util-wm-devel xcb-util-image-devel 13 | Requires: xdg-utils shared-mime-info hicolor-icon-theme adwaita-icon-theme openbox xscreensaver qt5ct xorg-x11-xinit upower udisks2 xorg-x11-xkb-utils xorg-x11-server-utils 14 | # where is udisks? (needed for optical media since udisks2 broke this) 15 | 16 | %description 17 | Simple Qt desktop environment. 18 | 19 | %prep 20 | %setup -q 21 | 22 | %build 23 | mkdir build && cd build 24 | cmake3 -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_INSTALL_LIBDIR=%{_lib} -DCMAKE_BUILD_TYPE=Release .. 25 | 26 | %install 27 | cd build 28 | make DESTDIR=%{buildroot} install 29 | 30 | %files 31 | %defattr(-,root,root,-) 32 | %{_sysconfdir}/X11/xinit/xinitrc.draco 33 | %{_sysconfdir}/dbus-1/system.d/org.dracolinux.Powerd.conf 34 | %{_sysconfdir}/xdg/autostart/org.dracolinux.Power.desktop 35 | %{_sysconfdir}/xdg/autostart/org.dracolinux.Storage.desktop 36 | %{_bindir}/draco-settings 37 | %{_bindir}/draco-settings-x11 38 | %{_bindir}/start-draco 39 | %{_docdir}/%{name}-* 40 | %{_libdir}/libDraco.so* 41 | %{_libexecdir}/org.dracolinux.Desktop 42 | %{_libexecdir}/org.dracolinux.Power 43 | %{_libexecdir}/org.dracolinux.Powerd 44 | %{_libexecdir}/org.dracolinux.Storage 45 | %{_libexecdir}/org.dracolinux.XDG 46 | %{_datadir}/applications/draco-settings-x11.desktop 47 | %{_datadir}/applications/draco-settings.desktop 48 | %{_datadir}/dbus-1/system-services/org.dracolinux.Powerd.service 49 | %{_datadir}/xsessions/draco.desktop 50 | 51 | %changelog 52 | -------------------------------------------------------------------------------- /share/share.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | theme/rc.xml 4 | theme/draco.qss 5 | theme/qt5ct.conf 6 | theme/gtkrc-2.0 7 | theme/settings.ini 8 | 9 | 10 | -------------------------------------------------------------------------------- /share/slackware/doinst.sh: -------------------------------------------------------------------------------- 1 | if [ -x /usr/bin/update-desktop-database ]; then 2 | /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 3 | fi 4 | -------------------------------------------------------------------------------- /share/slackware/draco.SlackBuild: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Slackware build script for draco 4 | 5 | # Copyright 2019 Ole-André Rodlie 6 | # All rights reserved. 7 | # 8 | # Redistribution and use of this script, with or without modification, is 9 | # permitted provided that the following conditions are met: 10 | # 11 | # 1. Redistributions of this script must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 15 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 18 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 20 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 22 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | 25 | PRGNAM=draco 26 | VERSION=${VERSION:-0.9.0} 27 | BUILD=${BUILD:-1} 28 | TAG=${TAG:-_SBo} 29 | 30 | if [ -z "$ARCH" ]; then 31 | case "$( uname -m )" in 32 | i?86) ARCH=i586 ;; 33 | arm*) ARCH=arm ;; 34 | *) ARCH=$( uname -m ) ;; 35 | esac 36 | fi 37 | 38 | CWD=$(pwd) 39 | TMP=${TMP:-/tmp/SBo} 40 | PKG=$TMP/package-$PRGNAM 41 | OUTPUT=${OUTPUT:-/tmp} 42 | NUMJOBS=${NUMJOBS:-4} 43 | 44 | if [ "$ARCH" = "i586" ]; then 45 | SLKCFLAGS="-O2 -march=i586 -mtune=i686" 46 | LIBDIRSUFFIX="" 47 | elif [ "$ARCH" = "i686" ]; then 48 | SLKCFLAGS="-O2 -march=i686 -mtune=i686" 49 | LIBDIRSUFFIX="" 50 | elif [ "$ARCH" = "x86_64" ]; then 51 | SLKCFLAGS="-O2 -fPIC" 52 | LIBDIRSUFFIX="64" 53 | else 54 | SLKCFLAGS="-O2" 55 | LIBDIRSUFFIX="" 56 | fi 57 | 58 | set -e -x 59 | 60 | # Prepare source 61 | rm -rf $PKG 62 | mkdir -p $TMP $PKG $OUTPUT 63 | cd $TMP 64 | rm -rf $PRGNAM-$VERSION 65 | tar xf $CWD/$PRGNAM-$VERSION.tar.gz 66 | cd $PRGNAM-$VERSION 67 | chown -R root:root . 68 | find -L . \ 69 | \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ 70 | -o -perm 511 \) -exec chmod 755 {} \; -o \ 71 | \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ 72 | -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; 73 | 74 | # Configure 75 | mkdir build 76 | cd build 77 | cmake \ 78 | -DPOWERD_SERVICE_USER=root \ 79 | -DPOWERD_SERVICE_GROUP=power \ 80 | -DCMAKE_INSTALL_PREFIX=/usr \ 81 | -DCMAKE_INSTALL_LIBDIR=lib${LIBDIRSUFFIX} \ 82 | -DCMAKE_INSTALL_MANDIR=/usr/man \ 83 | -DCMAKE_INSTALL_DOCDIR=/usr/doc \ 84 | -DCMAKE_BUILD_TYPE=Release \ 85 | -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ 86 | -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" .. 87 | 88 | # Build 89 | make -j${NUMJOBS} 90 | 91 | # Install 92 | make DESTDIR=$PKG install 93 | chmod +x $PKG/etc/X11/xinit/xinitrc.draco 94 | 95 | # Strip 96 | find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ 97 | | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true 98 | 99 | # Add SlackBuild 100 | if [ ! -d "$PKG/usr/doc/$PRGNAM-$VERSION" ]; then 101 | mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION 102 | fi 103 | cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild 104 | 105 | # Make package 106 | mkdir -p $PKG/install 107 | cat $CWD/slack-desc > $PKG/install/slack-desc 108 | cat $CWD/doinst.sh > $PKG/install/doinst.sh 109 | 110 | cd $PKG 111 | /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz} 112 | -------------------------------------------------------------------------------- /share/slackware/git.SlackBuild: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Slackware build script for draco 4 | 5 | # Copyright 2019 Ole-André Rodlie 6 | # All rights reserved. 7 | # 8 | # Redistribution and use of this script, with or without modification, is 9 | # permitted provided that the following conditions are met: 10 | # 11 | # 1. Redistributions of this script must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 15 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 18 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 20 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 22 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | 25 | PRGNAM=draco 26 | VERSION=${VERSION:-`printf "%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"`} 27 | BUILD=${BUILD:-1} 28 | TAG=${TAG:-} 29 | 30 | if [ -z "$ARCH" ]; then 31 | case "$( uname -m )" in 32 | i?86) ARCH=i586 ;; 33 | arm*) ARCH=arm ;; 34 | *) ARCH=$( uname -m ) ;; 35 | esac 36 | fi 37 | 38 | CWD=$(pwd) 39 | TMP=${TMP:-/tmp/SBo} 40 | PKG=$TMP/package-$PRGNAM 41 | OUTPUT=${OUTPUT:-/tmp} 42 | NUMJOBS=${NUMJOBS:-4} 43 | 44 | if [ "$ARCH" = "i586" ]; then 45 | SLKCFLAGS="-O2 -march=i586 -mtune=i686" 46 | LIBDIRSUFFIX="" 47 | elif [ "$ARCH" = "i686" ]; then 48 | SLKCFLAGS="-O2 -march=i686 -mtune=i686" 49 | LIBDIRSUFFIX="" 50 | elif [ "$ARCH" = "x86_64" ]; then 51 | SLKCFLAGS="-O2 -fPIC" 52 | LIBDIRSUFFIX="64" 53 | else 54 | SLKCFLAGS="-O2" 55 | LIBDIRSUFFIX="" 56 | fi 57 | 58 | set -e -x 59 | 60 | # Prepare source 61 | rm -rf $PKG 62 | mkdir -p $TMP $PKG $OUTPUT 63 | cd $TMP 64 | rm -rf $PRGNAM-$VERSION 65 | git clone "$CWD/../.." $PRGNAM-$VERSION 66 | cd $PRGNAM-$VERSION 67 | chown -R root:root . 68 | find -L . \ 69 | \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ 70 | -o -perm 511 \) -exec chmod 755 {} \; -o \ 71 | \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ 72 | -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; 73 | 74 | # Configure 75 | mkdir build 76 | cd build 77 | cmake \ 78 | -DPOWERD_SERVICE_USER=root \ 79 | -DPOWERD_SERVICE_GROUP=power \ 80 | -DCMAKE_INSTALL_PREFIX=/usr \ 81 | -DCMAKE_INSTALL_LIBDIR=lib${LIBDIRSUFFIX} \ 82 | -DCMAKE_INSTALL_MANDIR=/usr/man \ 83 | -DCMAKE_INSTALL_DOCDIR=/usr/doc \ 84 | -DCMAKE_BUILD_TYPE=Release \ 85 | -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ 86 | -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" .. 87 | 88 | # Build 89 | make -j${NUMJOBS} 90 | 91 | # Install 92 | make DESTDIR=$PKG install 93 | chmod +x $PKG/etc/X11/xinit/xinitrc.draco 94 | 95 | # Strip 96 | find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ 97 | | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true 98 | 99 | # Make package 100 | mkdir -p $PKG/install 101 | cat $CWD/slack-desc > $PKG/install/slack-desc 102 | cat $CWD/doinst.sh > $PKG/install/doinst.sh 103 | 104 | cd $PKG 105 | /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz} 106 | -------------------------------------------------------------------------------- /share/slackware/slack-desc: -------------------------------------------------------------------------------- 1 | # HOW TO EDIT THIS FILE: 2 | # The "handy ruler" below makes it easier to edit a package description. 3 | # Line up the first '|' above the ':' following the base package name, and 4 | # the '|' on the right side marks the last column you can put a character in. 5 | # You must make exactly 11 lines for the formatting to be correct. It's also 6 | # customary to leave one space after the ':' except on otherwise blank lines. 7 | 8 | |-----handy-ruler------------------------------------------------------| 9 | draco: draco (Draco Desktop Environment) 10 | draco: 11 | draco: Draco is a simple and lightweight desktop environment. While small 12 | draco: still features XDG integration, freedesktop services and integration, 13 | draco: power and storage management, desktop, panels, multi-monitor support 14 | draco: and much more. Draco does not include any user applications. 15 | draco: 16 | draco: Draco is developed for and on Slackware by Ole-André Rodlie. 17 | draco: 18 | draco: Homepage: https://github.com/rodlie/draco 19 | draco: 20 | -------------------------------------------------------------------------------- /share/slackware/slack-required: -------------------------------------------------------------------------------- 1 | hicolor-icon-theme 2 | adwaita-icon-theme 3 | xdg-utils 4 | shared-mime-info 5 | setxkbmap 6 | xscreensaver 7 | openbox 8 | upower 9 | ConsoleKit2 10 | udisks 11 | udisks2 12 | dbus 13 | libXScrnSaver 14 | libX11 15 | libXdamage 16 | libXfixes 17 | libXrandr 18 | qt5 19 | qt5ct 20 | libxcb 21 | xcb-util 22 | xcb-util-image 23 | xcb-util-wm 24 | xrandr 25 | xinit 26 | -------------------------------------------------------------------------------- /share/theme/draco.qss: -------------------------------------------------------------------------------- 1 | /* 2 | ** Default style sheet for panels in Draco 3 | */ 4 | 5 | LDPlugin#applauncher 6 | { 7 | background-color: transparent; 8 | border: none; 9 | } 10 | 11 | LDPlugin#applauncher QToolButton, 12 | LDPlugin, 13 | LDPlugin#desktopview QListWidget::item 14 | { 15 | background-color: transparent; 16 | border-width: 3px; 17 | border-style: solid; 18 | border-radius: 5px; 19 | border-color: transparent; 20 | color: white; 21 | } 22 | 23 | LDPlugin#applauncher QToolButton:hover, 24 | LDPlugin#desktopview QListWidget::item:hover 25 | { 26 | background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 1.1, stop: 0.1 palette(highlight), stop: 1 transparent); 27 | color: palette(highlighted-text); 28 | border-width: 3px; 29 | border-style: solid; 30 | border-radius: 5px; 31 | border-top-color: qradialgradient(spread:pad, cx:0.5, cy:1, radius:0.5, fx:0.5, fy:1, stop:0 rgba(0,0,0, 30), stop:0.724868 rgba(0,0,0, 60), stop:1 rgba(0,0,0, 10)); 32 | border-bottom-color: qradialgradient(spread:pad, cx:0.5, cy:0, radius:0.5, fx:0.5, fy:0, stop:0 rgba(0,0,0, 30), stop:0.724868 rgba(0,0,0, 60), stop:1 rgba(0,0,0, 10)); 33 | border-left-color: qradialgradient(spread:pad, cx:1, cy:0.5, radius:0.5, fx:1, fy:0.5, stop:0 rgba(0,0,0, 30), stop:0.724868 rgba(0,0,0, 60), stop:1 rgba(0,0,0, 10)); 34 | border-right-color: qradialgradient(spread:pad, cx:0, cy:0.5, radius:0.5, fx:1, fy:0.5, stop:0 rgba(0,0,0, 30), stop:0.724868 rgba(0,0,0, 60), stop:1 rgba(0,0,0, 10)); 35 | } 36 | 37 | QWidget#LuminaPanelColor 38 | { 39 | background: qradialgradient(spread:reflect, cx:0.113757, cy:0.875, radius:0.7, fx:0.045, fy:0.954545, stop:0 rgba(2, 2, 2, 60), stop:1 rgba(0, 0, 0, 110)); 40 | /*border-radius: 3px;*/ 41 | } 42 | 43 | /* Special taskmanager window buttons: based on window state */ 44 | LTBWidget, 45 | LPanel QToolButton, 46 | QDialog#LeaveDialog QToolButton 47 | { 48 | border: 1px solid transparent; 49 | border-radius: 3px; 50 | background: transparent; 51 | color: white; 52 | } 53 | 54 | QToolButton::menu-indicator, 55 | LTBWidget::menu-indicator { image: none; } /*disable the menu arrow*/ 56 | 57 | LTBWidget#WindowVisible 58 | { 59 | background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 1.1, stop: 0.1 palette(dark), stop: 1 transparent); 60 | } 61 | 62 | LTBWidget#WindowInvisible 63 | { 64 | background: transparent; 65 | color: palette(dark); 66 | } 67 | 68 | LTBWidget#WindowActive 69 | { 70 | /*background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 1.1, stop: 0.1 palette(midlight), stop: 1 transparent);*/ 71 | background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 1.1, stop: 0.1 palette(highlight), stop: 1 transparent); 72 | } 73 | 74 | LTBWidget#WindowAttention 75 | { 76 | background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 1.1, stop: 0.1 palette(highlight), stop: 1 transparent); 77 | } 78 | 79 | LTBWidget:hover, 80 | LTBWidget#WindowVisible:hover, 81 | LTBWidget#WindowInvisible:hover, 82 | LTBWidget#WindowActive:hover, 83 | LTBWidget#WindowAttention:hover, 84 | QToolButton:hover, 85 | QDialog#LeaveDialog QToolButton:hover 86 | { 87 | background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 1.1, stop: 0.1 palette(highlight), stop: 1 transparent); 88 | color: palette(highlighted-text); 89 | border-width: 1px; 90 | border-style: solid; 91 | border-top-color: qradialgradient(spread:pad, cx:0.5, cy:1, radius:0.5, fx:0.5, fy:1, stop:0 rgba(0,0,0, 30), stop:0.724868 rgba(0,0,0, 60), stop:1 rgba(0,0,0, 10)); 92 | border-bottom-color: qradialgradient(spread:pad, cx:0.5, cy:0, radius:0.5, fx:0.5, fy:0, stop:0 rgba(0,0,0, 30), stop:0.724868 rgba(0,0,0, 60), stop:1 rgba(0,0,0, 10)); 93 | border-left-color: qradialgradient(spread:pad, cx:1, cy:0.5, radius:0.5, fx:1, fy:0.5, stop:0 rgba(0,0,0, 30), stop:0.724868 rgba(0,0,0, 60), stop:1 rgba(0,0,0, 10)); 94 | border-right-color: qradialgradient(spread:pad, cx:0, cy:0.5, radius:0.5, fx:1, fy:0.5, stop:0 rgba(0,0,0, 30), stop:0.724868 rgba(0,0,0, 60), stop:1 rgba(0,0,0, 10)); 95 | } 96 | -------------------------------------------------------------------------------- /share/theme/gtkrc-2.0: -------------------------------------------------------------------------------- 1 | gtk-icon-theme-name = "Adwaita" 2 | gtk-theme-name = "Adwaita" 3 | gtk-font-name = "DejaVu Sans 11" 4 | 5 | -------------------------------------------------------------------------------- /share/theme/qt5ct.conf: -------------------------------------------------------------------------------- 1 | [Appearance] 2 | icon_theme=Adwaita 3 | style=Fusion 4 | -------------------------------------------------------------------------------- /share/theme/settings.ini: -------------------------------------------------------------------------------- 1 | [Settings] 2 | gtk-theme-name=Adwaita 3 | gtk-fallback-icon-theme=gnome 4 | gtk-font-name="DejaVu Sans 11" 5 | gtk-button-images=1 6 | gtk-menu-images=1 7 | gtk-xft-antialias=1 8 | gtk-xft-hinting=1 9 | gtk-xft-hintstyle=hintfull 10 | gtk-xft-rgba=none 11 | gtk-icon-theme-name=Adwaita 12 | -------------------------------------------------------------------------------- /share/xinit/xinitrc.draco: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | userresources=$HOME/.Xresources 4 | usermodmap=$HOME/.Xmodmap 5 | sysresources=/etc/X11/xinit/.Xresources 6 | sysmodmap=/etc/X11/xinit/.Xmodmap 7 | 8 | # merge in defaults and keymaps 9 | 10 | if [ -f $sysresources ]; then 11 | xrdb -merge $sysresources 12 | fi 13 | if [ -f $sysmodmap ]; then 14 | xmodmap $sysmodmap 15 | fi 16 | if [ -f $userresources ]; then 17 | xrdb -merge $userresources 18 | fi 19 | if [ -f $usermodmap ]; then 20 | xmodmap $usermodmap 21 | fi 22 | 23 | # Start the window manager: 24 | if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then 25 | exec dbus-launch --exit-with-session ck-launch-session start-draco 26 | else 27 | exec dbus-launch --exit-with-session start-draco 28 | fi 29 | 30 | -------------------------------------------------------------------------------- /share/xsessions/draco.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Exec=start-draco 3 | TryExec=start-draco 4 | Icon=system-run 5 | Type=Application 6 | Name=Draco 7 | Comment=Draco Desktop Environment 8 | -------------------------------------------------------------------------------- /src/desktop/AppMenu.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 2 of the License, or 10 | # (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 General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see 19 | # 20 | # This file incorporates work covered by the following copyright and 21 | # permission notice: 22 | # 23 | # Lumina Desktop Environment (https://lumina-desktop.org) 24 | # Copyright (c) 2012-2017, Ken Moore (moorekou@gmail.com) 25 | # All rights reserved 26 | # 27 | # Redistribution and use in source and binary forms, with or without 28 | # modification, are permitted provided that the following conditions are met: 29 | # * Redistributions of source code must retain the above copyright 30 | # notice, this list of conditions and the following disclaimer. 31 | # * Redistributions in binary form must reproduce the above copyright 32 | # notice, this list of conditions and the following disclaimer in the 33 | # documentation and/or other materials provided with the distribution. 34 | # * Neither the name of the organization nor the 35 | # names of its contributors may be used to endorse or promote products 36 | # derived from this software without specific prior written permission. 37 | # 38 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 39 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 40 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 41 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 42 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 43 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 44 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 45 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 46 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | # 49 | */ 50 | 51 | //=========================================== 52 | // Lumina-DE source code 53 | // Copyright (c) 2014, Ken Moore 54 | // Available under the 3-clause BSD license 55 | //=========================================== 56 | 57 | #ifndef DESKTOP_APP_MENU_H 58 | #define DESKTOP_APP_MENU_H 59 | 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include "LuminaXDG.h" 70 | 71 | class AppMenu : public QMenu 72 | { 73 | Q_OBJECT 74 | 75 | public: 76 | AppMenu(QWidget *parent = Q_NULLPTR); 77 | ~AppMenu(); 78 | 79 | QHash > *currentAppHash(); 80 | QDateTime lastHashUpdate; 81 | 82 | private: 83 | QString appstorelink, controlpanellink; 84 | QList MLIST; 85 | XDGDesktopList *sysApps; 86 | QHash > APPS; 87 | void updateAppList(); //completely update the menu lists 88 | 89 | private slots: 90 | void start(); //This is called in a new thread after initialization 91 | void watcherUpdate(); 92 | void launchApp(QAction *act); 93 | 94 | signals: 95 | void AppMenuUpdated(); 96 | }; 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /src/desktop/LDesktopBackground.cpp: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2016, Henry Hu 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | 8 | #include "LDesktopBackground.h" 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include "LSession.h" 15 | 16 | void LDesktopBackground::paintEvent(QPaintEvent *ev) 17 | { 18 | /* //return; //do nothing - always invisible 19 | if (bgPixmap != NULL) { 20 | //qDebug() << "Wallpaper paint Event:" << ev->rect(); 21 | //QPainter painter(this); 22 | //painter.setBrush(*bgPixmap); 23 | //painter.drawRect(ev->rect().adjusted(-1,-1,2,2)); 24 | }else{ 25 | QWidget::paintEvent(ev); 26 | }*/ 27 | if (bgPixmap == Q_NULLPTR) { QWidget::paintEvent(ev); } 28 | } 29 | 30 | QPixmap LDesktopBackground::setBackground(const QString& bgFile, 31 | const QString& format, 32 | QRect geom) 33 | { 34 | qDebug() << "SET BACKGROUND" << bgFile; 35 | QString imagefile = bgFile; 36 | if (imagefile == QString("default") || (!bgFile.startsWith("rgb(") && !QFile::exists(bgFile))) { 37 | imagefile = QString(":/defaults/draco-desktop.jpg"); 38 | } 39 | //if (bgPixmap != NULL) delete bgPixmap; 40 | QPixmap bgPixmap(geom.size());// = new QPixmap(size()); 41 | 42 | if (bgFile.startsWith("rgb(")) { 43 | QStringList colors = bgFile.section(")",0,0).section("(",1,1).split(","); 44 | QColor color = QColor(colors[0].toInt(), colors[1].toInt(), colors[2].toInt()); 45 | bgPixmap.fill(color); 46 | } else { 47 | bgPixmap.fill(Qt::black); 48 | 49 | // Load the background file and scale 50 | QPixmap bgImage(imagefile); 51 | if (format == "stretch" || format == "full" || format == "fit") { 52 | Qt::AspectRatioMode mode; 53 | if (format == "stretch") { 54 | mode = Qt::IgnoreAspectRatio; 55 | } else if (format == "full") { 56 | mode = Qt::KeepAspectRatioByExpanding; 57 | } else { 58 | mode = Qt::KeepAspectRatio; 59 | } 60 | if (bgImage.height() != geom.height() && bgImage.width() != geom.width()) { bgImage = bgImage.scaled(geom.size(), mode, Qt::SmoothTransformation); } 61 | //bgImage = bgImage.scaled(size(), mode); 62 | } 63 | 64 | // Calculate the offset 65 | int dx = 0, dy = 0; 66 | int drawWidth = bgImage.width(), drawHeight = bgImage.height(); 67 | if (format == "fit" || format == "center" || format == "full") { 68 | dx = (geom.width() - bgImage.width()) / 2; 69 | dy = (geom.height() - bgImage.height()) / 2; 70 | } else if (format == "tile") { 71 | drawWidth = geom.width(); 72 | drawHeight = geom.height(); 73 | } else { 74 | if (format.endsWith("right")) { 75 | dx = geom.width() - bgImage.width(); 76 | } 77 | if (format.startsWith("bottom")) { 78 | dy = geom.height() - bgImage.height(); 79 | } 80 | } 81 | 82 | // Draw the background image 83 | QPainter painter(&bgPixmap); 84 | painter.setBrush(bgImage); 85 | painter.setBrushOrigin(dx, dy); 86 | painter.drawRect(dx, dy, drawWidth, drawHeight); 87 | } 88 | //this->repaint(); //make sure the entire thing gets repainted right away 89 | //LSession::handle()->XCB->paintRoot(geom, &bgPixmap); 90 | return bgPixmap; 91 | //show(); 92 | } 93 | 94 | LDesktopBackground::LDesktopBackground() : QWidget() 95 | { 96 | bgPixmap = Q_NULLPTR; 97 | this->setWindowOpacity(0); 98 | } 99 | 100 | LDesktopBackground::~LDesktopBackground() 101 | { 102 | if (bgPixmap != Q_NULLPTR) { delete bgPixmap; } 103 | } 104 | -------------------------------------------------------------------------------- /src/desktop/LDesktopBackground.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2016, Henry Hu 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | 8 | #ifndef DESKTOP_LDESKTOPBACKGROUND_H 9 | #define DESKTOP_LDESKTOPBACKGROUND_H 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | class LDesktopBackground: public QWidget 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | LDesktopBackground(); 21 | virtual ~LDesktopBackground(); 22 | 23 | virtual void paintEvent(QPaintEvent*); 24 | static QPixmap setBackground(const QString&, 25 | const QString&, 26 | QRect geom); 27 | 28 | private: 29 | QPixmap *bgPixmap; 30 | }; 31 | 32 | #endif // DESKTOP_LDESKTOPBACKGROUND_H 33 | -------------------------------------------------------------------------------- /src/desktop/LWinInfo.cpp: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2014, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | 8 | #include "LWinInfo.h" 9 | 10 | #include 11 | 12 | #include "LSession.h" 13 | 14 | // Information Retrieval 15 | // Don't cache these results because they can change regularly 16 | QString LWinInfo::text() 17 | { 18 | if (window==0) { return ""; } 19 | QString nm = LSession::handle()->XCB->WindowVisibleIconName(window); 20 | if (nm.simplified().isEmpty()) { nm = LSession::handle()->XCB->WindowIconName(window); } 21 | if (nm.simplified().isEmpty()) { nm = LSession::handle()->XCB->WindowVisibleName(window); } 22 | if (nm.simplified().isEmpty()) { nm = LSession::handle()->XCB->WindowName(window); } 23 | if (nm.simplified().isEmpty()) { nm = LSession::handle()->XCB->OldWindowIconName(window); } 24 | if (nm.simplified().isEmpty()) { nm = LSession::handle()->XCB->OldWindowName(window); } 25 | //Make sure that the text is a reasonable size (40 char limit) 26 | //if(nm.length()>40){ nm = nm.left(40)+"..."; } 27 | return nm; 28 | } 29 | 30 | QIcon LWinInfo::icon(bool &noicon) 31 | { 32 | if (window==0) { noicon = true; return QIcon();} 33 | noicon = false; 34 | QIcon ico = LSession::handle()->XCB->WindowIcon(window); 35 | // Check for a null icon, and supply one if necessary 36 | if (ico.isNull()) { ico = LXDG::findIcon( this->Class().toLower(),""); } 37 | if (ico.isNull()) {ico = LXDG::findIcon("preferences-system-windows",""); noicon=true;} 38 | return ico; 39 | } 40 | 41 | QString LWinInfo::Class() 42 | { 43 | return LSession::handle()->XCB->WindowClass(window); 44 | } 45 | 46 | LXCB::WINDOWVISIBILITY LWinInfo::status(bool update) 47 | { 48 | if (window==0) { return LXCB::IGNORE; } 49 | if (update || cstate == LXCB::IGNORE) { 50 | cstate = LSession::handle()->XCB->WindowState(window); 51 | } 52 | return cstate; 53 | } 54 | -------------------------------------------------------------------------------- /src/desktop/LWinInfo.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2014, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | 8 | #ifndef DESKTOP_WINDOW_INFO_H 9 | #define DESKTOP_WINDOW_INFO_H 10 | 11 | // Qt includes 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | // libLumina includes 18 | #include 19 | #include 20 | 21 | // Local includes 22 | //#include "Globals.h" //For the STATES enumeration definition 23 | //#include "LSession.h" 24 | 25 | class LWinInfo 26 | { 27 | private: 28 | WId window; 29 | LXCB::WINDOWVISIBILITY cstate; // current window state 30 | 31 | public: 32 | LWinInfo(WId id = 0) 33 | { 34 | window = id; 35 | cstate = LXCB::IGNORE; // make sure this gets updates with the first "status" call 36 | } 37 | ~LWinInfo(){}; 38 | 39 | // The current window ID 40 | WId windowID() 41 | { 42 | return window; 43 | } 44 | 45 | // Information Retrieval 46 | // Don't cache these results because they can change regularly 47 | QString text(); 48 | QIcon icon(bool &noicon); 49 | QString Class(); 50 | LXCB::WINDOWVISIBILITY status(bool update = false); 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/desktop/LXcbEventFilter.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2012, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | // This class provides the XCB ->Xlib conversion necessary for Qt5 usage 8 | //=========================================== 9 | 10 | #ifndef DESKTOP_XCB_FILTER_H 11 | #define DESKTOP_XCB_FILTER_H 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include "LSession.h" 23 | 24 | /* 25 | List of XCB response types (since almost impossible to find good docs on XCB) 26 | switch (xcb_generic_event_t*->response_type & ~0x80) 27 | case values: 28 | XCB_KEY_[PRESS | RELEASE] 29 | XCB_BUTTON_[PRESS | RELEASE] 30 | XCB_MOTION_NOTIFY 31 | XCB_ENTER_NOTIFY 32 | XCB_LEAVE_NOTIFY 33 | XCB_FOCUS_[IN | OUT] 34 | XCB_KEYMAP_NOTIFY 35 | XCB_EXPOSE 36 | XCB_GRAPHICS_EXPOSURE 37 | XCB_VISIBILITY_NOTIFY 38 | XCB_CREATE_NOTIFY 39 | XCB_DESTROY_NOTIFY 40 | XCB_UNMAP_NOTIFY 41 | XCB_MAP_[NOTIFY | REQUEST] 42 | XCB_REPARENT_NOTIFY 43 | XCB_CONFIGURE_[NOTIFY | REQUEST] 44 | XCB_GRAVITY_NOTIFY 45 | XCB_RESIZE_REQUEST 46 | XCB_CIRCULATE_[NOTIFY | REQUEST] 47 | XCB_PROPERTY_NOTIFY 48 | XCB_SELECTION_[CLEAR | REQUEST | NOTIFY] 49 | XCB_COLORMAP_NOTIFY 50 | XCB_CLIENT_MESSAGE 51 | */ 52 | 53 | // SYSTEM TRAY STANDARD DEFINITIONS 54 | #define SYSTEM_TRAY_REQUEST_DOCK 0 55 | #define SYSTEM_TRAY_BEGIN_MESSAGE 1 56 | #define SYSTEM_TRAY_CANCEL_MESSAGE 2 57 | 58 | class XCBEventFilter : public QAbstractNativeEventFilter 59 | { 60 | private: 61 | LSession *session; 62 | xcb_atom_t _NET_SYSTEM_TRAY_OPCODE; 63 | QList WinNotifyAtoms, SysNotifyAtoms; 64 | int TrayDmgFlag; // internal damage event offset value for the system tray 65 | bool stopping; 66 | 67 | void InitAtoms() 68 | { 69 | // Initialize any special atoms that we need to save/use regularly 70 | // NOTE: All the EWMH atoms are already saved in session->XCB->EWMH 71 | WinNotifyAtoms.clear(); 72 | WinNotifyAtoms << session->XCB->EWMH._NET_WM_NAME \ 73 | << session->XCB->EWMH._NET_WM_VISIBLE_NAME \ 74 | << session->XCB->EWMH._NET_WM_ICON_NAME \ 75 | << session->XCB->EWMH._NET_WM_VISIBLE_ICON_NAME \ 76 | << session->XCB->EWMH._NET_WM_ICON \ 77 | << session->XCB->EWMH._NET_WM_ICON_GEOMETRY; 78 | 79 | SysNotifyAtoms.clear(); 80 | SysNotifyAtoms << session->XCB->EWMH._NET_CLIENT_LIST \ 81 | << session->XCB->EWMH._NET_CLIENT_LIST_STACKING \ 82 | << session->XCB->EWMH._NET_CURRENT_DESKTOP \ 83 | << session->XCB->EWMH._NET_WM_STATE \ 84 | << session->XCB->EWMH._NET_ACTIVE_WINDOW \ 85 | << session->XCB->EWMH._NET_WM_ICON \ 86 | << session->XCB->EWMH._NET_WM_ICON_GEOMETRY; 87 | //_NET_SYSTEM_TRAY_OPCODE 88 | xcb_intern_atom_cookie_t cookie = xcb_intern_atom(QX11Info::connection(), 0, 23,"_NET_SYSTEM_TRAY_OPCODE"); 89 | xcb_intern_atom_reply_t *r = xcb_intern_atom_reply(QX11Info::connection(), cookie, Q_NULLPTR); 90 | if (r) { 91 | _NET_SYSTEM_TRAY_OPCODE = r->atom; 92 | free(r); 93 | } 94 | } 95 | 96 | public: 97 | XCBEventFilter(LSession *sessionhandle); 98 | void setTrayDamageFlag(int flag); 99 | void StopEventHandling(){ stopping = true; } 100 | 101 | // This function format taken directly from the Qt5.3 documentation 102 | virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *) Q_DECL_OVERRIDE; 103 | }; 104 | 105 | #endif 106 | -------------------------------------------------------------------------------- /src/desktop/SystemWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 2 of the License, or 10 | # (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 General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see 19 | # 20 | # This file incorporates work covered by the following copyright and 21 | # permission notice: 22 | # 23 | # Lumina Desktop Environment (https://lumina-desktop.org) 24 | # Copyright (c) 2012-2017, Ken Moore (moorekou@gmail.com) 25 | # All rights reserved 26 | # 27 | # Redistribution and use in source and binary forms, with or without 28 | # modification, are permitted provided that the following conditions are met: 29 | # * Redistributions of source code must retain the above copyright 30 | # notice, this list of conditions and the following disclaimer. 31 | # * Redistributions in binary form must reproduce the above copyright 32 | # notice, this list of conditions and the following disclaimer in the 33 | # documentation and/or other materials provided with the distribution. 34 | # * Neither the name of the organization nor the 35 | # names of its contributors may be used to endorse or promote products 36 | # derived from this software without specific prior written permission. 37 | # 38 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 39 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 40 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 41 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 42 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 43 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 44 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 45 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 46 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | # 49 | */ 50 | 51 | #ifndef DESKTOP_SYSTEM_WINDOW_H 52 | #define DESKTOP_SYSTEM_WINDOW_H 53 | 54 | #include 55 | 56 | #include "ui_SystemWindow.h" 57 | 58 | namespace Ui 59 | { 60 | class SystemWindow; 61 | }; 62 | 63 | class SystemWindow : public QDialog 64 | { 65 | Q_OBJECT 66 | public: 67 | SystemWindow(); 68 | ~SystemWindow(); 69 | 70 | public slots: 71 | void updateWindow(); 72 | 73 | private: 74 | Ui::SystemWindow *ui; 75 | 76 | //void closeAllWindows(); 77 | 78 | private slots: 79 | void sysLogout(); 80 | 81 | void sysRestart(); 82 | //void sysUpdate(); 83 | void sysShutdown(); 84 | 85 | void sysSuspend(); 86 | void sysHibernate(); 87 | 88 | void sysCancel() 89 | { 90 | this->close(); 91 | } 92 | 93 | void sysLock(); 94 | 95 | bool msgDialog(QString const &title, 96 | QString const &text); 97 | }; 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /src/desktop/defaults/draco-desktop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodlie/draco/a5dbb30d8cc16dcb76e74f386287ad218597596c/src/desktop/defaults/draco-desktop.jpg -------------------------------------------------------------------------------- /src/desktop/defaults/draco-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodlie/draco/a5dbb30d8cc16dcb76e74f386287ad218597596c/src/desktop/defaults/draco-logo.png -------------------------------------------------------------------------------- /src/desktop/desktop-plugins/NewDP.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2014, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | // This class is the interface to load all the different desktop plugins 8 | //=========================================== 9 | #ifndef LUMINA_DESKTOP_NEW_DESKTOP_PLUGIN_H 10 | #define LUMINA_DESKTOP_NEW_DESKTOP_PLUGIN_H 11 | 12 | #include 13 | 14 | #include "LDPlugin.h" 15 | #include "applauncher/AppLauncherPlugin.h" 16 | 17 | class NewDP{ 18 | public: 19 | static LDPlugin* createPlugin(QString plugin, QWidget* parent = Q_NULLPTR) 20 | { 21 | qDebug() << "Create Plugin:" << plugin; 22 | LDPlugin *plug = Q_NULLPTR; 23 | if (plugin.section("---",0,0).section("::",0,0) == "applauncher") { 24 | //This plugin can be pre-initialized to a file path after the "::" delimiter 25 | plug = new AppLauncherPlugin(parent, plugin); 26 | } else { 27 | qWarning() << "Invalid Desktop Plugin:"< 2 | 3 | defaults/draco-logo.png 4 | defaults/draco-desktop.jpg 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/desktop/logo.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | defaults/draco-logo.png 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/desktop/panel-plugins/LPPlugin.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2014-2015, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | // This class is the generic container layout for all panel plugins 8 | // Simply subclass this when creating a new plugin to enable correct 9 | // visibility and usage within a panel 10 | //=========================================== 11 | #ifndef _LUMINA_DESKTOP_PANEL_PLUGIN_H 12 | #define _LUMINA_DESKTOP_PANEL_PLUGIN_H 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | class LPPlugin : public QWidget{ 22 | Q_OBJECT 23 | 24 | private: 25 | QBoxLayout *LY; 26 | QString plugintype; 27 | 28 | public: 29 | LPPlugin(QWidget *parent = 0, QString ptype="unknown", bool horizontal = true) : QWidget(parent){ 30 | plugintype=ptype; 31 | this->setContentsMargins(1,1,1,1); 32 | this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 33 | this->setFocusPolicy(Qt::NoFocus); //no keyboard focus on the panel/plugins 34 | if(horizontal){LY = new QBoxLayout(QBoxLayout::LeftToRight, this); } 35 | else{ LY = new QBoxLayout(QBoxLayout::TopToBottom, this); } 36 | this->setObjectName(ptype.section("---",0,0)); 37 | LY->setContentsMargins(0,0,0,0); 38 | LY->setSpacing(1); 39 | this->setLayout(LY); 40 | connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(LocaleChange()) ); 41 | connect(QApplication::instance(), SIGNAL(IconThemeChanged()), this, SLOT(ThemeChange()) ); 42 | } 43 | 44 | ~LPPlugin(){ 45 | } 46 | 47 | QBoxLayout* layout(){ 48 | return LY; 49 | } 50 | 51 | QString type(){ 52 | return plugintype; 53 | } 54 | 55 | virtual void AboutToClose(){ 56 | //This needs to be re-implemented in the subclasses plugin 57 | //This is for any last-minute cleanup before the plugin gets deleted 58 | } 59 | 60 | public slots: 61 | virtual void LocaleChange(){ 62 | //This needs to be re-implemented in the subclassed plugin 63 | //This is where all text is set/translated 64 | } 65 | virtual void ThemeChange(){ 66 | //This needs to be re-implemented in the subclasses plugin 67 | //This is where all the visuals are set if using Theme-dependant icons. 68 | } 69 | virtual void settingsChange(QSettings *settings, const QString &prefix) { 70 | Q_UNUSED(settings) 71 | Q_UNUSED(prefix) 72 | } 73 | virtual void OrientationChange(){ 74 | //This needs to be re-implemented in the subclasses plugin 75 | //This is where any horizontal/vertical orientations can be changed appropriately 76 | } 77 | 78 | signals: 79 | void MenuClosed(); //This needs to be emitted when any plugin's menu is closed for some reason (check/set focus properly) 80 | }; 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /src/desktop/panel-plugins/LTBWidget.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2013, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | #ifndef _LUMINA_TOOLBAR_WIDGET_H 8 | #define _LUMINA_TOOLBAR_WIDGET_H 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | //#include "Globals.h" 15 | #include 16 | 17 | class LTBWidget : public QToolButton{ 18 | Q_OBJECT 19 | 20 | private: 21 | LXCB::WINDOWVISIBILITY cstate; 22 | //QString rawstyle; 23 | void updateBackground(){ 24 | //QString background = "background: transparent; "; //default value 25 | //QString border = "border: 1px solid transparent;"; 26 | if(cstate == LXCB::IGNORE){ this->setObjectName(""); } //just use the defaults 27 | else if(cstate == LXCB::VISIBLE){ this->setObjectName("WindowVisible"); }//background = "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(255, 255, 255, 240), stop:0.505682 rgba(240, 240, 240, 150), stop:1 rgba(210, 210, 210, 55));"; border="border: 1px solid transparent;"; } 28 | else if(cstate == LXCB::INVISIBLE){this->setObjectName("WindowInvisible"); } //background = "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(215, 215, 215, 240), stop:0.505682 rgba(184, 185, 186, 150), stop:1 rgba(221, 246, 255, 55));"; border="border: 1px solid transparent;"; } 29 | else if(cstate == LXCB::ACTIVE){ this->setObjectName("WindowActive"); }//background= "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(241, 233, 156, 240), stop:0.355682 rgba(255, 243, 127, 150), stop:1 rgba(221, 246, 255, 55));"; border ="border: 1px solid transparent;"; } 30 | else if(cstate == LXCB::ATTENTION){ this->setObjectName("WindowAttention"); }//background= "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(252, 187, 127, 240), stop:0.505682 rgba(255, 222, 197, 150), stop:1 rgba(221, 246, 255, 55));"; border="border: 1px solid transparent;"; } 31 | this->setStyleSheet(""); //force the object to re-evaluate the current theme stylesheet and update visuals 32 | //QString raw = rawstyle; 33 | //this->setStyleSheet( raw.replace("%1",background).replace("%2", border) ); 34 | } 35 | 36 | signals: 37 | 38 | void wheelScroll(int change); 39 | 40 | public: 41 | LTBWidget(QWidget* parent) : QToolButton(parent){ 42 | //this->setStyleSheet( this->styleSheet()+" LTBWidget::menu-indicator{image: none;}"); 43 | cstate = LXCB::IGNORE; 44 | 45 | this->setPopupMode(QToolButton::InstantPopup); 46 | this->setAutoRaise(true); 47 | 48 | //rawstyle = "LTBWidget{ %1 %2 border-radius: 5px;} LTBWidget::menu-indicator{image: none;} LTBWidget::hover{ %1 border: 1px solid black; border-radius: 5px; } LTBWidget::menu-button{ background: transparent; width: 15px; } LTBWidget[popupMode=\"1\"]{%1 %2 border-radius: 5px; padding-right: 15px;} LTBWidget[popupMode=\"1\"]::hover{%1 border: 1px solid black; border-radius: 5px; padding-right: 15px}"; 49 | updateBackground(); 50 | } 51 | 52 | ~LTBWidget(){ 53 | } 54 | 55 | void setState(LXCB::WINDOWVISIBILITY newstate){ 56 | cstate = newstate; 57 | updateBackground(); 58 | } 59 | 60 | public slots: 61 | 62 | 63 | protected: 64 | void wheelEvent(QWheelEvent *event){ 65 | int change = event->delta()/120; // 1/15th of a rotation (delta/120) is usually one "click" of the wheel 66 | emit wheelScroll(change); 67 | } 68 | 69 | }; 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/desktop/panel-plugins/NewPP.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2014-2015, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | // This class is the interface to load all the different panel plugins 8 | //=========================================== 9 | #ifndef _LUMINA_DESKTOP_NEW_PANEL_PLUGIN_H 10 | #define _LUMINA_DESKTOP_NEW_PANEL_PLUGIN_H 11 | 12 | #include 13 | 14 | //List all the individual plugin includes here 15 | #include "LPPlugin.h" 16 | //#include "userbutton/LUserButton.h" 17 | //#include "desktopbar/LDeskBar.h" 18 | #include "spacer/LSpacer.h" 19 | #include "line/LLine.h" 20 | #include "clock/LClock.h" 21 | #include "desktopswitcher/LDesktopSwitcher.h" 22 | #include "taskmanager/LTaskManagerPlugin.h" 23 | #include "showdesktop/LHomeButton.h" 24 | #include "appmenu/LAppMenuPlugin.h" 25 | #include "applauncher/AppLaunchButton.h" 26 | #include "systemtray/LSysTray.h" //must be last due to X11 compile issues 27 | 28 | 29 | class NewPP{ 30 | public: 31 | static LPPlugin* createPlugin(QString plugin, QWidget* parent = 0, bool horizontal = true){ 32 | LPPlugin *plug = 0; 33 | /*if(plugin.startsWith("userbutton---")){ 34 | plug = new LUserButtonPlugin(parent, plugin, horizontal); 35 | }else*/ if(plugin.startsWith("homebutton---")){ 36 | plug = new LHomeButtonPlugin(parent, plugin, horizontal); 37 | }/*else if(plugin.startsWith("desktopbar---")){ 38 | plug = new LDeskBarPlugin(parent, plugin, horizontal); 39 | }*/else if(plugin.startsWith("spacer---")){ 40 | plug = new LSpacerPlugin(parent, plugin, horizontal); 41 | }else if(plugin.startsWith("line---")){ 42 | plug = new LLinePlugin(parent, plugin, horizontal); 43 | }else if(plugin.startsWith("taskmanager")){ 44 | //This one can be "taskmanager[-nogroups]---" 45 | plug = new LTaskManagerPlugin(parent, plugin, horizontal); 46 | }else if(plugin.startsWith("systemtray---")){ 47 | plug = new LSysTray(parent, plugin, horizontal); 48 | }else if(plugin.startsWith("desktopswitcher---")){ 49 | plug = new LDesktopSwitcher(parent, plugin, horizontal); 50 | }/*else if(plugin.startsWith("battery---") && LOS::hasBattery()){ 51 | plug = new LBattery(parent, plugin, horizontal); 52 | }*/else if(plugin.startsWith("clock---")){ 53 | plug = new LClock(parent, plugin, horizontal); 54 | }/*else if(plugin.startsWith("systemdashboard---")){ 55 | plug = new LSysDashboard(parent, plugin, horizontal); 56 | }*/else if(plugin.startsWith("appmenu---")){ 57 | plug = new LAppMenuPlugin(parent, plugin, horizontal); 58 | }/*else if(plugin.startsWith("systemstart---")){ 59 | plug = new LStartButtonPlugin(parent, plugin, horizontal); 60 | }else if(plugin.startsWith("audioplayer---")){ 61 | plug = new LPAudioPlayer(parent, plugin, horizontal); 62 | }else if(plugin.section("::::",0,0)=="jsonmenu" && plugin.split("::::").length()>=3 ){ 63 | plug = new LPJsonMenu(parent, plugin, horizontal); 64 | }*/else if(plugin.section("---",0,0).section("::",0,0)=="applauncher"){ 65 | plug = new AppLaunchButtonPlugin(parent, plugin, horizontal); 66 | //}else if( plugin.section("---",0,0).startsWith("quick-") && LUtils::validQuickPlugin(plugin.section("---",0,0)) ){ 67 | //plug = new QuickPPlugin(parent, plugin, horizontal); 68 | }else{ 69 | qWarning() << "Invalid Panel Plugin:"< 14 | #include 15 | #include 16 | #include 17 | 18 | class RotateToolButton : public QToolButton{ 19 | Q_OBJECT 20 | 21 | private: 22 | int rotate_degrees; 23 | void paintEvent(QPaintEvent*){ 24 | /* NOTE: This is what a standard QToolButton performs (peeked at Qt source code for this tidbit) 25 | QStylePainter p(this); 26 | QStyleOptionToolButton opt; 27 | initStyleOption(&opt); 28 | p.drawComplexControl(QStyle::CC_ToolButton, opt); 29 | */ 30 | QStylePainter p(this); 31 | QStyleOptionToolButton opt; 32 | initStyleOption(&opt); 33 | //Apply the rotation matrix to the painter before starting the paint 34 | QTransform trans = QTransform( p.transform() ).rotate(rotate_degrees); 35 | p.setTransform(trans, false); //merging already taken care of 36 | //Now do the normal painting procedure 37 | p.drawComplexControl(QStyle::CC_ToolButton, opt); 38 | } 39 | 40 | public: 41 | RotateToolButton(QWidget *parent = Q_NULLPTR) : QToolButton(parent){ 42 | rotate_degrees = 0; //no rotation initially 43 | } 44 | 45 | void setRotation(int degrees){ 46 | rotate_degrees = degrees; 47 | this->update(); //trigger a paint event 48 | } 49 | 50 | /*virtual void setText(QString text){ 51 | this->setText(text); 52 | if(rotate_degrees !=0){ 53 | this->setSizeHint( this->sizeHint() 54 | } 55 | }*/ 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2014, Susanne Jaeckel 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | #ifndef _LUMINA_DESKTOP_SWITCHER_H 8 | #define _LUMINA_DESKTOP_SWITCHER_H 9 | 10 | #include 11 | #include 12 | #include 13 | //#include 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | //#include "../LTBWidget.h" 22 | #include "../LPPlugin.h" 23 | 24 | //#include 25 | //#include 26 | //#include 27 | 28 | class LDesktopSwitcher : public LPPlugin{ 29 | Q_OBJECT 30 | public: 31 | LDesktopSwitcher(QWidget *parent = 0, QString id = "desktopswitcher", bool horizontal=true); 32 | ~LDesktopSwitcher(); 33 | 34 | private: 35 | QTimer *timer; 36 | QToolButton *label; 37 | QMenu *menu; 38 | int iconOld; 39 | 40 | //void setNumberOfDesktops(int); 41 | //void setCurrentDesktop(int); 42 | //int getNumberOfDesktops(); 43 | //int getCurrentDesktop(); 44 | 45 | 46 | QAction* newAction(int, QString); 47 | 48 | private slots: 49 | void openMenu(); 50 | void createMenu(); 51 | void menuActionTriggered(QAction*); 52 | void updateWorkspaceMenu(); 53 | 54 | public slots: 55 | void LocaleChange(){ 56 | createMenu(); 57 | } 58 | 59 | void OrientationChange(){ 60 | QSize sz; 61 | if(this->layout()->direction()==QBoxLayout::LeftToRight){ 62 | this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); 63 | sz = QSize(this->height(), this->height()); 64 | }else{ 65 | this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); 66 | sz = QSize(this->width(), this->width()); 67 | } 68 | label->setIconSize(sz); 69 | this->layout()->update(); 70 | } 71 | }; 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /src/desktop/panel-plugins/line/LLine.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2015, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | // This class is a generic line separator for the panel 8 | //=========================================== 9 | #ifndef _LUMINA_DESKTOP_PANEL_PLUGIN_LINE_H 10 | #define _LUMINA_DESKTOP_PANEL_PLUGIN_LINE_H 11 | 12 | #include "../LPPlugin.h" 13 | #include 14 | 15 | class LLinePlugin : public LPPlugin{ 16 | Q_OBJECT 17 | private: 18 | QFrame *line; 19 | 20 | public: 21 | LLinePlugin(QWidget *parent=0, QString id="spacer", bool horizontal=true) : LPPlugin(parent, id, horizontal){ 22 | line = new QFrame(this); 23 | line->setObjectName("LuminaPanelLine"); 24 | this->layout()->addWidget(line); 25 | OrientationChange(); 26 | } 27 | ~LLinePlugin(){} 28 | 29 | public slots: 30 | void OrientationChange(){ 31 | if(this->layout()->direction()==QBoxLayout::LeftToRight){ //horizontal 32 | line->setFrameShape(QFrame::VLine); 33 | }else{ //vertical 34 | line->setFrameShape(QFrame::HLine); 35 | } 36 | } 37 | }; 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/desktop/panel-plugins/spacer/LSpacer.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2014, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | // This class is a generic invisible spacer for the panel 8 | //=========================================== 9 | #ifndef _LUMINA_DESKTOP_PANEL_PLUGIN_SPACER_H 10 | #define _LUMINA_DESKTOP_PANEL_PLUGIN_SPACER_H 11 | 12 | #include "../LPPlugin.h" 13 | 14 | class LSpacerPlugin : public LPPlugin{ 15 | Q_OBJECT 16 | public: 17 | LSpacerPlugin(QWidget *parent=0, QString id="spacer", bool horizontal=true) : LPPlugin(parent, id, horizontal){ 18 | if(horizontal){ this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); } 19 | else{ this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); } 20 | } 21 | ~LSpacerPlugin(){} 22 | 23 | public slots: 24 | void OrientationChange(){ 25 | if(this->layout()->direction()==QBoxLayout::LeftToRight){ //horizontal 26 | this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); 27 | }else{ //vertical 28 | this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); 29 | } 30 | } 31 | }; 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/desktop/panel-plugins/systemtray/LSysTray.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2012-2015, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | #ifndef _LUMINA_DESKTOP_SYSTRAY_H 8 | #define _LUMINA_DESKTOP_SYSTRAY_H 9 | 10 | //Qt includes 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | //Local includes 18 | #include "../LPPlugin.h" 19 | #include "TrayIcon.h" 20 | 21 | //SYSTEM TRAY STANDARD DEFINITIONS 22 | #define SYSTEM_TRAY_REQUEST_DOCK 0 23 | #define SYSTEM_TRAY_BEGIN_MESSAGE 1 24 | #define SYSTEM_TRAY_CANCEL_MESSAGE 2 25 | 26 | class LSysTray : public LPPlugin{ 27 | Q_OBJECT 28 | public: 29 | LSysTray(QWidget *parent = 0, QString id="systemtray", bool horizontal=true); 30 | ~LSysTray(); 31 | 32 | virtual void AboutToClose(){ 33 | this->stop(); 34 | } 35 | 36 | private: 37 | bool isRunning, stopping, checking, pending; 38 | QList trayIcons; 39 | QFrame *frame; 40 | QBoxLayout *LI; //layout items 41 | QTimer *upTimer; //manual timer to force refresh of all items 42 | 43 | private slots: 44 | void checkAll(); 45 | void UpdateTrayWindow(WId win); 46 | 47 | //void removeTrayIcon(WId win); 48 | 49 | public slots: 50 | void start(); 51 | void stop(); 52 | 53 | virtual void OrientationChange(){ 54 | //make sure the internal layout has the same orientation as the main widget 55 | LI->setDirection( this->layout()->direction() ); 56 | //Re-adjust the maximum widget size 57 | int sz; 58 | if(this->layout()->direction()==QBoxLayout::LeftToRight){ 59 | this->setMaximumSize( trayIcons.length()*this->height(), 10000); 60 | sz = this->height()-2*frame->frameWidth(); 61 | }else{ 62 | this->setMaximumSize(10000, trayIcons.length()*this->width()); 63 | sz = this->width()-2*frame->frameWidth(); 64 | } 65 | if(sz>64){ sz = 64; } //many tray icons can't go larger than this anyway 66 | for(int i=0; isetSizeSquare(sz); 68 | trayIcons[i]->repaint(); 69 | } 70 | } 71 | 72 | }; 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /src/desktop/panel-plugins/systemtray/TrayIcon.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2014, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | // Note: The basic idea behind this class that that it puts the app window 8 | // in the same spot as the tray icon (to directly pass mouse events and such), 9 | // while keeping the tray icon visual in sync with the app window 10 | //=========================================== 11 | #ifndef _LUMINA_PANEL_PLUGIN_SYSTEM_TRAY_ICON_H 12 | #define _LUMINA_PANEL_PLUGIN_SYSTEM_TRAY_ICON_H 13 | 14 | //Qt includes 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | //#include 24 | // libLumina includes 25 | //#include 26 | 27 | class TrayIcon : public QWidget{ 28 | Q_OBJECT 29 | public: 30 | TrayIcon(QWidget* parent = 0); 31 | ~TrayIcon(); 32 | 33 | void cleanup(); //about to be removed after window was detroyed 34 | 35 | WId appID(); //the ID for the attached application 36 | void attachApp(WId id); 37 | void setSizeSquare(int side); 38 | 39 | public slots: 40 | void detachApp(); 41 | void updateIcon(); 42 | 43 | private: 44 | WId IID, AID; //icon ID and app ID 45 | int badpaints; 46 | uint dmgID; 47 | int scalefactor; 48 | 49 | protected: 50 | void paintEvent(QPaintEvent *event); 51 | void resizeEvent(QResizeEvent *event); 52 | 53 | signals: 54 | void BadIcon(); 55 | }; 56 | #endif 57 | -------------------------------------------------------------------------------- /src/lib/hotkey/qhotkey_p.h: -------------------------------------------------------------------------------- 1 | #ifndef QHOTKEY_P_H 2 | #define QHOTKEY_P_H 3 | 4 | #include "qhotkey.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | class QHOTKEY_SHARED_EXPORT QHotkeyPrivate : public QObject, public QAbstractNativeEventFilter 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | QHotkeyPrivate();//singleton!!! 16 | ~QHotkeyPrivate(); 17 | 18 | static QHotkeyPrivate *instance(); 19 | 20 | QHotkey::NativeShortcut nativeShortcut(Qt::Key keycode, Qt::KeyboardModifiers modifiers); 21 | 22 | bool addShortcut(QHotkey *hotkey); 23 | bool removeShortcut(QHotkey *hotkey); 24 | 25 | protected: 26 | void activateShortcut(QHotkey::NativeShortcut shortcut); 27 | 28 | virtual quint32 nativeKeycode(Qt::Key keycode, bool &ok) = 0;//platform implement 29 | virtual quint32 nativeModifiers(Qt::KeyboardModifiers modifiers, bool &ok) = 0;//platform implement 30 | 31 | virtual bool registerShortcut(QHotkey::NativeShortcut shortcut) = 0;//platform implement 32 | virtual bool unregisterShortcut(QHotkey::NativeShortcut shortcut) = 0;//platform implement 33 | 34 | private: 35 | QHash, QHotkey::NativeShortcut> mapping; 36 | QMultiHash shortcuts; 37 | 38 | Q_INVOKABLE void addMappingInvoked(Qt::Key keycode, Qt::KeyboardModifiers modifiers, const QHotkey::NativeShortcut &nativeShortcut); 39 | Q_INVOKABLE bool addShortcutInvoked(QHotkey *hotkey); 40 | Q_INVOKABLE bool removeShortcutInvoked(QHotkey *hotkey); 41 | Q_INVOKABLE QHotkey::NativeShortcut nativeShortcutInvoked(Qt::Key keycode, Qt::KeyboardModifiers modifiers); 42 | }; 43 | 44 | #define NATIVE_INSTANCE(ClassName) \ 45 | Q_GLOBAL_STATIC(ClassName, hotkeyPrivate) \ 46 | \ 47 | QHotkeyPrivate *QHotkeyPrivate::instance()\ 48 | {\ 49 | return hotkeyPrivate;\ 50 | } 51 | 52 | Q_DECLARE_METATYPE(Qt::Key) 53 | Q_DECLARE_METATYPE(Qt::KeyboardModifiers) 54 | 55 | #endif // QHOTKEY_P_H 56 | -------------------------------------------------------------------------------- /src/lib/lumina/AppDialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | AppDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 348 10 | 300 11 | 12 | 13 | 14 | Select Application 15 | 16 | 17 | 18 | 19 | 20 | Search for.... 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | Qt::Horizontal 31 | 32 | 33 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | buttonBox 43 | accepted() 44 | AppDialog 45 | accept() 46 | 47 | 48 | 248 49 | 254 50 | 51 | 52 | 157 53 | 274 54 | 55 | 56 | 57 | 58 | buttonBox 59 | rejected() 60 | AppDialog 61 | reject() 62 | 63 | 64 | 316 65 | 260 66 | 67 | 68 | 286 69 | 274 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /src/lib/lumina/DesktopSettings.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-desktop source code 3 | // Copyright (c) 2017, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | // This is a simple class for managing all the various desktop 8 | // setting files, and sending out notifications about changes 9 | //=========================================== 10 | // NOTE: 11 | // This class has a heirarchy-based lookup/write system 12 | // USER Settings > SYSTEM Settings > DEFAULT Settings 13 | // XDG_CONFIG_HOME/lumina-desktop > XDG_CONFIG_DIRS/lumina-desktop > XDG_DATA_DIRS/lumina-desktop 14 | //=========================================== 15 | #ifndef LUMINA_DESKTOP_SETTINGS_CLASS_H 16 | #define LUMINA_DESKTOP_SETTINGS_CLASS_H 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | class DesktopSettings : public QObject{ 26 | Q_OBJECT 27 | public: 28 | enum File{ System, Favorites, Environment, Session, Desktop, Panels, Plugins, ContextMenu, Keys, Animation, ScreenSaver, WM}; 29 | //Changes to this enum need to be added to the "filesForRunMode()" and "rel_path()" functions as well 30 | 31 | DesktopSettings(QObject *parent = 0); 32 | ~DesktopSettings(); 33 | 34 | static DesktopSettings* instance(); 35 | 36 | //Start/stop routines 37 | void start(); 38 | void stop(); 39 | 40 | //Main Read/Write functions 41 | QList< DesktopSettings::File > writableFiles(); //return the list of all writable files 42 | QVariant value(DesktopSettings::File, QString variable, QVariant defaultvalue); 43 | bool setValue(DesktopSettings::File, QString variable, QVariant value); 44 | QStringList keys(DesktopSettings::File); //return a list of all variables which are available in this file 45 | 46 | //Information functions 47 | QStringList filePaths(DesktopSettings::File); //just in case we need to access any of these files outside this class 48 | 49 | private: 50 | enum RunMode{UserFull, SystemFull, SystemInterface }; 51 | DesktopSettings::RunMode runmode; //simple flag for which mode the current session is running in 52 | QFileSystemWatcher *watcher; 53 | QHash< DesktopSettings::File, QStringList > files; //location hash for where files are actually located on disk 54 | QHash< QString, QSettings*> settings; //location hash for the settings files themselves 55 | 56 | //Functions 57 | void parseSystemSettings(); //run at start - determine the RunMode for this user/session 58 | void locateFiles(); //run at start - finds the locations of the various files (based on RunMode) 59 | void touchFile(QString path); //used to create an empty file so it can be watched for changes later 60 | 61 | //The two functions which define the public "File" enumeration (both need updates when the enum changes) 62 | QList< DesktopSettings::File > filesForRunMode(RunMode mode); 63 | QString rel_path(DesktopSettings::File); //return the relative file path (starting with "/") 64 | 65 | private slots: 66 | void fileChanged(QString); //QFileSystemWatcher change detected 67 | void dirChanged(QString); //QFileSystemWatcher change detected 68 | 69 | signals: 70 | void FileModified(DesktopSettings::File); 71 | 72 | }; 73 | #endif 74 | -------------------------------------------------------------------------------- /src/lib/lumina/LDesktopUtils.cpp: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2012-2016, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | #include "LDesktopUtils.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | //#include "LuminaThemes.h" 15 | 16 | 17 | 18 | 19 | QStringList LDesktopUtils::listFavorites(){ 20 | //static QDateTime lastRead; 21 | QStringList fav; 22 | //QDateTime cur = QDateTime::currentDateTime(); 23 | //if(lastRead.isNull() || fav.isEmpty() || lastRead*1000000 + *1000 + 80 | // Example: 1.2.3 -> 1002003 81 | } 82 | 83 | 84 | 85 | 86 | 87 | 88 | void LDesktopUtils::MigrateDesktopSettings(QSettings *settings, QString fromID, QString toID){ 89 | //desktop-ID 90 | QStringList keys = settings->allKeys(); 91 | QStringList filter = keys.filter("desktop-"+fromID+"/"); 92 | for(int i=0; isetValue("desktop-"+toID+"/"+filter[i].section("/",1,-1), settings->value(filter[i])); 94 | settings->remove(filter[i]); 95 | } 96 | //panel_ID.[number] 97 | filter = keys.filter("panel_"+fromID+"."); 98 | for(int i=0; isetValue("panel_"+toID+"."+ filter[i].section("/",0,0).section(".",-1)+"/"+filter[i].section("/",1,-1), settings->value(filter[i])); 100 | settings->remove(filter[i]); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/lib/lumina/LDesktopUtils.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2012-2016, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | #ifndef LUMINA_LIBRARY_DESKTOP_UTILS_H 8 | #define LUMINA_LIBRARY_DESKTOP_UTILS_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | //Other classes needed 18 | #include 19 | #include 20 | //#include 21 | 22 | class LDesktopUtils{ 23 | public: 24 | 25 | 26 | 27 | 28 | //Various functions for the favorites sub-system 29 | // Formatting Note: "::::[dir/app/]::::" 30 | // the field might not be used for "app" flagged entries 31 | static QStringList listFavorites(); 32 | static bool saveFavorites(QStringList); 33 | static bool isFavorite(QString path); 34 | static bool addFavorite(QString path, QString name = ""); 35 | static void removeFavorite(QString path); 36 | static void upgradeFavorites(int fromoldversionnumber); 37 | 38 | 39 | 40 | //Migrating desktop settings from one ID to another 41 | static void MigrateDesktopSettings(QSettings *settings, QString fromID, QString toID); 42 | 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/lib/lumina/LFileInfo.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2013-2017, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | // File Information simplification class (combine QFileInfo with XDGDesktop) 8 | // Need some extra information not usually available by a QFileInfo 9 | // ======================== 10 | #ifndef LUMINA_LIBRARY_FILE_INFO_H 11 | #define LUMINA_LIBRARY_FILE_INFO_H 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | class LFileInfo : public QFileInfo{ 19 | private: 20 | QString mime; 21 | QStringList iconList; 22 | int c_uid; 23 | XDGDesktop *desk; 24 | 25 | void loadExtraInfo(); 26 | 27 | public: 28 | //Couple overloaded contructors 29 | LFileInfo(); 30 | LFileInfo(QString filepath); 31 | LFileInfo(QFileInfo info); 32 | ~LFileInfo(); 33 | 34 | //Functions for accessing the extra information 35 | // -- Return the mimetype for the file 36 | QString mimetype(); 37 | 38 | // -- Return the icon file to use for this file 39 | QString iconfile(); //Note: This string is auto-formatted for use in the LXDG::findIcon() routine. 40 | QIcon icon(); 41 | 42 | // -- Check if this is an XDG desktop file 43 | bool isDesktopFile(); 44 | 45 | // -- Allow access to the internal XDG desktop data structure 46 | XDGDesktop* XDG(); 47 | 48 | //Other file type identification routines 49 | bool isImage(); //Is a readable image file (for thumbnail support) 50 | bool isVideo(); //Is a readable video file (for thumbnail support) 51 | bool isAVFile(); //Is an audio/video file 52 | 53 | }; 54 | typedef QList LFileInfoList; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/lib/lumina/LInputDevice.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2016, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | // This class governs all the XCB input device interactions 8 | // and provides simpler Qt-based functions for use elsewhere 9 | //=========================================== 10 | #ifndef LUMINA_XCB_INPUT_DEVICES_H 11 | #define LUMINA_XCB_INPUT_DEVICES_H 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include 20 | 21 | //Internal data structure for storing the property information 22 | struct propData{ 23 | int id; 24 | QString name; 25 | QVariant value; 26 | xcb_atom_t atom; 27 | }; 28 | 29 | class LInputDevice{ 30 | public: 31 | LInputDevice(unsigned int id, unsigned int type); //don't use this directly - use the "listDevices()" function instead 32 | ~LInputDevice(); 33 | 34 | //Device Information 35 | //QString name(); //Return the name of this device 36 | unsigned int devNumber(); 37 | bool isPointer(); 38 | bool isKeyboard(); 39 | bool isExtension(); 40 | 41 | //Property Management 42 | QList listProperties(); 43 | QString propertyName(int prop); 44 | QVariant getPropertyValue(int prop); 45 | bool setPropertyValue(int prop, QVariant value); 46 | 47 | private: 48 | unsigned int devID; //device ID number - assigned at class creation 49 | unsigned int devType; //device "use" identifier - assigned at class creation 50 | QHash devProps; //Known device properties 51 | 52 | void getProperties(); 53 | void readProperties(); 54 | QVariant valueToVariant(QString value); //xinput output to QVariant 55 | QString variantToString(QVariant value); //QVariant to xinput input string 56 | 57 | //QString devName; //device name - use this for cross-session management (id #'s can get changed every session) 58 | }; 59 | 60 | //Static functions for overall management 61 | class LInput{ 62 | public: 63 | static QList listDevices(); //NOTE: Make sure you "free()" all the LInputDevice objects when finished 64 | 65 | }; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/lib/lumina/LuminaRandR.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2017, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | // This class governs all the xcb/randr interactions 8 | // and provides simpler Qt-based functions for use elsewhere 9 | //=========================================== 10 | #ifndef LUMINA_LIBRARY_RANDR_MONITORS_H 11 | #define LUMINA_LIBRARY_RANDR_MONITORS_H 12 | 13 | //Qt includes 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | // XCB 24 | #include "xcb/randr.h" 25 | #include "xcb/xcb_atom.h" 26 | 27 | struct p_objects{ 28 | xcb_randr_output_t output; //This is the index used to identify particular monitors (unique ID) 29 | xcb_randr_crtc_t crtc; //This is the index used for the current settings/configuration (associated with output) 30 | 31 | //Cached Information 32 | bool primary; 33 | QRect geometry; 34 | 35 | QSize physicalSizeMM; //physical size of the display in MM 36 | QString name; 37 | 38 | xcb_randr_mode_t current_mode; 39 | QList modes; //each mode is a combination of resolution + refresh rate 40 | QList resolutions; //smaller subset of modes - just unique resolutions 41 | 42 | }; 43 | 44 | class OutputDevice{ 45 | public: 46 | 47 | // EXPANSIONS TO-DO 48 | //Refresh Rate 49 | //int cHz; //current refresh rate 50 | //QList availHz; //available refresh rates 51 | //Expand this later to include: 52 | // panning (current/possible) 53 | // rotation (current/possible) 54 | 55 | //Global Listing of Devices 56 | static QList availableMonitors(); 57 | 58 | //FUNCTIONS (do not use directly - use the static list function instead) 59 | OutputDevice(QString id); 60 | ~OutputDevice(); 61 | 62 | //Information 63 | QString ID(); 64 | 65 | bool isEnabled(); 66 | bool isPrimary(); 67 | bool isConnected(); 68 | QList availableResolutions(); 69 | QSize currentResolution(); //could be different from geometry.size() if things like panning/rotation are enabled 70 | QRect currentGeometry(); 71 | QSize physicalSizeMM(); 72 | QSize physicalDPI(); 73 | 74 | //Modification 75 | bool setAsPrimary(bool); 76 | bool disable(); 77 | bool enable(QRect geom); //if empty resolution is supplied (QSize(0,0)) it will use the highest-available resolution 78 | bool changeResolution(QSize); //change the resolution (but not position) of a currently-enabled screen 79 | bool move(QPoint); //move a currently-enabled screen to another place 80 | bool setGeometry(QRect); //move/resize a currently-enabled screen 81 | 82 | void updateInfoCache(); //Run this after all modification functions to refresh the current info for this device 83 | 84 | //Now define a simple public_objects class so that each implementation 85 | // has a storage container for placing semi-private objects as needed 86 | //class p_objects; //forward declaration - defined in the .cpp file 87 | p_objects p_obj; 88 | }; 89 | 90 | class OutputDeviceList{ 91 | private: 92 | QList out_devs; 93 | 94 | public: 95 | OutputDeviceList(); 96 | ~OutputDeviceList(); 97 | 98 | int length(){ return out_devs.length(); } 99 | 100 | OutputDevice* at(int i){ 101 | if(i 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | //Special subclass for a menu which the user can grab the edges and resize as necessary 20 | // Note: Make sure that you don't set 0pixel contents margins on this menu 21 | // - it needs at least 1 pixel margins for the user to be able to grab it 22 | class ResizeMenu : public QMenu{ 23 | Q_OBJECT 24 | public: 25 | ResizeMenu(QWidget *parent = 0); 26 | virtual ~ResizeMenu(); 27 | 28 | void setContents(QWidget *con); 29 | void resyncSize(); 30 | 31 | private: 32 | enum SideFlag{NONE, TOP, BOTTOM, LEFT, RIGHT}; 33 | SideFlag resizeSide; 34 | QWidget *contents; 35 | QWidgetAction *cAct; 36 | 37 | private slots: 38 | void clearFlags(){ 39 | resizeSide=NONE; 40 | } 41 | 42 | protected: 43 | virtual void mouseMoveEvent(QMouseEvent *ev); 44 | virtual void mousePressEvent(QMouseEvent *ev); 45 | virtual void mouseReleaseEvent(QMouseEvent *ev); 46 | 47 | signals: 48 | void MenuResized(QSize); //Emitted when the menu is manually resized by the user 49 | 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/lib/org.dracolinux.Disks.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #ifndef DISKS_H 23 | #define DISKS_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | class StorageDevice : public QObject 32 | { 33 | Q_OBJECT 34 | 35 | public: 36 | explicit StorageDevice(const QString block, QObject *parent = Q_NULLPTR); 37 | QString name; 38 | QString path; 39 | QString dev; 40 | QString drive; 41 | QString mountpoint; 42 | QString filesystem; 43 | bool isOptical; 44 | bool isRemovable; 45 | bool hasMedia; 46 | int opticalDataTracks; 47 | int opticalAudioTracks; 48 | bool isBlankDisc; 49 | bool hasPartition; 50 | 51 | private: 52 | QDBusInterface *dbus; 53 | 54 | signals: 55 | void mediaChanged(QString devicePath, bool mediaPresent); 56 | void mountpointChanged(QString devicePath, QString deviceMountpoint); 57 | void nameChanged(QString devicePath, QString deviceName); 58 | void errorMessage(QString devicePath, QString deviceError); 59 | 60 | public slots: 61 | void mount(); 62 | void unmount(); 63 | void eject(); 64 | 65 | private slots: 66 | void updateDeviceProperties(); 67 | void handlePropertiesChanged(const QString &interfaceType, const QMap &changedProperties); 68 | }; 69 | 70 | class Disks : public QObject 71 | { 72 | Q_OBJECT 73 | 74 | public: 75 | explicit Disks(QObject *parent = Q_NULLPTR); 76 | QMap devices; 77 | 78 | private: 79 | QDBusInterface *dbus; 80 | QTimer timer; 81 | 82 | signals: 83 | void updatedDevices(); 84 | void mediaChanged(QString path, bool media); 85 | void mountpointChanged(QString path, QString mountpoint); 86 | void deviceErrorMessage(QString path, QString error); 87 | void foundNewDevice(QString path); 88 | void removedDevice(QString path); 89 | 90 | private slots: 91 | void setupDBus(); 92 | void scanDevices(); 93 | void deviceAdded(const QDBusObjectPath &obj); 94 | void deviceRemoved(const QDBusObjectPath &obj); 95 | void handleDeviceMediaChanged(QString devicePath, bool mediaPresent); 96 | void handleDeviceMountpointChanged(QString devicePath, QString deviceMountpoint); 97 | void handleDeviceErrorMessage(QString devicePath, QString deviceError); 98 | void checkUDisks(); 99 | }; 100 | 101 | #endif // DISKS_H 102 | -------------------------------------------------------------------------------- /src/lib/org.dracolinux.Power.Client.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #ifndef POWER_CLIENT_H 23 | #define POWER_CLIENT_H 24 | 25 | #include 26 | 27 | class PowerClient 28 | { 29 | public: 30 | static double getBatteryLeft(QDBusInterface *iface); 31 | static bool hasBattery(QDBusInterface *iface); 32 | static bool onBattery(QDBusInterface *iface); 33 | static qlonglong timeToEmpty(QDBusInterface *iface); 34 | static bool canHibernate(QDBusInterface *iface); 35 | static bool canSuspend(QDBusInterface *iface); 36 | static bool canRestart(QDBusInterface *iface); 37 | static bool canPowerOff(QDBusInterface *iface); 38 | static bool lidIsPresent(QDBusInterface *iface); 39 | static void lockScreen(QDBusInterface *iface); 40 | static void hibernate(QDBusInterface *iface); 41 | static void suspend(QDBusInterface *iface); 42 | static bool restart(QDBusInterface *iface); 43 | static bool poweroff(QDBusInterface *iface); 44 | }; 45 | 46 | #endif // POWER_CLIENT_H 47 | -------------------------------------------------------------------------------- /src/lib/org.dracolinux.Power.Device.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #ifndef DEVICE_H 23 | #define DEVICE_H 24 | 25 | #include 26 | #include 27 | 28 | #define UPOWER_SERVICE "org.freedesktop.UPower" 29 | #define DBUS_PROPERTIES "org.freedesktop.DBus.Properties" 30 | #define DBUS_DEVICE "Device" 31 | #define DBUS_CHANGED "Changed" 32 | 33 | class Device : public QObject 34 | { 35 | Q_OBJECT 36 | 37 | public: 38 | enum DeviceType { 39 | DeviceUnknown, 40 | DeviceLinePower, 41 | DeviceBattery, 42 | DeviceUps, 43 | DeviceMonitor, 44 | DeviceMouse, 45 | DeviceKeyboard, 46 | DevicePda, 47 | DevicePhone 48 | }; 49 | explicit Device(const QString block, 50 | QObject *parent = NULL); 51 | QString name; 52 | QString path; 53 | QString model; 54 | DeviceType type; 55 | bool isRechargable; 56 | bool isPresent; 57 | double percentage; 58 | bool online; 59 | bool hasPowerSupply; 60 | bool isBattery; 61 | bool isAC; 62 | QString vendor; 63 | QString nativePath; 64 | double capacity; 65 | double energy; 66 | double energyFullDesign; 67 | double energyFull; 68 | double energyEmpty; 69 | qlonglong timeToEmpty; 70 | qlonglong timeToFull; 71 | 72 | private: 73 | QDBusInterface *dbus; 74 | QDBusInterface *dbusp; 75 | 76 | signals: 77 | void deviceChanged(const QString &devicePath); 78 | 79 | private slots: 80 | void updateDeviceProperties(); 81 | public slots: 82 | void update(); 83 | void updateBattery(); 84 | }; 85 | 86 | #endif // DEVICE_H 87 | -------------------------------------------------------------------------------- /src/lib/org.dracolinux.Power.HotPlugX11.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #include "org.dracolinux.Power.HotPlugX11.h" 23 | 24 | HotPlug::HotPlug(QObject *parent) : 25 | QObject(parent) 26 | , _scanning(false) 27 | { 28 | moveToThread(&t); 29 | t.start(); 30 | } 31 | 32 | HotPlug::~HotPlug() 33 | { 34 | _scanning = false; 35 | t.wait(); 36 | t.quit(); 37 | } 38 | 39 | void HotPlug::requestScan() 40 | { 41 | QMetaObject::invokeMethod(this, "scan"); 42 | } 43 | 44 | void HotPlug::scan() 45 | { 46 | if (_scanning) { return; } 47 | _scanning = true; 48 | 49 | Display *dpy; 50 | if ((dpy = XOpenDisplay(nullptr)) == nullptr) { return; } 51 | 52 | XRRScreenResources *sr; 53 | XRROutputInfo *info; 54 | XEvent ev; 55 | 56 | getScreens(dpy); 57 | 58 | XRRSelectInput(dpy, DefaultRootWindow(dpy), RROutputChangeNotifyMask); 59 | XSync(dpy, 0); 60 | while(_scanning) { 61 | if (!XNextEvent(dpy, &ev)) { 62 | sr = XRRGetScreenResources(OCNE(&ev)->display, OCNE(&ev)->window); 63 | if (sr == nullptr) { continue; } 64 | info = XRRGetOutputInfo(OCNE(&ev)->display, sr, OCNE(&ev)->output); 65 | if (info == nullptr) { 66 | XRRFreeScreenResources(sr); 67 | continue; 68 | } 69 | QString screenName = info->name; 70 | bool screenConnected = false; 71 | if (info->connection == RR_Connected) { screenConnected = true; } 72 | emit status(screenName, screenConnected); 73 | XRRFreeScreenResources(sr); 74 | XRRFreeOutputInfo(info); 75 | } 76 | } 77 | XCloseDisplay(dpy); 78 | } 79 | 80 | void HotPlug::requestSetScan(bool scanning) 81 | { 82 | QMetaObject::invokeMethod(this, "setScan", Q_ARG(bool, scanning)); 83 | } 84 | 85 | void HotPlug::getScreens(Display *dpy) 86 | { 87 | if (dpy == nullptr) { return; } 88 | QMap result = Screens::outputsDpy(dpy); 89 | emit found(result); 90 | } 91 | 92 | void HotPlug::setScan(bool scanning) 93 | { 94 | _scanning = scanning; 95 | } 96 | -------------------------------------------------------------------------------- /src/lib/org.dracolinux.Power.HotPlugX11.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #ifndef HOTPLUG_H 23 | #define HOTPLUG_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "org.dracolinux.Power.ScreenX11.h" 30 | #include 31 | 32 | // fix X11 inc 33 | #undef Bool 34 | #undef None 35 | #undef Status 36 | 37 | #define OCNE(X) ((XRROutputChangeNotifyEvent*)X) 38 | 39 | class HotPlug : public QObject 40 | { 41 | Q_OBJECT 42 | 43 | public: 44 | explicit HotPlug(QObject *parent = 0); 45 | ~HotPlug(); 46 | 47 | private: 48 | QThread t; 49 | bool _scanning; 50 | 51 | signals: 52 | void status(QString display, bool connected); 53 | void found(QMap devices); 54 | 55 | public slots: 56 | void requestScan(); 57 | void requestSetScan(bool scanning); 58 | private slots: 59 | void scan(); 60 | void getScreens(Display *dpy); 61 | void setScan(bool scanning); 62 | }; 63 | 64 | #endif // HOTPLUG_H 65 | -------------------------------------------------------------------------------- /src/lib/org.dracolinux.Power.ScreenX11.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #include "org.dracolinux.Power.ScreenX11.h" 23 | 24 | QMap Screens::outputsDpy(Display *dpy) 25 | { 26 | QMap result; 27 | if (dpy == nullptr) { return result; } 28 | XRRScreenResources *sr; 29 | XRROutputInfo *info; 30 | sr = XRRGetScreenResourcesCurrent(dpy, DefaultRootWindow(dpy)); 31 | if (sr) { 32 | for (int i = 0; i< sr->noutput;++i) { 33 | info = XRRGetOutputInfo(dpy, sr, sr->outputs[i]); 34 | if (info == nullptr) { 35 | XRRFreeOutputInfo(info); 36 | continue; 37 | } 38 | QString output = info->name; 39 | bool screenConnected = false; 40 | if (info->connection == RR_Connected) { screenConnected = true; } 41 | result[output] = screenConnected; 42 | XRRFreeOutputInfo(info); 43 | } 44 | } 45 | XRRFreeScreenResources(sr); 46 | return result; 47 | } 48 | 49 | QMap Screens::outputs() 50 | { 51 | QMap result; 52 | Display *dpy; 53 | if ((dpy = XOpenDisplay(nullptr)) == nullptr) { return result; } 54 | result = outputsDpy(dpy); 55 | XCloseDisplay(dpy); 56 | return result; 57 | } 58 | 59 | QString Screens::internalDpy(Display *dpy) 60 | { 61 | QString result; 62 | if (dpy == nullptr) { return result; } 63 | XRRScreenResources *sr; 64 | sr = XRRGetScreenResourcesCurrent(dpy, DefaultRootWindow(dpy)); 65 | if (sr) { 66 | XRROutputInfo *info = XRRGetOutputInfo(dpy, sr, sr->outputs[0]); 67 | if (info) { result = info->name; } 68 | XRRFreeOutputInfo(info); 69 | } 70 | XRRFreeScreenResources(sr); 71 | return result; 72 | } 73 | 74 | QString Screens::internal() 75 | { 76 | QString result; 77 | Display *dpy; 78 | if ((dpy = XOpenDisplay(nullptr)) == nullptr) { return result; } 79 | result = internalDpy(dpy); 80 | XCloseDisplay(dpy); 81 | return result; 82 | } 83 | -------------------------------------------------------------------------------- /src/lib/org.dracolinux.Power.ScreenX11.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #ifndef SCREENS_H 23 | #define SCREENS_H 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | class Screens 31 | { 32 | public: 33 | static QMap outputsDpy(Display *dpy); 34 | static QMap outputs(); 35 | static QString internalDpy(Display *dpy); 36 | static QString internal(); 37 | }; 38 | 39 | #endif // SCREENS_H 40 | -------------------------------------------------------------------------------- /src/lib/org.dracolinux.Power.Settings.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #include "org.dracolinux.Power.Settings.h" 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "power_def.h" 29 | #include "draco.h" 30 | 31 | void PowerSettings::setValue(const QString &type, const QVariant &value) 32 | { 33 | QSettings settings(Draco::powerSettingsFile(), QSettings::IniFormat); 34 | settings.setValue(type, value); 35 | settings.sync(); 36 | } 37 | 38 | const QVariant PowerSettings::getValue(const QString &type) 39 | { 40 | QSettings settings(Draco::powerSettingsFile(), QSettings::IniFormat); 41 | return settings.value(type); 42 | } 43 | 44 | bool PowerSettings::isValid(const QString &type) 45 | { 46 | QSettings settings(Draco::powerSettingsFile(), QSettings::IniFormat); 47 | return settings.value(type).isValid(); 48 | } 49 | 50 | void PowerSettings::saveDefault() 51 | { 52 | setValue(CONF_LID_BATTERY_ACTION, LID_BATTERY_DEFAULT); 53 | setValue(CONF_LID_AC_ACTION, LID_AC_DEFAULT); 54 | setValue(CONF_CRITICAL_BATTERY_ACTION, CRITICAL_DEFAULT); 55 | setValue(CONF_CRITICAL_BATTERY_TIMEOUT, CRITICAL_BATTERY); 56 | setValue(CONF_SUSPEND_BATTERY_TIMEOUT, AUTO_SLEEP_BATTERY); 57 | setValue(CONF_FREEDESKTOP_SS, true); 58 | setValue(CONF_FREEDESKTOP_PM, true); 59 | setValue(CONF_TRAY_NOTIFY, true); 60 | setValue(CONF_TRAY_SHOW, true); 61 | setValue(CONF_LID_DISABLE_IF_EXTERNAL, false); 62 | setValue(CONF_SUSPEND_BATTERY_ACTION, suspendSleep); 63 | setValue(CONF_SUSPEND_AC_ACTION, suspendNone); 64 | setValue(CONF_BACKLIGHT_BATTERY_ENABLE, false); 65 | setValue(CONF_BACKLIGHT_AC_ENABLE, false); 66 | setValue(CONF_BACKLIGHT_BATTERY_DISABLE_IF_LOWER, false); 67 | setValue(CONF_BACKLIGHT_AC_DISABLE_IF_HIGHER, false); 68 | setValue(CONF_WARN_ON_LOW_BATTERY, true); 69 | setValue(CONF_WARN_ON_VERYLOW_BATTERY, true); 70 | setValue(CONF_NOTIFY_ON_BATTERY, true); 71 | setValue(CONF_NOTIFY_ON_AC, true); 72 | setValue(CONF_BACKLIGHT_MOUSE_WHEEL, true); 73 | setValue(CONF_SUSPEND_LOCK_SCREEN, true); 74 | setValue(CONF_PSTATE_MAX_BATTERY, 100); 75 | setValue(CONF_PSTATE_MAX_AC, 100); 76 | } 77 | 78 | const QString PowerSettings::getConf() 79 | { 80 | return Draco::powerSettingsFile(); 81 | } 82 | 83 | const QString PowerSettings::getDir() 84 | { 85 | return Draco::configDir(); 86 | } 87 | -------------------------------------------------------------------------------- /src/lib/org.dracolinux.Power.Settings.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #ifndef POWER_SETTINGS_H 23 | #define POWER_SETTINGS_H 24 | 25 | #include 26 | #include 27 | 28 | class PowerSettings 29 | { 30 | public: 31 | static void setValue(const QString &type, const QVariant &value); 32 | static const QVariant getValue(const QString &type); 33 | static bool isValid(const QString &type); 34 | static void saveDefault(); 35 | static const QString getConf(); 36 | static const QString getDir(); 37 | }; 38 | 39 | #endif // POWER_SETTINGS_H 40 | -------------------------------------------------------------------------------- /src/lib/org.dracolinux.Powerd.Manager.Backlight.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #include "org.dracolinux.Powerd.Manager.Backlight.h" 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | const QString PowerBacklight::getDevice() 29 | { 30 | QString path = "/sys/class/backlight"; 31 | QDirIterator it(path, QDirIterator::Subdirectories); 32 | while (it.hasNext()) { 33 | QString foundDir = it.next(); 34 | if (foundDir.startsWith(QString("%1/radeon").arg(path))) { 35 | return foundDir; 36 | } else if (foundDir.startsWith(QString("%1/intel").arg(path))) { 37 | return foundDir; 38 | } else if (foundDir.startsWith(QString("%1/acpi").arg(path))) { 39 | return foundDir; 40 | } 41 | } 42 | return QString(); 43 | } 44 | 45 | bool PowerBacklight::canAdjustBrightness(const QString &device) 46 | { 47 | QFileInfo backlight(QString("%1/brightness").arg(device)); 48 | if (backlight.isWritable()) { return true; } 49 | return false; 50 | } 51 | 52 | bool PowerBacklight::canAdjustBrightness() 53 | { 54 | return canAdjustBrightness(getDevice()); 55 | } 56 | 57 | int PowerBacklight::getMaxBrightness(const QString &device) 58 | { 59 | int result = 0; 60 | QFile backlight(QString("%1/max_brightness").arg(device)); 61 | if (backlight.open(QIODevice::ReadOnly)) { 62 | result = backlight.readAll().trimmed().toInt(); 63 | backlight.close(); 64 | } 65 | return result; 66 | } 67 | 68 | int PowerBacklight::getMaxBrightness() 69 | { 70 | return getMaxBrightness(getDevice()); 71 | } 72 | 73 | int PowerBacklight::getCurrentBrightness(const QString &device) 74 | { 75 | int result = 0; 76 | QFile backlight(QString("%1/brightness").arg(device)); 77 | if (backlight.open(QIODevice::ReadOnly)) { 78 | result = backlight.readAll().trimmed().toInt(); 79 | backlight.close(); 80 | } 81 | return result; 82 | } 83 | 84 | int PowerBacklight::getCurrentBrightness() 85 | { 86 | return getCurrentBrightness(getDevice()); 87 | } 88 | 89 | bool PowerBacklight::setCurrentBrightness(const QString &device, int value) 90 | { 91 | if (!canAdjustBrightness(device)) { return false; } 92 | QFile backlight(QString("%1/brightness").arg(device)); 93 | if (backlight.open(QIODevice::WriteOnly|QIODevice::Truncate)) { 94 | QTextStream out(&backlight); 95 | if (value<1) { value = 1; } 96 | out << QString::number(value); 97 | backlight.close(); 98 | if (value == getCurrentBrightness(device)) { return true;} 99 | } 100 | return false; 101 | } 102 | 103 | bool PowerBacklight::setCurrentBrightness(int value) 104 | { 105 | return setCurrentBrightness(getDevice(), value); 106 | } 107 | -------------------------------------------------------------------------------- /src/lib/org.dracolinux.Powerd.Manager.Backlight.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #ifndef POWER_BACKLIGHT_H 23 | #define POWER_BACKLIGHT_H 24 | 25 | #include 26 | 27 | class PowerBacklight 28 | { 29 | public: 30 | static const QString getDevice(); 31 | static bool canAdjustBrightness(const QString &device); 32 | static bool canAdjustBrightness(); 33 | static int getMaxBrightness(const QString &device); 34 | static int getMaxBrightness(); 35 | static int getCurrentBrightness(const QString &device); 36 | static int getCurrentBrightness(); 37 | static bool setCurrentBrightness(const QString &device, int value); 38 | static bool setCurrentBrightness(int value); 39 | }; 40 | 41 | #endif // POWER_BACKLIGHT_H 42 | -------------------------------------------------------------------------------- /src/lib/org.dracolinux.Powerd.Manager.CPU.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #ifndef POWER_CPU_H 23 | #define POWER_CPU_H 24 | 25 | #include 26 | #include 27 | 28 | #define LINUX_CPU_SYS "/sys/devices/system/cpu" 29 | #define LINUX_CPU_DIR "cpufreq" 30 | #define LINUX_CPU_FREQUENCIES "scaling_available_frequencies" 31 | #define LINUX_CPU_FREQUENCY "scaling_cur_freq" 32 | #define LINUX_CPU_FREQUENCY_MAX "scaling_max_freq" 33 | #define LINUX_CPU_FREQUENCY_MIN "scaling_min_freq" 34 | #define LINUX_CPU_GOVERNORS "scaling_available_governors" 35 | #define LINUX_CPU_GOVERNOR "scaling_governor" 36 | #define LINUX_CPU_SET_SPEED "scaling_setspeed" 37 | #define LINUX_CPU_PSTATE "intel_pstate" 38 | #define LINUX_CPU_PSTATE_STATUS "status" 39 | #define LINUX_CPU_PSTATE_NOTURBO "no_turbo" 40 | #define LINUX_CPU_PSTATE_MAX_PERF "max_perf_pct" 41 | #define LINUX_CPU_PSTATE_MIN_PERF "min_perf_pct" 42 | 43 | #define LINUX_CORETEMP "/sys/class/hwmon/hwmon0" 44 | #define LINUX_CORETEMP_CRIT "temp%1_crit" 45 | #define LINUX_CORETEMP_INPUT "temp%1_input" 46 | #define LINUX_CORETEMP_LABEL "temp%1_label" 47 | #define LINUX_CORETEMP_MAX "temp%1_max" 48 | 49 | class PowerCpu 50 | { 51 | public: 52 | static int getTotal(); 53 | 54 | static const QString getGovernor(int cpu); 55 | static const QStringList getGovernors(); 56 | static const QStringList getAvailableGovernors(); 57 | static bool governorExists(const QString &gov); 58 | static bool setGovernor(const QString &gov, int cpu); 59 | static bool setGovernor(const QString &gov); 60 | 61 | static const QString getFrequency(int cpu); 62 | static const QStringList getFrequencies(); 63 | static int getMaxFrequencies(); 64 | static const QStringList getAvailableFrequency(); 65 | static int getMaxFrequency(); 66 | static int getMinFrequency(); 67 | static bool frequencyExists(const QString &freq); 68 | static bool setFrequency(const QString &freq, int cpu); 69 | static bool setFrequency(const QString &freq); 70 | 71 | static bool hasPState(); 72 | static bool hasPStateTurbo(); 73 | static bool setPStateTurbo(bool turbo); 74 | static int getPStateMax(); 75 | static int getPStateMin(); 76 | static bool setPStateMax(int maxState); 77 | static bool setPStateMin(int minState); 78 | 79 | static bool hasCoreTemp(); 80 | static int getCoreTemp(); 81 | }; 82 | 83 | #endif // POWER_CPU_H 84 | -------------------------------------------------------------------------------- /src/lib/org.dracolinux.Powerd.Manager.RTC.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #include "org.dracolinux.Powerd.Manager.RTC.h" 23 | 24 | #ifdef Q_OS_LINUX 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #define RTC_DEV "/dev/rtc" 32 | #endif 33 | 34 | bool PowerRtc::setAlarm(const QDateTime &date) 35 | { 36 | #ifdef Q_OS_LINUX 37 | if (!date.isValid() || date.isNull()) { return false; } 38 | 39 | int fd, result = 0; 40 | struct rtc_time rtc; 41 | 42 | fd = open(RTC_DEV, O_RDONLY); 43 | if (fd == -1) { return false; } 44 | 45 | result = ioctl(fd, RTC_UIE_OFF, 0); 46 | if (result == -1) { 47 | close(fd); 48 | return false; 49 | } 50 | 51 | result = ioctl(fd, RTC_RD_TIME, &rtc); 52 | if (result == -1) { 53 | close(fd); 54 | return false; 55 | } 56 | 57 | rtc.tm_year = date.date().year(); 58 | rtc.tm_mon = date.date().month(); 59 | rtc.tm_mday = date.date().day(); 60 | rtc.tm_hour = date.time().hour(); 61 | rtc.tm_min = date.time().minute(); 62 | rtc.tm_sec = date.time().second(); 63 | 64 | result = ioctl(fd, RTC_ALM_SET, &rtc); 65 | if (result == -1) { 66 | close(fd); 67 | return false; 68 | } 69 | 70 | result = ioctl(fd, RTC_AIE_ON, 0); 71 | if (result == -1) { 72 | close(fd); 73 | return false; 74 | } 75 | 76 | close(fd); 77 | return true; 78 | #else 79 | return false; 80 | #endif 81 | } 82 | -------------------------------------------------------------------------------- /src/lib/org.dracolinux.Powerd.Manager.RTC.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #ifndef POWER_RTC_H 23 | #define POWER_RTC_H 24 | 25 | #include 26 | 27 | class PowerRtc 28 | { 29 | public: 30 | static bool setAlarm(const QDateTime &date); 31 | }; 32 | 33 | #endif // POWER_RTC_H 34 | -------------------------------------------------------------------------------- /src/lib/org.dracolinux.Powerd.Manager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #include "org.dracolinux.Powerd.Manager.h" 23 | #include "org.dracolinux.Powerd.Manager.RTC.h" 24 | #include "org.dracolinux.Powerd.Manager.Backlight.h" 25 | #include "org.dracolinux.Powerd.Manager.CPU.h" 26 | 27 | #include 28 | 29 | Manager::Manager(QObject *parent) : QObject(parent) 30 | { 31 | } 32 | 33 | bool Manager::SetWakeAlarm(const QString &alarm) 34 | { 35 | qDebug() << "Try to set RTC wake alarm" << alarm; 36 | QDateTime date = QDateTime::fromString(alarm, "yyyy-MM-dd HH:mm:ss"); 37 | if (date.isNull() || !date.isValid()) { return false; } 38 | return PowerRtc::setAlarm(date); 39 | } 40 | 41 | bool Manager::SetDisplayBacklight(const QString &device, int value) 42 | { 43 | qDebug() << "Try to set DISPLAY backlight" << device << value; 44 | if (!PowerBacklight::canAdjustBrightness(device)) { return false; } 45 | int light = value; 46 | if (light>PowerBacklight::getMaxBrightness(device)) { light = PowerBacklight::getMaxBrightness(device); } 47 | else if (light<0) { light = 0; } 48 | return PowerBacklight::setCurrentBrightness(device, light); 49 | } 50 | 51 | bool Manager::SetCpuGovernor(const QString &gov) 52 | { 53 | qDebug() << "Try to set CPU governor" << gov; 54 | return PowerCpu::setGovernor(gov); 55 | } 56 | 57 | bool Manager::SetCpuFrequency(const QString &freq) 58 | { 59 | qDebug() << "Try to set CPU frequency" << freq; 60 | return PowerCpu::setFrequency(freq); 61 | } 62 | 63 | bool Manager::SetPStateTurbo(bool enable) 64 | { 65 | qDebug() << "Try to set Intel Turbo Boost" << enable; 66 | return PowerCpu::setPStateTurbo(enable); 67 | } 68 | 69 | bool Manager::SetPStateMax(int value) 70 | { 71 | qDebug() << "Try to set Intel pstate max" << value; 72 | return PowerCpu::setPStateMax(value); 73 | } 74 | 75 | bool Manager::SetPStateMin(int value) 76 | { 77 | qDebug() << "Try to set Intel pstate min" << value; 78 | return PowerCpu::setPStateMin(value); 79 | } 80 | -------------------------------------------------------------------------------- /src/lib/org.dracolinux.Powerd.Manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #ifndef MANAGER_H 23 | #define MANAGER_H 24 | 25 | #include 26 | #include 27 | 28 | class Manager : public QObject 29 | { 30 | Q_OBJECT 31 | 32 | public: 33 | explicit Manager(QObject *parent = NULL); 34 | 35 | public slots: 36 | bool SetWakeAlarm(const QString &alarm); 37 | bool SetDisplayBacklight(const QString &device, int value); 38 | bool SetCpuGovernor(const QString &gov); 39 | bool SetCpuFrequency(const QString &freq); 40 | bool SetPStateTurbo(bool enable); 41 | bool SetPStateMax(int value); 42 | bool SetPStateMin(int value); 43 | }; 44 | 45 | #endif // MANAGER_H 46 | -------------------------------------------------------------------------------- /src/lib/org.freedesktop.PowerManagement.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #include "org.freedesktop.PowerManagement.h" 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "power_def.h" 29 | 30 | PowerManagement::PowerManagement(QObject *parent) : QObject(parent) 31 | { 32 | timer.setInterval(PM_TIMEOUT); 33 | connect(&timer, SIGNAL(timeout()), 34 | this, SLOT(timeOut())); 35 | timer.start(); 36 | } 37 | 38 | int PowerManagement::randInt(int low, int high) 39 | { 40 | QTime time = QTime::currentTime(); 41 | qsrand((uint)time.msec()); 42 | return qrand() % ((high + 1) - low) + low; 43 | } 44 | 45 | quint32 PowerManagement::genCookie() 46 | { 47 | int low = 0; 48 | int high = 1000; 49 | quint32 cookie = (quint32)randInt(low, high); 50 | while(!clients.contains(cookie)) { 51 | if (!clients.contains(cookie)) { clients[cookie] = QTime::currentTime(); } 52 | else { cookie = (quint32)randInt(low, high); } 53 | } 54 | return cookie; 55 | } 56 | 57 | void PowerManagement::checkForExpiredClients() 58 | { 59 | QMapIterator client(clients); 60 | while (client.hasNext()) { 61 | client.next(); 62 | if (client.value() 63 | .secsTo(QTime::currentTime())>=PM_MAX_INHIBIT) { 64 | clients.remove(client.key()); 65 | } 66 | } 67 | } 68 | 69 | bool PowerManagement::canInhibit() 70 | { 71 | checkForExpiredClients(); 72 | if (clients.size()>0) { return true; } 73 | return false; 74 | } 75 | 76 | void PowerManagement::timeOut() 77 | { 78 | if (canInhibit()) { SimulateUserActivity(); } 79 | } 80 | 81 | void PowerManagement::SimulateUserActivity() 82 | { 83 | emit HasInhibitChanged(true); 84 | } 85 | 86 | quint32 PowerManagement::Inhibit(const QString &application, 87 | const QString &reason) 88 | { 89 | quint32 cookie = genCookie(); 90 | timeOut(); 91 | emit newInhibit(application, reason, cookie); 92 | emit HasInhibitChanged(canInhibit()); 93 | return cookie; 94 | } 95 | 96 | void PowerManagement::UnInhibit(quint32 cookie) 97 | { 98 | if (clients.contains(cookie)) { clients.remove(cookie); } 99 | timeOut(); 100 | emit removedInhibit(cookie); 101 | emit HasInhibitChanged(canInhibit()); 102 | } 103 | 104 | bool PowerManagement::HasInhibit() 105 | { 106 | return canInhibit(); 107 | } 108 | -------------------------------------------------------------------------------- /src/lib/org.freedesktop.PowerManagement.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #ifndef POWERMANAGEMENT_H 23 | #define POWERMANAGEMENT_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | class PowerManagement : public QObject 32 | { 33 | Q_OBJECT 34 | 35 | public: 36 | explicit PowerManagement(QObject *parent = NULL); 37 | 38 | private: 39 | QTimer timer; 40 | QMap clients; 41 | 42 | signals: 43 | void HasInhibitChanged(bool has_inhibit); 44 | void newInhibit(const QString &application, 45 | const QString &reason, 46 | quint32 cookie); 47 | void removedInhibit(quint32 cookie); 48 | 49 | private slots: 50 | int randInt(int low, int high); 51 | quint32 genCookie(); 52 | void checkForExpiredClients(); 53 | bool canInhibit(); 54 | void timeOut(); 55 | 56 | public slots: 57 | void SimulateUserActivity(); 58 | quint32 Inhibit(const QString &application, 59 | const QString &reason); 60 | void UnInhibit(quint32 cookie); 61 | bool HasInhibit(); 62 | }; 63 | 64 | #endif // POWERMANAGEMENT_H 65 | -------------------------------------------------------------------------------- /src/lib/org.freedesktop.ScreenSaver.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #include "org.freedesktop.ScreenSaver.h" 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include "power_def.h" 30 | 31 | ScreenSaver::ScreenSaver(QObject *parent) : QObject(parent) 32 | { 33 | timer.setInterval(SS_TIMEOUT); 34 | connect(&timer, SIGNAL(timeout()), 35 | this, SLOT(timeOut())); 36 | timer.start(); 37 | } 38 | 39 | int ScreenSaver::randInt(int low, int high) 40 | { 41 | QTime time = QTime::currentTime(); 42 | qsrand((uint)time.msec()); 43 | return qrand() % ((high + 1) - low) + low; 44 | } 45 | 46 | quint32 ScreenSaver::genCookie() 47 | { 48 | int low = 0; 49 | int high = 1000; 50 | quint32 cookie = (quint32)randInt(low, high); 51 | while(!clients.contains(cookie)) { 52 | if (!clients.contains(cookie)) { clients[cookie] = QTime::currentTime(); } 53 | else { cookie = (quint32)randInt(low, high); } 54 | } 55 | return cookie; 56 | } 57 | 58 | void ScreenSaver::checkForExpiredClients() 59 | { 60 | QMapIterator client(clients); 61 | while (client.hasNext()) { 62 | client.next(); 63 | if (client.value() 64 | .secsTo(QTime::currentTime())>=SS_MAX_INHIBIT) { 65 | clients.remove(client.key()); 66 | } 67 | } 68 | } 69 | 70 | bool ScreenSaver::canInhibit() 71 | { 72 | checkForExpiredClients(); 73 | if (clients.size()>0) { return true; } 74 | return false; 75 | } 76 | 77 | void ScreenSaver::timeOut() 78 | { 79 | if (canInhibit()) { SimulateUserActivity(); } 80 | } 81 | 82 | void ScreenSaver::pingPM() 83 | { 84 | QDBusInterface iface(PM_SERVICE, PM_PATH, PM_SERVICE, 85 | QDBusConnection::sessionBus()); 86 | if (!iface.isValid()) { 87 | return; 88 | } 89 | iface.call(SS_SIMULATE); 90 | } 91 | 92 | void ScreenSaver::SimulateUserActivity() 93 | { 94 | QProcess proc; 95 | proc.start(XSCREENSAVER); 96 | proc.waitForFinished(); 97 | proc.close(); 98 | pingPM(); 99 | } 100 | 101 | quint32 ScreenSaver::Inhibit(const QString &application, 102 | const QString &reason) 103 | { 104 | quint32 cookie = genCookie(); 105 | emit newInhibit(application, reason, cookie); 106 | timeOut(); 107 | return cookie; 108 | } 109 | 110 | void ScreenSaver::UnInhibit(quint32 cookie) 111 | { 112 | if (clients.contains(cookie)) { clients.remove(cookie); } 113 | timeOut(); 114 | emit removedInhibit(cookie); 115 | } 116 | -------------------------------------------------------------------------------- /src/lib/org.freedesktop.ScreenSaver.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #ifndef SCREENSAVER_H 23 | #define SCREENSAVER_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | class ScreenSaver : public QObject 32 | { 33 | Q_OBJECT 34 | 35 | public: 36 | explicit ScreenSaver(QObject *parent = NULL); 37 | 38 | private: 39 | QTimer timer; 40 | QMap clients; 41 | 42 | signals: 43 | void newInhibit(const QString &application, 44 | const QString &reason, 45 | quint32 cookie); 46 | void removedInhibit(quint32 cookie); 47 | 48 | private slots: 49 | int randInt(int low, int high); 50 | quint32 genCookie(); 51 | void checkForExpiredClients(); 52 | bool canInhibit(); 53 | void timeOut(); 54 | void pingPM(); 55 | 56 | public slots: 57 | void SimulateUserActivity(); 58 | quint32 Inhibit(const QString &application, 59 | const QString &reason); 60 | void UnInhibit(quint32 cookie); 61 | }; 62 | 63 | #endif // SCREENSAVER_H 64 | -------------------------------------------------------------------------------- /src/lib/org.freedesktop.UDisks2.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (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 General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser Public License 18 | * along with this program. If not, see 19 | # 20 | */ 21 | 22 | #ifndef UDISKS2_H 23 | #define UDISKS2_H 24 | 25 | #include 26 | 27 | #define DBUS_SERVICE "org.freedesktop.UDisks2" 28 | #define DBUS_PATH "/org/freedesktop/UDisks2" 29 | #define DBUS_OBJMANAGER "org.freedesktop.DBus.ObjectManager" 30 | #define DBUS_PROPERTIES "org.freedesktop.DBus.Properties" 31 | #define DBUS_INTROSPECTABLE "org.freedesktop.DBus.Introspectable" 32 | #define DBUS_DEVICE_ADDED "InterfacesAdded" 33 | #define DBUS_DEVICE_REMOVED "InterfacesRemoved" 34 | 35 | class uDisks2 36 | { 37 | public: 38 | static const QString getDrivePath(QString path); 39 | static bool hasPartition(QString path); 40 | static const QString getFileSystem(QString path); 41 | static bool isRemovable(QString path); 42 | static bool isOptical(QString path); 43 | static bool hasMedia(QString path); 44 | static bool hasOpticalMedia(QString path); 45 | static bool canEject(QString path); 46 | static bool opticalMediaIsBlank(QString path); 47 | static int opticalDataTracks(QString path); 48 | static int opticalAudioTracks(QString path); 49 | static const QString getMountPointOptical(QString path); 50 | static const QString getMountPoint(QString path); 51 | static const QString getDeviceName(QString path); 52 | static const QString getDeviceLabel(QString path); 53 | static const QString mountDevice(QString path); 54 | static const QString mountOptical(QString path); 55 | static const QString unmountDevice(QString path); 56 | static const QString unmountOptical(QString path); 57 | static const QString ejectDevice(QString path); 58 | static const QStringList getDevices(); 59 | }; 60 | 61 | #endif // UDISKS2_H 62 | -------------------------------------------------------------------------------- /src/lib/powerkit_theme.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie All rights reserved. 5 | # 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (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 | */ 20 | 21 | #include "powerkit_theme.h" 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include "powerkit_def.h" 30 | #include "powerkit_settings.h" 31 | 32 | void Theme::setIconTheme() 33 | { 34 | // setup icon theme search path 35 | QStringList iconsPath = QIcon::themeSearchPaths(); 36 | QString iconsHomeLocal = QString("%1/.local/share/icons").arg(QDir::homePath()); 37 | QString iconsHome = QString("%1/.icons").arg(QDir::homePath()); 38 | if (QFile::exists(iconsHomeLocal) && 39 | !iconsPath.contains(iconsHomeLocal)) { iconsPath.prepend(iconsHomeLocal); } 40 | if (QFile::exists(iconsHome) && 41 | !iconsPath.contains(iconsHome)) { iconsPath.prepend(iconsHome); } 42 | iconsPath << QString("%1/../share/icons").arg(qApp->applicationDirPath()); 43 | QIcon::setThemeSearchPaths(iconsPath); 44 | qDebug() << "using icon theme search path" << QIcon::themeSearchPaths(); 45 | 46 | QString theme = QIcon::themeName(); 47 | if (theme.isEmpty() || theme == "hicolor") { // try to load saved theme 48 | theme = PowerSettings::getValue(CONF_ICON_THEME).toString(); 49 | } 50 | if(theme.isEmpty() || theme == "hicolor") { // Nope, then scan for first available 51 | // gtk 52 | if(QFile::exists(QDir::homePath() + "/" + ".gtkrc-2.0")) { 53 | QSettings gtkFile(QDir::homePath() + "/.gtkrc-2.0", QSettings::IniFormat); 54 | theme = gtkFile.value("gtk-icon-theme-name").toString().remove("\""); 55 | } else { 56 | QSettings gtkFile(QDir::homePath() + "/.config/gtk-3.0/settings.ini", QSettings::IniFormat); 57 | theme = gtkFile.value("gtk-fallback-icon-theme").toString().remove("\""); 58 | } 59 | // fallback 60 | if(theme.isNull()) { theme = DEFAULT_THEME; } 61 | if (!theme.isEmpty()) { PowerSettings::setValue(CONF_ICON_THEME, theme); } 62 | } 63 | qDebug() << "Using icon theme" << theme; 64 | QIcon::setThemeName(theme); 65 | #ifdef BUNDLE_ICONS 66 | if (theme != DEFAULT_THEME) { // validate theme 67 | QIcon testTheme = QIcon::fromTheme(DEFAULT_AC_ICON); 68 | if (testTheme.isNull()) { 69 | qDebug() << "icon theme is broken, use failsafe!"; 70 | QIcon::setThemeName(DEFAULT_THEME); 71 | Common::savePowerSettings(CONF_ICON_THEME, DEFAULT_THEME); 72 | } 73 | } 74 | #endif 75 | } 76 | -------------------------------------------------------------------------------- /src/lib/powerkit_theme.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie All rights reserved. 5 | # 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (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 | */ 20 | 21 | #ifndef THEME_H 22 | #define THEME_H 23 | 24 | class Theme 25 | { 26 | public: 27 | static void setIconTheme(); 28 | }; 29 | 30 | #endif // THEME_H 31 | -------------------------------------------------------------------------------- /src/lib/qtcopydialog/qtcopydialog.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 | ** All rights reserved. 5 | ** Contact: Nokia Corporation (qt-info@nokia.com) 6 | ** 7 | ** This file is part of a Qt Solutions component. 8 | ** 9 | ** Commercial Usage 10 | ** Licensees holding valid Qt Commercial licenses may use this file in 11 | ** accordance with the Qt Solutions Commercial License Agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and Nokia. 14 | ** 15 | ** GNU Lesser General Public License Usage 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser 17 | ** General Public License version 2.1 as published by the Free Software 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the 19 | ** packaging of this file. Please review the following information to 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 | ** 23 | ** In addition, as a special exception, Nokia gives you certain 24 | ** additional rights. These rights are described in the Nokia Qt LGPL 25 | ** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this 26 | ** package. 27 | ** 28 | ** GNU General Public License Usage 29 | ** Alternatively, this file may be used under the terms of the GNU 30 | ** General Public License version 3.0 as published by the Free Software 31 | ** Foundation and appearing in the file LICENSE.GPL included in the 32 | ** packaging of this file. Please review the following information to 33 | ** ensure the GNU General Public License version 3.0 requirements will be 34 | ** met: http://www.gnu.org/copyleft/gpl.html. 35 | ** 36 | ** Please note Third Party Software included with Qt Solutions may impose 37 | ** additional restrictions and it is the user's responsibility to ensure 38 | ** that they have met the licensing requirements of the GPL, LGPL, or Qt 39 | ** Solutions Commercial license and the relevant license of the Third 40 | ** Party Software they are using. 41 | ** 42 | ** If you are unsure which license is appropriate for your use, please 43 | ** contact Nokia at qt-info@nokia.com. 44 | ** 45 | ****************************************************************************/ 46 | 47 | #ifndef QTCOPYDIALOG_H 48 | #define QTCOPYDIALOG_H 49 | 50 | #include 51 | #include "qtfilecopier.h" 52 | 53 | class QtCopyDialogPrivate; 54 | 55 | class QT_QTCOPYDIALOG_EXPORT QtCopyDialog : public QDialog 56 | { 57 | Q_OBJECT 58 | Q_PROPERTY(int minimumDuration READ minimumDuration WRITE setMinimumDuration) 59 | Q_PROPERTY(bool autoClose READ autoClose WRITE setAutoClose) 60 | public: 61 | 62 | QtCopyDialog(QWidget *parent = 0, bool delOnClose = true, Qt::WindowFlags f = 0); 63 | QtCopyDialog(QtFileCopier *copier, QWidget *parent = 0, bool delOnClose = true, Qt::WindowFlags f = 0); 64 | ~QtCopyDialog(); 65 | 66 | void setFileCopier(QtFileCopier *copier); 67 | QtFileCopier *fileCopier() const; 68 | 69 | int minimumDuration() const; 70 | void setMinimumDuration(int ms); 71 | 72 | bool autoClose() const; 73 | void setAutoClose(bool b); 74 | 75 | public Q_SLOTS: 76 | 77 | void reject(); 78 | 79 | private: 80 | 81 | QtCopyDialogPrivate *d_ptr; 82 | bool m_del; 83 | Q_DECLARE_PRIVATE(QtCopyDialog) 84 | Q_DISABLE_COPY(QtCopyDialog) 85 | 86 | Q_PRIVATE_SLOT(d_func(), void error(int, QtFileCopier::Error, bool)) 87 | Q_PRIVATE_SLOT(d_func(), void stateChanged(QtFileCopier::State)) 88 | Q_PRIVATE_SLOT(d_func(), void done(bool)) 89 | Q_PRIVATE_SLOT(d_func(), void started(int)) 90 | Q_PRIVATE_SLOT(d_func(), void dataTransferProgress(int, qint64)) 91 | Q_PRIVATE_SLOT(d_func(), void finished(int, bool)) 92 | Q_PRIVATE_SLOT(d_func(), void canceled()) 93 | Q_PRIVATE_SLOT(d_func(), void showProgress()) 94 | Q_PRIVATE_SLOT(d_func(), void showDialog()) 95 | 96 | }; 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /src/power/org.dracolinux.Power.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 2 of the License, or 10 | # (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 General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see 19 | # 20 | */ 21 | 22 | #include "draco.h" 23 | #include "org.dracolinux.Power.Tray.h" 24 | 25 | #include 26 | 27 | int main(int argc, char *argv[]) 28 | { 29 | QApplication a(argc, argv); 30 | QCoreApplication::setApplicationName("freedesktop"); 31 | QCoreApplication::setOrganizationDomain("org"); 32 | 33 | if (!QDBusConnection::sessionBus().registerService(Draco::powerSessionName())) { 34 | qWarning() << "Failed to register service" << Draco::powerSessionName(); 35 | return 1; 36 | } 37 | 38 | SysTray tray(a.parent()); 39 | return a.exec(); 40 | } 41 | -------------------------------------------------------------------------------- /src/power/org.dracolinux.Powerd.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie All rights reserved. 5 | # 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (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 | */ 20 | 21 | #include "org.dracolinux.Powerd.Manager.h" 22 | #include "draco.h" 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | int main(int argc, char *argv[]) 29 | { 30 | QCoreApplication a(argc, argv); 31 | QCoreApplication::setOrganizationDomain("org"); 32 | QCoreApplication::setApplicationName(DAEMON_APP_NAME); 33 | 34 | if (!QDBusConnection::systemBus().isConnected()) { 35 | qWarning("Cannot connect to the D-Bus system bus."); 36 | return 1; 37 | } 38 | 39 | if (!QDBusConnection::systemBus().registerService(Draco::powerdSessionName())) { 40 | qWarning() << "Failed to register service" << QDBusConnection::systemBus().lastError().message(); 41 | return 1; 42 | } 43 | qDebug() << "Registered service" << Draco::powerdSessionName(); 44 | 45 | Manager man; 46 | if (!QDBusConnection::systemBus().registerObject(Draco::powerdSessionPath(), 47 | &man, 48 | QDBusConnection::ExportAllContents)) { 49 | qWarning() << "Failed to register path" << Draco::powerdSessionPath() << QDBusConnection::systemBus().lastError().message(); 50 | return 1; 51 | } 52 | qDebug() << "Registered service path" << Draco::powerdSessionPath(); 53 | 54 | if (!QDBusConnection::systemBus().registerObject(Draco::powerdSessionFullPath(), 55 | &man, 56 | QDBusConnection::ExportAllContents)) { 57 | qWarning() << "Failed to register full path" << Draco::powerdSessionFullPath() << QDBusConnection::systemBus().lastError(); 58 | return 1; 59 | } 60 | qDebug() << "Registered service full path" << Draco::powerdSessionFullPath(); 61 | 62 | return a.exec(); 63 | } 64 | -------------------------------------------------------------------------------- /src/settings/config/GetPluginDialog.cpp: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2015, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | #include "GetPluginDialog.h" 8 | #include "ui_GetPluginDialog.h" 9 | 10 | #include 11 | 12 | GetPluginDialog::GetPluginDialog(QWidget *parent) : QDialog(parent), ui(new Ui::GetPluginDialog()){ 13 | ui->setupUi(this); 14 | selected = false; //nothing selected by default 15 | //Now center the window on the parent 16 | if(parent!=0){ 17 | QWidget *top = parent; 18 | while(!top->isWindow()){ top = top->parentWidget(); } 19 | QPoint center = top->geometry().center(); 20 | this->move(center.x()-(this->width()/2), center.y()-(this->height()/2) ); 21 | } 22 | //Load the icons 23 | ui->push_cancel->setIcon( LXDG::findIcon("dialog-cancel","") ); 24 | ui->push_accept->setIcon( LXDG::findIcon("dialog-ok","") ); 25 | this->setWindowIcon( LXDG::findIcon("preferences-plugin") ); 26 | //Connect the signals/slots 27 | connect(ui->combo_list, SIGNAL(currentIndexChanged(int)), this, SLOT(pluginchanged()) ); 28 | connect(ui->push_cancel, SIGNAL(clicked()), this, SLOT(close()) ); 29 | connect(ui->push_accept, SIGNAL(clicked()), this, SLOT(accept()) ); 30 | } 31 | 32 | GetPluginDialog::~GetPluginDialog(){ 33 | 34 | } 35 | 36 | void GetPluginDialog::LoadPlugins(QString type, LPlugins *DB){ 37 | //Special data format: :::::::::::: 38 | QStringList data; 39 | if(type.toLower()=="menu"){ 40 | QStringList plugs = DB->menuPlugins(); 41 | for(int i=0; imenuPluginInfo(plugs[i]); 43 | data << dat.name+"::::"+dat.ID+"::::"+dat.icon+"::::"+dat.description; 44 | } 45 | }else if(type.toLower()=="desktop"){ 46 | QStringList plugs = DB->desktopPlugins(); 47 | for(int i=0; idesktopPluginInfo(plugs[i]); 49 | data << dat.name+"::::"+dat.ID+"::::"+dat.icon+"::::"+dat.description; 50 | } 51 | }else if(type.toLower()=="panel"){ 52 | QStringList plugs = DB->panelPlugins(); 53 | for(int i=0; ipanelPluginInfo(plugs[i]); 55 | data << dat.name+"::::"+dat.ID+"::::"+dat.icon+"::::"+dat.description; 56 | } 57 | } 58 | data.sort(); //this will sort them according to visible name 59 | ui->combo_list->clear(); 60 | for(int i=0; icombo_list->addItem( LXDG::findIcon(data[i].section("::::",2,2),""), data[i].section("::::",0,0) , data[i]); 62 | } 63 | if(!data.isEmpty()){ 64 | ui->combo_list->setCurrentIndex(0); 65 | } 66 | } 67 | 68 | void GetPluginDialog::pluginchanged(){ 69 | //Load the description of the currently selected plugin 70 | if(ui->combo_list->count() < 1){ ui->label_desc->clear(); } 71 | else{ 72 | ui->label_desc->setText( ui->combo_list->currentData().toString().section("::::",3,50) ); 73 | } 74 | ui->push_accept->setEnabled(ui->combo_list->currentIndex()>=0); 75 | } 76 | 77 | void GetPluginDialog::accept(){ 78 | plugID = ui->combo_list->currentData().toString().section("::::",1,1); 79 | selected = true; 80 | this->close(); 81 | } 82 | -------------------------------------------------------------------------------- /src/settings/config/GetPluginDialog.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2015, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | #ifndef _LUMINA_CONFIG_GET_PLUGIN_DIALOG_H 8 | #define _LUMINA_CONFIG_GET_PLUGIN_DIALOG_H 9 | 10 | #include 11 | 12 | #include "LPlugins.h" 13 | 14 | namespace Ui{ 15 | class GetPluginDialog; 16 | }; 17 | 18 | class GetPluginDialog : public QDialog{ 19 | Q_OBJECT 20 | public: 21 | GetPluginDialog(QWidget* parent = 0); 22 | ~GetPluginDialog(); 23 | 24 | void LoadPlugins(QString type, LPlugins *DB); 25 | 26 | bool selected; //this is set to true if a plugin was selected by the user 27 | QString plugID; //this is set to the ID of the selected plugin 28 | 29 | private: 30 | Ui::GetPluginDialog *ui; 31 | 32 | private slots: 33 | void pluginchanged(); 34 | void accept(); 35 | 36 | }; 37 | 38 | #endif -------------------------------------------------------------------------------- /src/settings/config/GetPluginDialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | GetPluginDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 248 10 | 178 11 | 12 | 13 | 14 | Select Plugin 15 | 16 | 17 | 18 | 19 | 20 | 21 | 75 22 | true 23 | 24 | 25 | 26 | Select a Plugin: 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 0 38 | 0 39 | 40 | 41 | 42 | TextLabel 43 | 44 | 45 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop 46 | 47 | 48 | true 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | Cancel 58 | 59 | 60 | 61 | 62 | 63 | 64 | Qt::Horizontal 65 | 66 | 67 | 68 | 40 69 | 20 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | Select 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /src/settings/config/LPlugins.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2014, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | #ifndef _LUMINA_DESKTOP_CONFIG_PLUGINS_H 8 | #define _LUMINA_DESKTOP_CONFIG_PLUGINS_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | // Lumina Plugin Info class 16 | class LPI{ 17 | public: 18 | QString name, ID, description, icon; 19 | LPI(){} 20 | ~LPI(){} 21 | }; 22 | 23 | // Utility class for getting information 24 | class LPlugins{ 25 | public: 26 | LPlugins(); 27 | ~LPlugins(); 28 | //Total lists of plugins 29 | QStringList panelPlugins(); 30 | QStringList desktopPlugins(); 31 | QStringList menuPlugins(); 32 | QStringList colorItems(); 33 | //Information on individual plugins 34 | LPI panelPluginInfo(QString); 35 | LPI desktopPluginInfo(QString); 36 | LPI menuPluginInfo(QString); 37 | LPI colorInfo(QString); 38 | 39 | private: 40 | QHash PANEL, DESKTOP, MENU, COLORS; 41 | void LoadPanelPlugins(); 42 | void LoadDesktopPlugins(); 43 | void LoadMenuPlugins(); 44 | void LoadColorItems(); 45 | }; 46 | #endif 47 | -------------------------------------------------------------------------------- /src/settings/config/hooks.txt: -------------------------------------------------------------------------------- 1 | Settings file located at: ~/.lumina/settings/LuminaDE/desktopsettings.conf 2 | This file will pretty much be empty initially, except for the current background set to "default" 3 | 4 | 5 | Example Code: 6 | QSettings *settings = new QSettings(); 7 | settings->setValue(,); //to set a value 8 | value = settings->value(, ); //to read the current value 9 | 10 | Current Variable/Value combinations for the Lumina Desktop 11 | 12 | ===DESKTOP SETTINGS=== 13 | Prefix: "desktop-" (so the first screen is "desktop-0") 14 | 15 | --- Background settings --- 16 | Prefix/background/current -> (QString) filepath for current background image (do not modify - handled internally) 17 | === Note: a background filepath of "default" corresponds to "/usr/local/share/Lumina-DE/desktop-background.jpg" internally 18 | Prefix/background/filelist -> (QStringList) list of filepaths to use for backgrounds 19 | Prefix/background/minutesToChange -> (Integer) Number of minutes between background changes (ignored for single image) 20 | === Note: Default minutes setting is 5, but you can change that if you want in this tool 21 | 22 | --- Panel Settings --- 23 | Prefix/panels -> (Integer) Number of panels to create on this screen (0->2 only) 24 | 25 | --- Desktop Plugins --- 26 | Prefix/pluginlist -> (QStringList) List of different plugins in use on this screen 27 | 28 | ==== PANEL SETTINGS ==== 29 | Prefix: "panel." 30 | 31 | defaultpanel -> (QString) . (0.0 by default, might be removing this later, most used for testing at the moment) 32 | Prefix/location -> (QString) "top" or "bottom" (where to place the panel, should not have 2 panels with the same location on the same screen) 33 | Prefix/height -> (Integer) height in pixels for the panel 34 | Prefix/pluginlist -> (QStringList) List of plugins to put on the panel in order of Left->Right 35 | 36 | I will be adding a "Panel Color" option soon as well (some kind of rgba color code), but that is not implemented yet 37 | -------------------------------------------------------------------------------- /src/settings/config/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | #include "mainWindow.h" 9 | //#include 10 | #include 11 | //#include 12 | //#include 13 | #include "LuminaXDG.h" 14 | #include "draco.h" 15 | #include 16 | #include 17 | 18 | XDGDesktopList *APPSLIST = nullptr; 19 | 20 | int main(int argc, char ** argv) 21 | { 22 | // XDG 23 | LXDG::setEnvironmentVars(); 24 | 25 | // Check for dbus 26 | if (!QDBusConnection::sessionBus().isConnected()) { 27 | qWarning("Cannot connect to the D-Bus session bus."); 28 | return 1; 29 | } 30 | 31 | // Check for running settings 32 | QDBusInterface session(Draco::settingsSessionName(), 33 | Draco::settingsSessionPath(), 34 | Draco::settingsSessionName(), 35 | QDBusConnection::sessionBus()); 36 | if (session.isValid()) { 37 | qWarning("A settings session is already running"); 38 | return 1; 39 | } 40 | 41 | // Register settings session 42 | if (!QDBusConnection::sessionBus().registerService(Draco::settingsSessionName())) { 43 | qWarning() << QDBusConnection::sessionBus().lastError().message(); 44 | return 1; 45 | } 46 | 47 | //LTHEME::LoadCustomEnvSettings(); 48 | QApplication a(argc, argv); //loads translations inside constructor 49 | //if(!a.isPrimaryProcess()){ return 0; } 50 | //LuminaThemeEngine theme(&a); 51 | QStringList args; 52 | for(int i=1; i 2 | 3 | mainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 550 10 | 400 11 | 12 | 13 | 14 | 15 | 16 | 17 | Qt::CustomContextMenu 18 | 19 | 20 | false 21 | 22 | 23 | Qt::TopToolBarArea 24 | 25 | 26 | Qt::ToolButtonTextBesideIcon 27 | 28 | 29 | false 30 | 31 | 32 | TopToolBarArea 33 | 34 | 35 | false 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | Save 45 | 46 | 47 | Save current changes 48 | 49 | 50 | Ctrl+S 51 | 52 | 53 | 54 | 55 | Back to settings 56 | 57 | 58 | Back to overall settings 59 | 60 | 61 | Back to overall settings 62 | 63 | 64 | Qt::ApplicationShortcut 65 | 66 | 67 | 68 | 69 | Monitor 70 | 71 | 72 | Select monitor/desktop to configure 73 | 74 | 75 | Select monitor/desktop to configure 76 | 77 | 78 | QAction::ApplicationSpecificRole 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /src/settings/config/pages/PageWidget.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina Desktop Source Code 3 | // Copyright (c) 2016, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | #ifndef _LUMINA_CONFIG_PAGE_WIDGET_UI_H 8 | #define _LUMINA_CONFIG_PAGE_WIDGET_UI_H 9 | 10 | #include 11 | #include 12 | 13 | //=============================== 14 | // NOTES FOR CREATING SUBPAGES 15 | //=============================== 16 | // 1) Subclass this PageWidget for any client page 17 | // 2) Init any internal widgets/classes in the constructor 18 | // 3) Make sure you handle the [Save/Load]Settings functions (LoadSettings() will be called automatially after widget creation) 19 | // 4) Make sure to emit the signals as needed for interactivity with the main container 20 | //=============================== 21 | 22 | //Structure of all information needed for a page 23 | struct PAGEINFO{ 24 | QString name, title, icon, comment, category, id; 25 | QStringList req_systems, search_tags; 26 | }; 27 | 28 | //Main widget class needed to show a configuration page 29 | class PageWidget : public QWidget{ 30 | Q_OBJECT 31 | public: 32 | 33 | //Main constructor/destructor (create/destroy any interface items) 34 | PageWidget(QWidget *parent) : QWidget(parent){ 35 | //this->setFocusPolicy(Qt::NoFocus); 36 | } 37 | ~PageWidget(){} 38 | 39 | virtual bool needsScreenSelector(){ return false; } //change this to true for pages which load/set options on a per-screen basis 40 | virtual void setPreviousPage(QString){ } //re-implement this if the page needs knowledge of what the previous page was 41 | 42 | signals: 43 | //emit this when the page has changes which are waiting to be saved 44 | void HasPendingChanges(bool); 45 | //emit this when the page title changes (will updates main UI as needed) 46 | void ChangePageTitle(QString); 47 | //emit this when we need to change to another client/page (if needed - generally only used for the base/group pages) 48 | void ChangePage(QString); //ID of new page to open 49 | 50 | public slots: 51 | //User requested to save any pending changes 52 | virtual void SaveSettings(){} 53 | virtual void LoadSettings(int){} //INPUT: Screen number (0+) 54 | virtual void updateIcons(){} 55 | 56 | //Simplification function for widget connections 57 | virtual void settingChanged(){ 58 | emit HasPendingChanges(true); 59 | } 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/settings/config/pages/getPage.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 2 of the License, or 10 | # (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 General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see 19 | # 20 | # This file incorporates work covered by the following copyright and 21 | # permission notice: 22 | # 23 | # Lumina Desktop Environment (https://lumina-desktop.org) 24 | # Copyright (c) 2012-2017, Ken Moore (moorekou@gmail.com) 25 | # All rights reserved 26 | # 27 | # Redistribution and use in source and binary forms, with or without 28 | # modification, are permitted provided that the following conditions are met: 29 | # * Redistributions of source code must retain the above copyright 30 | # notice, this list of conditions and the following disclaimer. 31 | # * Redistributions in binary form must reproduce the above copyright 32 | # notice, this list of conditions and the following disclaimer in the 33 | # documentation and/or other materials provided with the distribution. 34 | # * Neither the name of the organization nor the 35 | # names of its contributors may be used to endorse or promote products 36 | # derived from this software without specific prior written permission. 37 | # 38 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 39 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 40 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 41 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 42 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 43 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 44 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 45 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 46 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | # 49 | */ 50 | 51 | //=========================================== 52 | // Lumina Desktop Source Code 53 | // Copyright (c) 2016, Ken Moore 54 | // Available under the 3-clause BSD license 55 | //=========================================== 56 | #ifndef _LUMINA_CONFIG_PAGE_WIDGET_FETCH_H 57 | #define _LUMINA_CONFIG_PAGE_WIDGET_FETCH_H 58 | 59 | #include "PageWidget.h" 60 | 61 | class Pages{ 62 | public: 63 | static PAGEINFO PageInfo(QString, QString, QString, QString, QString, QString, QStringList, QStringList); 64 | static QList KnownPages(); 65 | static PageWidget* GetNewPage(QString id, QWidget *parent); 66 | }; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/settings/config/pages/page_autostart.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina Desktop Source Code 3 | // Copyright (c) 2016, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | #ifndef _LUMINA_CONFIG_PAGE_AUTOSTART_H 8 | #define _LUMINA_CONFIG_PAGE_AUTOSTART_H 9 | 10 | #include "PageWidget.h" 11 | 12 | namespace Ui{ 13 | class page_autostart; 14 | }; 15 | 16 | class page_autostart : public PageWidget{ 17 | Q_OBJECT 18 | public: 19 | page_autostart(QWidget *parent); 20 | ~page_autostart(); 21 | 22 | public slots: 23 | void SaveSettings(); 24 | void LoadSettings(int screennum); 25 | void updateIcons(); 26 | 27 | private: 28 | Ui::page_autostart *ui; 29 | 30 | QString getSysApp(bool allowreset); 31 | 32 | private slots: 33 | void rmsessionstartitem(); 34 | void addsessionstartapp(); 35 | void addsessionstartbin(); 36 | void addsessionstartfile(); 37 | }; 38 | #endif 39 | -------------------------------------------------------------------------------- /src/settings/config/pages/page_autostart.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | page_autostart 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 9 19 | 20 | 21 | 6 22 | 23 | 24 | 9 25 | 26 | 27 | 9 28 | 29 | 30 | 31 | 32 | true 33 | 34 | 35 | 36 | 37 | 38 | 39 | Add New Startup Service 40 | 41 | 42 | Qt::AlignCenter 43 | 44 | 45 | 46 | 0 47 | 48 | 49 | 0 50 | 51 | 52 | 0 53 | 54 | 55 | 0 56 | 57 | 58 | 59 | 60 | 61 | 62 | Qt::Horizontal 63 | 64 | 65 | 66 | 40 67 | 20 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Application 76 | 77 | 78 | Qt::ToolButtonTextBesideIcon 79 | 80 | 81 | 82 | 83 | 84 | 85 | Binary 86 | 87 | 88 | Qt::ToolButtonTextBesideIcon 89 | 90 | 91 | 92 | 93 | 94 | 95 | File 96 | 97 | 98 | Qt::ToolButtonTextBesideIcon 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /src/settings/config/pages/page_interface_panels.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina Desktop Source Code 3 | // Copyright (c) 2016, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | #ifndef _LUMINA_CONFIG_PAGE_INTERFACE_PANELS_H 8 | #define _LUMINA_CONFIG_PAGE_INTERFACE_PANELS_H 9 | //#include "../globals.h" 10 | #include "PageWidget.h" 11 | #include "LPlugins.h" 12 | #include "PanelWidget.h" 13 | 14 | namespace Ui{ 15 | class page_interface_panels; 16 | }; 17 | 18 | class page_interface_panels : public PageWidget{ 19 | Q_OBJECT 20 | public: 21 | page_interface_panels(QWidget *parent); 22 | ~page_interface_panels(); 23 | 24 | bool needsScreenSelector(){ return true; } 25 | 26 | public slots: 27 | void SaveSettings(); 28 | void LoadSettings(int screennum = -1); 29 | void updateIcons(); 30 | 31 | private: 32 | Ui::page_interface_panels *ui; 33 | bool loading; 34 | int cscreen; //current monitor/screen number 35 | QSettings *settings; 36 | LPlugins *PINFO; 37 | QList PANELS; 38 | 39 | void setupProfiles(); 40 | 41 | private slots: 42 | void panelValChanged(); 43 | void newPanel(); 44 | void removePanel(int); //connected to a signal from the panel widget 45 | void applyProfile(QAction*); 46 | void applyImport(QAction*); 47 | void applyImport(QString fromID); 48 | }; 49 | #endif 50 | -------------------------------------------------------------------------------- /src/settings/config/pages/page_keyboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie All rights reserved. 5 | # 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (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 | */ 20 | 21 | #ifndef CONFIG_PAGE_KEYBOARD_H 22 | #define CONFIG_PAGE_KEYBOARD_H 23 | 24 | #include "PageWidget.h" 25 | #include 26 | #include "keyboard_common.h" 27 | 28 | namespace Ui{ 29 | class page_keyboard; 30 | }; 31 | 32 | class page_keyboard : public PageWidget{ 33 | Q_OBJECT 34 | public: 35 | page_keyboard(QWidget *parent); 36 | ~page_keyboard(); 37 | 38 | public slots: 39 | void SaveSettings(); 40 | void LoadSettings(int screennum = -1); 41 | void updateIcons(); 42 | 43 | virtual void settingChanged() 44 | { 45 | if (!loading) { emit HasPendingChanges(true); } 46 | } 47 | 48 | private: 49 | Ui::page_keyboard *ui; 50 | bool loading; 51 | bool verifySettingsReset(); 52 | 53 | private slots: 54 | void populateBox(QComboBox *box, xkbType type); 55 | void populateBoxes(); 56 | void handleLayoutChanged(int index); 57 | void handleVariantChanged(int index); 58 | void handleModelChanged(int index); 59 | void setCurrentIndex(QComboBox *box, xkbType type); 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/settings/config/pages/page_keyboard.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | page_keyboard 4 | 5 | 6 | 7 | 0 8 | 0 9 | 512 10 | 315 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Layout 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | Variant 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | Model 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | Qt::Vertical 78 | 79 | 80 | 81 | 20 82 | 200 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /src/settings/config/pages/page_main.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina Desktop Source Code 3 | // Copyright (c) 2016, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | #ifndef _LUMINA_CONFIG_PAGE_MAIN_H 8 | #define _LUMINA_CONFIG_PAGE_MAIN_H 9 | //#include "../globals.h" 10 | #include 11 | #include 12 | #include "PageWidget.h" 13 | 14 | namespace Ui{ 15 | class page_main; 16 | }; 17 | 18 | class page_main : public PageWidget{ 19 | Q_OBJECT 20 | public: 21 | page_main(QWidget *parent); 22 | ~page_main(); 23 | 24 | virtual void setPreviousPage(QString id); 25 | void clearlineEdit(); 26 | 27 | public slots: 28 | void SaveSettings(); 29 | void LoadSettings(int screennum = -1); 30 | void updateIcons(); 31 | 32 | private: 33 | Ui::page_main *ui; 34 | QList INFO; 35 | QShortcut *findShort; 36 | void UpdateItems(QString search); 37 | 38 | private slots: 39 | void showFind(); 40 | void itemTriggered(QTreeWidgetItem*, int); 41 | void searchChanged(QString); 42 | }; 43 | #endif 44 | -------------------------------------------------------------------------------- /src/settings/config/pages/page_main.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | page_main 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 2 19 | 20 | 21 | 0 22 | 23 | 24 | 2 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | 32 | Qt::TabFocus 33 | 34 | 35 | QTreeWidget{background: transparent; } 36 | 37 | 38 | Qt::ScrollBarAsNeeded 39 | 40 | 41 | QAbstractScrollArea::AdjustToContents 42 | 43 | 44 | QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked 45 | 46 | 47 | true 48 | 49 | 50 | false 51 | 52 | 53 | QAbstractItemView::SelectItems 54 | 55 | 56 | 57 | 32 58 | 32 59 | 60 | 61 | 62 | QAbstractItemView::ScrollPerItem 63 | 64 | 65 | 20 66 | 67 | 68 | true 69 | 70 | 71 | true 72 | 73 | 74 | true 75 | 76 | 77 | false 78 | 79 | 80 | true 81 | 82 | 83 | false 84 | 85 | 86 | false 87 | 88 | 89 | 90 | 1 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /src/settings/config/pages/page_power.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie All rights reserved. 5 | # 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (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 | */ 20 | 21 | #include "page_power.h" 22 | #include "ui_page_power.h" 23 | #include 24 | 25 | page_power::page_power(QWidget *parent) : PageWidget(parent), ui(new Ui::page_power()) 26 | { 27 | ui->setupUi(this); 28 | loading = false; 29 | power = new PowerSettingsWidget(this); 30 | ui->verticalLayout->addWidget(power); 31 | } 32 | 33 | page_power::~page_power() 34 | { 35 | } 36 | 37 | void page_power::SaveSettings() 38 | { 39 | emit HasPendingChanges(false); 40 | } 41 | 42 | void page_power::LoadSettings(int) 43 | { 44 | emit HasPendingChanges(false); 45 | emit ChangePageTitle( tr("Power Settings") ); 46 | loading = true; 47 | loading = false; 48 | } 49 | 50 | void page_power::updateIcons() 51 | { 52 | } 53 | -------------------------------------------------------------------------------- /src/settings/config/pages/page_power.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie All rights reserved. 5 | # 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (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 | */ 20 | 21 | #ifndef CONFIG_page_power_H 22 | #define CONFIG_page_power_H 23 | 24 | #include "PageWidget.h" 25 | #include "org.dracolinux.Power.SettingsWidget.h" 26 | 27 | namespace Ui{ 28 | class page_power; 29 | }; 30 | 31 | class page_power : public PageWidget{ 32 | Q_OBJECT 33 | public: 34 | page_power(QWidget *parent); 35 | ~page_power(); 36 | 37 | public slots: 38 | void SaveSettings(); 39 | void LoadSettings(int screennum = -1); 40 | void updateIcons(); 41 | 42 | virtual void settingChanged() 43 | { 44 | if (!loading) { emit HasPendingChanges(true); } 45 | } 46 | 47 | private: 48 | Ui::page_power *ui; 49 | PowerSettingsWidget *power; 50 | bool loading; 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/settings/config/pages/page_power.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | page_power 4 | 5 | 6 | 7 | 0 8 | 0 9 | 512 10 | 315 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 0 19 | 20 | 21 | 0 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 0 31 | 32 | 33 | 34 | 35 | 0 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/settings/config/pages/page_session_locale.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina Desktop Source Code 3 | // Copyright (c) 2016, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | #ifndef _LUMINA_CONFIG_PAGE_SESSION_LOCALE_H 8 | #define _LUMINA_CONFIG_PAGE_SESSION_LOCALE_H 9 | //#include "../globals.h" 10 | #include "PageWidget.h" 11 | 12 | namespace Ui{ 13 | class page_session_locale; 14 | }; 15 | 16 | class page_session_locale : public PageWidget{ 17 | Q_OBJECT 18 | public: 19 | page_session_locale(QWidget *parent); 20 | ~page_session_locale(); 21 | 22 | public slots: 23 | void SaveSettings(); 24 | void LoadSettings(int screennum); 25 | void updateIcons(); 26 | 27 | private: 28 | Ui::page_session_locale *ui; 29 | 30 | void setupLocales(); 31 | 32 | private slots: 33 | 34 | }; 35 | #endif 36 | -------------------------------------------------------------------------------- /src/settings/config/pages/page_session_locale.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | page_session_locale 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 6 19 | 20 | 21 | 6 22 | 23 | 24 | 6 25 | 26 | 27 | 6 28 | 29 | 30 | 31 | 32 | System localization settings (restart required) 33 | 34 | 35 | 36 | 37 | 38 | 39 | Language 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | Messages 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | Time 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | Numeric 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | Monetary 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | Collate 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | CType 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /src/settings/config/pages/page_session_options.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 2 of the License, or 10 | # (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 General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see 19 | # 20 | # This file incorporates work covered by the following copyright and 21 | # permission notice: 22 | # 23 | # Lumina Desktop Environment (https://lumina-desktop.org) 24 | # Copyright (c) 2012-2017, Ken Moore (moorekou@gmail.com) 25 | # All rights reserved 26 | # 27 | # Redistribution and use in source and binary forms, with or without 28 | # modification, are permitted provided that the following conditions are met: 29 | # * Redistributions of source code must retain the above copyright 30 | # notice, this list of conditions and the following disclaimer. 31 | # * Redistributions in binary form must reproduce the above copyright 32 | # notice, this list of conditions and the following disclaimer in the 33 | # documentation and/or other materials provided with the distribution. 34 | # * Neither the name of the organization nor the 35 | # names of its contributors may be used to endorse or promote products 36 | # derived from this software without specific prior written permission. 37 | # 38 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 39 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 40 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 41 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 42 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 43 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 44 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 45 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 46 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | # 49 | */ 50 | 51 | //=========================================== 52 | // Lumina Desktop Source Code 53 | // Copyright (c) 2016, Ken Moore 54 | // Available under the 3-clause BSD license 55 | //=========================================== 56 | #ifndef _LUMINA_CONFIG_PAGE_SESSION_OPTIONS_H 57 | #define _LUMINA_CONFIG_PAGE_SESSION_OPTIONS_H 58 | //#include "../globals.h" 59 | #include "PageWidget.h" 60 | 61 | namespace Ui{ 62 | class page_session_options; 63 | }; 64 | 65 | class page_session_options : public PageWidget{ 66 | Q_OBJECT 67 | public: 68 | page_session_options(QWidget *parent); 69 | ~page_session_options(); 70 | bool needsScreenSelector(){ return true; } 71 | 72 | public slots: 73 | void SaveSettings(); 74 | void LoadSettings(int screennum = -1); 75 | void updateIcons(); 76 | 77 | virtual void settingChanged(){ 78 | if(!loading){ emit HasPendingChanges(true); } 79 | } 80 | private: 81 | Ui::page_session_options *ui; 82 | int cscreen; //current monitor/screen number 83 | bool loading; 84 | //void FindWindowManagerOptions(); 85 | bool verifySettingsReset(); 86 | 87 | private slots: 88 | //void sessionChangeUserIcon(); 89 | //void sessionResetSys(); 90 | //void sessionResetLumina(); 91 | void sessionLoadTimeSample(); 92 | void sessionShowTimeCodes(); 93 | void sessionLoadDateSample(); 94 | void sessionShowDateCodes(); 95 | }; 96 | #endif 97 | -------------------------------------------------------------------------------- /src/settings/config/pages/page_wallpaper.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina Desktop Source Code 3 | // Copyright (c) 2016, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | #ifndef _LUMINA_CONFIG_PAGE_WALLPAPER_H 8 | #define _LUMINA_CONFIG_PAGE_WALLPAPER_H 9 | //#include "../globals.h" 10 | #include "PageWidget.h" 11 | 12 | namespace Ui{ 13 | class page_wallpaper; 14 | }; 15 | 16 | class page_wallpaper : public PageWidget{ 17 | Q_OBJECT 18 | public: 19 | page_wallpaper(QWidget *parent); 20 | ~page_wallpaper(); 21 | 22 | bool needsScreenSelector(){ return true; } 23 | 24 | public slots: 25 | void SaveSettings(); 26 | void LoadSettings(int screennum); 27 | void updateIcons(); 28 | 29 | private: 30 | Ui::page_wallpaper *ui; 31 | int cScreen, cBG; //current screen number/background 32 | QString DEFAULTBG; 33 | bool loading; 34 | 35 | QString getColorStyle(QString current, bool allowTransparency); 36 | 37 | private slots: 38 | void updateMenus(); 39 | void deskbgchanged(); 40 | void desktimechanged(); 41 | void deskbgremoved(); 42 | void deskbgadded(); 43 | void deskbgcoloradded(); 44 | void deskbgdiradded(); 45 | void deskbgdirradded(); 46 | 47 | protected: 48 | void resizeEvent(QResizeEvent*){ 49 | deskbgchanged(); //update the wallpaper preview 50 | } 51 | }; 52 | #endif 53 | -------------------------------------------------------------------------------- /src/settings/xconf/MainUI.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2015, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | #ifndef _LUMINA_SCREEN_CONFIG_DIALOG_H 8 | #define _LUMINA_SCREEN_CONFIG_DIALOG_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include "ScreenSettings.h" 20 | 21 | namespace Ui{ 22 | class MainUI; 23 | }; 24 | 25 | class MainUI : public QMainWindow{ 26 | Q_OBJECT 27 | public: 28 | MainUI(); 29 | ~MainUI(); 30 | 31 | public slots: 32 | void slotSingleInstance(){ 33 | this->raise(); 34 | this->show(); 35 | } 36 | void loadIcons(); 37 | 38 | private: 39 | Ui::MainUI *ui; 40 | QList SCREENS; 41 | double scaleFactor; 42 | QMenu *singleTileMenu, *profilesMenu; 43 | 44 | ScreenInfo currentScreenInfo(); 45 | 46 | //QStringList currentOpts(); 47 | QString currentSelection(); 48 | 49 | void AddScreenToWidget(ScreenInfo); 50 | void SyncBackend(); //sync backend structures to current settings 51 | 52 | private slots: 53 | void UpdateScreens(QString profile = ""); 54 | void ScreenSelected(); 55 | void updateNewScreenResolutions(); 56 | void tileScreensY(bool activeonly = false); 57 | void tileScreensX(bool activeonly = false); 58 | void tileScreens(); 59 | void tileSingleScreen(QAction*); 60 | void showMenu(){ singleTileMenu->popup(QCursor::pos()); } 61 | 62 | void DeactivateScreen(); 63 | void ActivateScreen(); 64 | void ApplyChanges(); //config changes 65 | void SaveSettings(bool quiet = false); 66 | void RestartFluxbox(); 67 | 68 | void removeProfile(); 69 | void updateProfiles(); 70 | void loadProfile(); 71 | void saveAsProfile(QAction *); 72 | }; 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /src/settings/xconf/ScreenSettings.h: -------------------------------------------------------------------------------- 1 | //=========================================== 2 | // Lumina-DE source code 3 | // Copyright (c) 2016, Ken Moore 4 | // Available under the 3-clause BSD license 5 | // See the LICENSE file for full details 6 | //=========================================== 7 | #ifndef _LUMINA_SCREEN_SETTINGS_BACKEND_H 8 | #define _LUMINA_SCREEN_SETTINGS_BACKEND_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | class ScreenInfo{ 16 | public: 17 | QString ID; 18 | QRect geom; //screen geometry 19 | bool isprimary; 20 | bool isactive; 21 | bool isavailable; 22 | int applyChange; //[<=0: do nothing, 1: deactivate, 2: activate] 23 | QStringList resList; 24 | int rotation; //possible values: [-90, 0, 90, 180] 25 | 26 | 27 | //Initial Defaults 28 | ScreenInfo(){ 29 | applyChange = -1; //initial value is invalid 30 | isprimary = false; 31 | isactive = false; 32 | isavailable = false; 33 | rotation = 0; //no rotation by default 34 | } 35 | ~ScreenInfo(){} 36 | }; 37 | 38 | class RRSettings{ 39 | public: 40 | //Reset current screen config to match previously-saved settings 41 | static void ApplyPrevious(); 42 | static void ApplyProfile(QString profile); 43 | //Setup all the connected monitors as a single mirror 44 | static void MirrorAll(); 45 | 46 | //Read the current screen config from xrandr 47 | static QList CurrentScreens(); //reads xrandr information 48 | static QList PreviousSettings(QString profile=""); 49 | static QStringList savedProfiles(); 50 | static void removeProfile(QString profile); 51 | 52 | //Save the screen config for later 53 | static bool SaveScreens(QList screens, QString profile = ""); 54 | 55 | //Apply screen configuration 56 | static void Apply(QList screens); 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/settings/xconf/lumina-xconfig.1: -------------------------------------------------------------------------------- 1 | .Dd November 6, 2017 2 | .Dt LUMINA-XCONFIG 1 3 | .Os 1.4.2 4 | 5 | .Sh NAME 6 | .Nm lumina-xconfig 7 | .Nd graphical front-end to xrandr, which manages monitor 8 | configurations. 9 | 10 | .Sh SYNOPSIS 11 | .Nm 12 | .Op Fl -reset-monitors 13 | .Nm 14 | .Op Fl -mirror-monitors 15 | .Nm 16 | .Op Fl -list-profiles 17 | .Nm 18 | .Op Fl -apply-profile Ao profile Ac 19 | 20 | .Sh DESCRIPTION 21 | .Nm 22 | opens the graphical utility for managing monitor configurations and 23 | requires the runtime utility xrandr. 24 | .Nm 25 | offers the ability to drag connected displays and orient them freely. 26 | It is also easy to select the resolution and rotation from a drop down 27 | box for each screen. 28 | The Add Screen tab provides an option to enable a connected monitor that 29 | is not in use. 30 | 31 | .Nm 32 | Options: 33 | .Bl -tag -width indent 34 | .It Ic --reset-monitors 35 | Reset the monitor configuration to the default profile 36 | .It Ic --mirror-monitors 37 | Setup all connected monitors as a single display output 38 | .It Ic --list-profiles 39 | Return the list of all the currently-known profiles 40 | .It Ic --apply-profile 41 | Apply the given monitor profile (will do nothing if profile does not exist) 42 | .El 43 | 44 | .Sh DEPENDENCIES 45 | A single extra runtime dependency is required: 46 | .Bl -tag -width indent 47 | .It Ic xrandr 48 | .El 49 | 50 | .Sh FILES 51 | .Bl -tag -width indent 52 | .It Pa /usr/local/bin/lumina-xconfig 53 | .It Pa {XDG_CONFIG_HOME}/lumina-desktop/lumina-xconfig.conf 54 | .El 55 | 56 | .Sh SEE ALSO 57 | .Xr xrandr(1) 58 | 59 | .Sh AUTHORS 60 | .An Aaron St. John 61 | .Aq aaron@ixsystems.com 62 | -------------------------------------------------------------------------------- /src/settings/xconf/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "MainUI.h" 7 | #include 8 | 9 | #include "ScreenSettings.h" 10 | #include "LuminaXDG.h" 11 | 12 | int main(int argc, char ** argv) 13 | { 14 | bool CLIdone = false; 15 | for(int i=1; i (i+1) ){ 29 | RRSettings::ApplyProfile( QString(argv[i+1]) ); 30 | CLIdone = true; 31 | break; 32 | } 33 | } 34 | if(CLIdone){ return 0; } 35 | //LTHEME::LoadCustomEnvSettings(); 36 | 37 | LXDG::setEnvironmentVars(); 38 | QApplication a(argc, argv); 39 | //if( !a.isPrimaryProcess()){ return 0; } 40 | //qDebug() << "Loaded QApplication"; 41 | //a.setApplicationName("Lumina Screen Configuration"); 42 | //LuminaThemeEngine themes(&a); 43 | 44 | //Start the UI 45 | MainUI w; 46 | //QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(slotSingleInstance()) ); 47 | //QObject::connect(&themes, SIGNAL(updateIcons()), &w, SLOT(loadIcons()) ); 48 | w.show(); 49 | 50 | int retCode = a.exec(); 51 | return retCode; 52 | } 53 | -------------------------------------------------------------------------------- /src/storage/org.dracolinux.Storage.Tray.h: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie All rights reserved. 5 | # 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (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 | */ 20 | 21 | #ifndef SYSTRAY_H 22 | #define SYSTRAY_H 23 | 24 | #include 25 | #include 26 | #include 27 | //#include 28 | #include "org.dracolinux.Disks.h" 29 | //#include "disks.h" 30 | //#include "mimeutils.h" 31 | 32 | class SysTray : public QObject 33 | { 34 | Q_OBJECT 35 | public: 36 | explicit SysTray(QObject *parent = nullptr); 37 | 38 | private: 39 | QSystemTrayIcon *disktray; 40 | QMenu *menu; 41 | Disks *man; 42 | bool showNotifications; 43 | //MimeUtils* mimeUtilsPtr; 44 | bool autoMount; 45 | //QHash appsCache; 46 | 47 | private slots: 48 | void loadSettings(); 49 | void generateContextMenu(); 50 | void disktrayActivated(QSystemTrayIcon::ActivationReason reason); 51 | void handleDisktrayMessageClicked(); 52 | void showMessage(QString title, 53 | QString message); 54 | void handleContextMenuAction(); 55 | void handleDeviceError(QString path, 56 | QString error); 57 | void handleDeviceMediaChanged(QString path, 58 | bool media); 59 | void handleDeviceMountpointChanged(QString path, 60 | QString mountpoint); 61 | void openMountpoint(QString mountpoint); 62 | void handleFoundNewDevice(QString path); 63 | void handleShowHideDisktray(); 64 | }; 65 | 66 | #endif // SYSTRAY_H 67 | -------------------------------------------------------------------------------- /src/storage/org.dracolinux.Storage.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | # 3 | # Draco Desktop Environment 4 | # Copyright (c) 2019, Ole-André Rodlie 5 | # All rights reserved. 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 2 of the License, or 10 | # (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 General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see 19 | # 20 | */ 21 | 22 | #include "org.dracolinux.Storage.Tray.h" 23 | #include 24 | 25 | int main(int argc, char *argv[]) 26 | { 27 | QApplication a(argc, argv); 28 | SysTray tray(a.parent()); 29 | return a.exec(); 30 | } 31 | --------------------------------------------------------------------------------