Compare commits

..

No commits in common. "4928a529b1885aa5105db29be348aa944596f71e" and "513942976e41bed721744be2e110b5be3d60494a" have entirely different histories.

6 changed files with 78 additions and 121 deletions

View File

@ -2,16 +2,10 @@
pkgs.writeShellApplication { pkgs.writeShellApplication {
name = "randomWallpaper"; name = "randomWallpaper";
runtimeInputs = with pkgs; [ findutils coreutils feh hyprland jq ]; runtimeInputs = with pkgs; [ findutils coreutils feh ];
text = '' text = ''
wallpaper="$(find ~/.config/wallpapers/ -type f,l | shuf -n 1)" wallpaper="$(find ~/.config/wallpapers/ -type f,l | shuf -n 1)"
if [ -z ''${WAYLAND_DISPLAY+x} ]; then
feh --bg-fill "$wallpaper" feh --bg-fill "$wallpaper"
else
hyprctl hyprpaper preload "$wallpaper"
hyprctl monitors -j | jq '.[].name' | xargs -I{} hyprctl hyprpaper wallpaper '{}',"$wallpaper"
hyprctl hyprpaper unload all
fi
''; '';
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 MiB

View File

@ -198,5 +198,4 @@ in
bindm = $mainMod, mouse:273, resizewindow bindm = $mainMod, mouse:273, resizewindow
exec-once=synology-drive exec-once=synology-drive
exec-once=randomWallpaper
'' ''

View File

@ -18,39 +18,16 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
# enable nix module
programs.hyprland = {
enable = true;
package = null; # because we use the home-manager module
};
# enable home-manager module
home-manager.users.moritz = { home-manager.users.moritz = {
# import home-manager module
imports = [ inputs.hyprland.homeManagerModules.default ]; imports = [ inputs.hyprland.homeManagerModules.default ];
wayland.windowManager.hyprland = { programs.waybar = {
enable = true; enable = true;
package = hyprland;
extraConfig = import ./config.nix args;
};
};
# add waybar as a status bar
home-manager.users.moritz.programs.waybar = {
enable = true;
# use package with hyprland support for switching workspaces
package = pkgs.waybar-hyprland; package = pkgs.waybar-hyprland;
# start using systemd service
systemd = { systemd = {
enable = true; enable = true;
target = "hyprland-session.target"; target = "hyprland-session.target";
}; };
settings = { settings = {
mainBar = { mainBar = {
layer = "top"; layer = "top";
@ -73,9 +50,13 @@ in
}; };
}; };
wayland.windowManager.hyprland = {
enable = true;
package = hyprland;
extraConfig = import ./config.nix args;
};
# lock screen after timeout services.swayidle = {
home-manager.users.moritz.services.swayidle = {
enable = true; enable = true;
events = [ events = [
{ {
@ -102,20 +83,6 @@ in
# start swayidle as part of hyprland, not sway # start swayidle as part of hyprland, not sway
systemd.user.services.swayidle.Install.WantedBy = lib.mkForce [ "hyprland-session.target" ]; systemd.user.services.swayidle.Install.WantedBy = lib.mkForce [ "hyprland-session.target" ];
# adds pam module for swaylock
security.pam.services.swaylock = { };
# start hyprpaper daemon using systemd unit (to set wallpaper)
systemd.user.services.hyprpaper = {
enable = true;
path = [ pkgs.hyprpaper ];
wantedBy = [ "hyprland-session.target" ];
after = [ "hyprland-session.target" ];
script = "hyprpaper";
};
# set hyprpaper conf (for setting initial background)
xdg.configFile."hypr/hyprpaper.conf" = { xdg.configFile."hypr/hyprpaper.conf" = {
text = text =
let let
@ -127,32 +94,32 @@ in
setWallpaper "/home/moritz/.config/wallpapers/a_short_walk.png"; setWallpaper "/home/moritz/.config/wallpapers/a_short_walk.png";
onChange = "${pkgs.systemd}/bin/systemctl restart --user hyprpaper.service"; onChange = "${pkgs.systemd}/bin/systemctl restart --user hyprpaper.service";
}; };
};
systemd.user.services.hyprpaper = {
# only consider graphical-session.target started when hyprland-sesstion.target is reached enable = true;
systemd.user.targets.hyprland-session = { path = [ pkgs.hyprpaper ];
wantedBy = [ "graphical-session.target" ]; wantedBy = [ "hyprland-session.target" ];
after = [ "display-manager.service" ];
script = "hyprpaper";
}; };
# add user packages for wayland and hyprland in particular
users.users.moritz.packages = with pkgs; [ users.users.moritz.packages = with pkgs; [
# pulse audio cli swayidle
swaylock-effects
pamixer pamixer
# control media playback
playerctl playerctl
# control brightness
brightnessctl brightnessctl
# screenshot tool for hyprland
grimblast grimblast
# region select for wayland (for screensharing)
slurp
# clipboard tool for wayland
wl-clipboard wl-clipboard
]; ];
security.pam.services.swaylock = { };
programs.hyprland = {
enable = true;
package = null;
};
# additional environment variables
environment.sessionVariables = environment.sessionVariables =
{ {
XDG_CURRENT_DESKTOP = "Hyprland"; XDG_CURRENT_DESKTOP = "Hyprland";
@ -163,7 +130,8 @@ in
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
QT_QPA_PLATFORMTHEME = "qt5ct"; QT_QPA_PLATFORMTHEME = "qt5ct";
_JAVA_AWT_WM_NONEREPARENTING = "1"; _JAVA_AWT_WM_NONEREPARENTING = "1";
} // (optionalAttrs cfg.nvidiaSupport } //
(if cfg.nvidiaSupport then
{ {
LIBVA_DRIVER_NAME = "nvidia"; LIBVA_DRIVER_NAME = "nvidia";
XDG_SESSION_TYPE = "wayland"; XDG_SESSION_TYPE = "wayland";
@ -171,12 +139,10 @@ in
__GLX_VENDOR_LIBRARY_NAME = "nvidia"; __GLX_VENDOR_LIBRARY_NAME = "nvidia";
WLR_NO_HARDWARE_CURSORS = "1"; WLR_NO_HARDWARE_CURSORS = "1";
__GL_VRR_ALLOWED = "0"; __GL_VRR_ALLOWED = "0";
}); } else { });
services = { services = {
dbus.enable = true; dbus.enable = true;
# use pipewire (needed for screensharing)
pipewire = { pipewire = {
enable = true; enable = true;
alsa.enable = true; alsa.enable = true;
@ -192,14 +158,12 @@ in
user = "moritz"; user = "moritz";
}; };
defaultSession = "hyprland"; defaultSession = "hyprland";
sessionPackages = [ hyprland ]; # can't set the defaultSession otherwise sessionPackages = [ hyprland ];
}; };
}; };
}; };
security.rtkit.enable = true; security.rtkit.enable = true;
# dekstop portal (for screensharing)
xdg.portal = { xdg.portal = {
enable = true; enable = true;
wlr.enable = true; wlr.enable = true;