feat: better file dialog
This commit is contained in:
parent
f6a5836a89
commit
3ecc0267fa
2 changed files with 10 additions and 10 deletions
|
|
@ -1,11 +1,11 @@
|
||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import qs.widgets
|
import qs.widgets
|
||||||
|
import qs.widgets.filedialog
|
||||||
import qs.services
|
import qs.services
|
||||||
import qs.config
|
import qs.config
|
||||||
import qs.utils
|
import qs.utils
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Dialogs
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
@ -65,9 +65,9 @@ Item {
|
||||||
id: dialog
|
id: dialog
|
||||||
|
|
||||||
title: qsTr("Select a wallpaper")
|
title: qsTr("Select a wallpaper")
|
||||||
acceptLabel: qsTr("Select")
|
filterLabel: qsTr("Image files")
|
||||||
nameFilters: [`Image files (${Wallpapers.extensions.map(e => `*.${e}`).join(" ")})`]
|
filters: Wallpapers.extensions
|
||||||
onAccepted: Wallpapers.setWallpaper(Paths.strip(selectedFile))
|
onAccepted: path => Wallpapers.setWallpaper(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import qs.widgets.filedialog
|
||||||
import qs.services
|
import qs.services
|
||||||
import qs.config
|
import qs.config
|
||||||
import qs.utils
|
import qs.utils
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Dialogs
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
@ -16,11 +16,11 @@ Item {
|
||||||
|
|
||||||
readonly property FileDialog facePicker: FileDialog {
|
readonly property FileDialog facePicker: FileDialog {
|
||||||
title: qsTr("Select a profile picture")
|
title: qsTr("Select a profile picture")
|
||||||
acceptLabel: qsTr("Select")
|
filterLabel: qsTr("Image files")
|
||||||
nameFilters: [`Image files (${Wallpapers.extensions.map(e => `*.${e}`).join(" ")})`]
|
filters: Wallpapers.extensions
|
||||||
onAccepted: {
|
onAccepted: path => {
|
||||||
Paths.copy(selectedFile, `${Paths.home}/.face`);
|
Paths.copy(path, `${Paths.home}/.face`);
|
||||||
Quickshell.execDetached(["notify-send", "-a", "caelestia-shell", "-u", "low", "-h", `STRING:image-path:${Paths.strip(selectedFile)}`, "Profile picture changed", `Profile picture changed to ${Paths.shortenHome(Paths.strip(selectedFile))}`]);
|
Quickshell.execDetached(["notify-send", "-a", "caelestia-shell", "-u", "low", "-h", `STRING:image-path:${path}`, "Profile picture changed", `Profile picture changed to ${Paths.shortenHome(path)}`]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue