initial commit

This commit is contained in:
2025-05-04 23:56:04 +02:00
commit 4e10b4d2c2
354 changed files with 53348 additions and 0 deletions

View File

@@ -0,0 +1,292 @@
/*
* Copyright 2018 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of applet-window-title
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.9
import QtQuick.Controls 1.0
import QtQuick.Controls 2.2 as Controls22
import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
import "../../tools/Tools.js" as Tools
Item {
id: root
property alias cfg_boldFont: boldChk.checked
property alias cfg_italicFont: italicChk.checked
property alias cfg_capitalFont: capitalChk.checked
property alias cfg_showIcon: showIconChk.checked
property alias cfg_iconFillThickness: iconFillChk.checked
property alias cfg_iconSize: iconSizeSpn.value
property alias cfg_spacing: spacingSpn.value
property alias cfg_style: root.selectedStyle
property alias cfg_lengthFirstMargin: lengthFirstSpn.value
property alias cfg_lengthLastMargin: lengthLastSpn.value
property alias cfg_lengthMarginsLock: lockItem.locked
property alias cfg_inFillMode: inFillChk.checked
property alias cfg_maximumLength: maxLengthSlider.value
property alias cfg_subsMatch: root.selectedMatches
property alias cfg_subsReplace: root.selectedReplacements
// used as bridge to communicate properly between configuration and ui
property int selectedStyle
property var selectedMatches: []
property var selectedReplacements: []
// used from the ui
readonly property real centerFactor: 0.3
readonly property int minimumWidth: 220
onSelectedStyleChanged: {
if (selectedStyle === 4) { /*NoText*/
showIconChk.checked = true;
}
}
SystemPalette {
id: palette
}
ColumnLayout {
id:mainColumn
spacing: units.largeSpacing
Layout.fillWidth: true
GridLayout{
columns: 2
Label{
Layout.minimumWidth: Math.max(centerFactor * root.width, minimumWidth)
text: i18n("Text style:")
horizontalAlignment: Text.AlignRight
}
StyleComboBox{
Layout.minimumWidth: 220
Layout.preferredWidth: 0.25 * root.width
Layout.maximumWidth: 320
}
}
GridLayout{
columns: 2
Label{
Layout.minimumWidth: Math.max(centerFactor * root.width, minimumWidth)
text: i18n("Icon:")
horizontalAlignment: Text.AlignRight
}
CheckBox{
id: showIconChk
text: i18n("Show when available")
enabled: root.selectedStyle !== 4 /*NoText*/
}
Label{
}
CheckBox{
id: iconFillChk
text: i18n("Fill thickness")
enabled: showIconChk.checked
}
Label{
}
RowLayout{
enabled: !iconFillChk.checked
SpinBox{
id: iconSizeSpn
minimumValue: 16
maximumValue: 128
suffix: " " + i18nc("pixels","px.")
enabled: !iconFillChk.checked
}
Label {
Layout.leftMargin: units.smallSpacing
text: "maximum"
}
}
}
GridLayout{
columns: 2
enabled : root.selectedStyle !== 4 /*NoText*/
Label{
Layout.minimumWidth: Math.max(centerFactor * root.width, minimumWidth)
text: i18n("Font:")
horizontalAlignment: Text.AlignRight
}
CheckBox{
id: boldChk
text: i18n("Bold")
}
Label{
id: italicLbl
font.italic: true
}
CheckBox{
id: italicChk
text: i18n("Italic")
}
Label{
}
CheckBox{
id: capitalChk
text: i18n("First letters capital")
}
}
GridLayout{
columns: 2
enabled : root.selectedStyle !== 4 /*NoText*/
Label{
id: lengthLbl
Layout.minimumWidth: Math.max(centerFactor * root.width, minimumWidth)
text: i18n("Length:")
horizontalAlignment: Text.AlignRight
}
CheckBox{
id: inFillChk
text: i18n("Fill available space")
}
Label{
}
RowLayout{
enabled: !inFillChk.checked
Slider {
id: maxLengthSlider
minimumValue: 24
maximumValue: 1500
stepSize: 2
}
Label {
text: maxLengthSlider.value + " " + i18n("px. at maximum")
}
}
}
ColumnLayout{
GridLayout{
id: visualSettingsGroup1
columns: 2
enabled: showIconChk.checked && root.selectedStyle !== 4 /*NoText*/
Label{
Layout.minimumWidth: Math.max(centerFactor * root.width, minimumWidth)
text: i18n("Spacing:")
horizontalAlignment: Text.AlignRight
}
SpinBox{
id: spacingSpn
minimumValue: 0
maximumValue: 36
suffix: " " + i18nc("pixels","px.")
}
}
GridLayout{
id: visualSettingsGroup2
columns: 3
rows: 2
flow: GridLayout.TopToBottom
columnSpacing: visualSettingsGroup1.columnSpacing
rowSpacing: visualSettingsGroup1.rowSpacing
property int lockerHeight: firstLengthLbl.height + rowSpacing/2
Label{
id: firstLengthLbl
Layout.minimumWidth: Math.max(centerFactor * root.width, minimumWidth)
text: plasmoid.configuration.formFactor===PlasmaCore.Types.Horizontal ?
i18n("Left margin:") : i18n("Top margin:")
horizontalAlignment: Text.AlignRight
}
Label{
Layout.minimumWidth: Math.max(centerFactor * root.width, minimumWidth)
text: plasmoid.configuration.formFactor===PlasmaCore.Types.Horizontal ?
i18n("Right margin:") : i18n("Bottom margin:")
horizontalAlignment: Text.AlignRight
enabled: !lockItem.locked
}
SpinBox{
id: lengthFirstSpn
minimumValue: 0
maximumValue: 24
suffix: " " + i18nc("pixels","px.")
property int lastValue: -1
onValueChanged: {
if (lockItem.locked) {
var step = value - lastValue > 0 ? 1 : -1;
lastValue = value;
lengthLastSpn.value = lengthLastSpn.value + step;
}
}
Component.onCompleted: {
lastValue = plasmoid.configuration.lengthFirstMargin;
}
}
SpinBox{
id: lengthLastSpn
minimumValue: 0
maximumValue: 24
suffix: " " + i18nc("pixels","px.")
enabled: !lockItem.locked
}
LockItem{
id: lockItem
Layout.minimumWidth: 40
Layout.maximumWidth: 40
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
Layout.minimumHeight: visualSettingsGroup2.lockerHeight
Layout.maximumHeight: Layout.minimumHeight
Layout.topMargin: firstLengthLbl.height / 2
Layout.rowSpan: 2
}
}
} // ColumnLayout
} //mainColumn
}

