hyprland: use lib.optionals for redshift startup

This commit is contained in:
Aly Raffauf 2024-06-10 20:15:27 -04:00
parent a81a230895
commit c3e1bd66cb

View file

@ -135,14 +135,10 @@
(lib.getExe pkgs.mako) (lib.getExe pkgs.mako)
"${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1" "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1"
] ]
++ ( ++ lib.lists.optionals (config.alyraffauf.desktop.hyprland.redShift) [
if config.alyraffauf.desktop.hyprland.redShift "${pkgs.geoclue2}/libexec/geoclue-2.0/demos/agent"
then [ (lib.getExe pkgs.gammastep)
"${pkgs.geoclue2}/libexec/geoclue-2.0/demos/agent" ];
(lib.getExe pkgs.gammastep)
]
else []
);
screenshot = rec { screenshot = rec {
bin = lib.getExe inputs.nixpkgsUnstable.legacyPackages."${pkgs.system}".hyprshot; bin = lib.getExe inputs.nixpkgsUnstable.legacyPackages."${pkgs.system}".hyprshot;
@ -248,130 +244,130 @@
} }
''; '';
in '' in ''
${ ${
lib.strings.concatStringsSep "\n" lib.strings.concatStringsSep "\n"
( (
lib.attrsets.mapAttrsToList (name: value: "monitor = ${value}") lib.attrsets.mapAttrsToList (name: value: "monitor = ${value}")
(laptopMonitors // externalMonitors) (laptopMonitors // externalMonitors)
) )
} }
monitor = ,preferred,auto,auto monitor = ,preferred,auto,auto
# Turn off the internal display when lid is closed. # Turn off the internal display when lid is closed.
bindl=,switch:on:Lid Switch,exec,${clamshell} on bindl=,switch:on:Lid Switch,exec,${clamshell} on
bindl=,switch:off:Lid Switch,exec,${clamshell} off bindl=,switch:off:Lid Switch,exec,${clamshell} off
# Enable virtual keyboard in tablet mode # Enable virtual keyboard in tablet mode
bindl=,switch:Lenovo Yoga Tablet Mode Control switch,exec,${tablet} bindl=,switch:Lenovo Yoga Tablet Mode Control switch,exec,${tablet}
# unscale XWayland apps # unscale XWayland apps
xwayland { xwayland {
force_zero_scaling = true force_zero_scaling = true
} }
# toolkit-specific scale # toolkit-specific scale
env = GDK_SCALE,${gdk_scale} env = GDK_SCALE,${gdk_scale}
# Some default env vars. # Some default env vars.
env = XCURSOR_SIZE,${toString config.alyraffauf.desktop.theme.cursorTheme.size} env = XCURSOR_SIZE,${toString config.alyraffauf.desktop.theme.cursorTheme.size}
env = QT_QPA_PLATFORMTHEME,qt6ct env = QT_QPA_PLATFORMTHEME,qt6ct
# Execute necessary apps # Execute necessary apps
${ ${
lib.strings.concatMapStringsSep lib.strings.concatMapStringsSep
"\n" "\n"
(x: "exec-once = ${x}") (x: "exec-once = ${x}")
startupApps startupApps
} }
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ # For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input { input {
kb_layout = us kb_layout = us
kb_variant = altgr-intl kb_variant = altgr-intl
follow_mouse = 1 follow_mouse = 1
sensitivity = 0 # -1.0 to 1.0, 0 means no modification. sensitivity = 0 # -1.0 to 1.0, 0 means no modification.
touchpad { touchpad {
clickfinger_behavior = true clickfinger_behavior = true
drag_lock = true drag_lock = true
middle_button_emulation = true middle_button_emulation = true
natural_scroll = yes natural_scroll = yes
tap-to-click = true tap-to-click = true
}
} }
}
gestures { gestures {
workspace_swipe = true workspace_swipe = true
workspace_swipe_touch = true workspace_swipe_touch = true
}
general {
gaps_in = 5
gaps_out = 6
border_size = 2
col.active_border = rgba(${lib.strings.removePrefix "#" config.alyraffauf.desktop.theme.colors.secondary}EE) rgba(${lib.strings.removePrefix "#" config.alyraffauf.desktop.theme.colors.primary}EE) 45deg
col.inactive_border = rgba(${lib.strings.removePrefix "#" config.alyraffauf.desktop.theme.colors.inactive}AA)
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(${lib.strings.removePrefix "#" config.alyraffauf.desktop.theme.colors.shadow}EE)
dim_special = 0.5 general {
gaps_in = 5
gaps_out = 6
border_size = 2
col.active_border = rgba(${lib.strings.removePrefix "#" config.alyraffauf.desktop.theme.colors.secondary}EE) rgba(${lib.strings.removePrefix "#" config.alyraffauf.desktop.theme.colors.primary}EE) 45deg
col.inactive_border = rgba(${lib.strings.removePrefix "#" config.alyraffauf.desktop.theme.colors.inactive}AA)
# Window-specific rules layout = dwindle
layerrule = blur, waybar
layerrule = ignorezero, waybar
layerrule = blur, launcher
layerrule = blur, notifications
layerrule = ignorezero, notifications
layerrule = blur, logout_dialog
layerrule = blur, swayosd
layerrule = ignorezero, swayosd
}
animations { allow_tearing = false
enabled = yes }
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
animation = border, 1, 10, default decoration {
animation = borderangle, 1, 8, default rounding = 10
animation = fade, 1, 7, default blur {
animation = specialWorkspace, 1, 6, default, slidevert enabled = true
animation = windows, 1, 7, myBezier size = 8
animation = windowsOut, 1, 7, default, popin 80% passes = 1
animation = workspaces, 1, 6, default }
} drop_shadow = yes
shadow_range = 4
shadow_render_power = 3
col.shadow = rgba(${lib.strings.removePrefix "#" config.alyraffauf.desktop.theme.colors.shadow}EE)
dwindle { dim_special = 0.5
preserve_split = yes
}
master { # Window-specific rules
always_center_master = true layerrule = blur, waybar
new_is_master = false layerrule = ignorezero, waybar
} layerrule = blur, launcher
layerrule = blur, notifications
layerrule = ignorezero, notifications
layerrule = blur, logout_dialog
layerrule = blur, swayosd
layerrule = ignorezero, swayosd
}
misc { animations {
disable_hyprland_logo = true enabled = yes
disable_splash_rendering = true bezier = myBezier, 0.05, 0.9, 0.1, 1.05
focus_on_activate = true
vfr = true
}
# Window Rules animation = border, 1, 10, default
${ animation = borderangle, 1, 8, default
animation = fade, 1, 7, default
animation = specialWorkspace, 1, 6, default, slidevert
animation = windows, 1, 7, myBezier
animation = windowsOut, 1, 7, default, popin 80%
animation = workspaces, 1, 6, default
}
dwindle {
preserve_split = yes
}
master {
always_center_master = true
new_is_master = false
}
misc {
disable_hyprland_logo = true
disable_splash_rendering = true
focus_on_activate = true
vfr = true
}
# Window Rules
${
lib.strings.concatMapStringsSep "\n" lib.strings.concatMapStringsSep "\n"
(x: '' (x: ''
windowrulev2 = center(1),class:(${x}) windowrulev2 = center(1),class:(${x})
@ -386,39 +382,39 @@
] ]
} }
windowrulev2 = center(1),class:(org.keepassxc.KeePassXC) windowrulev2 = center(1),class:(org.keepassxc.KeePassXC)
windowrulev2 = float,class:(org.keepassxc.KeePassXC) windowrulev2 = float,class:(org.keepassxc.KeePassXC)
windowrulev2 = size 80% 80%,class:(org.keepassxc.KeePassXC) windowrulev2 = size 80% 80%,class:(org.keepassxc.KeePassXC)
windowrulev2 = float, class:^(firefox)$, title:^(Picture-in-Picture)$ windowrulev2 = float, class:^(firefox)$, title:^(Picture-in-Picture)$
windowrulev2 = move 70% 20%, class:^(firefox)$, title:^(Picture-in-Picture)$ windowrulev2 = move 70% 20%, class:^(firefox)$, title:^(Picture-in-Picture)$
windowrulev2 = pin, class:^(firefox)$, title:^(Picture-in-Picture)$ windowrulev2 = pin, class:^(firefox)$, title:^(Picture-in-Picture)$
windowrulev2 = suppressevent maximize, class:.* windowrulev2 = suppressevent maximize, class:.*
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = ${modifier}, B, exec, ${defaultApps.browser} bind = ${modifier}, B, exec, ${defaultApps.browser}
bind = ${modifier}, E, exec, ${defaultApps.editor} bind = ${modifier}, E, exec, ${defaultApps.editor}
bind = ${modifier}, F, exec, ${defaultApps.fileManager} bind = ${modifier}, F, exec, ${defaultApps.fileManager}
bind = ${modifier}, P, exec, ${defaultApps.passwordManager} bind = ${modifier}, P, exec, ${defaultApps.passwordManager}
bind = ${modifier}, R, exec, ${defaultApps.launcher} bind = ${modifier}, R, exec, ${defaultApps.launcher}
bind = ${modifier}, T, exec, ${defaultApps.terminal} bind = ${modifier}, T, exec, ${defaultApps.terminal}
# Manage session. # Manage session.
bind = ${modifier}, C, killactive, bind = ${modifier}, C, killactive,
bind = ${modifier} CONTROL, L, exec, ${defaultApps.lock} bind = ${modifier} CONTROL, L, exec, ${defaultApps.lock}
bind = ${modifier}, M, exec, ${defaultApps.logout} bind = ${modifier}, M, exec, ${defaultApps.logout}
# Basic window management. # Basic window management.
bind = ${modifier} SHIFT, W, fullscreen bind = ${modifier} SHIFT, W, fullscreen
bind = ${modifier} SHIFT, V, togglefloating, bind = ${modifier} SHIFT, V, togglefloating,
# bind = ${modifier} SHIFT, P, pseudo, # dwindle # bind = ${modifier} SHIFT, P, pseudo, # dwindle
bind = ${modifier} SHIFT, backslash, togglesplit, # dwindle bind = ${modifier} SHIFT, backslash, togglesplit, # dwindle
# Move focus with mainMod + keys ++ # Move focus with mainMod + keys ++
# Move window with mainMod SHIFT + keys ++ # Move window with mainMod SHIFT + keys ++
# Move workspace to another output with mainMod CONTROL SHIFT + keys. # Move workspace to another output with mainMod CONTROL SHIFT + keys.
${ ${
lib.strings.concatStringsSep "\n" lib.strings.concatStringsSep "\n"
( (
lib.attrsets.mapAttrsToList (key: direction: '' lib.attrsets.mapAttrsToList (key: direction: ''
@ -430,71 +426,71 @@
) )
} }
# Gnome-like workspaces. # Gnome-like workspaces.
bind = ${modifier}, comma, exec, ${hyprnome} --previous bind = ${modifier}, comma, exec, ${hyprnome} --previous
bind = ${modifier}, period, exec, ${hyprnome} bind = ${modifier}, period, exec, ${hyprnome}
bind = ${modifier} SHIFT, comma, exec, ${hyprnome} --previous --move bind = ${modifier} SHIFT, comma, exec, ${hyprnome} --previous --move
bind = ${modifier} SHIFT, period, exec, ${hyprnome} --move bind = ${modifier} SHIFT, period, exec, ${hyprnome} --move
# Switch workspaces with mainMod + [1-9] ++ # Switch workspaces with mainMod + [1-9] ++
# Move active window to a workspace with mainMod + SHIFT + [1-9]. # Move active window to a workspace with mainMod + SHIFT + [1-9].
${
lib.strings.concatMapStringsSep "\n"
(x: ''
bind = ${modifier}, ${toString x}, workspace, ${toString x}
bind = ${modifier} SHIFT, ${toString x}, movetoworkspace, ${toString x}
'')
defaultWorkspaces
}
# Scratchpad show and move
bind = ${modifier}, S, togglespecialworkspace, magic
bind = ${modifier} SHIFT, S, movetoworkspace, special:magic
# Scroll through existing workspaces with mainMod + scroll
bind = ${modifier}, mouse_down, workspace, +1
bind = ${modifier}, mouse_up, workspace, -1
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = ${modifier}, mouse:272, movewindow
bindm = ${modifier}, mouse:273, resizewindow
# Display, volume, microphone, and media keys.
bindle = , xf86monbrightnessup, exec, ${brightness.up}
bindle = , xf86monbrightnessdown, exec, ${brightness.down}
bindle = , xf86audioraisevolume, exec, ${volume.up};
bindle = , xf86audiolowervolume, exec, ${volume.down};
bindl = , xf86audiomute, exec, ${volume.mute}
bindl = , xf86audiomicmute, exec, ${volume.micMute}
bindl = , xf86audioplay, exec, ${media.play}
bindl = , xf86audioprev, exec, ${media.prev}
bindl = , xf86audionext, exec, ${media.next}
# Extra bindings for petalburg.
bind = , xf86launch4, exec, pp-adjuster
bind = , xf86launch2, exec, ${media.play}
# Screenshot with hyprshot.
bind = , PRINT, exec, ${screenshot.screen}
bind = ${modifier}, PRINT, exec, ${screenshot.region}
# Show/hide waybar.
bind = ${modifier}, F11, exec, pkill -SIGUSR1 waybar
bind=CTRL ALT,R,submap,resize
submap=resize
binde=,down,resizeactive,0 10
binde=,left,resizeactive,-10 0
binde=,right,resizeactive,10 0
binde=,up,resizeactive,0 -10
bind=,escape,submap,reset
submap=reset
bind=CTRL ALT,M,submap,move
submap=move
# Move window with keys ++
# Move workspaces across monitors with CONTROL + keys.
${ ${
lib.strings.concatMapStringsSep "\n"
(x: ''
bind = ${modifier}, ${toString x}, workspace, ${toString x}
bind = ${modifier} SHIFT, ${toString x}, movetoworkspace, ${toString x}
'')
defaultWorkspaces
}
# Scratchpad show and move
bind = ${modifier}, S, togglespecialworkspace, magic
bind = ${modifier} SHIFT, S, movetoworkspace, special:magic
# Scroll through existing workspaces with mainMod + scroll
bind = ${modifier}, mouse_down, workspace, +1
bind = ${modifier}, mouse_up, workspace, -1
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = ${modifier}, mouse:272, movewindow
bindm = ${modifier}, mouse:273, resizewindow
# Display, volume, microphone, and media keys.
bindle = , xf86monbrightnessup, exec, ${brightness.up}
bindle = , xf86monbrightnessdown, exec, ${brightness.down}
bindle = , xf86audioraisevolume, exec, ${volume.up};
bindle = , xf86audiolowervolume, exec, ${volume.down};
bindl = , xf86audiomute, exec, ${volume.mute}
bindl = , xf86audiomicmute, exec, ${volume.micMute}
bindl = , xf86audioplay, exec, ${media.play}
bindl = , xf86audioprev, exec, ${media.prev}
bindl = , xf86audionext, exec, ${media.next}
# Extra bindings for petalburg.
bind = , xf86launch4, exec, pp-adjuster
bind = , xf86launch2, exec, ${media.play}
# Screenshot with hyprshot.
bind = , PRINT, exec, ${screenshot.screen}
bind = ${modifier}, PRINT, exec, ${screenshot.region}
# Show/hide waybar.
bind = ${modifier}, F11, exec, pkill -SIGUSR1 waybar
bind=CTRL ALT,R,submap,resize
submap=resize
binde=,down,resizeactive,0 10
binde=,left,resizeactive,-10 0
binde=,right,resizeactive,10 0
binde=,up,resizeactive,0 -10
bind=,escape,submap,reset
submap=reset
bind=CTRL ALT,M,submap,move
submap=move
# Move window with keys ++
# Move workspaces across monitors with CONTROL + keys.
${
lib.strings.concatStringsSep "\n" lib.strings.concatStringsSep "\n"
( (
lib.attrsets.mapAttrsToList (key: direction: '' lib.attrsets.mapAttrsToList (key: direction: ''
@ -505,18 +501,18 @@
) )
} }
# Move active window to a workspace with [1-9] # Move active window to a workspace with [1-9]
${ ${
lib.strings.concatMapStringsSep "\n" lib.strings.concatMapStringsSep "\n"
(x: "bind = , ${toString x}, movetoworkspace, ${toString x}") (x: "bind = , ${toString x}, movetoworkspace, ${toString x}")
defaultWorkspaces defaultWorkspaces
} }
# hyprnome # hyprnome
bind = , comma, exec, ${hyprnome} --previous --move bind = , comma, exec, ${hyprnome} --previous --move
bind = , period, exec, ${hyprnome} --move bind = , period, exec, ${hyprnome} --move
bind=,escape,submap,reset bind=,escape,submap,reset
submap=reset submap=reset
''; '';
}; };
} }