Skip to content

Commit 7c7d0cc

Browse files
committed
0.7
1 parent ecf7bc9 commit 7c7d0cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2787
-2434
lines changed

.gitignore

-52
This file was deleted.

README.md

+9-15
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div align="center">
2-
<img src="readme-icon.png" width="96">
2+
<img src="readme_icon.png" width="96">
33
<h1>plainPanel</h1>
4-
<p>Lightweight panel for OpenBox, FluxBox and other window managers.</p>
4+
<p>Lightweight panel for OpenBox, FluxBox, and other window managers.</p>
55

66
<img src="https://img.shields.io/github/last-commit/plainDE/plainPanel?style=plastic">
77
<img src="https://img.shields.io/github/license/plainDE/plainPanel?style=plastic">
@@ -15,7 +15,7 @@
1515
<img src="https://raw.githubusercontent.com/linuxmint/mint-y-icons/master/usr/share/icons/Mint-Y/apps/22/extensions.png"> Battery,<br>
1616
<img src="https://raw.githubusercontent.com/linuxmint/mint-y-icons/master/usr/share/icons/Mint-Y/apps/22/extensions.png"> Spacer,
1717
<img src="https://raw.githubusercontent.com/linuxmint/mint-y-icons/master/usr/share/icons/Mint-Y/apps/22/workspace-switcher-top-left.png"> Worskpaces,
18-
<img src="https://raw.githubusercontent.com/linuxmint/mint-y-icons/master/usr/share/icons/Mint-Y/apps/22/preferences-system-sound.png"> MPRIS,
18+
<img src="https://raw.githubusercontent.com/linuxmint/mint-y-icons/master/usr/share/icons/Mint-Y/apps/22/preferences-system-sound.png"> MPRIS Playback Control,
1919
<img src="https://raw.githubusercontent.com/linuxmint/mint-y-icons/master/usr/share/icons/Mint-Y/apps/22/preferences-system-sound.png"> Volume,
2020
<img src="https://raw.githubusercontent.com/linuxmint/mint-y-icons/master/usr/share/icons/Mint-Y/apps/22/extensions.png"> SNI tray,<br>
2121
<img src="https://raw.githubusercontent.com/linuxmint/mint-y-icons/master/usr/share/icons/Mint-Y/apps/22/keyboard.png"> Keyboard Layout,
@@ -25,18 +25,13 @@
2525
<img src="https://raw.githubusercontent.com/linuxmint/mint-y-icons/master/usr/share/icons/Mint-Y/categories/22/cs-network.png"> Local IPv4 Indicator
2626

2727
<h2>Screenshots</h2>
28-
<img src="scr-0.6.3.png" width="853">
29-
30-
<h2>Dependencies</h2>
31-
<code>git</code>, <code>qt5-base</code>, <code>xorg</code>, <code>noto-fonts-emoji</code>, <code>polkit</code>, <code>ttf-opensans</code>, <code>make</code>, <code>alsa-utils</code>, <code>kwindowsystem</code>, <code>python3</code>, <code>xcompmgr</code>, <code>upower</code>
28+
<img src="scr-0.7.png" width="853">
3229

3330
<h2>Installation</h2>
34-
Use <a href="https://github.com/plainDE/plainInstaller">plainInstaller</a>, a script that will download, compile and install everything automatically.<br><br>
35-
36-
Now add <code>plainPanel</code> to OpenBox/FluxBox/... autostart and enjoy!
31+
For the installation guide, refer to <a href="https://plainde.github.io/docs.github.io/installation.html">docs</a>.
3732

3833
<h2>Customizing</h2>
39-
You can either edit ~/.config/plainDE/config.json manually (refer to documentation) or use <a href="https://github.com/plainDE/plainControlCenter">plainControlCenter</a>.
34+
You can either edit ~/.config/plainDE/config.json manually (refer to <a href="https://plainde.github.io/docs.github.io/config.html">docs</a>) or use <a href="https://github.com/plainDE/plainControlCenter">plainControlCenter</a>.
4035

4136
<h2>How can I help you?</h2>
4237
<ul>
@@ -48,10 +43,9 @@
4843
<li>...</li>
4944
</ul>
5045

51-
Any help is appreciated.
52-
Email us at <a href="mailto:highsierra.2007@gmail.com">highsierra.2007@gmail.com</a>
53-
46+
Any help is appreciated. Use GitHub Issues to send your feedback.
47+
5448
<h2>Miscellaneous</h2>
55-
<b>Note</b>. Mint-Y/Mint-L is recommended icon theme (we use few Mint-Y-only icons).<br>
49+
<b>Note</b>. Mint-Y/Mint-L is recommended icon theme (we use a few Mint-Y-only icons).<br>
5650

5751
</div>