View File

@@ -0,0 +1,160 @@
/*
* Copyright 2018 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of applet-window-title
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.9
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
Item {
id: behaviorPage
property alias cfg_filterByScreen: filterByScreenChk.checked
property alias cfg_filterActivityInfo: filterActivityChk.checked
property alias cfg_showAppMenuOnMouseEnter: showAppMenuChk.checked
property alias cfg_showTooltip: showTooltip.checked
property alias cfg_actionScrollMinimize: cycleMinimizeChk.checked
property alias cfg_subsMatch: behaviorPage.selectedMatches
property alias cfg_subsReplace: behaviorPage.selectedReplacements
property alias cfg_placeHolder: placeHolder.text
// used as bridge to communicate properly between configuration and ui
property var selectedMatches: []
property var selectedReplacements: []
// used from the ui
readonly property real centerFactor: 0.3
readonly property int minimumWidth: 220
ColumnLayout {
id:mainColumn
spacing: units.largeSpacing
Layout.fillWidth: true
GridLayout {
columns: 2
Label{
Layout.minimumWidth: Math.max(centerFactor * behaviorPage.width, minimumWidth)
text: i18n("Filters:")
horizontalAlignment: Text.AlignRight
}
CheckBox{
id: filterByScreenChk
text: i18n("Show only window information from current screen")
}
}
GridLayout {
columns: 2
Label{
Layout.minimumWidth: Math.max(centerFactor * behaviorPage.width, minimumWidth)
text: i18n("Mouse:")
horizontalAlignment: Text.AlignRight
}
CheckBox{
id: showTooltip
text: i18n("Show tooltip on hover")
}
Label{
visible: showAppMenuChk.visible
enabled: showAppMenuChk.enabled
}
CheckBox{
id: showAppMenuChk
text: i18n("Show Window AppMenu applet on enter")
visible: plasmoid.configuration.containmentType === 2 /*Latte Containment*/
enabled: plasmoid.configuration.appMenuIsPresent
}
Label{
visible: cycleMinimizeChk.visible
}
CheckBox {
id: cycleMinimizeChk
text: i18n("Scroll to cycle and minimize through your tasks")
visible: plasmoid.configuration.containmentType === 1 /*Plasma Containment*/
}
}
GridLayout {
columns: 2
Label{
Layout.minimumWidth: Math.max(centerFactor * behaviorPage.width, minimumWidth)
text: i18n("Placeholder:")
horizontalAlignment: Text.AlignRight
}
CheckBox{
id: filterActivityChk
text: i18n("Show activity information")
}
Label{}
TextField {
id: placeHolder
text: plasmoid.configuration.placeHolder
Layout.fillWidth: true
enabled: !filterActivityChk.checked
placeholderText: i18n("placeholder text...")
}
}
GridLayout{
columns: 2
Label{
Layout.minimumWidth: Math.max(centerFactor * behaviorPage.width, minimumWidth)
text: i18n("Application name:")
horizontalAlignment: Text.AlignRight
}
Button{
checkable: true
checked: subsSlidingBox.shown
text: " " + i18n("Manage substitutions...") + " "
onClicked: {
if (subsSlidingBox.shown) {
subsSlidingBox.slideOut();
} else {
subsSlidingBox.slideIn();
}
}
SubstitutionsPopup {
id: subsSlidingBox
page: behaviorPage
slideOutFrom: PlasmaCore.Types.BottomEdge
}
}
}
}
}

