qs: add wallpaper cycling functionality
This commit is contained in:
@@ -34,6 +34,10 @@ Item {
|
|||||||
BackgroundService.setWallpaper(path);
|
BackgroundService.setWallpaper(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function next() {
|
||||||
|
WallpaperCycle.applyNext();
|
||||||
|
}
|
||||||
|
|
||||||
target: "background"
|
target: "background"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ Singleton {
|
|||||||
property alias location: adapter.location
|
property alias location: adapter.location
|
||||||
property alias backgroundPath: adapter.backgroundPath
|
property alias backgroundPath: adapter.backgroundPath
|
||||||
property alias wifiEnabled: adapter.wifiEnabled
|
property alias wifiEnabled: adapter.wifiEnabled
|
||||||
|
property alias cycleWallpapers: adapter.cycleWallpapers
|
||||||
|
|
||||||
FileView {
|
FileView {
|
||||||
id: settingFile
|
id: settingFile
|
||||||
@@ -34,6 +35,7 @@ Singleton {
|
|||||||
property string location: "New York"
|
property string location: "New York"
|
||||||
property string backgroundPath: ""
|
property string backgroundPath: ""
|
||||||
property bool wifiEnabled: true
|
property bool wifiEnabled: true
|
||||||
|
property list<string> cycleWallpapers: []
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import qs.Utils
|
||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property int cycleInterval: 900 // in seconds
|
||||||
|
property var wallpapers: SettingsService.cycleWallpapers
|
||||||
|
|
||||||
|
function applyNext() {
|
||||||
|
if (root.wallpapers.length === 0) {
|
||||||
|
Logger.w("WallpaperCycle", "No wallpapers to cycle through, skipping.");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
cycleTimer.stop();
|
||||||
|
const current = SettingsService.backgroundPath;
|
||||||
|
let index = -1;
|
||||||
|
if (current) {
|
||||||
|
for (let i = 0; i < root.wallpapers.length; i++) {
|
||||||
|
if (root.wallpapers[i] === current) {
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (index === -1) {
|
||||||
|
Logger.w("WallpaperCycle", "Current wallpaper not found in cycle list, starting from the beginning.");
|
||||||
|
index = 0;
|
||||||
|
} else {
|
||||||
|
index = (index + 1) % root.wallpapers.length;
|
||||||
|
}
|
||||||
|
const nextWallpaper = root.wallpapers[index];
|
||||||
|
Logger.i("WallpaperCycle", "Cycling to next wallpaper: " + nextWallpaper);
|
||||||
|
_apply(nextWallpaper);
|
||||||
|
cycleTimer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
function _apply(path) {
|
||||||
|
Quickshell.execDetached(["sh", "-c", "wallreel -a '" + path + "'"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: cycleTimer
|
||||||
|
|
||||||
|
running: false
|
||||||
|
repeat: true
|
||||||
|
interval: root.cycleInterval * 1000
|
||||||
|
onTriggered: {
|
||||||
|
root.applyNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -23,6 +23,7 @@ ShellRoot {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
SunsetService;
|
SunsetService;
|
||||||
NotesService;
|
NotesService;
|
||||||
|
WallpaperCycle;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCService {
|
IPCService {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"onSelected": "qs ipc call background set '{{ path }}'; touch '{{ path }}'; change-colortheme -c '{{ colorHex }}'",
|
"onSelected": "qs ipc call background set '{{ path }}'; change-colortheme -c '{{ colorHex }}'",
|
||||||
"onPreview": "qs ipc call background preview '{{ path }}'; change-colortheme -c '{{ colorHex }}' quickshell niri",
|
"onPreview": "qs ipc call background preview '{{ path }}'; change-colortheme -c '{{ colorHex }}' quickshell niri",
|
||||||
"quitOnSelected": true,
|
"quitOnSelected": true,
|
||||||
"saveState": [
|
"saveState": [
|
||||||
|
|||||||
Submodule config/wallpaper/Pictures/backgrounds updated: d5ec7053b7...387114f5e4
+13
-13
@@ -115,28 +115,28 @@ set -euo pipefail
|
|||||||
|
|
||||||
# mount virtual file systems
|
# mount virtual file systems
|
||||||
|
|
||||||
mkdir -pv $LFS/{dev,proc,sys,run}
|
mkdir -pv "$LFS"/{dev,proc,sys,run}
|
||||||
|
|
||||||
mount -v --bind /dev $LFS/dev
|
mountpoint -q "$LFS"/dev || mount -v --bind /dev "$LFS"/dev
|
||||||
|
|
||||||
mount -vt devpts devpts -o gid=5,mode=0620 $LFS/dev/pts
|
mountpoint -q "$LFS"/dev/pts || mount -vt devpts devpts -o gid=5,mode=0620 $LFS/dev/pts
|
||||||
mount -vt proc proc $LFS/proc
|
mountpoint -q "$LFS"/proc || mount -vt proc proc "$LFS"/proc
|
||||||
mount -vt sysfs sysfs $LFS/sys
|
mountpoint -q "$LFS"/sys || mount -vt sysfs sysfs "$LFS"/sys
|
||||||
mount -vt tmpfs tmpfs $LFS/run
|
mountpoint -q "$LFS"/run || mount -vt tmpfs tmpfs "$LFS"/run
|
||||||
|
|
||||||
if [ -h $LFS/dev/shm ]; then
|
if [ -h "$LFS"/dev/shm ]; then
|
||||||
install -v -d -m 1777 $LFS$(realpath /dev/shm)
|
install -v -d -m 1777 "${LFS}$(realpath /dev/shm)"
|
||||||
else
|
else
|
||||||
mount -vt tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm
|
mount -vt tmpfs -o nosuid,nodev tmpfs "$LFS"/dev/shm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# cleanup (defer)
|
# cleanup (defer)
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
echo "Cleaning up..."
|
echo "Cleaning up..."
|
||||||
mountpoint -q $LFS/dev/shm && umount $LFS/dev/shm
|
mountpoint -q "$LFS"/dev/shm && umount "$LFS"/dev/shm || true
|
||||||
umount $LFS/dev/pts
|
umount "$LFS"/dev/pts || true
|
||||||
umount $LFS/{sys,proc,run,dev}
|
umount "$LFS"/{sys,proc,run,dev} || true
|
||||||
}
|
}
|
||||||
trap cleanup EXIT INT TERM
|
trap cleanup EXIT INT TERM
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ chroot "$LFS" /usr/bin/env -i \
|
|||||||
NVIDIA 专有驱动的安装指引在 [GLFS 中](https://www.linuxfromscratch.org/glfs/view/stable/shareddeps/drivers-NVIDIA.html)有详细说明. 但其依赖众多, 其中包括很多 BLFS 和 GLFS 中的软件包. 因此不必心急, 可以先按需安装 BLFS 中的其他包, 等到需要 [Mesa](https://www.linuxfromscratch.org/blfs/view/stable-systemd/x/mesa.html) 作为依赖时再去 GLFS 中安装 NVIDIA 驱动, 这将会轻松不少.
|
NVIDIA 专有驱动的安装指引在 [GLFS 中](https://www.linuxfromscratch.org/glfs/view/stable/shareddeps/drivers-NVIDIA.html)有详细说明. 但其依赖众多, 其中包括很多 BLFS 和 GLFS 中的软件包. 因此不必心急, 可以先按需安装 BLFS 中的其他包, 等到需要 [Mesa](https://www.linuxfromscratch.org/blfs/view/stable-systemd/x/mesa.html) 作为依赖时再去 GLFS 中安装 NVIDIA 驱动, 这将会轻松不少.
|
||||||
|
|
||||||
关于其对内核配置的影响, 总结出来有以下两点:
|
关于其对内核配置的影响, 总结出来有以下两点:
|
||||||
- 禁用 nouveau. 除非显卡型号过于老旧, 否则不推荐使用内核中的 nouveau 驱动, 对应配置选项如 `CONFIG_DRM_NOUVEAU` `CONFIG_FB_NVIDIA` 等可留空. [GLFS NVIDIA-590.48.01 页面页脚](https://www.linuxfromscratch.org/glfs/view/stable/shareddeps/NVIDIA.html#ftn.idm139677630432800)有提到
|
- 禁用 nouveau. 除非显卡型号过于老旧, 否则不推荐使用内核中的 nouveau 驱动, 对应配置选项如 `CONFIG_DRM_NOUVEAU` `CONFIG_FB_NVIDIA` 等可留空. [GLFS NVIDIA-590.48.01 页面页脚](https://www.linuxfromscratch.org/glfs/view/stable/shareddeps/nvidia.html)有提到
|
||||||
|
|
||||||
> NVIDIA's kernel modules will fail to compile with TTY support unless a graphics driver is included in the kernel. Nouveau is used here, though alternate graphics drivers may also work.
|
> NVIDIA's kernel modules will fail to compile with TTY support unless a graphics driver is included in the kernel. Nouveau is used here, though alternate graphics drivers may also work.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user