mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-24 22:31:55 -05:00
hyprland: migrate to swaybg
This commit is contained in:
parent
20661e087e
commit
128bae8061
2
aly.nix
2
aly.nix
|
@ -46,7 +46,7 @@ in {
|
||||||
};
|
};
|
||||||
hyprland = {
|
hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
hyprpaper.randomWallpaper = true;
|
randomWallpaper = true;
|
||||||
};
|
};
|
||||||
sway = {
|
sway = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
defaultApps.enable = true;
|
defaultApps.enable = true;
|
||||||
hyprland = {
|
hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
hyprpaper.randomWallpaper = false;
|
randomWallpaper = false;
|
||||||
};
|
};
|
||||||
sway = {
|
sway = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
inputs,
|
inputs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
imports = [./hypridle ./hyprlock ./hyprpaper ./hyprshade];
|
imports = [./hypridle ./hyprlock ./hyprshade ./randomWallpaper.nix];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
alyraffauf.desktop.hyprland.enable =
|
alyraffauf.desktop.hyprland.enable =
|
||||||
|
@ -16,6 +16,11 @@
|
||||||
default = true;
|
default = true;
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
};
|
};
|
||||||
|
alyraffauf.desktop.hyprland.randomWallpaper = lib.mkOption {
|
||||||
|
description = "Whether to enable random wallpaper script.";
|
||||||
|
default = true;
|
||||||
|
type = lib.types.bool;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.alyraffauf.desktop.hyprland.enable {
|
config = lib.mkIf config.alyraffauf.desktop.hyprland.enable {
|
||||||
|
@ -25,10 +30,7 @@
|
||||||
hyprland = {
|
hyprland = {
|
||||||
hypridle.enable = lib.mkDefault false;
|
hypridle.enable = lib.mkDefault false;
|
||||||
hyprlock.enable = lib.mkDefault false;
|
hyprlock.enable = lib.mkDefault false;
|
||||||
hyprpaper = {
|
|
||||||
enable = lib.mkDefault true;
|
|
||||||
randomWallpaper = lib.mkDefault true;
|
|
||||||
};
|
|
||||||
hyprshade.enable = lib.mkDefault true;
|
hyprshade.enable = lib.mkDefault true;
|
||||||
};
|
};
|
||||||
theme.enable = lib.mkDefault true;
|
theme.enable = lib.mkDefault true;
|
||||||
|
@ -99,7 +101,7 @@
|
||||||
bar = lib.getExe pkgs.waybar;
|
bar = lib.getExe pkgs.waybar;
|
||||||
launcher = lib.getExe pkgs.fuzzel;
|
launcher = lib.getExe pkgs.fuzzel;
|
||||||
notifyd = lib.getExe pkgs.mako;
|
notifyd = lib.getExe pkgs.mako;
|
||||||
wallpaperd = lib.getExe pkgs.hyprpaper;
|
wallpaperd = "${lib.getExe pkgs.swaybg} -i ${config.alyraffauf.desktop.theme.wallpaper}";
|
||||||
logout = lib.getExe pkgs.wlogout;
|
logout = lib.getExe pkgs.wlogout;
|
||||||
# lock = pkgs.hyprlock + "/bin/hyprlock --immediate";
|
# lock = pkgs.hyprlock + "/bin/hyprlock --immediate";
|
||||||
# idled = pkgs.hypridle + "/bin/hypridle";
|
# idled = pkgs.hypridle + "/bin/hypridle";
|
||||||
|
@ -155,7 +157,7 @@
|
||||||
env = QT_QPA_PLATFORMTHEME,${qt_platform_theme}
|
env = QT_QPA_PLATFORMTHEME,${qt_platform_theme}
|
||||||
|
|
||||||
# Execute necessary apps
|
# Execute necessary apps
|
||||||
exec-once = ${wallpaperd}
|
exec-once = ${if config.alyraffauf.desktop.hyprland.randomWallpaper then "" else "${wallpaperd}"}
|
||||||
exec-once = ${bar}
|
exec-once = ${bar}
|
||||||
exec-once = ${notifyd}
|
exec-once = ${notifyd}
|
||||||
exec-once = ${lib.getExe' pkgs.wl-clipboard "wl-paste"} --type image --watch ${lib.getExe pkgs.cliphist} store
|
exec-once = ${lib.getExe' pkgs.wl-clipboard "wl-paste"} --type image --watch ${lib.getExe pkgs.cliphist} store
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [./hyprpaper-random.nix];
|
|
||||||
|
|
||||||
options = {
|
|
||||||
alyraffauf.desktop.hyprland.hyprpaper.enable =
|
|
||||||
lib.mkEnableOption "Enables hyprpaper and assorted wallpapers.";
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf config.alyraffauf.desktop.hyprland.hyprpaper.enable {
|
|
||||||
# Packages that should be installed to the user profile.
|
|
||||||
home.packages = with pkgs; [inputs.nixpkgsUnstable.legacyPackages."${pkgs.system}".hyprpaper];
|
|
||||||
|
|
||||||
xdg.configFile."hypr/hyprpaper.conf".text = ''
|
|
||||||
preload = ${config.alyraffauf.desktop.theme.wallpaper}
|
|
||||||
|
|
||||||
wallpaper = ,${config.alyraffauf.desktop.theme.wallpaper}
|
|
||||||
|
|
||||||
splash = false
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
hyprpaper-random = pkgs.writeShellScriptBin "hyprpaper-random" ''
|
|
||||||
directory=${config.home.homeDirectory}/.local/share/backgrounds
|
|
||||||
|
|
||||||
if [ -d "$directory" ]; then
|
|
||||||
while true; do
|
|
||||||
sleep 30
|
|
||||||
${config.wayland.windowManager.hyprland.package}/bin/hyprctl hyprpaper unload all
|
|
||||||
monitor=`${config.wayland.windowManager.hyprland.package}/bin/hyprctl monitors | grep Monitor | awk '{print $2}'`
|
|
||||||
for m in ''${monitor[@]}; do
|
|
||||||
random_background=$(ls $directory/*.{png,jpg} | shuf -n 1)
|
|
||||||
${config.wayland.windowManager.hyprland.package}/bin/hyprctl hyprpaper preload $random_background
|
|
||||||
${config.wayland.windowManager.hyprland.package}/bin/hyprctl hyprpaper wallpaper "$m,$random_background"
|
|
||||||
done
|
|
||||||
sleep 870
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
in {
|
|
||||||
options = {
|
|
||||||
alyraffauf.desktop.hyprland.hyprpaper.randomWallpaper =
|
|
||||||
lib.mkEnableOption "Enables hyprpaper random wallpaper script.";
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf config.alyraffauf.desktop.hyprland.hyprpaper.randomWallpaper {
|
|
||||||
# Packages that should be installed to the user profile.
|
|
||||||
home.packages = with pkgs; [hyprpaper-random];
|
|
||||||
|
|
||||||
wayland.windowManager.hyprland.extraConfig = "exec-once = ${hyprpaper-random}/bin/hyprpaper-random";
|
|
||||||
};
|
|
||||||
}
|
|
41
homeManagerModules/desktop/hypr/randomWallpaper.nix
Normal file
41
homeManagerModules/desktop/hypr/randomWallpaper.nix
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
hyprbg-randomWallpaper = pkgs.writeShellScriptBin "hyprbg-randomWallpaper" ''
|
||||||
|
kill `pidof swaybg`
|
||||||
|
|
||||||
|
OLD_PIDS=()
|
||||||
|
directory=${config.home.homeDirectory}/.local/share/backgrounds
|
||||||
|
|
||||||
|
if [ -d "$directory" ]; then
|
||||||
|
while true; do
|
||||||
|
NEW_PIDS=()
|
||||||
|
monitor=`${config.wayland.windowManager.hyprland.package}/bin/hyprctl monitors | grep Monitor | awk '{print $2}'`
|
||||||
|
for m in ''${monitor[@]}; do
|
||||||
|
random_background=$(ls $directory/*.{png,jpg} | shuf -n 1)
|
||||||
|
${lib.getExe pkgs.swaybg} -o $m -i $random_background &
|
||||||
|
NEW_PIDS+=($!)
|
||||||
|
done
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
for pid in ''${OLD_PIDS[@]}; do
|
||||||
|
kill $pid
|
||||||
|
done
|
||||||
|
|
||||||
|
OLD_PIDS=$NEW_PIDS
|
||||||
|
|
||||||
|
sleep 895
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
config = lib.mkIf config.alyraffauf.desktop.hyprland.randomWallpaper {
|
||||||
|
home.packages = with pkgs; [swaybg hyprbg-randomWallpaper];
|
||||||
|
|
||||||
|
wayland.windowManager.hyprland.extraConfig = "exec-once = ${lib.getExe hyprbg-randomWallpaper}";
|
||||||
|
};
|
||||||
|
}
|
|
@ -114,7 +114,7 @@
|
||||||
bar = lib.getExe pkgs.waybar;
|
bar = lib.getExe pkgs.waybar;
|
||||||
launcher = lib.getExe pkgs.fuzzel;
|
launcher = lib.getExe pkgs.fuzzel;
|
||||||
notifyd = lib.getExe pkgs.mako;
|
notifyd = lib.getExe pkgs.mako;
|
||||||
wallpaperd = lib.getExe pkgs.swaybg;
|
wallpaperd = "${lib.getExe pkgs.swaybg} -i ${config.alyraffauf.desktop.theme.wallpaper}";
|
||||||
logout = lib.getExe pkgs.wlogout;
|
logout = lib.getExe pkgs.wlogout;
|
||||||
lock = lib.getExe pkgs.swaylock;
|
lock = lib.getExe pkgs.swaylock;
|
||||||
idled =
|
idled =
|
||||||
|
@ -356,7 +356,12 @@
|
||||||
};
|
};
|
||||||
startup = [
|
startup = [
|
||||||
# {command = "${bar}";}
|
# {command = "${bar}";}
|
||||||
{command = "${wallpaperd}";}
|
{
|
||||||
|
command =
|
||||||
|
if config.alyraffauf.desktop.sway.randomWallpaper
|
||||||
|
then ""
|
||||||
|
else "${wallpaperd}";
|
||||||
|
}
|
||||||
{command = "${fileManager} --daemon";}
|
{command = "${fileManager} --daemon";}
|
||||||
{command = "${idled}";}
|
{command = "${idled}";}
|
||||||
{command = "${notifyd}";}
|
{command = "${notifyd}";}
|
||||||
|
|
Loading…
Reference in a new issue