View File

@@ -0,0 +1,88 @@
/*
* Copyright 2018 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of applet-window-title
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.9
import QtQuick.Controls 1.3
import QtQuick.Layouts 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
Item{
id: main
property bool locked: true
readonly property int verticalSubHeight: height - (button.height/2)
ColumnLayout{
id: column
spacing: 0
opacity: locked ? 1 : 0.5
Rectangle{
id: subRectTop
Layout.minimumWidth: button.width/2 + Layout.minimumHeight/2
Layout.minimumHeight: 3
Layout.maximumWidth: Layout.minimumWidth
Layout.maximumHeight: Layout.minimumHeight
color: palette.text
}
Rectangle {
Layout.leftMargin: subRectTop.Layout.minimumWidth - subRectTop.Layout.minimumHeight
Layout.minimumWidth: subRectTop.Layout.minimumHeight
Layout.minimumHeight: verticalSubHeight
Layout.maximumWidth: Layout.minimumWidth
Layout.maximumHeight: Layout.minimumHeight
color: palette.text
}
KQuickAddons.QIconItem{
id: button
width: 24
height: 24
icon: locked ? "lock" : "unlock"
}
Rectangle {
Layout.leftMargin: subRectTop.Layout.minimumWidth - subRectTop.Layout.minimumHeight
Layout.minimumWidth: subRectTop.Layout.minimumHeight
Layout.minimumHeight: verticalSubHeight
Layout.maximumWidth: Layout.minimumWidth
Layout.maximumHeight: Layout.minimumHeight
color: palette.text
}
Rectangle{
Layout.minimumWidth: subRectTop.Layout.minimumWidth
Layout.minimumHeight: subRectTop.Layout.minimumHeight
Layout.maximumWidth: Layout.minimumWidth
Layout.maximumHeight: Layout.minimumHeight
color: palette.text
}
}
MouseArea{
anchors.fill: column
onClicked: locked = !locked;
}
}

View File

@@ -0,0 +1,127 @@
/*
* Copyright 2018 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of applet-window-title
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.9
import QtQuick.Controls 1.0
import QtGraphicalEffects 1.0
import QtQuick.Controls 2.2 as Controls22
import QtQuick.Layouts 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
Item{
id: box
clip: true
x: parent.width/2 - width/2
/*y: slideOutFrom === PlasmaCore.Types.BottomEdge ? 0
height: 0*/
opacity: 0
property QtObject contentItem: null
property int slideOutFrom: PlasmaCore.Types.TopEdge
property bool shown: false
readonly property int availableWidth: width - 2*12 - 2*units.largeSpacing
readonly property int availableHeight: contentItem.childrenRect.height + 2*units.largeSpacing
readonly property int maximumHeight: availableHeight + 2*12
onContentItemChanged: {
if (contentItem){
contentItem.parent = centralItem
}
}
function slideIn() {
if (slideOutFrom === PlasmaCore.Types.TopEdge) {
height = maximumHeight;
y = -maximumHeight;
} else {
height = maximumHeight;
y = parent.height;
}
opacity = 1;
shown = true;
}
function slideOut() {
if (slideOutFrom === PlasmaCore.Types.TopEdge) {
height = 0;
y = 0;
} else {
height = 0;
y = parent.height;
}
opacity = 0;
shown = false;
}
Behavior on y{
NumberAnimation {
duration: 300
easing.type: Easing.OutCubic
}
}
Behavior on height{
NumberAnimation {
duration: 300
easing.type: Easing.OutCubic
}
}
Behavior on opacity{
NumberAnimation {
duration: 300
easing.type: Easing.OutCubic
}
}
SystemPalette {
id: palette
}
Item{
id: mainElement
width: parent.width
height: contentItem ? maximumHeight : 100
Rectangle{
id: centralItem
anchors.fill: parent
anchors.margins: 12
color: palette.alternateBase
border.width: 1
border.color: palette.mid
radius: 1
layer.enabled: true
layer.effect: DropShadow {
id: shadowElement
radius: 12
fast: true
samples: 2 * radius
color: palette.shadow
}
}
}
}

