diff --git a/homeManagerModules/desktopEnv/hypr/default.nix b/homeManagerModules/desktopEnv/hypr/default.nix index a59a52c1..eecc82a0 100644 --- a/homeManagerModules/desktopEnv/hypr/default.nix +++ b/homeManagerModules/desktopEnv/hypr/default.nix @@ -15,7 +15,7 @@ desktopEnv.hyprland.hyprpaper.enable = lib.mkDefault true; desktopEnv.hyprland.hyprshade.enable = lib.mkDefault true; - desktopEnv.hyprland.gtk-qt.enable = lib.mkDefault true; + desktopEnv.hyprland.theme.enable = lib.mkDefault true; # Basic apps needed to run a hyprland desktop. guiApps.waybar.enable = lib.mkDefault true; @@ -46,12 +46,7 @@ xfce.xfconf ]; - services.cliphist.enable = true; - - wayland.windowManager.hyprland = { - enable = true; - extraConfig = builtins.readFile ./hyprland.conf; - }; + services.cliphist.enable = lib.mkDefault true; xdg.configFile."xfce4/helpers.rc".text = '' TerminalEmulator=alacritty @@ -64,5 +59,278 @@ configPackages = [ pkgs.xdg-desktop-portal-hyprland ]; extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; }; + + wayland.windowManager.hyprland.enable = true; + wayland.windowManager.hyprland.extraConfig = let + modifier = "SUPER"; + # Default apps + browser = pkgs.firefox + "/bin/firefox"; + fileManager = pkgs.xfce.thunar + "/bin/thunar"; + editor = pkgs.vscodium + "/bin/codium"; + terminal = pkgs.alacritty + "/bin/alacritty"; + + # Hyprland shell utilities + bar = pkgs.waybar + "/bin/waybar"; + launcher = pkgs.fuzzel + "/bin/fuzzel"; + notifyd = pkgs.mako + "/bin/mako"; + wallpaperd = pkgs.hyprpaper + "/bin/hyprpaper"; + idle = pkgs.hypridle + "/bin/hypridle"; + logout = pkgs.wlogout + "/bin/wlogout"; + lock = pkgs.hyprlock + "/bin/hyprlock --immediate"; + hyprnome = pkgs.hyprnome + "/bin/hyprnome"; + hyprshade = pkgs.hyprshade + "/bin/hyprshade"; + + # Media/hardware commands + brightness = "${pkgs.brightnessctl}/bin/brightnessctl "; + brightness_up = "${brightness} set 5%+"; + brightness_down = "${brightness} set 5%-"; + volume = "${pkgs.wireplumber}/bin/wpctl"; + volume_up = "${volume} set-volume -l 1.0 @DEFAULT_SINK@ 5%+"; + volume_down = "${volume} set-volume -l 1.0 @DEFAULT_SINK@ 5%-"; + mute = "${volume} set-mute @DEFAULT_SINK@ toggle"; + media = "${pkgs.playerctl}/bin/playerctl"; + media_play = "${media} play-pause"; + media_next = "${media} next"; + media_previous = "${media} previous"; + + screenshot = "${pkgs.hyprshot}/bin/hyprshot"; + screenshot_folder = "~/Pictures/Screenshots"; + screenshot_screen = "${screenshot} -m output -o ${screenshot_folder}"; + + # Colors + border_primary = "ca9ee6ee"; + border_secondary = "99d1dbee"; + border_inactive = "303446aa"; + drop_shadow = "1a1a1aee"; + cursor_size = "24"; + qt_platform_theme = "gtk"; + + in '' + # For lavaridge. + monitor=desc:BOE 0x0BCA,preferred,auto,1.566667 + monitor=desc:BOE 0x095F,preferred,auto,1.566667 + + # For mauville. + monitor=desc:LG Electronics LG ULTRAWIDE 311NTAB5M720,preferred,auto,1.25,vrr,2 + + # For rustboro. + monitor=desc:LG Display 0x0569,preferred,auto,1.2 + + # For petalburg. + monitor=desc:Samsung Display Corp. 0x4152,preferred,auto,2 + + # Workshop monitor. + monitor=desc:Guangxi Century Innovation Display Electronics Co. Ltd 27C1U-D 0000000000001,preferred,-2560x0,1.5 + + # Use best settings for all other monitors. + monitor=,preferred,auto,auto + + # unscale XWayland apps + xwayland { + force_zero_scaling = true + } + + # toolkit-specific scale + env = GDK_SCALE,1.5 + + # Some default env vars. + env = XCURSOR_SIZE,${cursor_size} + # env = QT_QPA_PLATFORMTHEME,${qt_platform_theme} + + # Execute your favorite apps at launch + exec-once = ${pkgs.hyprshade} auto + exec-once = ${wallpaperd} + exec-once = ${bar} + exec-once = ${notifyd} + exec-once = ${pkgs.wl-clipboard}/bin/wl-paste --type text --watch cliphist store #Stores only text data + exec-once = ${pkgs.wl-clipboard}/bin/wl-paste --type image --watch cliphist store #Stores only image data + exec-once = ${idle} + + # For all categories, see https://wiki.hyprland.org/Configuring/Variables/ + input { + kb_layout = us + follow_mouse = 1 + sensitivity = 0 # -1.0 to 1.0, 0 means no modification. + touchpad { + clickfinger_behavior = true + drag_lock = true + middle_button_emulation = true + natural_scroll = yes + tap-to-click = true + } + } + + gestures { + workspace_swipe = true + } + + general { + gaps_in = 5 + gaps_out = 10 + border_size = 2 + col.active_border = rgba(${border_secondary}) rgba(${border_primary}) 45deg + col.inactive_border = rgba(${border_inactive}) + + layout = dwindle + + allow_tearing = false + } + + decoration { + rounding = 10 + blur { + enabled = true + size = 8 + passes = 1 + } + drop_shadow = yes + shadow_range = 4 + shadow_render_power = 3 + col.shadow = rgba(${drop_shadow}) + + dim_special = 0.5 + + layerrule = blur, waybar + layerrule = ignorezero, waybar + layerrule = blur, launcher + layerrule = blur, notifications + layerrule = ignorezero, notifications + layerrule = blur, logout_dialog + } + + animations { + enabled = yes + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 + + animation = windows, 1, 7, myBezier + animation = windowsOut, 1, 7, default, popin 80% + animation = border, 1, 10, default + animation = borderangle, 1, 8, default + animation = fade, 1, 7, default + animation = workspaces, 1, 6, default + animation = specialWorkspace, 1, 6, default, slidevert + } + + dwindle { + pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = yes # you probably want this + } + + master { + new_is_master = false + always_center_master = true + } + + misc { + disable_splash_rendering = true + disable_hyprland_logo = true + vfr = true + focus_on_activate = true + } + + windowrulev2 = suppressevent maximize, class:.* # You'll probably like this. + + # PavuControl, nmtui, and blueberry float. + windowrulev2 = float,class:(pavucontrol) + windowrulev2 = center(1),class:(pavucontrol) + windowrulev2 = float,class:(nmtui) + windowrulev2 = center(1),class:(nmtui) + windowrulev2 = float,class:(blueberry.py) + windowrulev2 = center(1),class:(blueberry.py) + + # See https://wiki.hyprland.org/Configuring/Keywords/ for more + $mainMod = ${modifier} + + # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more + bind = $mainMod, T, exec, ${terminal} + bind = $mainMod, F, exec, ${fileManager} + bind = $mainMod, B, exec, ${browser} + bind = $mainMod, E, exec, ${editor} + + bind = $mainMod, R, exec, ${launcher} + + # Manage session. + bind = $mainMod, C, killactive, + bind = $mainMod, M, exec, ${logout} + bind = $mainMod, L, exec, ${lock} + + # Basic window management. + bind = $mainMod SHIFT, W, fullscreen + bind = $mainMod SHIFT, V, togglefloating, + bind = $mainMod SHIFT, P, pseudo, # dwindle + bind = $mainMod SHIFT, J, togglesplit, # dwindle + + # Move focus with mainMod + arrow keys + bind = $mainMod, left, movefocus, l + bind = $mainMod, right, movefocus, r + bind = $mainMod, up, movefocus, u + bind = $mainMod, down, movefocus, d + + # Gnome-like workspaces. + bind = $mainMod, 1, exec, ${hyprnome} --previous + bind = $mainMod, 2, exec, ${hyprnome} + bind = $mainMod SHIFT, 1, exec, ${hyprnome} --previous --move + bind = $mainMod SHIFT, 2, exec, ${hyprnome} --move + + # # Switch workspaces with mainMod + [0-9] + # bind = $mainMod, 1, workspace, 1 + # bind = $mainMod, 2, workspace, 2 + # bind = $mainMod, 3, workspace, 3 + # bind = $mainMod, 4, workspace, 4 + # bind = $mainMod, 5, workspace, 5 + # bind = $mainMod, 6, workspace, 6 + # bind = $mainMod, 7, workspace, 7 + # bind = $mainMod, 8, workspace, 8 + # bind = $mainMod, 9, workspace, 9 + # bind = $mainMod, 0, workspace, 10 + + # # Move active window to a workspace with mainMod + SHIFT + [0-9] + # bind = $mainMod SHIFT, 1, movetoworkspace, 1 + # bind = $mainMod SHIFT, 2, movetoworkspace, 2 + # bind = $mainMod SHIFT, 3, movetoworkspace, 3 + # bind = $mainMod SHIFT, 4, movetoworkspace, 4 + # bind = $mainMod SHIFT, 5, movetoworkspace, 5 + # bind = $mainMod SHIFT, 6, movetoworkspace, 6 + # bind = $mainMod SHIFT, 7, movetoworkspace, 7 + # bind = $mainMod SHIFT, 8, movetoworkspace, 8 + # bind = $mainMod SHIFT, 9, movetoworkspace, 9 + # bind = $mainMod SHIFT, 0, movetoworkspace, 10 + + # Example special workspace (scratchpad) + bind = $mainMod, S, togglespecialworkspace, magic + bind = $mainMod SHIFT, S, movetoworkspace, special:magic + + # Scroll through existing workspaces with mainMod + scroll + bind = $mainMod, mouse_down, workspace, e+1 + bind = $mainMod, mouse_up, workspace, e-1 + + # Move/resize windows with mainMod + LMB/RMB and dragging + bindm = $mainMod, mouse:272, movewindow + bindm = $mainMod, mouse:273, resizewindow + + # Adjust display brightness. + bindle = , xf86monbrightnessup, exec, ${brightness_up} + bindle = , xf86monbrightnessdown, exec, ${brightness_down} + + # Adjust volume and play/pause. + bindle = , xf86audioraisevolume, exec, ${volume_up}; + bindle = , xf86audiolowervolume, exec, ${volume_down}; + bindl = , xf86audiomute, exec, ${mute} + bindl = , xf86audioplay, exec, ${media_play} + bindl = , xf86audioprev, exec, ${media_previous} + bindl = , xf86audionext, exec, ${media_next} + + # Extra bindings for petalburg. + bind = , xf86launch4, exec, pp-adjuster + # bind = ,xf86launch1, exec, cs-adjuster + bind = , xf86launch2, exec, ${media_play} + + # Screenshot with hyprshot. + bind = , PRINT, exec, ${screenshot_screen} + + # Show/hide waybar. + bind = $mainMod, F11, exec, pkill -SIGUSR1 waybar + ''; + }; } diff --git a/homeManagerModules/desktopEnv/hypr/hypridle/default.nix b/homeManagerModules/desktopEnv/hypr/hypridle/default.nix index dbac948c..82b7f2d5 100644 --- a/homeManagerModules/desktopEnv/hypr/hypridle/default.nix +++ b/homeManagerModules/desktopEnv/hypr/hypridle/default.nix @@ -8,7 +8,7 @@ config = lib.mkIf config.desktopEnv.hyprland.hypridle.enable { # Packages that should be installed to the user profile. - home.packages = with pkgs; [ hypridle ]; + home.packages = with pkgs; [ hypridle brightnessctl ]; xdg.configFile."hypr/hypridle.conf".source = ./hypridle.conf; }; diff --git a/homeManagerModules/desktopEnv/hypr/hypridle/hypridle.conf b/homeManagerModules/desktopEnv/hypr/hypridle/hypridle.conf index 44d282f4..5329be5d 100644 --- a/homeManagerModules/desktopEnv/hypr/hypridle/hypridle.conf +++ b/homeManagerModules/desktopEnv/hypr/hypridle/hypridle.conf @@ -30,5 +30,5 @@ listener { listener { timeout = 900 # 15min - on-timeout = [[ $(hostname) != "mauville" ]] && systemctl suspend # suspend pc unless on mauville + on-timeout = grep [[ $(hostname) != "mauville" ]] && systemctl suspend # suspend pc unless on mauville } diff --git a/homeManagerModules/desktopEnv/hypr/hyprpaper/hyprpaper.conf b/homeManagerModules/desktopEnv/hypr/hyprpaper/hyprpaper.conf index 1641c52e..03c9d0ee 100644 --- a/homeManagerModules/desktopEnv/hypr/hyprpaper/hyprpaper.conf +++ b/homeManagerModules/desktopEnv/hypr/hyprpaper/hyprpaper.conf @@ -1,6 +1,6 @@ preload = ~/.config/hypr/wallpapers/jr-korpa-9XngoIpxcEo-unsplash.jpg -# preload = ~/.config/hypr/wallpapers/salty-justice-NOMebOREvtc-unsplash.jpg -# preload = ~/.config/hypr/wallpapers/tokyoGreen.jpg +preload = ~/.config/hypr/wallpapers/salty-justice-NOMebOREvtc-unsplash.jpg +preload = ~/.config/hypr/wallpapers/tokyoGreen.jpg wallpaper = ,~/.config/hypr/wallpapers/jr-korpa-9XngoIpxcEo-unsplash.jpg diff --git a/homeManagerModules/desktopEnv/hypr/hyprshade/blue-light-filter.glsl b/homeManagerModules/desktopEnv/hypr/hyprshade/blue-light-filter.glsl deleted file mode 100644 index 41d0f822..00000000 --- a/homeManagerModules/desktopEnv/hypr/hyprshade/blue-light-filter.glsl +++ /dev/null @@ -1,43 +0,0 @@ -// from https://github.com/hyprwm/Hyprland/issues/1140#issuecomment-1335128437 - -precision highp float; -varying vec2 v_texcoord; -uniform sampler2D tex; - -const float temperature = 4500.0; -const float temperatureStrength = 1.0; - -#define WithQuickAndDirtyLuminancePreservation -const float LuminancePreservationFactor = 1.0; - -// function from https://www.shadertoy.com/view/4sc3D7 -// valid from 1000 to 40000 K (and additionally 0 for pure full white) -vec3 colorTemperatureToRGB(const in float temperature) { - // values from: http://blenderartists.org/forum/showthread.php?270332-OSL-Goodness&p=2268693&viewfull=1#post2268693 - mat3 m = (temperature <= 6500.0) ? mat3(vec3(0.0, -2902.1955373783176, -8257.7997278925690), - vec3(0.0, 1669.5803561666639, 2575.2827530017594), - vec3(1.0, 1.3302673723350029, 1.8993753891711275)) - : mat3(vec3(1745.0425298314172, 1216.6168361476490, -8257.7997278925690), - vec3(-2666.3474220535695, -2173.1012343082230, 2575.2827530017594), - vec3(0.55995389139931482, 0.70381203140554553, 1.8993753891711275)); - return mix(clamp(vec3(m[0] / (vec3(clamp(temperature, 1000.0, 40000.0)) + m[1]) + m[2]), vec3(0.0), vec3(1.0)), - vec3(1.0), smoothstep(1000.0, 0.0, temperature)); -} - -void main() { - vec4 pixColor = texture2D(tex, v_texcoord); - - // RGB - vec3 color = vec3(pixColor[0], pixColor[1], pixColor[2]); - -#ifdef WithQuickAndDirtyLuminancePreservation - color *= mix(1.0, dot(color, vec3(0.2126, 0.7152, 0.0722)) / max(dot(color, vec3(0.2126, 0.7152, 0.0722)), 1e-5), - LuminancePreservationFactor); -#endif - - color = mix(color, color * colorTemperatureToRGB(temperature), temperatureStrength); - - vec4 outCol = vec4(color, pixColor[3]); - - gl_FragColor = outCol; -} diff --git a/homeManagerModules/desktopEnv/hypr/hyprshade/default.nix b/homeManagerModules/desktopEnv/hypr/hyprshade/default.nix index c2d77e97..244d0d16 100644 --- a/homeManagerModules/desktopEnv/hypr/hyprshade/default.nix +++ b/homeManagerModules/desktopEnv/hypr/hyprshade/default.nix @@ -10,8 +10,56 @@ # Packages that should be installed to the user profile. home.packages = with pkgs; [ hyprshade ]; - xdg.configFile."hypr/shaders/blue-light-filter.glsl".source = - ./blue-light-filter.glsl; - xdg.configFile."hypr/hyprshade.toml".source = ./hyprshade.toml; + xdg.configFile."hypr/shaders/blue-light-filter.glsl".text = '' + // from https://github.com/hyprwm/Hyprland/issues/1140#issuecomment-1335128437 + + precision highp float; + varying vec2 v_texcoord; + uniform sampler2D tex; + + const float temperature = 4500.0; + const float temperatureStrength = 1.0; + + #define WithQuickAndDirtyLuminancePreservation + const float LuminancePreservationFactor = 1.0; + + // function from https://www.shadertoy.com/view/4sc3D7 + // valid from 1000 to 40000 K (and additionally 0 for pure full white) + vec3 colorTemperatureToRGB(const in float temperature) { + // values from: http://blenderartists.org/forum/showthread.php?270332-OSL-Goodness&p=2268693&viewfull=1#post2268693 + mat3 m = (temperature <= 6500.0) ? mat3(vec3(0.0, -2902.1955373783176, -8257.7997278925690), + vec3(0.0, 1669.5803561666639, 2575.2827530017594), + vec3(1.0, 1.3302673723350029, 1.8993753891711275)) + : mat3(vec3(1745.0425298314172, 1216.6168361476490, -8257.7997278925690), + vec3(-2666.3474220535695, -2173.1012343082230, 2575.2827530017594), + vec3(0.55995389139931482, 0.70381203140554553, 1.8993753891711275)); + return mix(clamp(vec3(m[0] / (vec3(clamp(temperature, 1000.0, 40000.0)) + m[1]) + m[2]), vec3(0.0), vec3(1.0)), + vec3(1.0), smoothstep(1000.0, 0.0, temperature)); + } + + void main() { + vec4 pixColor = texture2D(tex, v_texcoord); + + // RGB + vec3 color = vec3(pixColor[0], pixColor[1], pixColor[2]); + + #ifdef WithQuickAndDirtyLuminancePreservation + color *= mix(1.0, dot(color, vec3(0.2126, 0.7152, 0.0722)) / max(dot(color, vec3(0.2126, 0.7152, 0.0722)), 1e-5), + LuminancePreservationFactor); + #endif + + color = mix(color, color * colorTemperatureToRGB(temperature), temperatureStrength); + + vec4 outCol = vec4(color, pixColor[3]); + + gl_FragColor = outCol; + } + ''; + xdg.configFile."hypr/hyprshade.toml".text = '' + [[shades]] + name = "blue-light-filter" + start_time = 19:00:00 + end_time = 06:00:00 + ''; }; } diff --git a/homeManagerModules/desktopEnv/hypr/hyprshade/hyprshade.toml b/homeManagerModules/desktopEnv/hypr/hyprshade/hyprshade.toml deleted file mode 100644 index 7be1620b..00000000 --- a/homeManagerModules/desktopEnv/hypr/hyprshade/hyprshade.toml +++ /dev/null @@ -1,4 +0,0 @@ -[[shades]] -name = "blue-light-filter" -start_time = 19:00:00 -end_time = 06:00:00 # optional if you have more than one shade with start_time