Add hyprland
This commit is contained in:
parent
a4c37a779e
commit
be70cb6736
5 changed files with 357 additions and 0 deletions
216
home/features/desktop/hyprland/config.nix
Normal file
216
home/features/desktop/hyprland/config.nix
Normal file
|
@ -0,0 +1,216 @@
|
||||||
|
{
|
||||||
|
wayland.windowManager.hyprland = {
|
||||||
|
settings = {
|
||||||
|
# autostart
|
||||||
|
exec-once = [
|
||||||
|
"picokontroller"
|
||||||
|
"systemctl --user start hyprpolkitagent"
|
||||||
|
"busctl --user -- set-property rs.wl-gammarelay / rs.wl.gammarelay Temperature q 4000"
|
||||||
|
"hyprshade on bluelight"
|
||||||
|
"fcitx5"
|
||||||
|
];
|
||||||
|
|
||||||
|
input = {
|
||||||
|
kb_layout = "de";
|
||||||
|
numlock_by_default = true;
|
||||||
|
follow_mouse = 1;
|
||||||
|
float_switch_override_focus = 0;
|
||||||
|
mouse_refocus = 0;
|
||||||
|
sensitivity = 0;
|
||||||
|
touchpad = {
|
||||||
|
natural_scroll = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
general = {
|
||||||
|
"$mainMod" = "SUPER";
|
||||||
|
layout = "dwindle";
|
||||||
|
gaps_in = 5;
|
||||||
|
gaps_out = 10;
|
||||||
|
border_size = 2;
|
||||||
|
border_part_of_window = false;
|
||||||
|
no_border_on_floating = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
misc = {
|
||||||
|
disable_autoreload = true;
|
||||||
|
disable_hyprland_logo = true;
|
||||||
|
always_follow_on_dnd = true;
|
||||||
|
layers_hog_keyboard_focus = true;
|
||||||
|
animate_manual_resizes = false;
|
||||||
|
enable_swallow = true;
|
||||||
|
focus_on_activate = true;
|
||||||
|
new_window_takes_over_fullscreen = 2;
|
||||||
|
middle_click_paste = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
dwindle = {
|
||||||
|
# no_gaps_when_only = false;
|
||||||
|
force_split = 0;
|
||||||
|
special_scale_factor = 1.0;
|
||||||
|
split_width_multiplier = 1.0;
|
||||||
|
use_active_for_splits = true;
|
||||||
|
pseudotile = "yes";
|
||||||
|
preserve_split = "yes";
|
||||||
|
};
|
||||||
|
|
||||||
|
master = {
|
||||||
|
new_status = "master";
|
||||||
|
special_scale_factor = 1;
|
||||||
|
# no_gaps_when_only = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
decoration = {
|
||||||
|
# active_opacity = 0.90;
|
||||||
|
# inactive_opacity = 0.90;
|
||||||
|
# fullscreen_opacity = 1.0;
|
||||||
|
|
||||||
|
blur = {
|
||||||
|
enabled = true;
|
||||||
|
size = 3;
|
||||||
|
passes = 2;
|
||||||
|
brightness = 1;
|
||||||
|
contrast = 1.4;
|
||||||
|
ignore_opacity = true;
|
||||||
|
noise = 0;
|
||||||
|
new_optimizations = true;
|
||||||
|
xray = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
shadow = {
|
||||||
|
enabled = true;
|
||||||
|
|
||||||
|
ignore_window = true;
|
||||||
|
offset = "0 2";
|
||||||
|
range = 20;
|
||||||
|
render_power = 3;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
bind = [
|
||||||
|
# show keybinds list
|
||||||
|
"$mainMod, F1, exec, show-keybinds"
|
||||||
|
|
||||||
|
# keybindings
|
||||||
|
"$mainMod, Return, exec, alacritty"
|
||||||
|
"$mainMod, B, exec, hyprctl dispatch exec '[workspace 1 silent] zen'"
|
||||||
|
"$mainMod, Q, killactive,"
|
||||||
|
"$mainMod, F, fullscreen, 0"
|
||||||
|
"$mainMod SHIFT, F, fullscreen, 1"
|
||||||
|
"$mainMod, Space, exec, toggle_float"
|
||||||
|
"$mainMod, D, exec, rofi -show drun || pkill rofi"
|
||||||
|
"$mainMod SHIFT, D, exec, webcord --enable-features=UseOzonePlatform --ozone-platform=wayland"
|
||||||
|
"$mainMod SHIFT, S, exec, hyprctl dispatch exec '[workspace 5 silent] SoundWireServer'"
|
||||||
|
"$mainMod, Escape, exec, swaylock"
|
||||||
|
"ALT, Escape, exec, hyprlock"
|
||||||
|
"$mainMod SHIFT, Escape, exec, power-menu"
|
||||||
|
"$mainMod, P, pseudo,"
|
||||||
|
"$mainMod, X, togglesplit,"
|
||||||
|
"$mainMod, T, exec, toggle_oppacity"
|
||||||
|
"$mainMod CTRL, E, exec, nemo"
|
||||||
|
"$mainMod, E, exec, hyprctl dispatch exec '[float; center; size 1111 700] nemo'"
|
||||||
|
"$mainMod SHIFT, B, exec, toggle_waybar"
|
||||||
|
"$mainMod, C ,exec, hyprpicker -a"
|
||||||
|
"$mainMod, W,exec, wallpaper-picker"
|
||||||
|
"$mainMod SHIFT, W,exec, hyprctl dispatch exec '[float; center; size 925 615] waypaper'"
|
||||||
|
"$mainMod, N, exec, swaync-client -t -sw"
|
||||||
|
# "$mainMod SHIFT, W, exec, vm-start"
|
||||||
|
|
||||||
|
# screenshot
|
||||||
|
",Print, exec, screenshot --copy"
|
||||||
|
"$mainMod, Print, exec, screenshot --save"
|
||||||
|
"$mainMod SHIFT, Print, exec, screenshot --swappy"
|
||||||
|
|
||||||
|
# switch focus
|
||||||
|
"$mainMod, left, movefocus, l"
|
||||||
|
"$mainMod, right, movefocus, r"
|
||||||
|
"$mainMod, up, movefocus, u"
|
||||||
|
"$mainMod, down, movefocus, d"
|
||||||
|
"$mainMod, h, movefocus, l"
|
||||||
|
"$mainMod, j, movefocus, d"
|
||||||
|
"$mainMod, k, movefocus, u"
|
||||||
|
"$mainMod, l, movefocus, r"
|
||||||
|
|
||||||
|
# switch workspace
|
||||||
|
"$mainMod, 1, workspace, 1"
|
||||||
|
"$mainMod, 2, workspace, 2"
|
||||||
|
"$mainMod, 3, workspace, 3"
|
||||||
|
"$mainMod, 4, workspace, 4"
|
||||||
|
"$mainMod, 5, workspace, 5"
|
||||||
|
"$mainMod, 6, workspace, 6"
|
||||||
|
"$mainMod, 7, workspace, 7"
|
||||||
|
"$mainMod, 8, workspace, 8"
|
||||||
|
"$mainMod, 9, workspace, 9"
|
||||||
|
"$mainMod, 0, workspace, 10"
|
||||||
|
|
||||||
|
# same as above, but switch to the workspace
|
||||||
|
"$mainMod SHIFT, 1, movetoworkspacesilent, 1" # movetoworkspacesilent
|
||||||
|
"$mainMod SHIFT, 2, movetoworkspacesilent, 2"
|
||||||
|
"$mainMod SHIFT, 3, movetoworkspacesilent, 3"
|
||||||
|
"$mainMod SHIFT, 4, movetoworkspacesilent, 4"
|
||||||
|
"$mainMod SHIFT, 5, movetoworkspacesilent, 5"
|
||||||
|
"$mainMod SHIFT, 6, movetoworkspacesilent, 6"
|
||||||
|
"$mainMod SHIFT, 7, movetoworkspacesilent, 7"
|
||||||
|
"$mainMod SHIFT, 8, movetoworkspacesilent, 8"
|
||||||
|
"$mainMod SHIFT, 9, movetoworkspacesilent, 9"
|
||||||
|
"$mainMod SHIFT, 0, movetoworkspacesilent, 10"
|
||||||
|
"$mainMod CTRL, c, movetoworkspace, empty"
|
||||||
|
|
||||||
|
# window control
|
||||||
|
"$mainMod SHIFT, left, movewindow, l"
|
||||||
|
"$mainMod SHIFT, right, movewindow, r"
|
||||||
|
"$mainMod SHIFT, up, movewindow, u"
|
||||||
|
"$mainMod SHIFT, down, movewindow, d"
|
||||||
|
"$mainMod SHIFT, h, movewindow, l"
|
||||||
|
"$mainMod SHIFT, j, movewindow, d"
|
||||||
|
"$mainMod SHIFT, k, movewindow, u"
|
||||||
|
"$mainMod SHIFT, l, movewindow, r"
|
||||||
|
|
||||||
|
"$mainMod CTRL, left, resizeactive, -80 0"
|
||||||
|
"$mainMod CTRL, right, resizeactive, 80 0"
|
||||||
|
"$mainMod CTRL, up, resizeactive, 0 -80"
|
||||||
|
"$mainMod CTRL, down, resizeactive, 0 80"
|
||||||
|
"$mainMod CTRL, h, resizeactive, -80 0"
|
||||||
|
"$mainMod CTRL, j, resizeactive, 0 80"
|
||||||
|
"$mainMod CTRL, k, resizeactive, 0 -80"
|
||||||
|
"$mainMod CTRL, l, resizeactive, 80 0"
|
||||||
|
|
||||||
|
"$mainMod ALT, left, moveactive, -80 0"
|
||||||
|
"$mainMod ALT, right, moveactive, 80 0"
|
||||||
|
"$mainMod ALT, up, moveactive, 0 -80"
|
||||||
|
"$mainMod ALT, down, moveactive, 0 80"
|
||||||
|
"$mainMod ALT, h, moveactive, -80 0"
|
||||||
|
"$mainMod ALT, j, moveactive, 0 80"
|
||||||
|
"$mainMod ALT, k, moveactive, 0 -80"
|
||||||
|
"$mainMod ALT, l, moveactive, 80 0"
|
||||||
|
|
||||||
|
# media and volume controls
|
||||||
|
# ",XF86AudioMute,exec, pamixer -t"
|
||||||
|
",XF86AudioPlay,exec, playerctl play-pause"
|
||||||
|
",XF86AudioNext,exec, playerctl next"
|
||||||
|
",XF86AudioPrev,exec, playerctl previous"
|
||||||
|
",XF86AudioStop,exec, playerctl stop"
|
||||||
|
|
||||||
|
"$mainMod, mouse_down, workspace, e-1"
|
||||||
|
"$mainMod, mouse_up, workspace, e+1"
|
||||||
|
|
||||||
|
# clipboard manager
|
||||||
|
"$mainMod, V, exec, cliphist list | rofi -dmenu -theme-str 'window {width: 50%;} listview {columns: 1;}' | cliphist decode | wl-copy"
|
||||||
|
];
|
||||||
|
|
||||||
|
# mouse binding
|
||||||
|
bindm = [
|
||||||
|
"$mainMod, mouse:272, movewindow"
|
||||||
|
"$mainMod, mouse:273, resizewindow"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
extraConfig = "
|
||||||
|
monitor=,preferred,auto,auto
|
||||||
|
|
||||||
|
xwayland {
|
||||||
|
force_zero_scaling = true
|
||||||
|
}
|
||||||
|
";
|
||||||
|
};
|
||||||
|
}
|
104
home/features/desktop/hyprland/default.nix
Normal file
104
home/features/desktop/hyprland/default.nix
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
cmd = "busctl --user -- set-property rs.wl-gammarelay / rs.wl.gammarelay Temperature q";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ./config.nix ./variables.nix ];
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
swww
|
||||||
|
hyprpicker
|
||||||
|
# hyprsunset
|
||||||
|
# wl-gammarelay-rs
|
||||||
|
hyprshade
|
||||||
|
hyprpolkitagent
|
||||||
|
grim
|
||||||
|
slurp
|
||||||
|
wl-clip-persist
|
||||||
|
cliphist
|
||||||
|
wf-recorder
|
||||||
|
glib
|
||||||
|
wayland
|
||||||
|
direnv
|
||||||
|
alacritty
|
||||||
|
];
|
||||||
|
wayland.windowManager.hyprland = {
|
||||||
|
enable = true;
|
||||||
|
xwayland.enable = true;
|
||||||
|
systemd.enable = true;
|
||||||
|
};
|
||||||
|
programs.waybar = {
|
||||||
|
enable = true;
|
||||||
|
systemd.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
xdg.configFile."hypr/shaders/bluelight.glsl".text = ''
|
||||||
|
precision highp float;
|
||||||
|
varying vec2 v_texcoord;
|
||||||
|
uniform sampler2D tex;
|
||||||
|
|
||||||
|
const float temperature = 4000.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;
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
# systemd.user.services.wl-gammarelay-rs = {
|
||||||
|
# Unit = {
|
||||||
|
# PartOf = [ "graphical-session.target" ];
|
||||||
|
# After = [ "graphical-session-pre.target" ];
|
||||||
|
# };
|
||||||
|
#
|
||||||
|
# Service = {
|
||||||
|
# ExecStart = "${pkgs.wl-gammarelay-rs}/bin/wl-gammarelay-rs";
|
||||||
|
# ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID";
|
||||||
|
# Restart = "on-failure";
|
||||||
|
# KillMode = "mixed";
|
||||||
|
# };
|
||||||
|
#
|
||||||
|
# Install = { WantedBy = [ "default.target" ]; };
|
||||||
|
# };
|
||||||
|
# systemd.user.services.wl-gammarelay-rs-restart = {
|
||||||
|
# Unit = {
|
||||||
|
# After = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" "suspend-then-hibernate.target" ];
|
||||||
|
# };
|
||||||
|
#
|
||||||
|
# Service = {
|
||||||
|
# ExecStart = "${pkgs.bash}/bin/bash -c '${cmd} 6000 && ${cmd} 4000'";
|
||||||
|
# };
|
||||||
|
#
|
||||||
|
# Install = { WantedBy = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" "suspend-then-hibernate.target" ]; };
|
||||||
|
# };
|
||||||
|
}
|
11
home/features/desktop/hyprland/variables.nix
Normal file
11
home/features/desktop/hyprland/variables.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
home.sessionVariables = {
|
||||||
|
NIXOS_OZONE_WL = "1";
|
||||||
|
GDK_BACKEND = "wayland";
|
||||||
|
DIRENV_LOG_FORMAT = "";
|
||||||
|
QT_QPA_PLATFORM = "xcb";
|
||||||
|
XDG_SESSION_TYPE = "wayland";
|
||||||
|
SDL_VIDEODRIVER = "wayland";
|
||||||
|
CLUTTER_BACKEND = "wayland";
|
||||||
|
};
|
||||||
|
}
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
../common/global
|
../common/global
|
||||||
../common/optional/desktop/awesome.nix
|
../common/optional/desktop/awesome.nix
|
||||||
|
../common/optional/desktop/hyprland.nix
|
||||||
|
|
||||||
../common/optional/systemd-boot.nix
|
../common/optional/systemd-boot.nix
|
||||||
../common/optional/wireshark.nix
|
../common/optional/wireshark.nix
|
||||||
|
|
25
hosts/common/optional/desktop/hyprland.nix
Normal file
25
hosts/common/optional/desktop/hyprland.nix
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{ pkgs, ... }: {
|
||||||
|
imports = [ ./global.nix ./x11.nix ./wayland.nix ];
|
||||||
|
|
||||||
|
programs.hyprland.enable = true;
|
||||||
|
|
||||||
|
xdg.portal = {
|
||||||
|
enable = true;
|
||||||
|
wlr.enable = true;
|
||||||
|
xdgOpenUsePortal = true;
|
||||||
|
extraPortals = [
|
||||||
|
pkgs.xdg-desktop-portal-hyprland
|
||||||
|
pkgs.xdg-desktop-portal-gtk
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.etc."systemd/system-sleep/post-hibernate-bluelight.sh".source = pkgs.writeShellScript "post-hibernate-bluelight.sh" ''
|
||||||
|
if [ "$1-$SYSTEMD_SLEEP_ACTION" = "post-hibernate" ]; then
|
||||||
|
${pkgs.systemd}/bin/busctl --user set-property rs.wl-gammarelay / rs.wl.gammarelay Temperature q 4000
|
||||||
|
${pkgs.systemd}/bin/busctl --user set-property rs.wl-gammarelay / rs.wl.gammarelay Temperature q 6000
|
||||||
|
${pkgs.systemd}/bin/busctl --user set-property rs.wl-gammarelay / rs.wl.gammarelay Temperature q 4000
|
||||||
|
${pkgs.systemd}/bin/busctl --user set-property rs.wl-gammarelay / rs.wl.gammarelay Temperature q 4000
|
||||||
|
${pkgs.systemd}/bin/busctl --user set-property rs.wl-gammarelay / rs.wl.gammarelay Temperature q 4000
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue