show image on swaylock

This commit is contained in:
Ivan Dimitrov 2024-02-17 11:11:42 +02:00
parent 39177911da
commit 04dd977f29
3 changed files with 7 additions and 4 deletions

View File

@ -1,7 +1,8 @@
#!/usr/bin/env nu #!/usr/bin/env nu
let today = (date now | format date '%Y-%m-%d') let today = (date now | format date '%Y-%m-%d')
let bg_dir = (xdg-user-dir PICTURES) | path join "bg" let pic_dir = (xdg-user-dir PICTURES)
let bg_dir = $pic_dir | path join "bg"
let today_img_file = $bg_dir | path join ( [ $today, ".png" ] | str join ) let today_img_file = $bg_dir | path join ( [ $today, ".png" ] | str join )
let is_new = ((date now | format date "%H" | into int) >= 10) let is_new = ((date now | format date "%H" | into int) >= 10)
mkdir $bg_dir mkdir $bg_dir
@ -28,6 +29,7 @@ cleanup
if $is_new and (not (exists $today_img_file)) { if $is_new and (not (exists $today_img_file)) {
fetch fetch
/run/current-system/sw/bin/ln -sf $today_img_file ( $pic_dir | path join "bg.png" )
} }
cleanup cleanup

View File

@ -33,7 +33,7 @@
Environment = [ Environment = [
"PATH=${pkgs.xdg-user-dirs}/bin:${pkgs.swaybg}/bin" "PATH=${pkgs.xdg-user-dirs}/bin:${pkgs.swaybg}/bin"
]; ];
ExecStart = [ "${pkgs.nushell}/bin/nu -c 'swaybg -i (ls ((xdg-user-dir PICTURES) | path join 'bg') | get name | last)'" ]; ExecStart = [ "${pkgs.nushell}/bin/nu -c 'swaybg -i ((xdg-user-dir PICTURES) | path join 'bg.png')'" ];
}; };
}; };
bingwp = { bingwp = {

View File

@ -1,10 +1,11 @@
{ { config, ... }: {
programs.swaylock = { programs.swaylock = {
enable = true; enable = true;
settings = { settings = {
color = "000000"; color = "000000";
line-color = "ffffff"; line-color = "ffffff";
show-failed-attempts = true; show-failed-attempts = true;
image = config.home.homeDirectory + "/pic/bg.png";
}; };
}; };
} }