forked from Shinonome/dots-hyprland
region selector: fix target regions
This commit is contained in:
@@ -48,7 +48,6 @@ PanelWindow {
|
|||||||
property color imageBorderColor: "#ddf1d1ff"
|
property color imageBorderColor: "#ddf1d1ff"
|
||||||
property color imageFillColor: "#33f1d1ff"
|
property color imageFillColor: "#33f1d1ff"
|
||||||
property color onBorderColor: "#ff000000"
|
property color onBorderColor: "#ff000000"
|
||||||
property real standardRounding: 4
|
|
||||||
readonly property var windows: [...HyprlandData.windowList].sort((a, b) => {
|
readonly property var windows: [...HyprlandData.windowList].sort((a, b) => {
|
||||||
// Sort floating=true windows before others
|
// Sort floating=true windows before others
|
||||||
if (a.floating === b.floating) return 0;
|
if (a.floating === b.floating) return 0;
|
||||||
@@ -357,13 +356,13 @@ PanelWindow {
|
|||||||
root.snip();
|
root.snip();
|
||||||
}
|
}
|
||||||
onPositionChanged: (mouse) => {
|
onPositionChanged: (mouse) => {
|
||||||
|
root.updateTargetedRegion(mouse.x, mouse.y);
|
||||||
if (!root.dragging) return;
|
if (!root.dragging) return;
|
||||||
root.draggingX = mouse.x;
|
root.draggingX = mouse.x;
|
||||||
root.draggingY = mouse.y;
|
root.draggingY = mouse.y;
|
||||||
root.dragDiffX = mouse.x - root.dragStartX;
|
root.dragDiffX = mouse.x - root.dragStartX;
|
||||||
root.dragDiffY = mouse.y - root.dragStartY;
|
root.dragDiffY = mouse.y - root.dragStartY;
|
||||||
root.points.push({ x: mouse.x, y: mouse.y });
|
root.points.push({ x: mouse.x, y: mouse.y });
|
||||||
root.updateTargetedRegion(mouse.x, mouse.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
@@ -478,6 +477,8 @@ PanelWindow {
|
|||||||
&& root.targetedRegionWidth === modelData.size[0]
|
&& root.targetedRegionWidth === modelData.size[0]
|
||||||
&& root.targetedRegionHeight === modelData.size[1])
|
&& root.targetedRegionHeight === modelData.size[1])
|
||||||
|
|
||||||
|
colBackground: root.genericContentColor
|
||||||
|
colForeground: root.genericContentForeground
|
||||||
opacity: root.draggedAway ? 0 : 1
|
opacity: root.draggedAway ? 0 : 1
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
@@ -510,6 +511,8 @@ PanelWindow {
|
|||||||
&& root.targetedRegionWidth === modelData.size[0]
|
&& root.targetedRegionWidth === modelData.size[0]
|
||||||
&& root.targetedRegionHeight === modelData.size[1])
|
&& root.targetedRegionHeight === modelData.size[1])
|
||||||
|
|
||||||
|
colBackground: root.genericContentColor
|
||||||
|
colForeground: root.genericContentForeground
|
||||||
opacity: root.draggedAway ? 0 : 1
|
opacity: root.draggedAway ? 0 : 1
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
@@ -542,6 +545,8 @@ PanelWindow {
|
|||||||
&& root.targetedRegionWidth === modelData.size[0]
|
&& root.targetedRegionWidth === modelData.size[0]
|
||||||
&& root.targetedRegionHeight === modelData.size[1])
|
&& root.targetedRegionHeight === modelData.size[1])
|
||||||
|
|
||||||
|
colBackground: root.genericContentColor
|
||||||
|
colForeground: root.genericContentForeground
|
||||||
opacity: root.draggedAway ? 0 : 1
|
opacity: root.draggedAway ? 0 : 1
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import Quickshell.Hyprland
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: regionRect
|
id: regionRect
|
||||||
|
required property color colBackground
|
||||||
|
required property color colForeground
|
||||||
property bool showIcon: false
|
property bool showIcon: false
|
||||||
property bool targeted: false
|
property bool targeted: false
|
||||||
property color borderColor
|
property color borderColor
|
||||||
@@ -26,14 +28,14 @@ Rectangle {
|
|||||||
color: fillColor
|
color: fillColor
|
||||||
border.color: borderColor
|
border.color: borderColor
|
||||||
border.width: targeted ? 3 : 1
|
border.width: targeted ? 3 : 1
|
||||||
radius: root.standardRounding
|
radius: 4
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: regionLabelBackground
|
id: regionLabelBackground
|
||||||
property real verticalPadding: 5
|
property real verticalPadding: 5
|
||||||
property real horizontalPadding: 10
|
property real horizontalPadding: 10
|
||||||
radius: 10
|
radius: 10
|
||||||
color: root.genericContentColor
|
color: regionRect.colBackground
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: Appearance.m3colors.m3outlineVariant
|
border.color: Appearance.m3colors.m3outlineVariant
|
||||||
anchors {
|
anchors {
|
||||||
@@ -62,7 +64,7 @@ Rectangle {
|
|||||||
StyledText {
|
StyledText {
|
||||||
id: regionText
|
id: regionText
|
||||||
text: regionRect.text
|
text: regionRect.text
|
||||||
color: root.genericContentForeground
|
color: regionRect.colForeground
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user