applet.cpp

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#include "applet.h"
2+
3+
void Applet::setBlurredBackground(QWidget* internalWidget) {
4+
QScreen* screen = internalWidget->screen();
5+
QRect widgetGeometry = internalWidget->geometry();
6+
QPixmap pixmap = screen->grabWindow(0,
7+
widgetGeometry.x(),
8+
widgetGeometry.y(),
9+
widgetGeometry.width(),
10+
widgetGeometry.height());
11+
qDebug() << widgetGeometry;
12+
QGraphicsBlurEffect* blurEffect = new QGraphicsBlurEffect();
13+
blurEffect->setBlurRadius(15);
14+
blurEffect->setBlurHints(QGraphicsBlurEffect::QualityHint);
15+
16+
QGraphicsScene* scene = new QGraphicsScene();
17+
QGraphicsPixmapItem item;
18+
item.setPixmap(pixmap);
19+
item.setGraphicsEffect(blurEffect);
20+
scene->addItem(&item);
21+
QImage res(QSize(widgetGeometry.width(), widgetGeometry.height()), QImage::Format_ARGB32);
22+
res.fill(Qt::transparent);
23+
QPainter ptr(&res);
24+
scene->render(&ptr, QRectF(), QRectF(0, 0, widgetGeometry.width(), widgetGeometry.height()));
25+
26+
QPalette palette;
27+
palette.setBrush(internalWidget->backgroundRole(),
28+
QBrush(QPixmap::fromImage(res)));
29+
internalWidget->setPalette(palette);
30+
}
31+
32+
QPair<int,int> Applet::getButtonCoordinates(QWidget* externalWidget, Panel* parentPanel) {
33+
int buttonCoord1, buttonCoord2;
34+
if (parentPanel->mPanelLayout == Horizontal) {
35+
buttonCoord1 = externalWidget->x() + parentPanel->mAxisShift;
36+
buttonCoord2 = externalWidget->geometry().topRight().x() + parentPanel->mAxisShift;
37+
}
38+
else { // Vertical
39+
buttonCoord1 = externalWidget->y() + parentPanel->mAxisShift;
40+
buttonCoord2 = externalWidget->geometry().bottomRight().y() + parentPanel->mAxisShift;
41+
}
42+
return qMakePair(buttonCoord1, buttonCoord2);
43+
}
44+
45+
void Applet::externalWidgetSetup(ConfigManager*, Panel*) {
46+
47+
}
48+
49+
void Applet::preliminaryInternalWidgetSetup(QWidget* internalWidget,
50+
QWidget* externalWidget,
51+
ConfigManager* cfgMan,
52+
Panel* parentPanel,
53+
int width,
54+
int height,
55+
bool canBeTransparent) {
56+
// Window flags
57+
internalWidget->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
58+
59+
// Geometry
60+
QScreen* screen = parentPanel->mPanelScreen;
61+
QRect screenGeometry = screen->geometry();
62+
int ax = 0, ay = 0;
63+
QPair<int,int> buttonCoords = getButtonCoordinates(externalWidget, parentPanel);
64+
int buttonCoord1 = buttonCoords.first, buttonCoord2 = buttonCoords.second;
65+
switch (parentPanel->mPanelLocation) {
66+
case Top:
67+
ax = (screenGeometry.width() - buttonCoord1 >= width) ? buttonCoord1 : buttonCoord2 - width;
68+
ay = parentPanel->mPanelThickness + 5;
69+
break;
70+
71+
case Bottom:
72+
ax = (screenGeometry.width() - buttonCoord1 >= width) ? buttonCoord1 : buttonCoord2 - width;
73+
ay = screenGeometry.height() - parentPanel->mPanelThickness - height - 5;
74+
break;
75+
76+
case Left:
77+
ax = parentPanel->mPanelThickness + 5;
78+
ay = (screenGeometry.height() - buttonCoord1 >= height) ? buttonCoord1 : buttonCoord2 - height;
79+
break;
80+
81+
case Right:
82+
ax = screenGeometry.width() - parentPanel->mPanelThickness - width - 5;
83+
ay = (screenGeometry.height() - buttonCoord1 >= height) ? buttonCoord1 : buttonCoord2 - height;
84+
break;
85+
}
86+
87+
ax += screenGeometry.x();
88+
ay += screenGeometry.y();
89+
internalWidget->setFixedSize(width, height);
90+
internalWidget->move(ax, ay);
91+
92+
// Font
93+
internalWidget->setFont(cfgMan->mFont);
94+
95+
// Theme
96+
QFile stylesheetReader("/usr/share/plainDE/styles/" + cfgMan->mStylesheet);
97+
stylesheetReader.open(QIODevice::ReadOnly | QIODevice::Text);
98+
QTextStream styleSheet(&stylesheetReader);
99+
internalWidget->setStyleSheet(styleSheet.readAll());
100+
if (cfgMan->mTransparent && canBeTransparent) {
101+
setBlurredBackground(internalWidget);
102+
}
103+
104+
// Opacity
105+
internalWidget->setWindowOpacity(parentPanel->mOpacity);
106+
}
107+
108+
Applet::Applet(ConfigManager*, Panel*, QString) {
109+
110+
}

applet.h

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#ifndef APPLET_H
2+
#define APPLET_H
3+
4+
#include <QObject>
5+
#include <QWidget>
6+
#include <QScreen>
7+
8+
#include <QGraphicsEffect>
9+
#include <QGraphicsScene>
10+
#include <QGraphicsPixmapItem>
11+
#include <QPainter>
12+
13+
#include "configman.h"
14+
#include "panel.h"
15+
16+
class Applet : public QObject {
17+
Q_OBJECT
18+
public:
19+
Applet(ConfigManager* cfgMan,
20+
Panel* parentPanel,
21+
QString additionalInfo);
22+
void externalWidgetSetup(ConfigManager* cfgMan, Panel* parentPanel);
23+
void internalWidgetSetup(ConfigManager* cfgMan, Panel* parentPanel);
24+
void repeatingAction(ConfigManager* cfgMan, Panel* parentPanel);
25+
void activate(ConfigManager* cfgMan, Panel* parentPanel);
26+
27+
void setBlurredBackground(QWidget* internalWidget);
28+
QPair<int,int> getButtonCoordinates(QWidget* externalWidget,
29+
Panel* parentPanel);
30+
void preliminaryInternalWidgetSetup(QWidget* internalWidget,
31+
QWidget* externalWidget,
32+
ConfigManager* cfgMan,
33+
Panel* parentPanel,
34+
int width,
35+
int height,
36+
bool canBeTransparent);
37+
38+
QWidget* mExternalWidget;
39+
QWidget* mInternalWidget;
40+
};
41+
42+
#endif // APPLET_H

0 commit comments

Comments
 (0)