forked from Shinonome/dots-hyprland
wallpaper selector: fix dark mode
This commit is contained in:
@@ -16,10 +16,9 @@ Image {
|
|||||||
if (!fileModelData.fileIsDir)
|
if (!fileModelData.fileIsDir)
|
||||||
return Quickshell.iconPath("application-x-zerosize");
|
return Quickshell.iconPath("application-x-zerosize");
|
||||||
|
|
||||||
const name = fileModelData.fileName;
|
|
||||||
const homeDir = Directories.home
|
const homeDir = Directories.home
|
||||||
if ([Directories.documents, Directories.downloads, Directories.music, Directories.pictures, Directories.videos].includes(name))
|
if ([Directories.documents, Directories.downloads, Directories.music, Directories.pictures, Directories.videos].includes(fileModelData.filePath))
|
||||||
return Quickshell.iconPath(`folder-${name.toLowerCase()}`);
|
return Quickshell.iconPath(`folder-${fileModelData.fileName.toLowerCase()}`);
|
||||||
|
|
||||||
return Quickshell.iconPath("inode-directory");
|
return Quickshell.iconPath("inode-directory");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ Item {
|
|||||||
property bool useThumbnail: Images.isValidImageByName(fileModelData.fileName)
|
property bool useThumbnail: Images.isValidImageByName(fileModelData.fileName)
|
||||||
property bool isHovered: false
|
property bool isHovered: false
|
||||||
|
|
||||||
property alias color: background.color
|
property alias colBackground: background.color
|
||||||
|
property alias colText: wallpaperItemName.color
|
||||||
property alias radius: background.radius
|
property alias radius: background.radius
|
||||||
property alias padding: background.anchors.margins
|
property alias padding: background.anchors.margins
|
||||||
|
|
||||||
@@ -122,7 +123,6 @@ Item {
|
|||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font.pixelSize: Appearance.font.pixelSize.smaller
|
font.pixelSize: Appearance.font.pixelSize.smaller
|
||||||
color: (index === grid.currentIndex || parent.isHovered) ? Appearance.colors.colOnPrimary : Appearance.colors.colOnLayer0
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
animation: Appearance.animation.elementMoveFast.colorAnimation.createObject(this)
|
animation: Appearance.animation.elementMoveFast.colorAnimation.createObject(this)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,46 +116,14 @@ Item {
|
|||||||
implicitWidth: 140
|
implicitWidth: 140
|
||||||
clip: true
|
clip: true
|
||||||
model: [
|
model: [
|
||||||
{
|
{ icon: "home", name: "Home", path: Directories.home },
|
||||||
icon: "home",
|
{ icon: "docs", name: "Documents", path: Directories.documents },
|
||||||
name: "Home",
|
{ icon: "download", name: "Downloads", path: Directories.downloads },
|
||||||
path: Directories.home
|
{ icon: "image", name: "Pictures", path: Directories.pictures },
|
||||||
},
|
{ icon: "movie", name: "Videos", path: Directories.videos },
|
||||||
{
|
{ icon: "", name: "---", path: "INTENTIONALLY_INVALID_DIR" },
|
||||||
icon: "folder",
|
{ icon: "wallpaper", name: "Wallpapers", path: `${Directories.pictures}/Wallpapers` },
|
||||||
name: "Documents",
|
{ icon: "favorite", name: "Homework", path: `${Directories.pictures}/homework` },
|
||||||
path: Directories.documents
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: "download",
|
|
||||||
name: "Downloads",
|
|
||||||
path: Directories.downloads
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: "image",
|
|
||||||
name: "Pictures",
|
|
||||||
path: Directories.pictures
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: "movie",
|
|
||||||
name: "Videos",
|
|
||||||
path: Directories.videos
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: "",
|
|
||||||
name: "---",
|
|
||||||
path: "INTENTIONALLY_INVALID_DIR"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: "wallpaper",
|
|
||||||
name: "Wallpapers",
|
|
||||||
path: `${Directories.pictures}/Wallpapers`
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: "favorite",
|
|
||||||
name: "Homework",
|
|
||||||
path: `${Directories.pictures}/homework`
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
delegate: RippleButton {
|
delegate: RippleButton {
|
||||||
id: quickDirButton
|
id: quickDirButton
|
||||||
@@ -266,7 +234,8 @@ Item {
|
|||||||
fileModelData: modelData
|
fileModelData: modelData
|
||||||
width: grid.cellWidth
|
width: grid.cellWidth
|
||||||
height: grid.cellHeight
|
height: grid.cellHeight
|
||||||
color: (index === grid?.currentIndex || parent?.isHovered) ? Appearance.colors.colPrimary : ColorUtils.transparentize(Appearance.colors.colPrimary)
|
colBackground: (index === grid?.currentIndex || parent?.isHovered) ? Appearance.colors.colPrimaryContainer : ColorUtils.transparentize(Appearance.colors.colPrimaryContainer)
|
||||||
|
colText: (index === grid.currentIndex || parent.isHovered) ? Appearance.colors.colPrimary : Appearance.colors.colOnLayer0
|
||||||
onActivated: {
|
onActivated: {
|
||||||
Wallpapers.select(fileModelData.filePath, root.useDarkMode);
|
Wallpapers.select(fileModelData.filePath, root.useDarkMode);
|
||||||
|
|
||||||
@@ -314,7 +283,7 @@ Item {
|
|||||||
implicitWidth: height
|
implicitWidth: height
|
||||||
buttonRadius: Appearance.rounding.full
|
buttonRadius: Appearance.rounding.full
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Wallpapers.openFallbackPicker();
|
Wallpapers.openFallbackPicker(root.useDarkMode);
|
||||||
GlobalStates.wallpaperSelectorOpen = false;
|
GlobalStates.wallpaperSelectorOpen = false;
|
||||||
}
|
}
|
||||||
contentItem: MaterialSymbol {
|
contentItem: MaterialSymbol {
|
||||||
@@ -370,12 +339,10 @@ Item {
|
|||||||
// No filtering, just navigate grid
|
// No filtering, just navigate grid
|
||||||
if (event.key === Qt.Key_Down) {
|
if (event.key === Qt.Key_Down) {
|
||||||
grid.moveSelection(grid.columns);
|
grid.moveSelection(grid.columns);
|
||||||
wallpaperGrid.forceActiveFocus();
|
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
}
|
}
|
||||||
if (event.key === Qt.Key_Up) {
|
if (event.key === Qt.Key_Up) {
|
||||||
grid.moveSelection(-grid.columns);
|
grid.moveSelection(-grid.columns);
|
||||||
wallpaperGrid.forceActiveFocus();
|
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,11 @@ Singleton {
|
|||||||
id: applyProc
|
id: applyProc
|
||||||
}
|
}
|
||||||
|
|
||||||
function openFallbackPicker() {
|
function openFallbackPicker(darkMode = Appearance.m3colors.darkmode) {
|
||||||
applyProc.exec([Directories.wallpaperSwitchScriptPath])
|
applyProc.exec([
|
||||||
|
Directories.wallpaperSwitchScriptPath,
|
||||||
|
"--mode", (darkMode ? "dark" : "light")
|
||||||
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
function apply(path, darkMode = Appearance.m3colors.darkmode) {
|
function apply(path, darkMode = Appearance.m3colors.darkmode) {
|
||||||
@@ -62,7 +65,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function select(filePath, darkMode = Appearance.m3colors.darkmode) {
|
function select(filePath, darkMode = Appearance.m3colors.darkmode) {
|
||||||
selectProc.select(filePath);
|
selectProc.select(filePath, darkMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
|
|||||||
Reference in New Issue
Block a user