1
0
Fork 0

Change wall-paper to gnome

This commit is contained in:
Malte Brandy 2020-05-16 13:19:05 +02:00
parent ac590efe44
commit ac7d7112c2
No known key found for this signature in database
GPG key ID: 226A2D41EF5378C9
2 changed files with 7 additions and 8 deletions

View file

@ -3,7 +3,8 @@ let
inherit (import ../../pkgs) desktop-pkgs my-ssh-add;
inherit (import ../../lib) colors;
in {
imports = [ ./rofi.nix ./ssh-agent.nix ./sleep-nag.nix ./kitty.nix ];
imports =
[ ./rofi.nix ./ssh-agent.nix ./sleep-nag.nix ./kitty.nix ./wallpaper.nix ];
m-0 = {
terminal = "${desktop-pkgs.terminal}/bin/terminal";
colors = colors;

View file

@ -4,18 +4,16 @@ let
randomWallpaper = writeHaskellScript {
name = "random-wallpaper";
imports = [ "System.Random" ];
bins = [ pkgs.coreutils pkgs.sway ];
bins = [ pkgs.coreutils pkgs.glib ];
} ''
linkPath = "/home/maralorn/volatile/wallpaper.jpg"
main = do
mode <- cat "/home/maralorn/tmp/mode" |> captureTrim
(lines . decodeUtf8 -> files) <- ls ([i|/home/maralorn/.wallpapers/#{mode}|] :: String) |> captureTrim
((files Unsafe.!!) -> file) <- getStdRandom $ randomR (0, length files - 1)
(decodeUtf8 -> current) <- readlink linkPath |> captureTrim
let new = [i|/home/maralorn/.wallpapers/#{mode}/#{file}|] :: String
when (new /= current) $ do
ln "-sf" new linkPath
swaymsg "output * bg /home/maralorn/volatile/wallpaper.jpg fill"
(decodeUtf8 -> current) <- gsettings "get" "org.gnome.desktop.background" "picture-uri" |> captureTrim
let new = [i|file:///home/maralorn/.wallpapers/#{mode}/#{file}|] :: String
when (new /= current) $
gsettings "set" "org.gnome.desktop.background" "picture-uri" new
'';
in {
home.packages = [ randomWallpaper ];