Show wallpapers as a justified gallery in the picker drawer

Back to the drawer picker, now with justified rows: each thumbnail keeps
its aspect ratio (read from the file header by the scan) and every row
fills the width. Arrows move in two dimensions, click or Enter applies,
✦ marks outline wallpapers. Drops the full-screen preview picker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mxandClaude Opus 5.5 committed 2026-11-08 22:57:08 +01:00
1 parent 2a41cde6f5
commit ebace10767
7 files changed
+205 -243

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@ Open Settings → Wallpaper → Open wallpaper picker, or run:
./scripts/glassmxrph wallpaper
```
The picker covers the screen with a live preview of the selected wallpaper and a grid of thumbnails on a frosted sheet. Selecting a wallpaper (click or arrow keys) plays the real transition to it in the preview; Enter or double-click applies it, and the desktop under the preview switches directly while other outputs play the transition. Space hides the sheet to look at the preview alone, typing searches, and Escape closes without changing anything. ✦ marks wallpapers whose subject outline is drawn first. History records the last 50 selections.
The picker drawer shows the wallpapers as a justified gallery: every thumbnail keeps its own aspect ratio and each row fills the width. Search local images, select an output, browse with the arrow keys and apply with Enter or a click. ✦ marks wallpapers whose subject outline is drawn first when changing to them. History records the last 50 selections. Escape or an outside click closes it.
Configure image directories in Wallpaper settings; the default search directory is ~/Pictures/Wallpapers. Select the Native backend when replacing Serpantinum. New configurations default to Native; existing explicit backend preferences are preserved.
+37 -1
View File
@@ -92,6 +92,41 @@ def apply(req):
else:raise ValueError('No active wallpaper provider')
return {'backend':backend,'path':str(path),'providerPath':str(path)}
def image_size(path):
"""(width, height) from the file header, or None. Standard library only:
the picker lays thumbnails out by aspect ratio before any is decoded."""
import struct
try:
with open(path,'rb') as f:
head=f.read(32)
if head[:8]==b'\x89PNG\r\n\x1a\n':
return struct.unpack('>II',head[16:24])
if head[:2]==b'BM':
w,h=struct.unpack('<ii',head[18:26]);return (abs(w),abs(h))
if head[:4]==b'RIFF' and head[8:12]==b'WEBP':
kind=head[12:16]
if kind==b'VP8 ':
w,h=struct.unpack('<HH',head[26:30]);return (w&0x3fff,h&0x3fff)
if kind==b'VP8L':
b=head[21:25];return (1+(((b[1]&0x3f)<<8)|b[0]),1+(((b[3]&0xf)<<10)|(b[2]<<2)|((b[1]&0xc0)>>6)))
if kind==b'VP8X':
return (1+int.from_bytes(head[24:27],'little'),1+int.from_bytes(head[27:30],'little'))
return None
if head[:2]==b'\xff\xd8':
f.seek(2)
while True:
marker=f.read(2)
if len(marker)<2 or marker[0]!=0xff:return None
while marker[1]==0xff:marker=marker[:1]+f.read(1)
if marker[1] in (0xd8,0x01) or 0xd0<=marker[1]<=0xd7:continue
length=struct.unpack('>H',f.read(2))[0]
if marker[1] in (0xc0,0xc1,0xc2,0xc3,0xc5,0xc6,0xc7,0xc9,0xca,0xcb,0xcd,0xce,0xcf):
h,w=struct.unpack('>xHH',f.read(5));return (w,h)
f.seek(length-2,1)
except (OSError,struct.error):
return None
return None
def scan(req):
found={};errors=[]
for directory in (req.get('directories') or [str(Path.home()/'Pictures/Wallpapers')]):
@@ -99,7 +134,8 @@ def scan(req):
try:
for entry in base.iterdir():
if entry.is_file() and entry.suffix.lower() in IMAGES:
resolved=entry.resolve();found[str(resolved)]={'path':str(resolved),'url':resolved.as_uri(),'name':entry.name}
resolved=entry.resolve();size=image_size(resolved)
found[str(resolved)]={'path':str(resolved),'url':resolved.as_uri(),'name':entry.name,'width':size[0] if size else 0,'height':size[1] if size else 0}
if len(found)>=1000:break
except OSError as error:errors.append(str(error))
if len(found)>=1000:break
+1 -8
View File
@@ -48,18 +48,11 @@ Singleton {
next[output] = path;
observed = next;
}
// Output -> path that switches without a change, because the picker's live
// preview already shows it there (see WallpaperBackground).
property var instant: ({})
function apply(path, instantOutput) {
function apply(path) {
const outputs = selectedMonitor === "all" ? Quickshell.screens.map(s => s.name) : [monitor];
if (!ConfigService.ready || !ConfigService.writable || !outputs.length || !outputs[0] || busy)
return false;
error = "";
const nextInstant = {};
if (instantOutput)
nextInstant[instantOutput] = path;
instant = nextInstant;
prepareTransition(path);
// Native rendering needs no provider round trip: decode once, then switch
// every output in one write so their transitions start together.
+3 -5
View File
@@ -116,11 +116,9 @@ Item {
}
function pickerQuery(text: string): void {input.findChild(ShellState.wallpaperWindow.contentItem,"wallpaperSearch").text=text;}
function pickerSelect(index: int): bool {
const view=input.findChild(ShellState.wallpaperWindow.contentItem,"wallpaperGrid");
view.positionViewAtIndex(index,GridView.Contain);input.wait(50);
const item=view.itemAtIndex(index);if(!item)return false;
// Click previews; double-click applies.
input.mouseDoubleClickSequence(item,item.width/2,item.height/2);return true;
ShellState.wallpaperWindow.tileAt(index);input.wait(50);
const item=ShellState.wallpaperWindow.tileAt(index);if(!item)return false;
input.mouseClick(item,item.width/2,item.height/2);return true;
}
function pickerScreenshot(path: string): bool {return input.findChild(ShellState.wallpaperWindow.contentItem,"wallpaperPickerSurface").grabToImage(result=>result.saveToFile(path));}
function geometry(name: string): string {
+2 -5
View File
@@ -4,7 +4,7 @@ import "../services"
import "../theme"
// A full-size wallpaper that changes with shaders/transition.frag: colonies, or
// the new wallpaper's subject outline when helpers/wallfx.py has its maps.
// The desktop background and the picker's live preview both draw with it.
// One per output (WallpaperBackground).
Item {
id: root
// The wallpaper to show. Changing it starts a change once the new image
@@ -13,8 +13,6 @@ Item {
// false: a change starts as soon as it is ready. true: it emits ready()
// and waits for go(), so several outputs can start together.
property bool waitForGo: false
// Show the next path directly, without a change (consumed by that change).
property bool instantNext: false
signal loading()
signal ready()
// 0..1 while the new wallpaper takes over.
@@ -25,8 +23,7 @@ Item {
// The first wallpaper (and reduced motion) appears directly; later changes
// load into `incoming` and are revealed once decoded.
onTargetChanged: {
if (!shown.source.toString() || Theme.duration === 0 || instantNext) {
instantNext = false;
if (!shown.source.toString() || Theme.duration === 0) {
reveal.stop(); progress = 0; incoming.source = ""; shown.source = target;
return;
}
+1 -6
View File
@@ -24,12 +24,7 @@ PanelWindow {
onLoading:WallpaperService.revealLoading(root.modelData.name)
onReady:WallpaperService.revealReady(root.modelData.name)
}
// The picker's live preview already shows the wallpaper it applies on its
// own output, so that output switches directly underneath it.
onTargetPathChanged:{
stage.instantNext=WallpaperService.instant[root.modelData.name]===targetPath;
stage.path=targetPath;
}
onTargetPathChanged:stage.path=targetPath
Component.onCompleted:stage.path=targetPath
Connections {
target:WallpaperService
+160 -217
View File
@@ -10,290 +10,233 @@ import "../services"
import "../core"
import "../theme"
// qmllint disable uncreatable-type
// Full-screen wallpaper picker. The whole screen is a live preview: moving the
// selection plays the real change (TransitionStage) to that wallpaper, and the
// grid sits on a frosted sheet over it. Enter applies (the desktop under the
// preview switches directly, see WallpaperBackground), Esc leaves everything as
// it was, Space hides the sheet to look at the preview alone.
PanelWindow {
id:root
screen:ScreenService.current(ShellState.wallpaperScreen)
anchors {top:true;bottom:true;left:true;right:true}
readonly property string screenName:screen ? screen.name : ""
readonly property bool open:ShellState.wallpaperPickerOpen
visible:open || content.opacity>0
// Hangs from the middle of the bar as a drawer; the layer starts at the
// screen top so the bar join is inside its box.
anchors {top:true}
readonly property real screenWidth:screen ? screen.width : 1920
readonly property real screenHeight:screen ? screen.height : 1080
implicitWidth:Math.round(surface.width)
implicitHeight:Math.round(BarDrawers.bottom+surface.contentHeight)
visible:ShellState.wallpaperPickerOpen || surface.shown
color:Theme.transparent
exclusionMode:ExclusionMode.Ignore
WlrLayershell.namespace:"glassMxrph-wallpaper-picker"
WlrLayershell.layer:WlrLayer.Overlay
WlrLayershell.keyboardFocus:open ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
WlrLayershell.keyboardFocus:ShellState.wallpaperPickerOpen ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
Component.onCompleted:ShellState.wallpaperWindow=root
Component.onDestruction:ShellState.wallpaperWindow=null
property string filter:"all"
readonly property var results:WallpaperService.images.filter(i=>(filter!=="history" || ConfigService.data.wallpaper.history.includes(i.path)) && (!search.text || i.name.toLowerCase().includes(search.text.toLowerCase())))
// The selection lives here, not in the view: a rescan or a new search
// replaces the model, and the view would fall back to the first tile.
property string selectedPath:""
readonly property var selected:results.find(i=>i.path===selectedPath) || null
property bool peek:false
property string applying:""
readonly property string desktopPath:ConfigService.ready ? (ConfigService.data.wallpaper.byMonitor[root.screenName] || WallpaperService.currentPath) : ""
// Justified rows, as in a photo gallery: every thumbnail keeps its own
// aspect ratio (from the scan's header sizes) and each row is scaled so it
// fills the width exactly. The last row keeps the target height.
readonly property real rowTarget:170
readonly property real gap:10
readonly property var rows:layoutRows(results,view.width)
function aspectOf(image) {
const a=image.width>0 && image.height>0 ? image.width/image.height : 16/9;
return Math.max(0.5,Math.min(3,a)); // keep panoramas and slivers usable
}
function layoutRows(images,width) {
const out=[];
if(width<=0)return out;
let row=[],sum=0;
const close=height=>{
let x=0;
out.push({height:height,tiles:row.map(t=>{const w=t.aspect*height;const tile={index:t.index,x:x,width:w};x+=w+root.gap;return tile;})});
row=[];sum=0;
};
images.forEach((image,index)=>{
const aspect=aspectOf(image);
row.push({index:index,aspect:aspect});sum+=aspect;
if(sum*rowTarget+gap*(row.length-1)>=width)close((width-gap*(row.length-1))/sum);
});
if(row.length)close(rowTarget);
return out;
}
// Where each result sits: its row, and its horizontal centre for up/down.
readonly property var places:{
const p=[];
rows.forEach((row,r)=>row.tiles.forEach(t=>p[t.index]={row:r,center:t.x+t.width/2}));
return p;
}
property int current:0
onResultsChanged:if(current>=results.length)current=Math.max(0,results.length-1)
function select(index) {
if(index<0 || index>=results.length)return;
view.currentIndex=index;
selectedPath=results[index].path;
current=index;
if(places[index])view.positionViewAtIndex(places[index].row,ListView.Contain);
}
// Puts the view back on the selection after its model was replaced. The
// selection only changes on input (select/step), never from the view.
property bool centerOnSync:false
function syncSelection() {
const index=results.findIndex(i=>i.path===selectedPath);
view.currentIndex=index;
if(index>=0 && centerOnSync) {view.positionViewAtIndex(index,GridView.Center);centerOnSync=false;}
// Up/down: the tile in the next row whose centre is closest.
function vertical(direction) {
const here=places[current];
if(!here)return select(0);
const row=rows[here.row+direction];
if(!row)return;
let best=row.tiles[0];
for(const t of row.tiles)if(Math.abs(t.x+t.width/2-here.center)<Math.abs(best.x+best.width/2-here.center))best=t;
select(best.index);
}
// Arrow keys: move in the grid; from no selection, start at the first tile.
function step(move) {
if(!results.length)return;
if(view.currentIndex<0)view.currentIndex=0;
else move();
selectedPath=results[view.currentIndex].path;
function applyCurrent() {if(root.results[current])WallpaperService.apply(root.results[current].path);}
// For the test driver: the thumbnail item of a result, scrolled into view.
function tileAt(index) {
const place=places[index];
if(!place)return null;
view.positionViewAtIndex(place.row,ListView.Contain);
const row=view.itemAtIndex(place.row);
return row ? row.tileAt(index) : null;
}
// A search that hides the selection selects its first match.
Connections {
target:search
function onTextChanged() {if(search.text && !root.selected && root.results.length)root.select(0);}
}
onResultsChanged:Qt.callLater(syncSelection)
// Previews follow the selection once it rests, so sweeping across the grid
// does not start a change per tile.
onSelectedPathChanged:previewDelay.restart()
Timer {id:previewDelay;interval:200;onTriggered:if(root.open && root.selectedPath)preview.path=root.selectedPath}
function applySelected() {
if(!selectedPath || applying)return;
// Enter before the preview caught up: show it directly, the desktop is about to.
if(preview.path!==selectedPath) {previewDelay.stop();preview.instantNext=true;preview.path=selectedPath;}
if(WallpaperService.apply(selectedPath,root.screenName)) {applying=selectedPath;applyGuard.restart();}
}
// Close once this output's desktop shows the applied wallpaper (a moment to
// decode it), or after a while regardless.
readonly property bool applied:applying!=="" && desktopPath===applying
onAppliedChanged:if(applied)closeDelay.restart()
Timer {id:closeDelay;interval:150;onTriggered:root.close()}
Timer {id:applyGuard;interval:1500;onTriggered:if(root.applying)root.close()}
function close() {applying="";ShellState.wallpaperPickerOpen=false;}
onOpenChanged:{
if(open) {
applying="";peek=false;
target:ShellState
function onWallpaperPickerOpenChanged() {
if(ShellState.wallpaperPickerOpen) {
WallpaperService.refresh();WallpaperService.scan();
preview.instantNext=true;
preview.path=desktopPath;
selectedPath=desktopPath;
centerOnSync=true;
syncSelection();
const at=root.results.findIndex(i=>i.path===WallpaperService.currentPath);
if(at>=0)root.select(at);
Qt.callLater(()=>view.forceActiveFocus());
}
}
Item {
id:content
}
// Exclusive focus routes outside clicks here (see ControlCenter).
MouseArea {x:-20000;y:-20000;width:40000;height:40000;onPressed:ShellState.wallpaperPickerOpen=false}
BarDrawer {
id:surface
objectName:"wallpaperPickerSurface"
anchors.fill:parent
opacity:root.open ? 1 : 0
Behavior on opacity {NumberAnimation {duration:Theme.duration*1.2;easing.type:Easing.OutCubic}}
// Release the preview's textures once fully closed.
onOpacityChanged:if(opacity===0 && !root.open)preview.path=""
TransitionStage {
id:preview
anchors.fill:parent
}
MouseArea {anchors.fill:parent;onClicked:root.peek=!root.peek}
// Name and transition of the selection, over the preview.
ColumnLayout {
id:info
x:56;y:48
spacing:6
opacity:root.selected ? 1 : 0
Behavior on opacity {NumberAnimation {duration:Theme.duration}}
layer.enabled:true
layer.effect:MultiEffect {shadowEnabled:true;shadowBlur:0.8;shadowOpacity:0.7;shadowColor:"black";autoPaddingEnabled:true}
Text {
text:root.selected ? root.selected.name.replace(/\.[^.]+$/,"") : ""
color:"white";font.pixelSize:34;font.weight:Font.DemiBold
}
Text {
readonly property string status:root.selected ? (WallpaperService.outlineStatus[root.selected.path] || "") : ""
text:(status==="outline" ? "✦ Outline transition" : status==="pending" ? "Preparing outline…" : "Colonies transition")
+" · "+(view.currentIndex+1)+" / "+root.results.length
+(root.selected && root.selected.path===root.desktopPath ? " · current" : "")
color:Qt.alpha("white",0.85);font.pixelSize:15
}
}
// Frosted sheet: a blurred copy of the preview behind it, so the glass
// shows the wallpaper being previewed (the compositor's blur would show
// what is under this window instead).
Item {
id:sheet
width:parent.width-96
height:Math.min(540,Math.round(parent.height*0.46))
x:48
y:root.peek || !root.open ? parent.height+16 : parent.height-height-36
Behavior on y {NumberAnimation {duration:Theme.duration*1.4;easing.type:Easing.OutCubic}}
ShaderEffectSource {
id:sheetBackdrop
sourceItem:preview
sourceRect:Qt.rect(sheet.x,sheet.y,sheet.width,sheet.height)
visible:false
}
Item {
id:sheetMask
anchors.fill:parent
visible:false
layer.enabled:true
Rectangle {anchors.fill:parent;radius:28}
}
MultiEffect {
anchors.fill:parent
source:sheetBackdrop
autoPaddingEnabled:false
blurEnabled:true;blur:1;blurMax:64
saturation:-0.1;brightness:-0.08
maskEnabled:true;maskSource:sheetMask
maskThresholdMin:0.5;maskSpreadAtMin:1
}
Rectangle {anchors.fill:parent;radius:28;color:Qt.alpha(Theme.tint,0.38);border.width:1;border.color:Theme.border}
y:BarDrawers.bottom
open:ShellState.wallpaperPickerOpen
contentWidth:Math.min(1240,root.screenWidth-2*(BarDrawers.margin+BarDrawers.radius+ear))
contentHeight:Math.min(640,root.screenHeight-BarDrawers.bottom-40)
drawerId:"wallpaper"
screenName:root.screen ? root.screen.name : ""
screenX:(root.screenWidth-width)/2
MouseArea {anchors.fill:parent}
ColumnLayout {
anchors.fill:parent;anchors.margins:22;spacing:14
anchors.fill:parent;anchors.margins:22;spacing:16
RowLayout {
Layout.fillWidth:true;spacing:10
Text {text:"Wallpapers";color:Theme.text;font.pixelSize:22}
GlassButton {text:"All";accented:root.filter==="all";onClicked:root.filter="all"}
GlassButton {text:"History";accented:root.filter==="history";onClicked:root.filter="history"}
GlassTextField {
id:search;objectName:"wallpaperSearch"
Layout.fillWidth:true;placeholderText:"Search wallpapers…"
Keys.onEscapePressed:root.close()
Keys.onDownPressed:view.forceActiveFocus()
Keys.onReturnPressed:view.forceActiveFocus()
}
Layout.fillWidth:true
Text {text:"Wallpapers";color:Theme.text;font.pixelSize:24;Layout.fillWidth:true}
GlassComboBox {
Layout.preferredWidth:150
Layout.preferredWidth:160
model:["all","primary"].concat(Quickshell.screens.map(s=>s.name))
currentIndex:Math.max(0,model.indexOf(WallpaperService.selectedMonitor))
onActivated:WallpaperService.selectedMonitor=currentText
}
GlassIconButton {text:"↻";onClicked:WallpaperService.scan();Accessible.name:"Refresh wallpapers"}
GlassIconButton {text:"⚙";onClicked:ShellState.openSettings("wallpaper");Accessible.name:"Wallpaper settings"}
GlassIconButton {text:"×";onClicked:root.close();Accessible.name:"Close picker"}
GlassIconButton {text:"×";onClicked:ShellState.wallpaperPickerOpen=false;Accessible.name:"Close picker"}
}
GridView {
RowLayout {
GlassButton {text:"All";accented:root.filter==="all";onClicked:root.filter="all"}
GlassButton {text:"History";accented:root.filter==="history";onClicked:root.filter="history"}
GlassTextField {id:search;objectName:"wallpaperSearch";Layout.fillWidth:true;placeholderText:"Search wallpapers…";onTextChanged:root.select(0);Keys.onEscapePressed:ShellState.wallpaperPickerOpen=false;Keys.onDownPressed:view.forceActiveFocus()}
GlassIconButton {text:"↻";onClicked:WallpaperService.scan();Accessible.name:"Refresh wallpapers"}
}
ListView {
id:view
objectName:"wallpaperGrid"
objectName:"wallpaperGallery"
Layout.fillWidth:true;Layout.fillHeight:true
readonly property int columns:Math.max(3,Math.floor(width/300))
cellWidth:Math.floor(width/columns)
cellHeight:Math.round((cellWidth-16)*9/16)+16
spacing:root.gap
clip:true
model:root.results
model:root.rows
boundsBehavior:Flickable.StopAtBounds
keyNavigationEnabled:false
ScrollBar.vertical:ScrollBar {}
Keys.onLeftPressed:root.step(()=>view.moveCurrentIndexLeft())
Keys.onRightPressed:root.step(()=>view.moveCurrentIndexRight())
Keys.onUpPressed:root.step(()=>view.moveCurrentIndexUp())
Keys.onDownPressed:root.step(()=>view.moveCurrentIndexDown())
Keys.onReturnPressed:root.applySelected()
Keys.onEnterPressed:root.applySelected()
Keys.onEscapePressed:root.close()
Keys.onSpacePressed:root.peek=!root.peek
// Typing goes to the search field.
Keys.onPressed:event=>{
if(event.text && event.text.trim() && !(event.modifiers&(Qt.ControlModifier|Qt.AltModifier|Qt.MetaModifier))) {
search.forceActiveFocus();search.text+=event.text;event.accepted=true;
}
}
// One rounded mask shared by every thumbnail (they are all the same size).
Item {
id:tileMask
width:view.cellWidth-16;height:view.cellHeight-16
visible:false
layer.enabled:true
Rectangle {anchors.fill:parent;radius:14}
}
Keys.onLeftPressed:root.select(root.current-1)
Keys.onRightPressed:root.select(root.current+1)
Keys.onUpPressed:root.vertical(-1)
Keys.onDownPressed:root.vertical(1)
Keys.onReturnPressed:root.applyCurrent()
Keys.onEnterPressed:root.applyCurrent()
Keys.onEscapePressed:ShellState.wallpaperPickerOpen=false
delegate:Item {
id:cell
id:rowItem
required property var modelData
required property int index
readonly property bool current:view.currentIndex===index
width:view.cellWidth;height:view.cellHeight
width:view.width
height:modelData.height
function tileAt(index) {
for(let i=0;i<tiles.count;i++)if(tiles.itemAt(i).modelData.index===index)return tiles.itemAt(i);
return null;
}
Repeater {
id:tiles
model:rowItem.modelData.tiles
delegate:Item {
id:tile
required property var modelData
readonly property var image:root.results[modelData.index]
readonly property bool selected:root.current===modelData.index
x:modelData.x;width:modelData.width;height:rowItem.height
Item {
anchors.fill:parent;anchors.margins:8
scale:cell.current ? 1 : (tileArea.containsMouse ? 0.98 : 0.95)
anchors.fill:parent
scale:hover.containsMouse && !tile.selected ? 1.02 : 1
Behavior on scale {NumberAnimation {duration:Theme.duration;easing.type:Easing.OutCubic}}
Image {
anchors.fill:parent
source:cell.modelData.url
sourceSize:Qt.size(480,270)
source:tile.image ? tile.image.url : ""
sourceSize:Qt.size(Math.round(tile.width*1.5),Math.round(tile.height*1.5))
asynchronous:true
fillMode:Image.PreserveAspectCrop
opacity:status===Image.Ready ? (cell.current ? 1 : 0.82) : 0
opacity:status===Image.Ready ? 1 : 0
Behavior on opacity {NumberAnimation {duration:Theme.duration}}
layer.enabled:true
layer.effect:MultiEffect {maskEnabled:true;maskSource:tileMask;maskThresholdMin:0.5;maskSpreadAtMin:1}
layer.effect:MultiEffect {maskEnabled:true;maskSource:mask;maskThresholdMin:0.5;maskSpreadAtMin:1}
}
Item {
id:mask
anchors.fill:parent
visible:false
layer.enabled:true
Rectangle {anchors.fill:parent;radius:12}
}
Rectangle {
anchors.fill:parent;radius:14;color:"transparent"
border.width:cell.current ? 3 : 1
border.color:cell.current ? Theme.accent : Qt.alpha("white",0.16)
anchors.fill:parent;radius:12;color:"transparent"
border.width:tile.selected ? 3 : 1
border.color:tile.selected ? Theme.accent : Theme.border
}
// Name on the selected or hovered thumbnail only.
Rectangle {
anchors.left:parent.left;anchors.right:parent.right;anchors.bottom:parent.bottom;anchors.margins:3
height:30;radius:9
color:Qt.alpha(Theme.surface,0.78)
opacity:tile.selected || hover.containsMouse ? 1 : 0
Behavior on opacity {NumberAnimation {duration:Theme.duration}}
Text {
anchors.fill:parent;anchors.leftMargin:10;anchors.rightMargin:10
verticalAlignment:Text.AlignVCenter
text:tile.image ? tile.image.name : ""
color:Theme.text;font.pixelSize:12;elide:Text.ElideMiddle
}
}
// ✦ the subject's outline is drawn first · ✓ current wallpaper
Row {
anchors.top:parent.top;anchors.right:parent.right;anchors.margins:8;spacing:6
anchors.top:parent.top;anchors.right:parent.right;anchors.margins:7;spacing:5
Repeater {
model:[WallpaperService.outlineStatus[cell.modelData.path]==="outline" ? "✦" : "",
cell.modelData.path===root.desktopPath ? "✓" : ""].filter(s=>s)
model:tile.image ? [WallpaperService.outlineStatus[tile.image.path]==="outline" ? "✦" : "",
tile.image.path===WallpaperService.currentPath ? "✓" : ""].filter(s=>s) : []
delegate:Rectangle {
required property string modelData
width:24;height:24;radius:12
width:22;height:22;radius:11
color:Qt.alpha("black",0.55)
Text {anchors.centerIn:parent;text:parent.modelData;color:"white";font.pixelSize:13}
Text {anchors.centerIn:parent;text:parent.modelData;color:"white";font.pixelSize:12}
}
}
}
}
// Click previews, double-click applies.
MouseArea {
id:tileArea
id:hover
anchors.fill:parent
hoverEnabled:true
onClicked:{root.select(cell.index);view.forceActiveFocus();}
onDoubleClicked:{root.select(cell.index);root.applySelected();}
onClicked:{root.current=tile.modelData.index;view.forceActiveFocus();root.applyCurrent();}
}
}
}
}
}
Text {visible:!root.results.length;text:WallpaperService.scanning ? "Loading wallpapers…" : "No wallpapers here. Choose a folder in Wallpaper settings.";color:Theme.textSecondary;Layout.fillWidth:true;wrapMode:Text.Wrap}
Text {
text:WallpaperService.error || (root.applying ? "Applying wallpaper…" : "Click or arrows preview · Double-click or Enter apply · Space peek · type to search · Esc close")
color:WallpaperService.error ? Theme.urgent : Theme.textSecondary
Layout.fillWidth:true;elide:Text.ElideRight
}
}
}
// While peeking, a click or any key brings the sheet back.
Text {
anchors.bottom:parent.bottom;anchors.horizontalCenter:parent.horizontalCenter;anchors.bottomMargin:28
visible:root.peek && root.open
text:"Space to show wallpapers · Enter apply · Esc close"
color:"white";font.pixelSize:14
layer.enabled:true
layer.effect:MultiEffect {shadowEnabled:true;shadowBlur:0.6;shadowOpacity:0.8;shadowColor:"black"}
Text {text:WallpaperService.error || (WallpaperService.busy?"Applying wallpaper…":"Click or arrows and Enter to apply · ✦ outline transition · Esc Close");color:WallpaperService.error?Theme.urgent:Theme.textSecondary;Layout.fillWidth:true;wrapMode:Text.Wrap}
}
}
}