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
(import ./vars.nix)
defaultWorkspaces
externalMonitors
laptopMonitors
layerRules
modifier
windowManagerBinds
@ -110,12 +108,10 @@ in {
${hyprctl} keyword monitor "eDP-1, disable"
fi
elif [ "$1" == "off" ]; then
${
lib.strings.concatLines
(
lib.attrsets.mapAttrsToList (name: monitor: ''${hyprctl} keyword monitor "${monitor}"'')
laptopMonitors
)
${
lib.strings.concatMapStringsSep "\n"
(monitor: ''${hyprctl} keyword monitor "${monitor}"'')
cfg.desktop.hyprland.laptopMonitors
}
fi
'';
@ -172,143 +168,142 @@ in {
}
'';
in ''
${
lib.strings.concatLines
(
lib.attrsets.mapAttrsToList (name: value: "monitor = ${value}")
(laptopMonitors // externalMonitors)
)
${
lib.strings.concatMapStringsSep "\n"
(monitor: ''monitor = ${monitor}'')
(cfg.desktop.hyprland.laptopMonitors
++ cfg.desktop.hyprland.monitors)
}
monitor = ,preferred,auto,auto
# Turn off the internal display when lid is closed.
bindl=,switch:on:Lid Switch,exec,${clamshell} on
bindl=,switch:off:Lid Switch,exec,${clamshell} off
monitor = ,preferred,auto,auto
# Enable virtual keyboard in tablet mode
bindl=,switch:Lenovo Yoga Tablet Mode Control switch,exec,${tablet}
# Turn off the internal display when lid is closed.
bindl = ,switch:on:Lid Switch,exec,${clamshell} on
bindl = ,switch:off:Lid Switch,exec,${clamshell} off
# unscale XWayland apps
xwayland {
force_zero_scaling = true
}
# Enable virtual keyboard in tablet mode
${
lib.strings.concatMapStringsSep "\n"
(switch: ''bindl = ,switch:${switch},exec,${tablet}'')
cfg.desktop.hyprland.tabletMode.tabletSwitches
}
# Some default env vars.
env = XCURSOR_SIZE,${toString config.home.pointerCursor.size}
env = QT_QPA_PLATFORMTHEME,qt6ct
# unscale XWayland apps
xwayland {
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
"\n"
(x: "exec-once = ${x}")
startupApps
}
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
kb_layout = us
kb_variant = altgr-intl
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 = true
tap-to-click = true
}
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
kb_layout = us
kb_variant = altgr-intl
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 = true
tap-to-click = true
}
}
gestures {
workspace_swipe = true
workspace_swipe_touch = true
gestures {
workspace_swipe = 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 {
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)
animations {
enabled = yes
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
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 {
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)
master {
always_center_master = true
new_status = false
}
dim_special = 0.5
misc {
disable_hyprland_logo = true
disable_splash_rendering = true
focus_on_activate = true
vfr = true
}
# Window-specific rules
${layerRules}
}
# Window Rules
${windowRules}
animations {
enabled = yes
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
# 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}
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
}
# Manage session.
bind = ${modifier}, C, killactive,
bind = ${modifier} CONTROL, L, exec, ${defaultApps.lock}
bind = ${modifier}, M, exec, ${defaultApps.logout}
dwindle {
preserve_split = yes
}
# 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
master {
always_center_master = true
new_status = false
}
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.
${
# 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.attrsets.mapAttrsToList (key: direction: ''
@ -320,14 +315,14 @@ in {
)
}
# Gnome-like workspaces.
bind = ${modifier}, comma, exec, ${hyprnome} --previous
bind = ${modifier}, period, exec, ${hyprnome}
bind = ${modifier} SHIFT, comma, exec, ${hyprnome} --previous --move
bind = ${modifier} SHIFT, period, exec, ${hyprnome} --move
# Gnome-like workspaces.
bind = ${modifier}, comma, exec, ${hyprnome} --previous
bind = ${modifier}, period, exec, ${hyprnome}
bind = ${modifier} SHIFT, comma, exec, ${hyprnome} --previous --move
bind = ${modifier} SHIFT, period, exec, ${hyprnome} --move
# Switch workspaces with mainMod + [1-9] ++
# Move active window to a workspace with mainMod + SHIFT + [1-9].
# Switch workspaces with mainMod + [1-9] ++
# Move active window to a workspace with mainMod + SHIFT + [1-9].
${
lib.strings.concatMapStringsSep "\n"
(x: ''
@ -337,56 +332,56 @@ in {
defaultWorkspaces
}
# Scratchpad show and move
bind = ${modifier}, S, togglespecialworkspace, magic
bind = ${modifier} SHIFT, S, movetoworkspace, special:magic
# 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
# 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
# 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}
# 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}
# Screenshot with hyprshot.
bind = , PRINT, exec, ${screenshot.screen}
bind = ${modifier}, PRINT, exec, ${screenshot.region}
bind = CONTROL, F12, exec, ${screenshot.screen}
bind = ${modifier} CONTROL, F12, exec, ${screenshot.region}
# Screenshot with hyprshot.
bind = , PRINT, exec, ${screenshot.screen}
bind = ${modifier}, PRINT, exec, ${screenshot.region}
bind = CONTROL, F12, exec, ${screenshot.screen}
bind = ${modifier} CONTROL, F12, exec, ${screenshot.region}
# Show/hide waybar.
bind = ${modifier}, F11, exec, pkill -SIGUSR1 waybar
# 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
binde=,j,resizeactive,0 10
binde=,h,resizeactive,-10 0
binde=,l,resizeactive,10 0
binde=,k,resizeactive,0 -10
bind=,escape,submap,reset
submap=reset
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
binde=,j,resizeactive,0 10
binde=,h,resizeactive,-10 0
binde=,l,resizeactive,10 0
binde=,k,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.
${
bind=CTRL ALT,M,submap,move
submap=move
# Move window with keys ++
# Move workspaces across monitors with CONTROL + keys.
${
lib.strings.concatLines
(
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"
(x: "bind = , ${toString x}, movetoworkspace, ${toString x}")
defaultWorkspaces
}
# hyprnome
bind = , comma, exec, ${hyprnome} --previous --move
bind = , period, exec, ${hyprnome} --move
bind=,escape,submap,reset
submap=reset
# hyprnome
bind = , comma, exec, ${hyprnome} --previous --move
bind = , period, exec, ${hyprnome} --move
bind=,escape,submap,reset
submap=reset
'';
};
};

View file

@ -1,21 +1,6 @@
{
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 = ''
# Window-specific rules
layerrule = blur, waybar

View file

@ -3,7 +3,6 @@
lib,
osConfig,
pkgs,
self,
...
}: let
cfg = config.ar.home;
@ -105,6 +104,18 @@ in {
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 {
description = "Whether to enable random wallpaper script.";
default = cfg.desktop.hyprland.enable;
@ -132,6 +143,12 @@ in {
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 {
description = "Whether to enable dynamic virtual keyboard.";
default = cfg.desktop.hyprland.tabletMode.enable;

View file

@ -54,4 +54,11 @@
# 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;
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 = {
enable = true;

View file

@ -4,4 +4,9 @@
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 = [
{
ar.home.services.easyeffects = {
enable = true;
preset = "framework13";
ar.home = {
desktop.hyprland.laptopMonitors = ["desc:BOE 0x095F,preferred,auto,1.566667"];
services.easyeffects = {
enable = true;
preset = "framework13";
};
};
}
];

View file

@ -9,7 +9,11 @@
sharedModules = [
{
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"
'';
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 = [
{
programs.vscode.userSettings = {
"editor.fontSize" = lib.mkForce "16";
};
home.pointerCursor.size = lib.mkForce 24;
gtk.font.size = lib.mkForce 14;
home.pointerCursor.size = lib.mkForce 24;
programs.vscode.userSettings."editor.fontSize" = lib.mkForce "16";
ar.home.services.easyeffects = {
enable = true;
preset = "LoudnessEqualizer";
ar.home = {
desktop.hyprland.laptopMonitors = ["desc:LG Display 0x0569,preferred,auto,1.0"];
services.easyeffects = {
enable = true;
preset = "LoudnessEqualizer";
};
};
}
];