use wallpaper from swaybg
This commit is contained in:
parent
56cba97339
commit
b5e5ecf2f3
6 changed files with 43 additions and 13 deletions
|
|
@ -40,9 +40,7 @@ Then start it with niri, in your niri config:
|
||||||
spawn-at-startup "quadshell"
|
spawn-at-startup "quadshell"
|
||||||
```
|
```
|
||||||
|
|
||||||
To have your wallpaper blurred behind the lockscreen, use
|
The lockscreen shows whatever image swaybg is showing (its `-i` argument), blurred.
|
||||||
`pkgs.quadshell.override { wallpaper = ./background.jpg; }`. It sets `QUADSHELL_WALLPAPER`,
|
|
||||||
which you can also set yourself, or before `nix run .#phone` to a path on the phone.
|
|
||||||
|
|
||||||
It brings `nmcli`, `mmcli`, `nmgui` and `adw-bluetooth` with it. The system needs:
|
It brings `nmcli`, `mmcli`, `nmgui` and `adw-bluetooth` with it. The system needs:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,7 @@
|
||||||
exec ssh -t "$host" "
|
exec ssh -t "$host" "
|
||||||
nix-store --realise ${builtins.dirOf (builtins.dirOf quickshell)} >/dev/null;
|
nix-store --realise ${builtins.dirOf (builtins.dirOf quickshell)} >/dev/null;
|
||||||
pkill -f '^/nix/store/[^ ]*/bin/quickshell ';
|
pkill -f '^/nix/store/[^ ]*/bin/quickshell ';
|
||||||
exec systemd-run --user --pty --quiet --collect \
|
exec systemd-run --user --pty --quiet --collect ${quickshell} --path ~/$dest
|
||||||
''${QUADSHELL_WALLPAPER:+--setenv=QUADSHELL_WALLPAPER=$QUADSHELL_WALLPAPER} \
|
|
||||||
${quickshell} --path ~/$dest
|
|
||||||
"
|
"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,7 @@
|
||||||
coreutils,
|
coreutils,
|
||||||
gawk,
|
gawk,
|
||||||
gnugrep,
|
gnugrep,
|
||||||
# Blurred behind the lockscreen
|
procps,
|
||||||
wallpaper ? null,
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
config = lib.fileset.toSource {
|
config = lib.fileset.toSource {
|
||||||
|
|
@ -31,10 +30,10 @@ writeShellApplication {
|
||||||
gawk
|
gawk
|
||||||
gnugrep
|
gnugrep
|
||||||
glib # gdbus, for logind's lock signal
|
glib # gdbus, for logind's lock signal
|
||||||
|
procps # pgrep, for the wallpaper swaybg is showing
|
||||||
];
|
];
|
||||||
|
|
||||||
text = ''
|
text = ''
|
||||||
${lib.optionalString (wallpaper != null) "export QUADSHELL_WALLPAPER=${wallpaper}"}
|
|
||||||
exec ${lib.getExe quickshell} --path ${config} "$@"
|
exec ${lib.getExe quickshell} --path ${config} "$@"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
39
src/Lock.qml
39
src/Lock.qml
|
|
@ -12,6 +12,7 @@ Scope {
|
||||||
property string error: ""
|
property string error: ""
|
||||||
property string password
|
property string password
|
||||||
property string sessionPath
|
property string sessionPath
|
||||||
|
property string wallpaper
|
||||||
|
|
||||||
signal failed
|
signal failed
|
||||||
|
|
||||||
|
|
@ -26,6 +27,11 @@ Scope {
|
||||||
pam.start();
|
pam.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function findWallpaper() {
|
||||||
|
wallpaperTimer.tries = 0;
|
||||||
|
wallpaperTimer.restart();
|
||||||
|
}
|
||||||
|
|
||||||
function setLockedHint() {
|
function setLockedHint() {
|
||||||
if (sessionPath === "") return;
|
if (sessionPath === "") return;
|
||||||
Quickshell.execDetached(["busctl", "call", "org.freedesktop.login1", sessionPath,
|
Quickshell.execDetached(["busctl", "call", "org.freedesktop.login1", sessionPath,
|
||||||
|
|
@ -37,7 +43,10 @@ Scope {
|
||||||
WlSessionLock {
|
WlSessionLock {
|
||||||
id: session
|
id: session
|
||||||
locked: true
|
locked: true
|
||||||
onLockedChanged: root.setLockedHint()
|
onLockedChanged: {
|
||||||
|
root.setLockedHint();
|
||||||
|
if (locked) root.findWallpaper();
|
||||||
|
}
|
||||||
|
|
||||||
LockSurface {
|
LockSurface {
|
||||||
lock: root
|
lock: root
|
||||||
|
|
@ -88,6 +97,34 @@ Scope {
|
||||||
onRunningChanged: if (!running) restartLogind.start()
|
onRunningChanged: if (!running) restartLogind.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: swaybg
|
||||||
|
command: ["pgrep", "-a", "swaybg"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
const image = text.match(/(?:-i|--image) (\S+)/)?.[1];
|
||||||
|
if (image) root.wallpaper = image;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: wallpaperTimer
|
||||||
|
property int tries
|
||||||
|
running: true
|
||||||
|
triggeredOnStart: true
|
||||||
|
repeat: true
|
||||||
|
interval: 1000
|
||||||
|
onTriggered: {
|
||||||
|
if (tries > 0 && root.wallpaper !== "" || tries >= 10) {
|
||||||
|
stop();
|
||||||
|
} else {
|
||||||
|
tries++;
|
||||||
|
swaybg.running = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: restartLogind
|
id: restartLogind
|
||||||
interval: 2000
|
interval: 2000
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ WlSessionLockSurface {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: -blur.blurMax
|
anchors.margins: -blur.blurMax
|
||||||
visible: false
|
visible: false
|
||||||
source: Theme.wallpaper === "" ? "" : `file://${Theme.wallpaper}`
|
source: surface.lock.wallpaper === "" ? "" : `file://${surface.lock.wallpaper}`
|
||||||
fillMode: Image.PreserveAspectCrop
|
fillMode: Image.PreserveAspectCrop
|
||||||
sourceSize.width: surface.width / 2
|
sourceSize.width: surface.width / 2
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,4 @@ Singleton {
|
||||||
readonly property color subtext: "#d8dee9"
|
readonly property color subtext: "#d8dee9"
|
||||||
|
|
||||||
readonly property string font: "Inter"
|
readonly property string font: "Inter"
|
||||||
|
|
||||||
readonly property string wallpaper: Quickshell.env("QUADSHELL_WALLPAPER") ?? ""
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue