-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathxfwm_compositor_settings.cpp
More file actions
150 lines (122 loc) · 6.53 KB
/
xfwm_compositor_settings.cpp
File metadata and controls
150 lines (122 loc) · 6.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#include "cmd.h"
#include "ui_xfwm_compositor_settings.h"
#include "xfwm_compositor_settings.h"
using namespace Qt::Literals::StringLiterals;
xfwm_compositor_settings::xfwm_compositor_settings(QWidget *parent) noexcept :
QDialog(parent),
ui(new Ui::xfwm_compositor_settings)
{
ui->setupUi(this);
setWindowFlags(Qt::Window); // for the close, min and max buttons
connect(ui->pushClose, &QPushButton::clicked, this, &xfwm_compositor_settings::close);
setup();
}
xfwm_compositor_settings::~xfwm_compositor_settings() noexcept
{
delete ui;
}
// setup some initial values
void xfwm_compositor_settings::setup() noexcept
{
setWindowTitle(tr("Xfwm Compositor Settings"));
// initial settings
QString value;
value = runCmd(u"xfconf-query -c xfwm4 -p /general/unredirect_overlays"_s).output;
ui->checkRedirect->setChecked(value == "true"_L1);
value = runCmd(u"xfconf-query -c xfwm4 -p /general/sync_to_vblank"_s).output;
ui->checkVsync->setChecked(value == "true"_L1);
value = runCmd(u"xfconf-query -c xfwm4 -p /general/cycle_preview"_s).output;
ui->checkPreview->setChecked(value == "true"_L1);
value = runCmd(u"xfconf-query -c xfwm4 -p /general/show_popup_shadow"_s).output;
ui->checkPopupShadows->setChecked(value == "true"_L1);
value = runCmd(u"xfconf-query -c xfwm4 -p /general/show_dock_shadow"_s).output;
ui->checkDockShadows->setChecked(value == "true"_L1);
value = runCmd(u"xfconf-query -c xfwm4 -p /general/show_frame_shadow"_s).output;
ui->checkFrameShadows->setChecked(value == "true"_L1);
value = runCmd(u"xfconf-query -c xfwm4 -p /general/frame_opacity"_s).output;
ui->sliderWindowDecorations->setValue(value.toInt());
ui->sliderWindowDecorations->setToolTip(value);
value = runCmd(u"xfconf-query -c xfwm4 -p /general/inactive_opacity"_s).output;
ui->sliderInactiveWindows->setValue(value.toInt());
ui->sliderInactiveWindows->setToolTip(value);
value = runCmd(u"xfconf-query -c xfwm4 -p /general/move_opacity"_s).output;
ui->sliderWindowsMove->setValue(value.toInt());
ui->sliderWindowsMove->setToolTip(value);
value = runCmd(u"xfconf-query -c xfwm4 -p /general/resize_opacity"_s).output;
ui->sliderWindowsResize->setValue(value.toInt());
ui->sliderWindowsResize->setToolTip(value);
value = runCmd(u"xfconf-query -c xfwm4 -p /general/popup_opacity"_s).output;
ui->sliderPopup->setValue(value.toInt());
ui->sliderPopup->setToolTip(value);
connect(ui->checkRedirect, &QCheckBox::toggled, this, &xfwm_compositor_settings::checkRedirect_toggled);
connect(ui->checkVsync, &QCheckBox::toggled, this, &xfwm_compositor_settings::checkVsync_toggled);
connect(ui->checkPreview, &QCheckBox::toggled, this, &xfwm_compositor_settings::checkPreview_toggled);
connect(ui->checkPopupShadows, &QCheckBox::toggled, this, &xfwm_compositor_settings::checkPopupShadows_toggled);
connect(ui->checkDockShadows, &QCheckBox::toggled, this, &xfwm_compositor_settings::checkDockShadows_toggled);
connect(ui->checkFrameShadows, &QCheckBox::toggled, this, &xfwm_compositor_settings::checkFrameShadows_toggled);
connect(ui->sliderWindowDecorations, &QSlider::valueChanged, this, &xfwm_compositor_settings::sliderWindowDecorations_valueChanged);
connect(ui->sliderInactiveWindows, &QSlider::valueChanged, this, &xfwm_compositor_settings::sliderInactiveWindows_valueChanged);
connect(ui->sliderWindowsMove, &QSlider::valueChanged, this, &xfwm_compositor_settings::sliderWindowsMove_valueChanged);
connect(ui->sliderWindowsResize, &QSlider::valueChanged, this, &xfwm_compositor_settings::sliderWindowsResize_valueChanged);
connect(ui->sliderPopup, &QSlider::valueChanged, this, &xfwm_compositor_settings::sliderPopup_valueChanged);
}
void xfwm_compositor_settings::checkRedirect_toggled(bool checked) noexcept
{
runProc(u"xfconf-query"_s, {u"-c"_s, u"xfwm4"_s, u"-p"_s,
u"/general/unredirect_overlays"_s, u"-s"_s, (checked ? u"true"_s : u"false"_s)});
}
void xfwm_compositor_settings::checkVsync_toggled(bool checked) noexcept
{
runProc(u"xfconf-query"_s, {u"-c"_s, u"xfwm4"_s, u"-p"_s,
u"/general/sync_to_vblank"_s, u"-s"_s, (checked ? u"true"_s : u"false"_s)});
}
void xfwm_compositor_settings::checkPreview_toggled(bool checked) noexcept
{
runProc(u"xfconf-query"_s, {u"-c"_s, u"xfwm4"_s, u"-p"_s,
u"/general/cycle_preview"_s, u"-s"_s, (checked ? u"true"_s : u"false"_s)});
}
void xfwm_compositor_settings::checkPopupShadows_toggled(bool checked) noexcept
{
runProc(u"xfconf-query"_s, {u"-c"_s, u"xfwm4"_s, u"-p"_s,
u"/general/show_popup_shadow"_s, u"-s"_s, (checked ? u"true"_s : u"false"_s)});
}
void xfwm_compositor_settings::checkDockShadows_toggled(bool checked) noexcept
{
runProc(u"xfconf-query"_s, {u"-c"_s, u"xfwm4"_s, u"-p"_s,
u"/general/show_dock_shadow"_s, u"-s"_s, (checked ? u"true"_s : u"false"_s)});
}
void xfwm_compositor_settings::checkFrameShadows_toggled(bool checked) noexcept
{
runProc(u"xfconf-query"_s, {u"-c"_s, u"xfwm4"_s, u"-p"_s,
u"/general/show_frame_shadow"_s, u"-s"_s, (checked ? u"true"_s : u"false"_s)});
}
void xfwm_compositor_settings::sliderWindowDecorations_valueChanged(int value) noexcept
{
const QString ¶m = QString::number(value);
ui->sliderWindowDecorations->setToolTip(param);
runProc(u"xfconf-query"_s, {u"-c"_s, u"xfwm4"_s, u"-p"_s, u"/general/frame_opacity"_s, u"-s"_s, param});
}
void xfwm_compositor_settings::sliderInactiveWindows_valueChanged(int value) noexcept
{
const QString ¶m = QString::number(value);
ui->sliderInactiveWindows->setToolTip(param);
runProc(u"xfconf-query"_s, {u"-c"_s, u"xfwm4"_s, u"-p"_s, u"/general/inactive_opacity"_s, u"-s"_s, param});
}
void xfwm_compositor_settings::sliderWindowsMove_valueChanged(int value) noexcept
{
const QString ¶m = QString::number(value);
ui->sliderWindowsMove->setToolTip(param);
runProc(u"xfconf-query"_s, {u"-c"_s, u"xfwm4"_s, u"-p"_s, u"/general/move_opacity"_s, u"-s"_s, param});
}
void xfwm_compositor_settings::sliderWindowsResize_valueChanged(int value) noexcept
{
const QString ¶m = QString::number(value);
ui->sliderWindowsResize->setToolTip(param);
runProc(u"xfconf-query"_s, {u"-c"_s, u"xfwm4"_s, u"-p"_s, u"/general/resize_opacity"_s, u"-s"_s, param});
}
void xfwm_compositor_settings::sliderPopup_valueChanged(int value) noexcept
{
QString param = QString::number(value);
ui->sliderWindowDecorations->setToolTip(param);
runProc(u"xfconf-query"_s, {u"-c"_s, u"xfwm4"_s, u"-p"_s, u"/general/popup_opacity"_s, u"-s"_s, param});
}