diff --git a/LiveWall.qml b/LiveWall.qml index a6a5438..b817ddd 100644 --- a/LiveWall.qml +++ b/LiveWall.qml @@ -14,7 +14,8 @@ Singleton { id: root readonly property string home: Quickshell.env("HOME") - readonly property string stateFile: (Quickshell.env("XDG_RUNTIME_DIR") || "/tmp") + "/lucid-live.json" + // one per shell, so a second copy (a test one, say) never drives this player + readonly property string stateFile: (Quickshell.env("XDG_RUNTIME_DIR") || "/tmp") + "/lucid-live-" + Qt.md5(Quickshell.shellDir).substring(0, 8) + ".json" readonly property string childConfig: Quickshell.shellDir + "/lucidlive/LiveShell.qml" readonly property var videoExts: ["mp4", "webm", "mkv", "mov", "m4v"] diff --git a/Prefs.qml b/Prefs.qml index c1009c1..01c3eb6 100644 --- a/Prefs.qml +++ b/Prefs.qml @@ -851,7 +851,7 @@ Singleton { "wallpaperFolder": "", "wallpaperPickerStyle": "strip", "wallpaperPickerKeys": "sides", - "liveWallpapers": false, + "liveWallpapers": true, "liveDecoder": "auto", "livePauseUnder": "any", "liveGameMode": "pause", @@ -1468,7 +1468,7 @@ Singleton { // videos in the wallpaper folder, played behind the desktop (LiveWall.qml). // decoder: auto | vaapi | cuda | cpu; pause under: never | fullscreen | any; // in game mode: play | pause | still (the first frame, player stopped) - property bool liveWallpapers: false + property bool liveWallpapers: true property string liveDecoder: "auto" property string livePauseUnder: "any" property string liveGameMode: "pause" diff --git a/README.md b/README.md index 1d82fbd..87a385c 100644 --- a/README.md +++ b/README.md @@ -339,9 +339,11 @@ on the wallpaper you have, without changing anything. The choice is written to line by line (never sourced); anything it does not recognise falls back to the plain fade. -**Live wallpapers** (Settings → Theme → *Live wallpapers*, off by default): -videos in the wallpaper folder (mp4, webm, mkv, mov) get a **Live** tab of their -own in the launcher (`>live`), in the same four picker styles. A video plays +**Live wallpapers** (Settings → Theme → *Live wallpapers*, on by default): +videos in the wallpaper folder (mp4, webm, mkv, mov) get a side of the picker of +their own, in the same four styles: a tall *Pictures* / *Live* switch sits beside +the picker, which opens on whichever kind is on the desktop (`>live` goes +straight to the videos). A video plays behind the desktop's icons and widgets; its first frame is what `awww` holds under it and what the colours come from, so the palette matches the picture the video starts on. The player is a quickshell of its own (`lucidlive/`), started diff --git a/luciddocks/Dock.qml b/luciddocks/Dock.qml index 211797c..aa3b392 100644 --- a/luciddocks/Dock.qml +++ b/luciddocks/Dock.qml @@ -66,7 +66,12 @@ PanelWindow { // every write to the search field goes through here, so the face is built // before anything tries to set text on it - function setSearchText(text) { + // the wallpaper picker opens on the tab of what is on the desktop: Live for a + // video. exact is the Pictures / Live switch asking for one tab in particular + function setSearchText(text, exact) { + if (text === ">wallpaper" && !exact && Prefs.liveWallpapers && LiveWall.isVideo(dockWindow.appliedWallpaper)) + text = ">live"; + dockWindow.launcherBuilt = true; if (launcherLoader.item) launcherLoader.item.searchText = text; @@ -471,6 +476,8 @@ PanelWindow { readonly property real wallTilesContentMax: Math.max(dockWindow.menuContentMax, Math.round((dockWindow.screen ? dockWindow.screen.height : 1080) * 0.62)) readonly property int wallTilesTile: Math.max(Theme.dp(40), Math.min(dockWindow.wallTilesBase, Math.floor((dockWindow.wallTilesContentMax - dockWindow.wallTilesChrome) / dockWindow.wallTilesRows))) readonly property int wallTilesCellW: Prefs.wallpaperTilesAspect === "wide" ? Math.round(dockWindow.wallTilesTile * 16 / 9) : dockWindow.wallTilesTile + // the Pictures / Live switch beside the picker, and the gap after it + readonly property int wallKindRailWidth: Prefs.liveWallpapers ? Theme.dp(108) : 0 readonly property int wallTilesWidth: Math.ceil(dockWindow.pickerModel.count / dockWindow.wallTilesRows) * dockWindow.wallTilesCellW + Theme.dp(24) // Pills: the row with every wallpaper in it, when that is narrower than the // panel, so a short folder doesn't leave the panel wider than its pills @@ -491,12 +498,12 @@ PanelWindow { readonly property real menuWidth: { if (dockWindow.pickerMode) { if (dockWindow.wallIsTiles) - return Math.min(Math.max(Prefs.launcherPanelWidth, dockWindow.wallTilesWidth + dockWindow.panelPadding + dockWindow.wallHoverRoom), dockWindow.maxDockWidth - 48); + return Math.min(Math.max(Prefs.launcherPanelWidth, dockWindow.wallTilesWidth + dockWindow.wallKindRailWidth + dockWindow.panelPadding + dockWindow.wallHoverRoom), dockWindow.maxDockWidth - 48); if (Prefs.wallpaperPickerStyle === "pills") - return Math.min(Math.max(Prefs.launcherPanelWidth, dockWindow.wallPillsWidth + dockWindow.panelPadding), dockWindow.maxDockWidth - 48); + return Math.min(Math.max(Prefs.launcherPanelWidth, dockWindow.wallPillsWidth + dockWindow.wallKindRailWidth + dockWindow.panelPadding), dockWindow.maxDockWidth - 48); - return Math.min((Prefs.wallpaperPickerStyle === "strip" ? dockWindow.wallStripWidth : dockWindow.wallBaseWidth) + dockWindow.panelPadding + dockWindow.wallHoverRoom, dockWindow.maxDockWidth - 48); + return Math.min((Prefs.wallpaperPickerStyle === "strip" ? dockWindow.wallStripWidth : dockWindow.wallBaseWidth) + dockWindow.wallKindRailWidth + dockWindow.panelPadding + dockWindow.wallHoverRoom, dockWindow.maxDockWidth - 48); } // the list plus its preview pane @@ -1801,7 +1808,7 @@ PanelWindow { function onLiveWallpapersChanged() { wallpaperScanner.scan(false); if (!Prefs.liveWallpapers && dockWindow.mode === "live") - dockWindow.setSearchText(">wallpaper"); + dockWindow.setSearchText(">wallpaper", true); } @@ -2798,6 +2805,8 @@ PanelWindow { model: resultsModel resultCount: dockWindow.resultCount wallpaperModel: dockWindow.pickerModel + kindRailWidth: dockWindow.wallKindRailWidth + onPickerKindRequested: (kind) => dockWindow.setSearchText(kind === "live" ? ">live" : ">wallpaper", true) wallHeroW: dockWindow.wallHeroW wallHeroH: dockWindow.wallHeroH wallMidW: dockWindow.wallMidW diff --git a/luciddocks/LauncherFace.qml b/luciddocks/LauncherFace.qml index 3f9177a..800a6e6 100644 --- a/luciddocks/LauncherFace.qml +++ b/luciddocks/LauncherFace.qml @@ -80,12 +80,8 @@ Item { readonly property bool searchTop: Prefs.launcherSearchTop readonly property int chromeHeight: Prefs.launcherChromeH readonly property int headBlock: face.headOn ? face.headHeight + Prefs.launcherHeadGap : 0 - // the launcher's modes, reachable by prefix, by pill or by Ctrl and a digit. - // Live is there with Settings -> Theme -> Live wallpapers on - readonly property var modes: face.allModes.filter((m) => { - return m.key !== "live" || Prefs.liveWallpapers; - }) - readonly property var allModes: [{ + // the launcher's modes, reachable by prefix, by pill or by Ctrl and a digit + readonly property var modes: [{ "key": "apps", "label": "Apps", "icon": "apps" @@ -101,10 +97,6 @@ Item { "key": "wallpaper", "label": "Wallpapers", "icon": "wallpaper" - }, { - "key": "live", - "label": "Live", - "icon": "movie" }, { "key": "theme", "label": "Themes", @@ -124,6 +116,8 @@ Item { // what the empty state needs, so the dock never sizes the panel under it readonly property real emptyHeight: resultList.emptyExtent property string displayMode: "apps" + // the Pictures / Live switch beside the picker, as wide as the dock makes room for + property int kindRailWidth: 0 // pictures and videos share the picker, a tab each readonly property bool pickerMode: face.displayMode === "wallpaper" || face.displayMode === "live" readonly property bool listVisible: !face.pickerMode @@ -147,6 +141,8 @@ Item { signal activated(int index) signal closeRequested() + // "wallpaper" or "live", from the switch beside the picker + signal pickerKindRequested(string kind) signal wallpaperChosen(string path) signal wallpaperPreviewed(string path) signal backRequested() @@ -303,7 +299,8 @@ Item { height: face.headHeight visible: face.headOn modes: face.modes - current: face.displayMode + // the Live tab is the wallpaper picker too + current: face.displayMode === "live" ? "wallpaper" : face.displayMode countLabel: face.countLabel onChosen: (key) => { face.modeRequested(key); @@ -408,10 +405,93 @@ Item { clearArmed: face.clearArmed } + // Pictures and Live, tall enough to be seen as the two halves of the picker + Column { + id: kindRail + + anchors.left: parent.left + anchors.top: parent.top + anchors.bottom: parent.bottom + width: Math.max(0, face.kindRailWidth - Theme.dp(12)) + spacing: Theme.dp(8) + visible: face.pickerMode && face.kindRailWidth > 0 + + Repeater { + model: [{ + "key": "wallpaper", + "label": "Pictures", + "icon": "wallpaper" + }, { + "key": "live", + "label": "Live", + "icon": "movie" + }] + + Item { + id: kind + + required property var modelData + readonly property bool on: face.displayMode === kind.modelData.key + readonly property color content: kind.on ? Theme.fgAccent : Theme.subtext + + width: kindRail.width + height: (kindRail.height - kindRail.spacing) / 2 + + Rectangle { + anchors.fill: parent + radius: Theme.shapeXl + color: kind.on ? Theme.accent : Theme.withBlur(Theme.surfaceHigh) + + Behavior on color { + ColorAnimation { + duration: Theme.durDefaultEffects + } + + } + + StateLayer { + radius: Theme.shapeXl + tint: kind.content + onClicked: { + face.pickerKindRequested(kind.modelData.key); + searchInput.forceActiveFocus(); + } + } + + } + + Column { + anchors.centerIn: parent + spacing: Theme.dp(6) + + Icon { + anchors.horizontalCenter: parent.horizontalCenter + name: kind.modelData.icon + size: Theme.dp(26) + fill: kind.on ? 1 : 0 + color: kind.content + } + + LText { + anchors.horizontalCenter: parent.horizontalCenter + role: "labelLarge" + text: kind.modelData.label + color: kind.content + } + + } + + } + + } + + } + Loader { id: pickerLoader anchors.fill: parent + anchors.leftMargin: kindRail.visible ? face.kindRailWidth : 0 visible: face.pickerMode source: face.pickerFiles[face.pickerStyle] || face.pickerFiles.strip onLoaded: pickerRestore.restart() diff --git a/lucidprefs/ThemePage.qml b/lucidprefs/ThemePage.qml index 3088bdc..e369538 100644 --- a/lucidprefs/ThemePage.qml +++ b/lucidprefs/ThemePage.qml @@ -683,6 +683,101 @@ Column { } + SettingCard { + title: "LIVE WALLPAPERS" + + SettingRow { + title: "Live wallpapers" + description: "Videos in the wallpaper folder (mp4, webm, mkv) get a Live tab in the launcher and play behind the desktop. The colours come from the first frame." + showDivider: Prefs.liveWallpapers + + M3Switch { + checked: Prefs.liveWallpapers + onToggled: (v) => { + return Prefs.liveWallpapers = v; + } + } + + } + + SettingRow { + title: "Decoder" + description: "What decodes the video. Automatic tries the integrated GPU first, so a laptop does not wake its graphics card for a wallpaper, then NVIDIA. The CPU always works, and costs the most." + visible: Prefs.liveWallpapers + stacked: true + + M3Segmented { + width: Math.min(parent.width, Theme.dp(560)) + current: Prefs.liveDecoder + options: [{ + "key": "auto", + "label": "Automatic" + }, { + "key": "vaapi", + "label": "VA-API" + }, { + "key": "cuda", + "label": "NVIDIA" + }, { + "key": "cpu", + "label": "CPU" + }] + onChosen: (key) => Prefs.liveDecoder = key + } + + } + + SettingRow { + title: "Pause under windows" + description: "Hold the video still on a screen whose workspace has windows, or only behind a fullscreen one." + visible: Prefs.liveWallpapers + stacked: true + + M3Segmented { + width: Math.min(parent.width, Theme.dp(480)) + current: Prefs.livePauseUnder + options: [{ + "key": "any", + "label": "Any window" + }, { + "key": "fullscreen", + "label": "Fullscreen" + }, { + "key": "never", + "label": "Never" + }] + onChosen: (key) => Prefs.livePauseUnder = key + } + + } + + SettingRow { + title: "In game mode" + description: "Keep playing, pause, or stop the player and leave the first frame, which frees what the video was using." + visible: Prefs.liveWallpapers + showDivider: false + stacked: true + + M3Segmented { + width: Math.min(parent.width, Theme.dp(480)) + current: Prefs.liveGameMode + options: [{ + "key": "play", + "label": "Keep playing" + }, { + "key": "pause", + "label": "Pause" + }, { + "key": "still", + "label": "Still frame" + }] + onChosen: (key) => Prefs.liveGameMode = key + } + + } + + } + SettingCard { title: "WALLPAPER PICKER" @@ -900,101 +995,6 @@ Column { } - SettingCard { - title: "LIVE WALLPAPERS" - - SettingRow { - title: "Live wallpapers" - description: "Videos in the wallpaper folder (mp4, webm, mkv) get a Live tab in the launcher and play behind the desktop. The colours come from the first frame." - showDivider: Prefs.liveWallpapers - - M3Switch { - checked: Prefs.liveWallpapers - onToggled: (v) => { - return Prefs.liveWallpapers = v; - } - } - - } - - SettingRow { - title: "Decoder" - description: "What decodes the video. Automatic tries the integrated GPU first, so a laptop does not wake its graphics card for a wallpaper, then NVIDIA. The CPU always works, and costs the most." - visible: Prefs.liveWallpapers - stacked: true - - M3Segmented { - width: Math.min(parent.width, Theme.dp(560)) - current: Prefs.liveDecoder - options: [{ - "key": "auto", - "label": "Automatic" - }, { - "key": "vaapi", - "label": "VA-API" - }, { - "key": "cuda", - "label": "NVIDIA" - }, { - "key": "cpu", - "label": "CPU" - }] - onChosen: (key) => Prefs.liveDecoder = key - } - - } - - SettingRow { - title: "Pause under windows" - description: "Hold the video still on a screen whose workspace has windows, or only behind a fullscreen one." - visible: Prefs.liveWallpapers - stacked: true - - M3Segmented { - width: Math.min(parent.width, Theme.dp(480)) - current: Prefs.livePauseUnder - options: [{ - "key": "any", - "label": "Any window" - }, { - "key": "fullscreen", - "label": "Fullscreen" - }, { - "key": "never", - "label": "Never" - }] - onChosen: (key) => Prefs.livePauseUnder = key - } - - } - - SettingRow { - title: "In game mode" - description: "Keep playing, pause, or stop the player and leave the first frame, which frees what the video was using." - visible: Prefs.liveWallpapers - showDivider: false - stacked: true - - M3Segmented { - width: Math.min(parent.width, Theme.dp(480)) - current: Prefs.liveGameMode - options: [{ - "key": "play", - "label": "Keep playing" - }, { - "key": "pause", - "label": "Pause" - }, { - "key": "still", - "label": "Still frame" - }] - onChosen: (key) => Prefs.liveGameMode = key - } - - } - - } - SettingCard { id: transCard