View File

@@ -0,0 +1,85 @@
/*
* Copyright 2018 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of applet-window-title
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Controls 2.2 as Controls22
import QtQuick.Layouts 1.0
Controls22.ComboBox{
id: combobox
model: titleStyles
property var titleStyles: [
i18n("Application"),
i18n("Title"),
i18n("Application - Title"),
i18n("Title - Application"),
i18n("Do not show any text"),
];
Connections{
target: popup
onClosed: root.forceActiveFocus();
}
delegate: MouseArea{
width: combobox.width
height: combobox.height
hoverEnabled: true
onClicked: {
combobox.currentIndex = index;
root.selectedStyle = index;
combobox.popup.close();
}
Rectangle{
id:delegateBackground
anchors.fill: parent
color: {
if (containsMouse) {
return palette.highlight;
}
if (combobox.currentIndex === index) {
return selectedColor;
}
return "transparent";
}
readonly property color selectedColor: Qt.rgba(palette.highlight.r, palette.highlight.g, palette.highlight.b, 0.5);
Label{
id: label
anchors.left: parent.left
anchors.leftMargin: units.smallSpacing
anchors.verticalCenter: parent.verticalCenter
text: titleStyles[index];
color: containsMouse ? palette.highlightedText : palette.text
}
}
}
Component.onCompleted: {
currentIndex = plasmoid.configuration.style;
}
}

View File

@@ -0,0 +1,114 @@
/*
* Copyright 2018 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of applet-window-title
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.9
import QtQuick.Controls 1.0
import QtQuick.Controls 2.2 as Controls22
import QtQuick.Layouts 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
import "../../tools/Tools.js" as Tools
SlidingBox {
id: popup
width: Tools.qBound(400, 0.6*page.width, 750)
property QtObject page: null
function textAreaToList(text) {
var res = text.split("\n");
return res;
}
function listToText(text) {
var res = text.join("\n");
return res;
}
contentItem: ColumnLayout{
id: mainColumn
width: popup.availableWidth
anchors.margins: units.largeSpacing
anchors.centerIn: parent
spacing: units.largeSpacing
Label{
Layout.fillWidth: true
horizontalAlignment: Qt.AlignHCenter
font.bold: true
text: i18n("Substitutions")
}
GridLayout {
columns: 2
Label{
Layout.fillWidth: true
horizontalAlignment: Qt.AlignHCenter
font.bold: true
text: "Match"
}
Label{
Layout.fillWidth: true
horizontalAlignment: Qt.AlignHCenter
font.bold: true
text: "Replace with"
}
TextArea{
id: textAreaMatch
Layout.fillWidth: true
Layout.fillHeight: true
text: listToText(page.selectedMatches)
onTextChanged: page.selectedMatches = popup.textAreaToList(text)
flickableItem.onContentYChanged: {
textAreaReplace.flickableItem.contentY = flickableItem.contentY
}
}
TextArea{
id: textAreaReplace
Layout.fillWidth: true
Layout.fillHeight: true
text: listToText(page.selectedReplacements)
onTextChanged: page.selectedReplacements = popup.textAreaToList(text)
flickableItem.onContentYChanged: {
textAreaMatch.flickableItem.contentY = flickableItem.contentY
}
}
}
Label{
Layout.fillWidth: true
horizontalAlignment: Qt.AlignHCenter
font.italic: true
color: "#ff0000"
text: {
if (page.selectedMatches.length !== page.selectedReplacements.length) {
return i18n("Warning: Matches and Replacements do not have the same size...");
}
return "";
}
}
}
}