diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-07-20 14:42:09 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-07-20 14:42:09 +1000 |
| commit | e00d5b124f3028ed134abe240404a85a5c4caace (patch) | |
| tree | c49a1f8078ea7414fec4135807317420a10aa99a | |
| parent | filedialog: add nav rail (diff) | |
| download | caelestia-shell-e00d5b124f3028ed134abe240404a85a5c4caace.tar.gz caelestia-shell-e00d5b124f3028ed134abe240404a85a5c4caace.tar.bz2 caelestia-shell-e00d5b124f3028ed134abe240404a85a5c4caace.zip | |
filedialog: add special icons for xdg dirs
| -rw-r--r-- | widgets/filedialog/FileDialog.qml | 2 | ||||
| -rw-r--r-- | widgets/filedialog/FolderContents.qml | 34 | ||||
| -rw-r--r-- | widgets/filedialog/Sidebar.qml | 3 | ||||
| -rw-r--r-- | widgets/filedialog/Sizes.qml | 2 |
4 files changed, 29 insertions, 12 deletions
diff --git a/widgets/filedialog/FileDialog.qml b/widgets/filedialog/FileDialog.qml index 53f1b57..85103c7 100644 --- a/widgets/filedialog/FileDialog.qml +++ b/widgets/filedialog/FileDialog.qml @@ -15,6 +15,8 @@ FloatingWindow { implicitHeight: 600 color: Colours.palette.m3surface + onAccepted: visible = false + RowLayout { anchors.fill: parent diff --git a/widgets/filedialog/FolderContents.qml b/widgets/filedialog/FolderContents.qml index b5d2c5a..bc4d6dc 100644 --- a/widgets/filedialog/FolderContents.qml +++ b/widgets/filedialog/FolderContents.qml @@ -56,7 +56,16 @@ Item { clip: true focus: true currentIndex: -1 - Keys.onEscapePressed: view.currentIndex = -1 + Keys.onEscapePressed: currentIndex = -1 + + Keys.onReturnPressed: { + if (currentItem) + root.dialog.accepted(currentItem.filePath); + } + Keys.onEnterPressed: { + if (currentItem) + root.dialog.accepted(currentItem.filePath); + } model: FolderListModel { showDirsFirst: true @@ -87,13 +96,11 @@ Item { implicitHeight: nonAnimHeight radius: Appearance.rounding.normal - color: view.currentItem === item ? Colours.palette.m3primary : "transparent" - z: view.currentItem === item || implicitHeight !== nonAnimHeight ? 1 : 0 + color: GridView.isCurrentItem ? Colours.palette.m3surfaceContainerHighest : "transparent" + z: GridView.isCurrentItem || implicitHeight !== nonAnimHeight ? 1 : 0 clip: true StateLayer { - color: view.currentItem === item ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface - onDoubleClicked: { if (item.fileIsDir) root.dialog.cwd.push(item.fileName); @@ -115,7 +122,17 @@ Item { asynchronous: true implicitSize: Sizes.itemWidth - Appearance.padding.normal * 2 - source: Quickshell.iconPath(item.fileIsDir ? "inode-directory" : "application-x-zerosize") + source: { + if (!item.fileIsDir) + return Quickshell.iconPath("application-x-zerosize"); + + const name = item.fileName; + if (root.dialog.cwd.length === 1 && ["Desktop", "Documents", "Downloads", "Music", "Pictures", "Public", "Templates", "Videos"].includes(name)) + return Quickshell.iconPath(`folder-${name.toLowerCase()}`); + + return Quickshell.iconPath("inode-directory"); + } + onStatusChanged: { if (status === Image.Error) source = Quickshell.iconPath("error"); @@ -144,9 +161,8 @@ Item { horizontalAlignment: Text.AlignHCenter text: item.fileName - color: view.currentItem === item ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface - elide: view.currentItem === item ? Text.ElideNone : Text.ElideRight - wrapMode: view.currentItem === item ? Text.WrapAtWordBoundaryOrAnywhere : Text.NoWrap + elide: item.GridView.isCurrentItem ? Text.ElideNone : Text.ElideRight + wrapMode: item.GridView.isCurrentItem ? Text.WrapAtWordBoundaryOrAnywhere : Text.NoWrap } Behavior on implicitHeight { diff --git a/widgets/filedialog/Sidebar.qml b/widgets/filedialog/Sidebar.qml index f0bcc58..523ad83 100644 --- a/widgets/filedialog/Sidebar.qml +++ b/widgets/filedialog/Sidebar.qml @@ -46,8 +46,7 @@ StyledRect { required property string modelData readonly property bool selected: modelData === root.dialog.cwd[root.dialog.cwd.length - 1] - anchors.left: parent.left - anchors.right: parent.right + Layout.fillWidth: true implicitHeight: placeInner.implicitHeight + Appearance.padding.normal * 2 radius: Appearance.rounding.full diff --git a/widgets/filedialog/Sizes.qml b/widgets/filedialog/Sizes.qml index c8cacba..2ad31f9 100644 --- a/widgets/filedialog/Sizes.qml +++ b/widgets/filedialog/Sizes.qml @@ -3,6 +3,6 @@ pragma Singleton import Quickshell Singleton { - property int itemWidth: 100 + property int itemWidth: 103 property int sidebarWidth: 200 } |