home/hyprland: remove monitor + tablet config from module (#30)

* home: moved hyprland monitors to config.ar.home.desktop.hyprland.monitors and config.ar.home.desktop.desktop.hyprland.laptopMonitors

* nix fmt

* home/options: update formatting

* home/hyprland: move laptop montiors to hosts/hostname/home.nix

* home/hyprland: move external non-desktop displays to user home configs

* home/hyprland: move monitors to host + home configs

* home/hyprland: add ar.home.desktop.hyprland.tabletMode.tabletSwitches for automatically setting up a list of tablet switches

* nix fmt
This commit is contained in:
Aly Raffauf 2024-07-15 00:14:18 -04:00 committed by GitHub
parent 68058f33cd
commit 3899be29c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 241 additions and 208 deletions

View file

@ -15,8 +15,6 @@ in {
inherit inherit
(import ./vars.nix) (import ./vars.nix)
defaultWorkspaces defaultWorkspaces
externalMonitors
laptopMonitors
layerRules layerRules
modifier modifier
windowManagerBinds windowManagerBinds
@ -110,12 +108,10 @@ in {
${hyprctl} keyword monitor "eDP-1, disable" ${hyprctl} keyword monitor "eDP-1, disable"
fi fi
elif [ "$1" == "off" ]; then elif [ "$1" == "off" ]; then
${ ${
lib.strings.concatLines lib.strings.concatMapStringsSep "\n"
( (monitor: ''${hyprctl} keyword monitor "${monitor}"'')
lib.attrsets.mapAttrsToList (name: monitor: ''${hyprctl} keyword monitor "${monitor}"'') cfg.desktop.hyprland.laptopMonitors
laptopMonitors
)
} }
fi fi
''; '';
@ -172,143 +168,142 @@ in {
} }
''; '';
in '' in ''
${ ${
lib.strings.concatLines lib.strings.concatMapStringsSep "\n"
( (monitor: ''monitor = ${monitor}'')
lib.attrsets.mapAttrsToList (name: value: "monitor = ${value}") (cfg.desktop.hyprland.laptopMonitors
(laptopMonitors // externalMonitors) ++ cfg.desktop.hyprland.monitors)
)
} }
monitor = ,preferred,auto,auto
# Turn off the internal display when lid is closed. monitor = ,preferred,auto,auto
bindl=,switch:on:Lid Switch,exec,${clamshell} on
bindl=,switch:off:Lid Switch,exec,${clamshell} off
# Enable virtual keyboard in tablet mode # Turn off the internal display when lid is closed.
bindl=,switch:Lenovo Yoga Tablet Mode Control switch,exec,${tablet} bindl = ,switch:on:Lid Switch,exec,${clamshell} on
bindl = ,switch:off:Lid Switch,exec,${clamshell} off
# unscale XWayland apps # Enable virtual keyboard in tablet mode
xwayland { ${
force_zero_scaling = true lib.strings.concatMapStringsSep "\n"
} (switch: ''bindl = ,switch:${switch},exec,${tablet}'')
cfg.desktop.hyprland.tabletMode.tabletSwitches
}
# Some default env vars. # unscale XWayland apps
env = XCURSOR_SIZE,${toString config.home.pointerCursor.size} xwayland {
env = QT_QPA_PLATFORMTHEME,qt6ct force_zero_scaling = true
}
# Execute necessary apps # Some default env vars.
${ env = XCURSOR_SIZE,${toString config.home.pointerCursor.size}
env = QT_QPA_PLATFORMTHEME,qt6ct
# 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 = true natural_scroll = true
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 "#" cfg.theme.colors.secondary}EE) rgba(${lib.strings.removePrefix "#" cfg.theme.colors.primary}EE) 45deg
col.inactive_border = rgba(${lib.strings.removePrefix "#" cfg.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 "#" cfg.theme.colors.shadow}EE)
dim_special = 0.5
${layerRules}
}
general { animations {
gaps_in = 5 enabled = yes
gaps_out = 6 bezier = myBezier, 0.05, 0.9, 0.1, 1.05
border_size = 2
col.active_border = rgba(${lib.strings.removePrefix "#" cfg.theme.colors.secondary}EE) rgba(${lib.strings.removePrefix "#" cfg.theme.colors.primary}EE) 45deg
col.inactive_border = rgba(${lib.strings.removePrefix "#" cfg.theme.colors.inactive}AA)
layout = dwindle 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
}
allow_tearing = false dwindle {
} preserve_split = yes
}
decoration { master {
rounding = 10 always_center_master = true
blur { new_status = false
enabled = true }
size = 8
passes = 1
}
drop_shadow = yes
shadow_range = 4
shadow_render_power = 3
col.shadow = rgba(${lib.strings.removePrefix "#" cfg.theme.colors.shadow}EE)
dim_special = 0.5 misc {
disable_hyprland_logo = true
disable_splash_rendering = true
focus_on_activate = true
vfr = true
}
# Window-specific rules # Window Rules
${layerRules} ${windowRules}
}
animations { # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
enabled = yes bind = ${modifier}, B, exec, ${defaultApps.browser}
bezier = myBezier, 0.05, 0.9, 0.1, 1.05 bind = ${modifier}, E, exec, ${defaultApps.editor}
bind = ${modifier}, F, exec, ${defaultApps.fileManager}
bind = ${modifier}, R, exec, ${defaultApps.launcher}
bind = ${modifier}, T, exec, ${defaultApps.terminal}
animation = border, 1, 10, default # Manage session.
animation = borderangle, 1, 8, default bind = ${modifier}, C, killactive,
animation = fade, 1, 7, default bind = ${modifier} CONTROL, L, exec, ${defaultApps.lock}
animation = specialWorkspace, 1, 6, default, slidevert bind = ${modifier}, M, exec, ${defaultApps.logout}
animation = windows, 1, 7, myBezier
animation = windowsOut, 1, 7, default, popin 80%
animation = workspaces, 1, 6, default
}
dwindle { # Basic window management.
preserve_split = yes bind = ${modifier} SHIFT, W, fullscreen
} bind = ${modifier} SHIFT, V, togglefloating,
# bind = ${modifier} SHIFT, P, pseudo, # dwindle
bind = ${modifier} SHIFT, backslash, togglesplit, # dwindle
master { # Move focus with mainMod + keys ++
always_center_master = true # Move window with mainMod SHIFT + keys ++
new_status = false # Move workspace to another output with mainMod CONTROL SHIFT + keys.
} ${
misc {
disable_hyprland_logo = true
disable_splash_rendering = true
focus_on_activate = true
vfr = true
}
# Window Rules
${windowRules}
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = ${modifier}, B, exec, ${defaultApps.browser}
bind = ${modifier}, E, exec, ${defaultApps.editor}
bind = ${modifier}, F, exec, ${defaultApps.fileManager}
bind = ${modifier}, R, exec, ${defaultApps.launcher}
bind = ${modifier}, T, exec, ${defaultApps.terminal}
# Manage session.
bind = ${modifier}, C, killactive,
bind = ${modifier} CONTROL, L, exec, ${defaultApps.lock}
bind = ${modifier}, M, exec, ${defaultApps.logout}
# Basic window management.
bind = ${modifier} SHIFT, W, fullscreen
bind = ${modifier} SHIFT, V, togglefloating,
# bind = ${modifier} SHIFT, P, pseudo, # dwindle
bind = ${modifier} SHIFT, backslash, togglesplit, # dwindle
# Move focus with mainMod + keys ++
# Move window with mainMod SHIFT + keys ++
# Move workspace to another output with mainMod CONTROL SHIFT + keys.
${
lib.strings.concatLines lib.strings.concatLines
( (
lib.attrsets.mapAttrsToList (key: direction: '' lib.attrsets.mapAttrsToList (key: direction: ''
@ -320,14 +315,14 @@ in {
) )
} }
# 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" lib.strings.concatMapStringsSep "\n"
(x: '' (x: ''
@ -337,56 +332,56 @@ in {
defaultWorkspaces defaultWorkspaces
} }
# Scratchpad show and move # Scratchpad show and move
bind = ${modifier}, S, togglespecialworkspace, magic bind = ${modifier}, S, togglespecialworkspace, magic
bind = ${modifier} SHIFT, S, movetoworkspace, special:magic bind = ${modifier} SHIFT, S, movetoworkspace, special:magic
# Scroll through existing workspaces with mainMod + scroll # Scroll through existing workspaces with mainMod + scroll
bind = ${modifier}, mouse_down, workspace, +1 bind = ${modifier}, mouse_down, workspace, +1
bind = ${modifier}, mouse_up, workspace, -1 bind = ${modifier}, mouse_up, workspace, -1
# Move/resize windows with mainMod + LMB/RMB and dragging # Move/resize windows with mainMod + LMB/RMB and dragging
bindm = ${modifier}, mouse:272, movewindow bindm = ${modifier}, mouse:272, movewindow
bindm = ${modifier}, mouse:273, resizewindow bindm = ${modifier}, mouse:273, resizewindow
# Display, volume, microphone, and media keys. # Display, volume, microphone, and media keys.
bindle = , xf86monbrightnessup, exec, ${brightness.up} bindle = , xf86monbrightnessup, exec, ${brightness.up}
bindle = , xf86monbrightnessdown, exec, ${brightness.down} bindle = , xf86monbrightnessdown, exec, ${brightness.down}
bindle = , xf86audioraisevolume, exec, ${volume.up}; bindle = , xf86audioraisevolume, exec, ${volume.up};
bindle = , xf86audiolowervolume, exec, ${volume.down}; bindle = , xf86audiolowervolume, exec, ${volume.down};
bindl = , xf86audiomute, exec, ${volume.mute} bindl = , xf86audiomute, exec, ${volume.mute}
bindl = , xf86audiomicmute, exec, ${volume.micMute} bindl = , xf86audiomicmute, exec, ${volume.micMute}
bindl = , xf86audioplay, exec, ${media.play} bindl = , xf86audioplay, exec, ${media.play}
bindl = , xf86audioprev, exec, ${media.prev} bindl = , xf86audioprev, exec, ${media.prev}
bindl = , xf86audionext, exec, ${media.next} bindl = , xf86audionext, exec, ${media.next}
# Screenshot with hyprshot. # Screenshot with hyprshot.
bind = , PRINT, exec, ${screenshot.screen} bind = , PRINT, exec, ${screenshot.screen}
bind = ${modifier}, PRINT, exec, ${screenshot.region} bind = ${modifier}, PRINT, exec, ${screenshot.region}
bind = CONTROL, F12, exec, ${screenshot.screen} bind = CONTROL, F12, exec, ${screenshot.screen}
bind = ${modifier} CONTROL, F12, exec, ${screenshot.region} bind = ${modifier} CONTROL, F12, exec, ${screenshot.region}
# Show/hide waybar. # Show/hide waybar.
bind = ${modifier}, F11, exec, pkill -SIGUSR1 waybar bind = ${modifier}, F11, exec, pkill -SIGUSR1 waybar
bind=CTRL ALT,R,submap,resize bind=CTRL ALT,R,submap,resize
submap=resize submap=resize
binde=,down,resizeactive,0 10 binde=,down,resizeactive,0 10
binde=,left,resizeactive,-10 0 binde=,left,resizeactive,-10 0
binde=,right,resizeactive,10 0 binde=,right,resizeactive,10 0
binde=,up,resizeactive,0 -10 binde=,up,resizeactive,0 -10
binde=,j,resizeactive,0 10 binde=,j,resizeactive,0 10
binde=,h,resizeactive,-10 0 binde=,h,resizeactive,-10 0
binde=,l,resizeactive,10 0 binde=,l,resizeactive,10 0
binde=,k,resizeactive,0 -10 binde=,k,resizeactive,0 -10
bind=,escape,submap,reset bind=,escape,submap,reset
submap=reset submap=reset
bind=CTRL ALT,M,submap,move bind=CTRL ALT,M,submap,move
submap=move submap=move
# Move window with keys ++ # Move window with keys ++
# Move workspaces across monitors with CONTROL + keys. # Move workspaces across monitors with CONTROL + keys.
${ ${
lib.strings.concatLines lib.strings.concatLines
( (
lib.attrsets.mapAttrsToList (key: direction: '' lib.attrsets.mapAttrsToList (key: direction: ''
@ -397,18 +392,18 @@ in {
) )
} }
# 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
''; '';
}; };
}; };

View file

@ -1,21 +1,6 @@
{ {
defaultWorkspaces = [1 2 3 4 5 6 7 8 9]; defaultWorkspaces = [1 2 3 4 5 6 7 8 9];
externalMonitors = {
homeOffice0 = "desc:LG Electronics LG ULTRAWIDE 311NTAB5M720,preferred,auto,1.25,vrr,2";
homeOffice1 = "desc:LG Electronics LG IPS QHD 109NTWG4Y865,preferred,-2560x0,auto";
homeOffice3 = "desc:LG Electronics LG ULTRAWIDE 207NTHM9F673, preferred,auto,1.25,vrr,2";
homeOffice4 = "desc:LG Electronics LG IPS QHD 207NTVSE5615,preferred,-1152x0,1.25,transform,1";
workShop = "desc:Guangxi Century Innovation Display Electronics Co. Ltd 27C1U-D 0000000000001,preferred,-2400x0,1.6";
weWork = "desc:HP Inc. HP 24mh 3CM037248S,preferred,-1920x0,auto";
};
laptopMonitors = {
framework = "desc:BOE 0x095F,preferred,auto,1.566667";
t440p = "desc:LG Display 0x0569,preferred,auto,1.0";
yoga9i = "desc:Samsung Display Corp. 0x4152,preferred,auto,2,transform,0";
};
layerRules = '' layerRules = ''
# Window-specific rules # Window-specific rules
layerrule = blur, waybar layerrule = blur, waybar

View file

@ -3,7 +3,6 @@
lib, lib,
osConfig, osConfig,
pkgs, pkgs,
self,
... ...
}: let }: let
cfg = config.ar.home; cfg = config.ar.home;
@ -105,6 +104,18 @@ in {
type = lib.types.bool; type = lib.types.bool;
}; };
laptopMonitors = lib.mkOption {
description = "List of internal laptop monitors.";
default = [];
type = lib.types.listOf lib.types.str;
};
monitors = lib.mkOption {
description = "List of external monitors.";
default = [];
type = lib.types.listOf lib.types.str;
};
randomWallpaper = lib.mkOption { randomWallpaper = lib.mkOption {
description = "Whether to enable random wallpaper script."; description = "Whether to enable random wallpaper script.";
default = cfg.desktop.hyprland.enable; default = cfg.desktop.hyprland.enable;
@ -132,6 +143,12 @@ in {
type = lib.types.bool; type = lib.types.bool;
}; };
tabletSwitches = lib.mkOption {
description = "Switches to activate tablet mode when toggled.";
default = [];
type = lib.types.listOf lib.types.str;
};
virtKeyboard = lib.mkOption { virtKeyboard = lib.mkOption {
description = "Whether to enable dynamic virtual keyboard."; description = "Whether to enable dynamic virtual keyboard.";
default = cfg.desktop.hyprland.tabletMode.enable; default = cfg.desktop.hyprland.tabletMode.enable;

View file

@ -54,4 +54,11 @@
# windowrulev2 = workspace special:notes,class:(obsidian) # windowrulev2 = workspace special:notes,class:(obsidian)
''; '';
}; };
ar.home.desktop.hyprland.monitors = [
"desc:Guangxi Century Innovation Display Electronics Co. Ltd 27C1U-D 0000000000001,preferred,-2400x0,1.6"
"desc:HP Inc. HP 24mh 3CM037248S,preferred,-1920x0,auto"
"desc:LG Electronics LG IPS QHD 109NTWG4Y865,preferred,-2560x0,auto"
"desc:LG Electronics LG IPS QHD 207NTVSE5615,preferred,-1152x0,1.25,transform,1"
];
} }

View file

@ -38,7 +38,17 @@ self: {
}; };
defaultApps.enable = true; defaultApps.enable = true;
desktop.hyprland.randomWallpaper = true;
desktop.hyprland = {
monitors = [
"desc:Guangxi Century Innovation Display Electronics Co. Ltd 27C1U-D 0000000000001,preferred,-2400x0,1.6"
"desc:HP Inc. HP 24mh 3CM037248S,preferred,-1920x0,auto"
"desc:LG Electronics LG IPS QHD 109NTWG4Y865,preferred,-2560x0,auto"
"desc:LG Electronics LG IPS QHD 207NTVSE5615,preferred,-1152x0,1.25,transform,1"
];
randomWallpaper = true;
};
theme = { theme = {
enable = true; enable = true;

View file

@ -4,4 +4,9 @@
pkgs, pkgs,
... ...
}: { }: {
home-manager.sharedModules = [
{
ar.home.desktop.hyprland.laptopMonitors = ["desc:BOE 0x095F,preferred,auto,1.566667"];
}
];
} }

View file

@ -6,9 +6,13 @@
}: { }: {
home-manager.sharedModules = [ home-manager.sharedModules = [
{ {
ar.home.services.easyeffects = { ar.home = {
enable = true; desktop.hyprland.laptopMonitors = ["desc:BOE 0x095F,preferred,auto,1.566667"];
preset = "framework13";
services.easyeffects = {
enable = true;
preset = "framework13";
};
}; };
} }
]; ];

View file

@ -9,7 +9,11 @@
sharedModules = [ sharedModules = [
{ {
xdg.userDirs.music = "/mnt/Media/Music"; xdg.userDirs.music = "/mnt/Media/Music";
ar.home.desktop.hyprland.autoSuspend = false;
ar.home.desktop.hyprland = {
autoSuspend = false;
monitors = ["desc:LG Electronics LG ULTRAWIDE 311NTAB5M720,preferred,auto,1.25,vrr,2"];
};
} }
]; ];

View file

@ -24,7 +24,13 @@
exec-once = ${lib.getExe self.inputs.iio-hyprland.packages.${pkgs.system}.default} "desc:Samsung Display Corp. 0x4152" exec-once = ${lib.getExe self.inputs.iio-hyprland.packages.${pkgs.system}.default} "desc:Samsung Display Corp. 0x4152"
''; '';
ar.home.desktop.hyprland.tabletMode.enable = true; ar.home.desktop.hyprland = {
laptopMonitors = ["desc:Samsung Display Corp. 0x4152,preferred,auto,2,transform,0"];
tabletMode = {
enable = true;
tabletSwitches = ["Lenovo Yoga Tablet Mode Control switch"];
};
};
} }
]; ];
} }

View file

@ -6,17 +6,17 @@
}: { }: {
home-manager.sharedModules = [ home-manager.sharedModules = [
{ {
programs.vscode.userSettings = {
"editor.fontSize" = lib.mkForce "16";
};
home.pointerCursor.size = lib.mkForce 24;
gtk.font.size = lib.mkForce 14; gtk.font.size = lib.mkForce 14;
home.pointerCursor.size = lib.mkForce 24;
programs.vscode.userSettings."editor.fontSize" = lib.mkForce "16";
ar.home.services.easyeffects = { ar.home = {
enable = true; desktop.hyprland.laptopMonitors = ["desc:LG Display 0x0569,preferred,auto,1.0"];
preset = "LoudnessEqualizer";
services.easyeffects = {
enable = true;
preset = "LoudnessEqualizer";
};
}; };
} }
]; ];