WindowInfo widget
This commit is contained in:
@@ -45,6 +45,8 @@ PanelWindow {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WindowInfo {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Row { // bar widgets center
|
Row { // bar widgets center
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
import "../../../config"
|
||||||
|
import "../states/Apps"
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property real pad: Config.spacing_fun(bar.height) * 1.5
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
|
||||||
|
implicitWidth: contentRow.implicitWidth + pad * 2
|
||||||
|
implicitHeight: contentRow.implicitHeight
|
||||||
|
|
||||||
|
readonly property string windowClass: Hyprland.activeToplevel?.wayland?.appId ?? ""
|
||||||
|
|
||||||
|
readonly property string windowTitle: {
|
||||||
|
const title = Hyprland.activeToplevel?.title;
|
||||||
|
if (!title)
|
||||||
|
return qsTr("Desktop");
|
||||||
|
return title.split(/\s+[\-\u2013\u2014\|]\s+/).pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
readonly property string appIcon: {
|
||||||
|
if (!root.windowClass) return AppsState.matchIcon(root.windowTitle);
|
||||||
|
|
||||||
|
let icon = AppsState.matchIcon(root.windowClass);
|
||||||
|
|
||||||
|
if (!icon) {
|
||||||
|
icon = AppsState.matchIcon(root.windowClass.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!icon) {
|
||||||
|
icon = AppsState.matchIcon(root.windowTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
|
||||||
|
id: contentRow
|
||||||
|
spacing: Config.spacing_fun(bar.height) * 1.25
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: root.windowTitle
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
elide: Text.ElideRight
|
||||||
|
maximumLineCount: 1
|
||||||
|
width: Math.min(implicitWidth, 250)
|
||||||
|
|
||||||
|
font.pixelSize: Config.iconSize(bar.height) * 0.8
|
||||||
|
color: Colors.primary
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: root.appIcon
|
||||||
|
visible: text !== ""
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
font.pixelSize: Math.round(Config.iconSize(bar.height) * 0.85)
|
||||||
|
color: Colors.primary
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user