Compare commits
17
Commits
KDE6-patch-1
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd0095d920 | ||
|
|
449c6f2df1 | ||
|
|
2737009692 | ||
|
|
d3becd1c16 | ||
|
|
c28a7a5bee | ||
|
|
807ac002e5 | ||
|
|
e6cdeb4c1f | ||
|
|
75cb35127c | ||
|
|
81cd272037 | ||
|
|
a468e5a798 | ||
|
|
a724c4bfca | ||
|
|
bfc37ad9f2 | ||
|
|
5e99953fff | ||
|
|
aa5033f8f3 | ||
|
|
eb562e3048 | ||
|
|
917ea50689 | ||
|
|
2446f068df |
No files matched your search
+1
-82
@@ -1,85 +1,4 @@
|
||||
### CHANGELOG
|
||||
|
||||
#### Version 0.8.0
|
||||
#### Version 0.1.0
|
||||
|
||||
* use applet geometry to accept mouse events when inside latte docks and panels
|
||||
* show menu only after the previous one has already become hidden
|
||||
|
||||
#### Version 0.7.1
|
||||
|
||||
* do not show any appmenu on empty and inactive screens
|
||||
* improve compact button spacing
|
||||
* show proper popup menu for vertical panels
|
||||
|
||||
#### Version 0.7.0
|
||||
|
||||
* fix occasional crash when menu is hiding
|
||||
* fixes when present in plasma panels
|
||||
* position menus relevant to screen edge
|
||||
* add filter for maximized windows
|
||||
* apply filters properly for compact button scenario
|
||||
* respect Fitt's law for floating latte panels
|
||||
* position menus relevant to entire screen geometry
|
||||
* add option to enable unity behavior in neighbour window title applets
|
||||
* fixes for unity behavior in latte panels
|
||||
|
||||
#### Version 0.6.0
|
||||
|
||||
* new option to support color schemes for menus. For Latte a new option to colorize the menus based on the current window color scheme is already present.
|
||||
* release menu item hovering when not needed any more
|
||||
* new option to maximize/restore active window when used in plasma panels [@Taras Fomin]
|
||||
|
||||
#### Version 0.5.1
|
||||
|
||||
* fix buttons vertical positioning. Previously there were cases that the buttons had 1px. difference with the surrounding applets
|
||||
|
||||
#### Version 0.5.0
|
||||
|
||||
* show app menus also for inactive windows in multi-screen environment through Latte WindowsTracking v0.9 interface
|
||||
* improve appearance when in Latte edit mode
|
||||
* use new Latte Communicator API for v0.9
|
||||
|
||||
#### Version 0.4.2
|
||||
|
||||
* fix a serious crash for some systems when the user was clicking the menu items Plasma or Latte was crashing
|
||||
* various improvements for Unity style behavior
|
||||
* fix behavior with Latte git version dragging/maximizing/restoring active window from panel empty areas
|
||||
* dont register the global menu service under wayland in order for windows to keep their global menus in their windows
|
||||
* fix warnings on startup
|
||||
|
||||
|
||||
#### Version 0.4.1
|
||||
|
||||
* fix not showing menu items for all applications
|
||||
* fix RTL menu items alignment
|
||||
|
||||
#### Version 0.4
|
||||
|
||||
* provide a Unity behavior option when used with Window Title v0.4 in latest Latte master
|
||||
* support horizontal scrolling
|
||||
* improve screen filtering
|
||||
|
||||
#### Version 0.3
|
||||
|
||||
* add an option in order to set spacing between menu items
|
||||
* dont crash under wayland
|
||||
* in edit mode show a menu sample in order to not show an empty space
|
||||
* option to always fill maximum available space
|
||||
* avoid empty QMenu (upstream plasma fix)
|
||||
* reduce menu items spacing
|
||||
* support new Latte Communicator mechanism
|
||||
|
||||
#### Version 0.2
|
||||
|
||||
* Scroll menu support when the menu is too big
|
||||
* Option to show menus only from active/main windows
|
||||
* support Latte painting for single button presentation
|
||||
* dont hide menu when Latte is in editing mode (needs Latte>=0.9)
|
||||
* show shortcuts properly when Alt is pressed
|
||||
|
||||
#### Version 0.1
|
||||
|
||||
* Minimize-state aware
|
||||
* Multi-Screen aware
|
||||
* Support Latte new painting
|
||||
* based totally on official plasma appmenu applet in order to improve maintainability and code exchange
|
||||
+3
-5
@@ -1,6 +1,6 @@
|
||||
project(applet_window_appmenu)
|
||||
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
|
||||
|
||||
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
|
||||
project(applet_window_appmenu)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(VERSION 0.8.0)
|
||||
@@ -18,11 +18,9 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Quick Widgets DBus)
|
||||
|
||||
find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS WindowSystem ConfigWidgets)
|
||||
find_package(KWayland REQUIRED)
|
||||
|
||||
find_package(Plasma "6.0" REQUIRED)
|
||||
|
||||
find_package(KDecoration2 REQUIRED)
|
||||
find_package(KDecoration3 REQUIRED)
|
||||
find_package(LibTaskManager)
|
||||
|
||||
include(ECMQtDeclareLoggingCategory)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Window AppMenu Applet
|
||||
This is port [psifidotos](https://github.com/psifidotos/applet-window-appmenu/) and [proatgram](https://github.com/proatgram/applet-window-appmenu6/) .
|
||||
|
||||
This is a Plasma 5 applet that shows the current window appmenu in your panels. This plasmoid is coming from [Latte land](https://phabricator.kde.org/source/latte-dock/repository/master/) but it can also support Plasma panels.
|
||||
This is a Plasma 6.6 applet that shows the current window appmenu in your panels. This plasmoid was coming from [Latte land](https://phabricator.kde.org/source/latte-dock/repository/master/) but now support only Plasma panels.
|
||||
|
||||
<p align="center">
|
||||
<img src="https://i.imgur.com/T0sLWav.gif" width="580"><br/>
|
||||
@@ -12,10 +13,6 @@ This is a Plasma 5 applet that shows the current window appmenu in your panels.
|
||||
<i>scroll menu support</i>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://imgur.com/lIxNfoU.png" width="580"><br/>
|
||||
<i>color schemes for menu</i>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://imgur.com/w1EA6lr.png" width="580"><br/>
|
||||
@@ -24,23 +21,19 @@ This is a Plasma 5 applet that shows the current window appmenu in your panels.
|
||||
|
||||
# Features
|
||||
|
||||
- Latte Dock Compliance: Auto color support
|
||||
- Latte Dock Compliance: Show menus from child windows and not only from the main window
|
||||
- Latte Dock Compliance: Provide Unity-style behavior to hide and show in conjuction with [Window Title applet](https://github.com/psifidotos/applet-window-title)
|
||||
- Latte Dock Compliance: Scroll through your menus when your panel free space is not sufficient
|
||||
- Provide spacing option
|
||||
- Customise your menu colors based on your system color schemes
|
||||
|
||||
# Requires
|
||||
|
||||
- Qt >= 5.9
|
||||
- KF5 >= 5.38
|
||||
- Plasma >= 5.12
|
||||
- plasma-workspace-devel >= 5.19.0 [for wayland support]
|
||||
- Qt >= 6.7
|
||||
- KF6 >= 6.1
|
||||
- Plasma >= 6.0
|
||||
- plasma-workspace-devel >= 6.1.0
|
||||
|
||||
**Qt elements**: Quick Widgets DBus
|
||||
|
||||
**KF5 elements**: Plasma WindowSystem KDecoration2 Kirigami2 extra-cmake-modules
|
||||
**KF6 elements**: Plasma WindowSystem KDecoration2 Kirigami2 extra-cmake-modules
|
||||
|
||||
**X11 libraries**: XCB RandR
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
/* Define if you have LibTaskManager at all */
|
||||
// #cmakedefine01 HAVE_LibTaskManager)
|
||||
|
||||
#cmakedefine KF5_CURRENTMINOR_VERSION @KF5_CURRENTMINOR_VERSION@
|
||||
#cmakedefine KF6_CURRENTMINOR_VERSION @KF6_CURRENTMINOR_VERSION@
|
||||
|
||||
#cmakedefine LibTaskManager_CURRENTMINOR_VERSION @LibTaskManager_CURRENTMINOR_VERSION@
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
if ! [ -a build ] ; then
|
||||
if [ ! -d build ] ; then
|
||||
mkdir build
|
||||
fi
|
||||
cd build
|
||||
|
||||
+7
-7
@@ -3,25 +3,25 @@ set(appmenuapplet_SRCS
|
||||
decorationpalette.cpp
|
||||
)
|
||||
|
||||
add_library(plasma_applet_windowappmenu MODULE ${appmenuapplet_SRCS})
|
||||
add_library(org.kde.windowappmenu MODULE ${appmenuapplet_SRCS})
|
||||
|
||||
#kcoreaddons_desktop_to_json(plasma_applet_windowappmenu ../package/metadata.desktop)
|
||||
#kcoreaddons_desktop_to_json(org.kde.windowappmenu ../package/metadata.desktop)
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/metadata.json
|
||||
COMMAND desktoptojson -i ${CMAKE_SOURCE_DIR}/package/metadata.desktop
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
set_property(TARGET plasma_applet_windowappmenu APPEND PROPERTY AUTOGEN_TARGET_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/metadata.json)
|
||||
set_property(TARGET org.kde.windowappmenu APPEND PROPERTY AUTOGEN_TARGET_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/metadata.json)
|
||||
|
||||
target_link_libraries(plasma_applet_windowappmenu
|
||||
target_link_libraries(org.kde.windowappmenu
|
||||
Qt6::Widgets
|
||||
Qt6::Quick
|
||||
Qt6::DBus
|
||||
KF6::ConfigWidgets
|
||||
Plasma::Plasma
|
||||
KF6::WindowSystem
|
||||
KDecoration2::KDecoration
|
||||
KDecoration2::KDecoration2Private)
|
||||
KDecoration3::KDecoration
|
||||
KDecoration3::KDecoration3Private)
|
||||
|
||||
install(TARGETS plasma_applet_windowappmenu DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
|
||||
install(TARGETS org.kde.windowappmenu DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
|
||||
+12
-11
@@ -50,12 +50,13 @@ QString viewService()
|
||||
AppMenuApplet::AppMenuApplet(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
||||
: Plasma::Applet(parent, data, args)
|
||||
{
|
||||
#if LibTaskManager_CURRENTMINOR_VERSION < 19 /*5.19*/
|
||||
|
||||
//#if LibTaskManager_CURRENTMINOR_VERSION < 19 /*5.19*/
|
||||
// Disable for Plasma Desktop < 5.19
|
||||
if (KWindowSystem::isPlatformWayland()) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
//if (KWindowSystem::isPlatformWayland()) {
|
||||
// return;
|
||||
//}
|
||||
//#endif
|
||||
|
||||
++s_refs;
|
||||
|
||||
@@ -213,8 +214,8 @@ void AppMenuApplet::onMenuAboutToHide()
|
||||
//! far from menus, the menus deactivate but for some reason an Enter event is sent and for that
|
||||
//! reason a button think that containsMouse. Without that workaround the experience
|
||||
//! is a bit broken because there case that buttons appear hovered without really be hovered.
|
||||
QHoverEvent e(QEvent::Leave, QPoint(-5,-5), QPoint(2, 2));
|
||||
QCoreApplication::instance()->sendEvent(m_currentMenu->windowHandle()->transientParent(), &e);
|
||||
//QHoverEvent e(QEvent::Leave, QPoint(-5,-5), QPoint(2, 2));
|
||||
//QCoreApplication::instance()->sendEvent(m_currentMenu->windowHandle()->transientParent(), &e);
|
||||
}
|
||||
|
||||
void AppMenuApplet::repositionMenu()
|
||||
@@ -392,8 +393,8 @@ bool AppMenuApplet::eventFilter(QObject *watched, QEvent *event)
|
||||
}
|
||||
|
||||
// Support Fitt's Law and take care the panel margins
|
||||
const QPointF &windowLocalPos = m_buttonGrid->window()->mapFromGlobal(e->globalPos());
|
||||
QPointF buttonGridLocalPos = m_buttonGrid->mapFromScene(windowLocalPos);
|
||||
const QPointF &windowLocalPos = m_buttonGrid->window()->mapFromGlobal(e->globalPosition());
|
||||
const QPointF &buttonGridLocalPos = m_buttonGrid->mapFromScene(windowLocalPos);
|
||||
|
||||
// In Latte panel >= v0.10 we can access applets visual geometry
|
||||
QVariant appletsVisualGeomVariant = m_buttonGrid->window() ? m_buttonGrid->window()->property("_applets_layout_geometry") : QVariant();
|
||||
@@ -404,7 +405,7 @@ bool AppMenuApplet::eventFilter(QObject *watched, QEvent *event)
|
||||
appletsVisualGeom.moveTopLeft(windowVisualGeom.topLeft());
|
||||
windowVisualGeom = appletsVisualGeom;
|
||||
}
|
||||
|
||||
/*
|
||||
if (inPanel() && windowVisualGeom.contains(e->globalPos()) && !m_buttonGrid->contains(buttonGridLocalPos)) {
|
||||
if (formFactor() == Plasma::Types::Horizontal) {
|
||||
buttonGridLocalPos.setY(1);
|
||||
@@ -412,7 +413,7 @@ bool AppMenuApplet::eventFilter(QObject *watched, QEvent *event)
|
||||
buttonGridLocalPos.setX(1);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
auto *item = m_buttonGrid->childAt(buttonGridLocalPos.x(), buttonGridLocalPos.y());
|
||||
|
||||
if (!item) {
|
||||
|
||||
@@ -62,10 +62,10 @@ bool DecorationPalette::isValid() const
|
||||
return m_activeTitleBarColor.isValid();
|
||||
}
|
||||
|
||||
QColor DecorationPalette::color(KDecoration2::ColorGroup group, KDecoration2::ColorRole role) const
|
||||
QColor DecorationPalette::color(KDecoration3::ColorGroup group, KDecoration3::ColorRole role) const
|
||||
{
|
||||
using KDecoration2::ColorRole;
|
||||
using KDecoration2::ColorGroup;
|
||||
using KDecoration3::ColorRole;
|
||||
using KDecoration3::ColorGroup;
|
||||
|
||||
switch (role) {
|
||||
case ColorRole::Frame:
|
||||
|
||||
@@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#ifndef KWIN_DECORATION_PALETTE_H
|
||||
#define KWIN_DECORATION_PALETTE_H
|
||||
|
||||
#include <KDecoration2/DecorationSettings>
|
||||
#include <KDecoration3/DecorationSettings>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QPalette>
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
QColor color(KDecoration2::ColorGroup group, KDecoration2::ColorRole role) const;
|
||||
QColor color(KDecoration3::ColorGroup group, KDecoration3::ColorRole role) const;
|
||||
QPalette palette() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
@@ -39,8 +39,8 @@ Item {
|
||||
//! thought that they containMouse even though they did not
|
||||
property bool containsMouse: {
|
||||
if (inFullView) {
|
||||
if (plasmoid.nativeInterface.currentIndex > -1) {
|
||||
return plasmoid.nativeInterface.currentIndex === buttonIndex;
|
||||
if (plasmoid.currentIndex > -1) {
|
||||
return plasmoid.currentIndex === buttonIndex;
|
||||
}
|
||||
|
||||
return (buttonIndex > -1) && (buttonGrid.currentIndex === buttonIndex);
|
||||
@@ -110,7 +110,7 @@ Item {
|
||||
radius: buttonItem.shadow
|
||||
|
||||
// fake highlighted
|
||||
color: {
|
||||
/*color: {
|
||||
if (menuOpened) {
|
||||
return enforceLattePalette ? root.latteBridge.palette.highlightColor : Kirigami.Theme.highlightColor
|
||||
} else if (buttonItem.containsMouse) {
|
||||
@@ -118,6 +118,15 @@ Item {
|
||||
} else {
|
||||
return 'transparent';
|
||||
}
|
||||
}*/
|
||||
color: {
|
||||
if (buttonItem.menuOpened) {
|
||||
return Kirigami.Theme.highlightColor
|
||||
} else if (buttonItem.containsMouse) {
|
||||
return Kirigami.Theme.backgroundColor
|
||||
} else {
|
||||
return 'transparent';
|
||||
}
|
||||
}
|
||||
|
||||
layer.enabled: menuOpened || buttonItem.containsMouse
|
||||
@@ -266,16 +275,18 @@ Item {
|
||||
|
||||
return Util.stylizeEscapedMnemonics(Util.toHtmlEscaped(text));
|
||||
}
|
||||
|
||||
color: {
|
||||
|
||||
//! HACK:
|
||||
//! Unable to assign [undefined] to QColor
|
||||
/*color: {
|
||||
if (buttonItem.menuOpened) {
|
||||
return enforceLattePalette ? root.latteBridge.palette.highlightedTextColor : Kirigami.Theme.highlightedTextColor
|
||||
return Kirigami.Theme.highlightedTextColor
|
||||
} else if (buttonItem.containsMouse) {
|
||||
return enforceLattePalette ? root.latteBridge.palette.buttonTextColor : Kirigami.Theme.buttonTextColor
|
||||
return Kirigami.Theme.buttonTextColor
|
||||
} else {
|
||||
return enforceLattePalette ? root.latteBridge.palette.textColor : Kirigami.Theme.textColor;
|
||||
return Kirigami.Theme.textColor;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,11 +303,11 @@ Item {
|
||||
layer.effect: ColorOverlay{
|
||||
color: {
|
||||
if (buttonItem.menuOpened) {
|
||||
return enforceLattePalette ? root.latteBridge.palette.highlightedTextColor : Kirigami.Theme.highlightedTextColor
|
||||
return Kirigami.Theme.highlightedTextColor
|
||||
} else if (buttonItem.containsMouse) {
|
||||
return enforceLattePalette ? root.latteBridge.palette.buttonTextColor : Kirigami.Theme.textColor
|
||||
return Kirigami.Theme.buttonTextColor
|
||||
} else {
|
||||
return enforceLattePalette ? root.latteBridge.palette.textColor : Kirigami.Theme.textColor;
|
||||
return Kirigami.Theme.textColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.kde.kirigami as Kirigami
|
||||
import org.kde.private.windowAppMenu as AppMenuPrivate
|
||||
|
||||
Item {
|
||||
//TO-DO Fix QML ConfigGeneral: Created graphical object was not placed in the graphics scene.
|
||||
id: configGeneral
|
||||
|
||||
property alias cfg_compactView: compactViewRadioButton.checked
|
||||
@@ -82,7 +83,7 @@ Item {
|
||||
|
||||
ColumnLayout {
|
||||
id:mainColumn
|
||||
spacing: PlasmaCore.Units.largeSpacing
|
||||
spacing: Kirigami.Units.gridUnit
|
||||
width:parent.width - anchors.leftMargin * 2
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
@@ -121,8 +122,8 @@ Item {
|
||||
ButtonGroup.group: viewOptionGroup
|
||||
}
|
||||
}
|
||||
|
||||
GridLayout{
|
||||
//! TODO FIX
|
||||
/*GridLayout{
|
||||
columns: 2
|
||||
|
||||
Label {
|
||||
@@ -144,7 +145,7 @@ Item {
|
||||
currentIndex = schemesModel.indexOf(plasmoid.configuration.selectedScheme);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
GridLayout{
|
||||
columns: 2
|
||||
|
||||
@@ -22,14 +22,16 @@ import Qt5Compat.GraphicalEffects
|
||||
import QtQuick.Controls
|
||||
|
||||
import org.kde.plasma.plasmoid
|
||||
import org.kde.kquickcontrolsaddons
|
||||
import org.kde.kquickcontrolsaddons 2.0
|
||||
import org.kde.plasma.core as PlasmaCore
|
||||
import org.kde.plasma.plasma5support as Plasma5Support
|
||||
import org.kde.plasma.components as PlasmaComponents
|
||||
import org.kde.taskmanager as TaskManager
|
||||
|
||||
|
||||
import org.kde.private.windowAppMenu as AppMenuPrivate
|
||||
|
||||
|
||||
PlasmoidItem {
|
||||
id: root
|
||||
|
||||
@@ -39,7 +41,8 @@ PlasmoidItem {
|
||||
readonly property bool view: inCompactView
|
||||
readonly property bool inEditMode: plasmoid.userConfiguring || latteInEditMode
|
||||
readonly property bool menuAvailable: appMenuModel.menuAvailable
|
||||
readonly property bool kcmAuthorized: KCMShell.authorize(["style.desktop"]).length > 0
|
||||
//! FixReferenceError: KCMShell is not definedI don't know what this line does, but there's an error here
|
||||
//readonly property bool kcmAuthorized: KCMShell.authorize(["style.desktop"]).length > 0
|
||||
|
||||
readonly property bool inFullView: !plasmoid.configuration.compactView && plasmoid.formFactor === PlasmaCore.Types.Horizontal
|
||||
readonly property bool inCompactView: !inFullView
|
||||
@@ -176,9 +179,11 @@ PlasmoidItem {
|
||||
Component.onCompleted: {
|
||||
plasmoid.configuration.supportsActiveWindowSchemes = false;
|
||||
plasmoid.configuration.windowTitleIsPresent = false;
|
||||
plasmoid.buttonGrid = buttonGrid;
|
||||
//plasmoid.buttonGrid = buttonGrid;
|
||||
//! fix Error: Cannot assign QObject* to QQuickItem*
|
||||
plasmoid.setButtonGrid = buttonGrid;
|
||||
|
||||
containmentIdentifierTimer.start();
|
||||
//containmentIdentifierTimer.start();
|
||||
|
||||
// using a Connections {} doesn't work for some reason in Qt >= 5.8
|
||||
plasmoid.requestActivateIndex.connect(function (index) {
|
||||
@@ -433,24 +438,26 @@ PlasmoidItem {
|
||||
height: parent.height
|
||||
|
||||
TaskManager.TasksModel {
|
||||
id: tasksModel
|
||||
//fix Unable to assign [undefined] to QRect
|
||||
id: plasmoidTasksModel
|
||||
filterByScreen: plasmoid.configuration.filterByScreen
|
||||
screenGeometry: plasmoid.screenGeometry
|
||||
//! fix Unable to assign [undefined] to QRect HACK:
|
||||
//screenGeometry: plasmoid.screenGeometry
|
||||
}
|
||||
|
||||
onDoubleClicked: {
|
||||
if(plasmoid.configuration.toggleMaximizedOnDoubleClick){
|
||||
tasksModel.requestToggleMaximized(tasksModel.activeTask)
|
||||
plasmoidTasksModel.requestToggleMaximized(plasmoidTasksModel.activeTask)
|
||||
}
|
||||
}
|
||||
|
||||
onWheel: {
|
||||
if(plasmoid.configuration.toggleMaximizedOnMouseWheel){
|
||||
var isMaximized = tasksModel.data(tasksModel.activeTask, TaskManager.AbstractTasksModel.IsMaximized)
|
||||
var isMaximized = plasmoidTasksModel.data(plasmoidTasksModel.activeTask, TaskManager.AbstractTasksModel.IsMaximized)
|
||||
if (wheel.angleDelta.y > 0 && !isMaximized) {
|
||||
tasksModel.requestToggleMaximized(tasksModel.activeTask)
|
||||
plasmoidTasksModel.requestToggleMaximized(plasmoidTasksModel.activeTask)
|
||||
} else if(wheel.angleDelta.y < 0 && isMaximized){
|
||||
tasksModel.requestToggleMaximized(tasksModel.activeTask)
|
||||
plasmoidTasksModel.requestToggleMaximized(plasmoidTasksModel.activeTask)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -464,12 +471,15 @@ PlasmoidItem {
|
||||
|
||||
filterByActive: plasmoid.configuration.filterByActive
|
||||
filterChildren: plasmoid.configuration.filterChildrenWindows
|
||||
screenGeometry: plasmoid.configuration.filterByScreen && !latteBridge ? plasmoid.screenGeometry : Qt.rect(-1, -1, 0, 0) //null geometry
|
||||
//! Remove Latte
|
||||
//screenGeometry: plasmoid.configuration.filterByScreen && !latteBridge ? plasmoid.screenGeometry : Qt.rect(-1, -1, 0, 0) //null geometry
|
||||
screenGeometry: plasmoid.configuration.filterByScreen ? plasmoid.screenGeometry : Qt.rect(-1, -1, 0, 0)
|
||||
onRequestActivateIndex: plasmoid.requestActivateIndex(index)
|
||||
Component.onCompleted: {
|
||||
plasmoid.model = appMenuModel
|
||||
}
|
||||
|
||||
|
||||
//! TO-DO Remove Latte
|
||||
winId: latteBridge && existsWindowShown && lastActiveTaskItem ? lastActiveTaskItem.winId : -1
|
||||
|
||||
readonly property bool ignoreWindow: {
|
||||
@@ -489,13 +499,14 @@ PlasmoidItem {
|
||||
id: containmentIdentifierTimer
|
||||
interval: 5000
|
||||
onTriggered: {
|
||||
if (latteBridge) {
|
||||
plasmoid.configuration.containmentType = 2; /*Latte containment with new API*/
|
||||
latteBridge.actions.broadcastToApplet("org.kde.windowtitle", "isPresent", true);
|
||||
latteBridge.actions.broadcastToApplet("org.kde.windowtitle", "menuIsPresent", broadcaster.menuIsPresent);
|
||||
} else {
|
||||
//! Remove Latte
|
||||
//if (latteBridge) {
|
||||
// plasmoid.configuration.containmentType = 2; /*Latte containment with new API*/
|
||||
// latteBridge.actions.broadcastToApplet("org.kde.windowtitle", "isPresent", true);
|
||||
// latteBridge.actions.broadcastToApplet("org.kde.windowtitle", "menuIsPresent", broadcaster.menuIsPresent);
|
||||
//} else {
|
||||
plasmoid.configuration.containmentType = 1; /*Plasma containment or Latte with old API*/
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,12 @@ Name=Window AppMenu
|
||||
Comment=Shows the current window menu
|
||||
Icon=show-menu
|
||||
Type=Service
|
||||
X-KDE-PluginInfo-Author=Michail Vourlakos
|
||||
X-KDE-PluginInfo-Email=mvourlakos@gmail.com
|
||||
X-KDE-PluginInfo-Author=Stanislav Trifonov
|
||||
X-KDE-PluginInfo-Email=trifonov.stas@gmail.com
|
||||
X-KDE-PluginInfo-License=GPL-2.0+
|
||||
X-KDE-PluginInfo-Name=org.kde.windowappmenu
|
||||
X-KDE-PluginInfo-Version=0.8.0
|
||||
X-KDE-PluginInfo-Website=https://github.com/psifidotos/applet-window-appmenu
|
||||
X-KDE-PluginInfo-Version=0.1.0
|
||||
X-KDE-PluginInfo-Website=https://github.com/StanFrad/applet-window-appmenu6/
|
||||
X-KDE-ServiceTypes=Plasma/Applet
|
||||
X-Plasma-API-Minimum-Version=6.0
|
||||
X-KDE-Library=plasma_applet_windowappmenu
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
"KPlugin": {
|
||||
"Authors": [
|
||||
{
|
||||
"Email": "mvourlakos@gmail.com",
|
||||
"Name": "Michail Vourlakos"
|
||||
"Email": "trifonov.stas@gmail.com",
|
||||
"Name": "Stanislav Trifonov"
|
||||
}
|
||||
],
|
||||
"Category": "Windows and Tasks",
|
||||
@@ -15,8 +15,8 @@
|
||||
"ServiceTypes": [
|
||||
"Plasma/Applet"
|
||||
],
|
||||
"Version": "0.8.0",
|
||||
"Website": "https://github.com/psifidotos/applet-window-appmenu"
|
||||
"Version": "0.1.0",
|
||||
"Website": "https://github.com/StanFrad/applet-window-appmenu6/"
|
||||
},
|
||||
"X-Plasma-API-Minimum-Version": "6.0"
|
||||
}
|
||||
@@ -21,7 +21,6 @@ target_link_libraries(appmenuplugin
|
||||
Qt6::Widgets
|
||||
Qt6::Quick
|
||||
Plasma::Plasma
|
||||
Plasma::KWaylandClient
|
||||
KF6::WindowSystem
|
||||
PW::LibTaskManager
|
||||
dbusmenuqt)
|
||||
|
||||
@@ -62,13 +62,6 @@ AppMenuModel::AppMenuModel(QObject *parent)
|
||||
: QAbstractListModel(parent),
|
||||
m_serviceWatcher(new QDBusServiceWatcher(this))
|
||||
{
|
||||
#if LibTaskManager_CURRENTMINOR_VERSION < 19
|
||||
// Disable for Plasma Desktop < 5.19
|
||||
if (KWindowSystem::isPlatformWayland()) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
initWM();
|
||||
|
||||
connect(this, &AppMenuModel::modelNeedsUpdate, this, [this] {
|
||||
|
||||
@@ -18,15 +18,12 @@
|
||||
*/
|
||||
|
||||
#include "waylandwindowmanager.h"
|
||||
#include <config-appmenu.h>
|
||||
|
||||
//Qt
|
||||
#include <QDebug>
|
||||
#include <QModelIndex>
|
||||
|
||||
// KDE
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWindowSystem>
|
||||
|
||||
// Plasma
|
||||
@@ -39,17 +36,12 @@ namespace WM {
|
||||
WaylandWindowManager::WaylandWindowManager(QObject *parent)
|
||||
: AbstractWindowManager(parent)
|
||||
{
|
||||
#if KF5_CURRENTMINOR_VERSION < 69
|
||||
// Disable for KF5::Wayland < 5.69
|
||||
if (KWindowSystem::isPlatformWayland()) {
|
||||
if (!KWindowSystem::isPlatformWayland()) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_tasksModel = new TaskManager::TasksModel(this);
|
||||
|
||||
setupWaylandIntegration();
|
||||
|
||||
m_delayedApplicationMenuTimer.setSingleShot(true);
|
||||
m_delayedApplicationMenuTimer.setInterval(DELAYEDMENUTIMER);
|
||||
connect(&m_delayedApplicationMenuTimer, &QTimer::timeout, this, &WaylandWindowManager::onDelayedTimerTriggered);
|
||||
@@ -71,80 +63,38 @@ WaylandWindowManager::~WaylandWindowManager()
|
||||
{
|
||||
}
|
||||
|
||||
void WaylandWindowManager::setupWaylandIntegration()
|
||||
{
|
||||
if (!KWindowSystem::isPlatformWayland()) {
|
||||
return;
|
||||
}
|
||||
|
||||
using namespace KWayland::Client;
|
||||
auto connection = ConnectionThread::fromApplication(this);
|
||||
|
||||
if (!connection) {
|
||||
return;
|
||||
}
|
||||
|
||||
Registry *registry{new Registry(this)};
|
||||
registry->create(connection);
|
||||
|
||||
connect(registry, &Registry::plasmaShellAnnounced, this
|
||||
, [this, registry](quint32 name, quint32 version) {
|
||||
m_waylandShell = registry->createPlasmaShell(name, version, this);
|
||||
});
|
||||
|
||||
QObject::connect(registry, &KWayland::Client::Registry::plasmaWindowManagementAnnounced,
|
||||
[this, registry](quint32 name, quint32 version) {
|
||||
m_windowManagement = registry->createPlasmaWindowManagement(name, version, this);
|
||||
});
|
||||
|
||||
registry->setup();
|
||||
connection->roundtrip();
|
||||
}
|
||||
|
||||
KWayland::Client::PlasmaWindow *WaylandWindowManager::windowFor(QVariant wid)
|
||||
{
|
||||
auto it = std::find_if(m_windowManagement->windows().constBegin(), m_windowManagement->windows().constEnd(), [&wid](KWayland::Client::PlasmaWindow * w) noexcept {
|
||||
return w->isValid() && w->uuid().toUInt() == wid.toUInt();
|
||||
});
|
||||
|
||||
if (it == m_windowManagement->windows().constEnd()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return *it;
|
||||
}
|
||||
|
||||
void WaylandWindowManager::onActiveWindowChanged()
|
||||
{
|
||||
if (hasUserWindowId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if LibTaskManager_CURRENTMINOR_VERSION >= 19
|
||||
const QModelIndex activeTaskIndex = m_tasksModel->activeTask();
|
||||
const QString objectPath = m_tasksModel->data(activeTaskIndex, TaskManager::AbstractTasksModel::ApplicationMenuObjectPath).toString();
|
||||
const QString serviceName = m_tasksModel->data(activeTaskIndex, TaskManager::AbstractTasksModel::ApplicationMenuServiceName).toString();
|
||||
|
||||
validateApplicationMenu(objectPath, serviceName);
|
||||
#endif
|
||||
}
|
||||
|
||||
void WaylandWindowManager::onWinIdChanged()
|
||||
{
|
||||
if (!m_windowManagement || !hasUserWindowId()) {
|
||||
if (!hasUserWindowId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if KF5_CURRENTMINOR_VERSION >= 69
|
||||
auto window = windowFor(m_userWindowId);
|
||||
// Search the tasks model for the window matching m_userWindowId
|
||||
for (int i = 0; i < m_tasksModel->rowCount(); ++i) {
|
||||
const QModelIndex idx = m_tasksModel->index(i, 0);
|
||||
const QVariant wid = m_tasksModel->data(idx, TaskManager::AbstractTasksModel::WinIdList);
|
||||
|
||||
if (window) {
|
||||
const QString objectPath = window->applicationMenuObjectPath();
|
||||
const QString serviceName = window->applicationMenuServiceName();
|
||||
if (wid.toList().contains(m_userWindowId) || wid == m_userWindowId) {
|
||||
const QString objectPath = m_tasksModel->data(idx, TaskManager::AbstractTasksModel::ApplicationMenuObjectPath).toString();
|
||||
const QString serviceName = m_tasksModel->data(idx, TaskManager::AbstractTasksModel::ApplicationMenuServiceName).toString();
|
||||
|
||||
validateApplicationMenu(objectPath, serviceName);
|
||||
validateApplicationMenu(objectPath, serviceName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void WaylandWindowManager::validateApplicationMenu(const QString &objectPath, const QString &serviceName)
|
||||
|
||||
@@ -28,10 +28,6 @@
|
||||
#include <QPointer>
|
||||
#include <QTimer>
|
||||
|
||||
// KDE
|
||||
#include <KWayland/Client/plasmashell.h>
|
||||
#include <KWayland/Client/plasmawindowmanagement.h>
|
||||
|
||||
// Plasma TaskManager
|
||||
#include <taskmanager/tasksmodel.h>
|
||||
|
||||
@@ -51,20 +47,13 @@ private slots:
|
||||
void onWinIdChanged();
|
||||
|
||||
private:
|
||||
void setupWaylandIntegration();
|
||||
void validateApplicationMenu(const QString &objectPath, const QString &serviceName);
|
||||
|
||||
|
||||
KWayland::Client::PlasmaWindow *windowFor(QVariant wid);
|
||||
|
||||
private:
|
||||
//! window that its menu initialization may be delayed
|
||||
QVariant m_delayedMenuWindowId{-1};
|
||||
QTimer m_delayedApplicationMenuTimer;
|
||||
|
||||
KWayland::Client::PlasmaShell *m_waylandShell{nullptr};
|
||||
QPointer<KWayland::Client::PlasmaWindowManagement> m_windowManagement;
|
||||
|
||||
TaskManager::TasksModel* m_tasksModel;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user