Merge remote-tracking branch 'upstream/main' into fix-search-focus-loss

This commit is contained in:
altrup
2026-01-15 10:18:44 -05:00
34 changed files with 2163 additions and 123 deletions
@@ -80,19 +80,21 @@ Item { // Bar content region
RowLayout {
id: leftSectionRowLayout
anchors.fill: parent
spacing: 10
spacing: 0
LeftSidebarButton { // Left sidebar button
id: leftSidebarButton
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: Appearance.rounding.screenRounding
colBackground: barLeftSideMouseArea.hovered ? Appearance.colors.colLayer1Hover : ColorUtils.transparentize(Appearance.colors.colLayer1Hover, 1)
}
ActiveWindow {
visible: root.useShortenedForm === 0
Layout.leftMargin: 10 + (leftSidebarButton.visible ? 0 : Appearance.rounding.screenRounding)
Layout.rightMargin: Appearance.rounding.screenRounding
Layout.fillWidth: true
Layout.fillHeight: true
visible: root.useShortenedForm === 0
}
}
}
@@ -9,6 +9,11 @@ RippleButton {
property bool showPing: false
property bool aiChatEnabled: Config.options.policies.ai !== 0
property bool translatorEnabled: Config.options.sidebar.translator.enable
property bool animeEnabled: Config.options.policies.weeb !== 0
visible: aiChatEnabled || translatorEnabled || animeEnabled
property real buttonPadding: 5
implicitWidth: distroIcon.width + buttonPadding * 2
implicitHeight: distroIcon.height + buttonPadding * 2
@@ -100,5 +100,16 @@ StyledPopup {
value: Weather.data.sunset
}
}
// Footer: last refresh
StyledText {
Layout.alignment: Qt.AlignHCenter
text: Translation.tr("Last refresh: %1").arg(Weather.data.lastRefresh)
font {
weight: Font.Medium
pixelSize: Appearance.font.pixelSize.smaller
}
color: Appearance.colors.colOnSurfaceVariant
}
}
}
@@ -133,7 +133,7 @@ Item {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
}
clip: true
color: Appearance.colors.colSurfaceContainer
color: Appearance.m3colors.m3surfaceContainer
radius: Appearance.rounding.normal
anchors.bottom: parent.bottom
anchors.bottomMargin: Appearance.sizes.elevationMargin
@@ -16,7 +16,6 @@ LockScreen {
}
// Push everything down
property var lastWorkspaceId: 1
Variants {
model: Quickshell.screens
delegate: Scope {
@@ -25,13 +24,16 @@ LockScreen {
property string targetMonitorName: modelData.name
property int verticalMovementDistance: modelData.height
property int horizontalSqueeze: modelData.width * 0.2
property int lastWorkspaceId
onShouldPushChanged: {
if (shouldPush) {
root.lastWorkspaceId = HyprlandData.activeWorkspace.id;
// Save workspace
print(targetMonitorName)
lastWorkspaceId = HyprlandData.monitors.find(m => m.name == targetMonitorName).activeWorkspace.id
// Set anim to vertical and move to very very big workspace for a sliding up effect
Quickshell.execDetached(["hyprctl", "--batch", "keyword animation workspaces,1,7,menu_decel,slidevert; dispatch workspace 2147483647"]);
Quickshell.execDetached(["hyprctl", "--batch", `keyword animation workspaces,1,7,menu_decel,slidevert; dispatch workspace ${2147483647 - lastWorkspaceId}`]);
} else {
Quickshell.execDetached(["hyprctl", "--batch", `dispatch workspace ${root.lastWorkspaceId}; reload`]);
Quickshell.execDetached(["hyprctl", "--batch", `dispatch workspace ${lastWorkspaceId}; reload`]);
}
}
}
@@ -136,6 +136,8 @@ MouseArea {
// Style
clip: true
font.pixelSize: Appearance.font.pixelSize.small
selectedTextColor: materialShapeChars ? "transparent" : Appearance.colors.colOnSecondaryContainer
selectionColor: materialShapeChars ? "transparent" : Appearance.colors.colSecondaryContainer
// Password
enabled: !root.context.unlockInProgress
@@ -195,6 +197,9 @@ MouseArea {
}
sourceComponent: PasswordChars {
length: root.context.currentText.length
selectionStart: passwordBox.selectionStart
selectionEnd: passwordBox.selectionEnd
cursorPosition: passwordBox.cursorPosition
}
}
}
@@ -215,7 +220,7 @@ MouseArea {
iconSize: 24
text: {
if (root.context.targetAction === LockContext.ActionEnum.Unlock) {
return root.ctrlHeld ? "emoji_food_beverage" : "arrow_right_alt";
return root.ctrlHeld ? "coffee" : "arrow_right_alt";
} else if (root.context.targetAction === LockContext.ActionEnum.Poweroff) {
return "power_settings_new";
} else if (root.context.targetAction === LockContext.ActionEnum.Reboot) {
@@ -9,29 +9,62 @@ import Quickshell
StyledFlickable {
id: root
required property int length
property int selectionStart
property int selectionEnd
property int cursorPosition
property color color: Appearance.colors.colPrimary
property color selectedTextColor: Appearance.colors.colOnSecondaryContainer
property color selectionColor: Appearance.colors.colSecondaryContainer
property int charSize: 20
contentWidth: dotsRow.implicitWidth
contentX: (Math.max(contentWidth - width, 0))
Behavior on contentX {
animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this)
}
Rectangle {
id: cursor
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: root.charSize * root.cursorPosition
}
color: root.color
implicitWidth: 2
implicitHeight: root.charSize
Behavior on anchors.leftMargin {
animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(cursor)
}
}
Row {
id: dotsRow
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
leftMargin: 4
leftMargin: 4 - 5 // -5 to account for spacing being simulated by char item width
}
spacing: 10
spacing: 0
Repeater {
model: ScriptModel {
model: ScriptModel { // TODO: use proper custom object model to insert new char at the correct pos
values: Array(root.length)
}
delegate: Item {
delegate: Rectangle {
id: charItem
required property int index
implicitWidth: 10
implicitHeight: 10
implicitWidth: root.charSize
implicitHeight: root.charSize
property bool selected: index >= root.selectionStart && index < root.selectionEnd
color: ColorUtils.transparentize(root.selectionColor, selected ? 0 : 1)
MaterialShape {
id: materialShape
anchors.centerIn: parent
@@ -46,7 +79,7 @@ StyledFlickable {
]
shape: charShapes[charItem.index % charShapes.length]
// Animate on appearance
color: Appearance.colors.colPrimary
color: charItem.selected ? root.selectedTextColor : root.color
implicitSize: 0
opacity: 0
scale: 0.5
@@ -1,15 +1,12 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import Quickshell
import qs
import qs.services
import qs.modules.common
import qs.modules.common.widgets
import qs.modules.common.functions
import Qt5Compat.GraphicalEffects
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import Quickshell.Io
import Quickshell.Hyprland
RowLayout {
id: root
@@ -92,6 +89,16 @@ RowLayout {
}
}
}
Keys.onPressed: event => {
if (event.key === Qt.Key_Tab) {
if (LauncherSearch.results.length === 0) return;
const tabbedText = LauncherSearch.results[0].name;
LauncherSearch.query = tabbedText;
searchInput.text = tabbedText;
event.accepted = true;
}
}
}
IconToolbarButton {
@@ -1,15 +1,16 @@
pragma ComponentBehavior: Bound
import Qt.labs.synchronizer
import Qt5Compat.GraphicalEffects
import QtQuick
import QtQuick.Layouts
import Quickshell
import qs
import qs.services
import qs.modules.common
import qs.modules.common.widgets
import qs.modules.common.functions
import Qt.labs.synchronizer
import Qt5Compat.GraphicalEffects
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import Quickshell.Io
Item { // Wrapper
id: root
@@ -205,12 +206,25 @@ Item { // Wrapper
}
delegate: SearchItem {
id: searchItem
// The selectable item for each search result
required property var modelData
anchors.left: parent?.left
anchors.right: parent?.right
entry: modelData
query: StringUtils.cleanOnePrefix(root.searchingText, [Config.options.search.prefix.action, Config.options.search.prefix.app, Config.options.search.prefix.clipboard, Config.options.search.prefix.emojis, Config.options.search.prefix.math, Config.options.search.prefix.shellCommand, Config.options.search.prefix.webSearch])
Keys.onPressed: event => {
if (event.key === Qt.Key_Tab) {
if (LauncherSearch.results.length === 0)
return;
const tabbedText = searchItem.modelData.name;
LauncherSearch.query = tabbedText;
searchBar.searchInput.text = tabbedText;
event.accepted = true;
root.focusSearchInput();
}
}
}
}
}
@@ -0,0 +1,112 @@
import qs.services
import qs.modules.common
import qs.modules.common.widgets
import QtQuick
Item {
id: root
property var action
property var selectionMode
property string description: switch (root.action) {
case RegionSelection.SnipAction.Copy:
case RegionSelection.SnipAction.Edit:
return Translation.tr("Copy region (LMB) or annotate (RMB)");
case RegionSelection.SnipAction.Search:
return Translation.tr("Search with Google Lens");
case RegionSelection.SnipAction.CharRecognition:
return Translation.tr("Recognize text");
case RegionSelection.SnipAction.Record:
case RegionSelection.SnipAction.RecordWithSound:
return Translation.tr("Record region");
}
property string materialSymbol: switch (root.action) {
case RegionSelection.SnipAction.Copy:
case RegionSelection.SnipAction.Edit:
return "content_cut";
case RegionSelection.SnipAction.Search:
return "image_search";
case RegionSelection.SnipAction.CharRecognition:
return "document_scanner";
case RegionSelection.SnipAction.Record:
case RegionSelection.SnipAction.RecordWithSound:
return "videocam";
default:
return "";
}
property bool showDescription: true
function hideDescription() {
root.showDescription = false
}
Timer {
id: descTimeout
interval: 1000
running: true
onTriggered: {
root.hideDescription()
}
}
onActionChanged: {
root.showDescription = true
descTimeout.restart()
}
property int margins: 8
implicitWidth: content.implicitWidth + margins * 2
implicitHeight: content.implicitHeight + margins * 2
Rectangle {
id: content
anchors.centerIn: parent
property real padding: 8
implicitHeight: 38
implicitWidth: root.showDescription ? contentRow.implicitWidth + padding * 2 : implicitHeight
clip: true
topLeftRadius: 6
bottomLeftRadius: implicitHeight - topLeftRadius
bottomRightRadius: bottomLeftRadius
topRightRadius: bottomLeftRadius
color: Appearance.colors.colPrimary
Behavior on topLeftRadius {
animation: Appearance.animation.elementMove.numberAnimation.createObject(this)
}
Behavior on implicitWidth {
animation: Appearance.animation.elementMove.numberAnimation.createObject(this)
}
Row {
id: contentRow
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: content.padding
}
spacing: 12
MaterialSymbol {
anchors.verticalCenter: parent.verticalCenter
iconSize: 22
color: Appearance.colors.colOnPrimary
animateChange: true
text: root.materialSymbol
}
FadeLoader {
id: descriptionLoader
anchors.verticalCenter: parent.verticalCenter
shown: root.showDescription
sourceComponent: StyledText {
color: Appearance.colors.colOnPrimary
text: root.description
anchors.right: parent.right
anchors.rightMargin: 6
}
}
}
}
}
@@ -23,48 +23,6 @@ Toolbar {
// Signals
signal dismiss()
MaterialShape {
Layout.fillHeight: true
Layout.leftMargin: 2
Layout.rightMargin: 2
implicitSize: 36 // Intentionally smaller because this one is brighter than others
shape: switch (root.action) {
case RegionSelection.SnipAction.Copy:
case RegionSelection.SnipAction.Edit:
return MaterialShape.Shape.Cookie4Sided;
case RegionSelection.SnipAction.Search:
return MaterialShape.Shape.Pentagon;
case RegionSelection.SnipAction.CharRecognition:
return MaterialShape.Shape.Sunny;
case RegionSelection.SnipAction.Record:
case RegionSelection.SnipAction.RecordWithSound:
return MaterialShape.Shape.Gem;
default:
return MaterialShape.Shape.Cookie12Sided;
}
color: Appearance.colors.colPrimary
MaterialSymbol {
anchors.centerIn: parent
iconSize: 22
color: Appearance.colors.colOnPrimary
animateChange: true
text: switch (root.action) {
case RegionSelection.SnipAction.Copy:
case RegionSelection.SnipAction.Edit:
return "content_cut";
case RegionSelection.SnipAction.Search:
return "image_search";
case RegionSelection.SnipAction.CharRecognition:
return "document_scanner";
case RegionSelection.SnipAction.Record:
case RegionSelection.SnipAction.RecordWithSound:
return "videocam";
default:
return "";
}
}
}
ToolbarTabBar {
id: tabBar
tabButtonList: [
@@ -76,5 +34,4 @@ Toolbar {
root.selectionMode = currentIndex === 0 ? RegionSelection.SelectionMode.RectCorners : RegionSelection.SelectionMode.Circle;
}
}
}
@@ -33,22 +33,40 @@ Item {
}
// Selection border
Rectangle {
// Rectangle {
// id: selectionBorder
// z: 1
// anchors {
// left: parent.left
// top: parent.top
// leftMargin: root.regionX
// topMargin: root.regionY
// }
// width: root.regionWidth
// height: root.regionHeight
// color: "transparent"
// border.color: root.color
// border.width: 2
// // radius: root.standardRounding
// radius: 0 // TODO: figure out how to make the overlay thing work with rounding
// }
DashedBorder {
id: selectionBorder
z: 1
z: 9
anchors {
left: parent.left
top: parent.top
leftMargin: root.regionX
topMargin: root.regionY
leftMargin: Math.round(root.regionX) - borderWidth
topMargin: Math.round(root.regionY) - borderWidth
}
width: root.regionWidth
height: root.regionHeight
color: "transparent"
border.color: root.color
border.width: 2
// radius: root.standardRounding
radius: 0 // TODO: figure out how to make the overlay thing work with rounding
width: Math.round(root.regionWidth) + borderWidth * 2
height: Math.round(root.regionHeight) + borderWidth * 2
color: root.color
dashLength: 6
gapLength: 3
borderWidth: 1
}
StyledText {
@@ -35,7 +35,7 @@ PanelWindow {
signal dismiss()
property string screenshotDir: Directories.screenshotTemp
property color overlayColor: "#88111111"
property color overlayColor: ColorUtils.transparentize("#000000", 0.4)
property color brightText: Appearance.m3colors.darkmode ? Appearance.colors.colOnLayer0 : Appearance.colors.colLayer0
property color brightSecondary: Appearance.m3colors.darkmode ? Appearance.colors.colSecondary : Appearance.colors.colOnSecondary
property color brightTertiary: Appearance.m3colors.darkmode ? Appearance.colors.colTertiary : Qt.lighter(Appearance.colors.colPrimary)
@@ -375,6 +375,14 @@ PanelWindow {
}
}
CursorGuide {
z: 9999
x: root.dragging ? root.regionX + root.regionWidth : mouseArea.mouseX
y: root.dragging ? root.regionY + root.regionHeight : mouseArea.mouseY
action: root.action
selectionMode: root.selectionMode
}
// Window regions
Repeater {
model: ScriptModel {
@@ -447,7 +455,7 @@ PanelWindow {
// Controls
Row {
id: regionSelectionControls
z: 9999
z: 10
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
@@ -48,6 +48,7 @@ Item {
spacing: sidebarPadding
Toolbar {
visible: tabButtonList.length > 0
Layout.alignment: Qt.AlignHCenter
enableShadow: false
ToolbarTabBar {
@@ -83,9 +84,10 @@ Item {
}
contentChildren: [
...((root.aiChatEnabled || (!root.translatorEnabled && !root.animeEnabled)) ? [aiChat.createObject()] : []),
...(root.aiChatEnabled ? [aiChat.createObject()] : []),
...(root.translatorEnabled ? [translator.createObject()] : []),
...(root.animeEnabled ? [anime.createObject()] : [])
...((root.tabButtonList.length === 0 || (!root.aiChatEnabled && !root.translatorEnabled && root.animeCloset)) ? [placeholder.createObject()] : []),
...(root.animeEnabled ? [anime.createObject()] : []),
]
}
}
@@ -102,6 +104,15 @@ Item {
id: anime
Anime {}
}
Component {
id: placeholder
Item {
StyledText {
anchors.centerIn: parent
text: root.animeCloset ? Translation.tr("Nothing") : Translation.tr("Enjoy your empty sidebar...")
color: Appearance.colors.colSubtext
}
}
}
}
}
@@ -138,7 +138,7 @@ Rectangle {
anchors.fill: parent
// implicitHeight: tabStack.implicitHeight
spacing: 10
spacing: 20
// Navigation rail
Item {
@@ -146,7 +146,7 @@ Rectangle {
Layout.fillWidth: false
Layout.leftMargin: 10
Layout.topMargin: 10
width: tabBar.width
implicitWidth: tabBar.implicitWidth
// Navigation rail buttons
NavigationRailTabArray {
id: tabBar
@@ -73,7 +73,7 @@ MouseArea {
target: Wallpapers
function onThumbnailGenerated(directory) {
if (thumbnailImage.status !== Image.Error) return;
if (FileUtils.parentDirectory(thumbnailImage.sourcePath) !== directory) return;
if (FileUtils.parentDirectory(thumbnailImage.sourcePath) !== FileUtils.trimFileProtocol(directory)) return;
thumbnailImage.source = "";
thumbnailImage.source = thumbnailImage.thumbnailPath;
}
@@ -141,7 +141,7 @@ ContentPage {
key: "Ctrl"
}
KeyboardKey {
key: "󰖳"
key: Config.options.cheatsheet.superKey ?? "󰖳"
}
StyledText {
Layout.alignment: Qt.AlignVCenter