mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-25 13:51:54 -05:00
home/hyprland: add options for default workspaces and window manager binds
Some checks are pending
nix-build / default-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / petalburg-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run
Some checks are pending
nix-build / default-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / petalburg-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run
This commit is contained in:
parent
ab5081b910
commit
cf5ce8202f
|
@ -9,13 +9,10 @@ in {
|
|||
config = lib.mkIf cfg.desktop.hyprland.enable {
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
|
||||
settings =
|
||||
import ./vars.nix {inherit config lib pkgs;};
|
||||
|
||||
extraConfig = let
|
||||
inherit (import ./helpers.nix {inherit config lib pkgs;}) defaultWorkspaces windowManagerBinds;
|
||||
in ''
|
||||
extraConfig = ''
|
||||
submap=resize
|
||||
binde=,down,resizeactive,0 10
|
||||
binde=,left,resizeactive,-10 0
|
||||
|
@ -38,7 +35,7 @@ in {
|
|||
bind = , ${key}, movewindow, ${direction}
|
||||
bind = CONTROL, ${key}, movecurrentworkspacetomonitor, ${direction}
|
||||
'')
|
||||
windowManagerBinds
|
||||
cfg.desktop.hyprland.windowManagerBinds
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -46,7 +43,7 @@ in {
|
|||
${
|
||||
lib.strings.concatMapStringsSep "\n"
|
||||
(x: "bind = , ${toString x}, movetoworkspace, ${toString x}")
|
||||
defaultWorkspaces
|
||||
cfg.desktop.hyprland.workspaces
|
||||
}
|
||||
|
||||
# hyprnome
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.ar.home;
|
||||
in {
|
||||
# Media/hardware commands
|
||||
brightness = rec {
|
||||
bin = lib.getExe' pkgs.swayosd "swayosd-client";
|
||||
up = "${bin} --brightness=raise";
|
||||
down = "${bin} --brightness=lower";
|
||||
};
|
||||
|
||||
# Default apps
|
||||
defaultApps = {
|
||||
browser = lib.getExe cfg.defaultApps.webBrowser;
|
||||
editor = lib.getExe cfg.defaultApps.editor;
|
||||
fileManager = lib.getExe cfg.defaultApps.fileManager;
|
||||
launcher = lib.getExe pkgs.fuzzel;
|
||||
lock = lib.getExe pkgs.swaylock;
|
||||
logout = lib.getExe pkgs.wlogout;
|
||||
terminal = lib.getExe cfg.defaultApps.terminal;
|
||||
virtKeyboard = lib.getExe' pkgs.squeekboard "squeekboard";
|
||||
};
|
||||
|
||||
defaultWorkspaces = [1 2 3 4 5 6 7 8 9];
|
||||
|
||||
media = rec {
|
||||
bin = lib.getExe pkgs.playerctl;
|
||||
play = "${bin} play-pause";
|
||||
paus = "${bin} pause";
|
||||
next = "${bin} next";
|
||||
prev = "${bin} previous";
|
||||
};
|
||||
|
||||
screenshot = rec {
|
||||
bin = lib.getExe pkgs.hyprshot;
|
||||
folder = "${config.xdg.userDirs.pictures}/screenshots";
|
||||
screen = "${bin} -m output -o ${folder}";
|
||||
region = "${bin} -m region -o ${folder}";
|
||||
};
|
||||
|
||||
volume = rec {
|
||||
bin = lib.getExe' pkgs.swayosd "swayosd-client";
|
||||
up = "${bin} --output-volume=raise";
|
||||
down = "${bin} --output-volume=lower";
|
||||
mute = "${bin} --output-volume=mute-toggle";
|
||||
micMute = "${bin} --input-volume=mute-toggle";
|
||||
};
|
||||
|
||||
windowManagerBinds = {
|
||||
down = "d";
|
||||
left = "l";
|
||||
right = "r";
|
||||
up = "u";
|
||||
h = "l";
|
||||
j = "d";
|
||||
k = "u";
|
||||
l = "r";
|
||||
};
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
}: let
|
||||
cfg = config.ar.home;
|
||||
hyprctl = lib.getExe' config.wayland.windowManager.hyprland.package "hyprctl";
|
||||
inherit (import ./helpers.nix {inherit config lib pkgs;}) defaultApps media;
|
||||
virtKeyboard = lib.getExe' pkgs.squeekboard "squeekboard";
|
||||
in {
|
||||
clamshell = pkgs.writeShellScript "hyprland-clamshell" ''
|
||||
NUM_MONITORS=$(${hyprctl} monitors all | grep Monitor | wc --lines)
|
||||
|
@ -25,11 +25,11 @@ in {
|
|||
|
||||
idleD = pkgs.writeShellScript "hyprland-idled" ''
|
||||
${lib.getExe pkgs.swayidle} -w \
|
||||
before-sleep '${media.paus}' \
|
||||
before-sleep '${defaultApps.lock}' \
|
||||
before-sleep '${lib.getExe pkgs.playerctl} play-pause' \
|
||||
before-sleep '${lib.getExe pkgs.swaylock}' \
|
||||
timeout 240 '${lib.getExe pkgs.brightnessctl} -s set 10' \
|
||||
resume '${lib.getExe pkgs.brightnessctl} -r' \
|
||||
timeout 300 '${defaultApps.lock}' \
|
||||
timeout 300 '${lib.getExe pkgs.swaylock}' \
|
||||
timeout 330 '${hyprctl} dispatch dpms off' \
|
||||
resume '${hyprctl} dispatch dpms on' \
|
||||
${
|
||||
|
@ -43,8 +43,8 @@ in {
|
|||
STATE=`${lib.getExe pkgs.dconf} read /org/gnome/desktop/a11y/applications/screen-keyboard-enabled`
|
||||
|
||||
if [ $STATE -z ] || [ $STATE == "false" ]; then
|
||||
if ! [ `pgrep -f ${defaultApps.virtKeyboard}` ]; then
|
||||
${defaultApps.virtKeyboard} &
|
||||
if ! [ `pgrep -f ${virtKeyboard}` ]; then
|
||||
${virtKeyboard} &
|
||||
fi
|
||||
${lib.getExe pkgs.dconf} write /org/gnome/desktop/a11y/applications/screen-keyboard-enabled true
|
||||
elif [ $STATE == "true" ]; then
|
||||
|
|
|
@ -6,16 +6,46 @@
|
|||
}: let
|
||||
cfg = config.ar.home;
|
||||
inherit (import ./scripts.nix {inherit config lib pkgs;}) clamshell idleD tablet wallpaperD;
|
||||
inherit
|
||||
(import ./helpers.nix {inherit config lib pkgs;})
|
||||
brightness
|
||||
defaultApps
|
||||
defaultWorkspaces
|
||||
media
|
||||
screenshot
|
||||
volume
|
||||
windowManagerBinds
|
||||
;
|
||||
|
||||
# Media/hardware commands
|
||||
brightness = rec {
|
||||
bin = lib.getExe' pkgs.swayosd "swayosd-client";
|
||||
up = "${bin} --brightness=raise";
|
||||
down = "${bin} --brightness=lower";
|
||||
};
|
||||
|
||||
# Default apps
|
||||
defaultApps = {
|
||||
browser = lib.getExe cfg.defaultApps.webBrowser;
|
||||
editor = lib.getExe cfg.defaultApps.editor;
|
||||
fileManager = lib.getExe cfg.defaultApps.fileManager;
|
||||
launcher = lib.getExe pkgs.fuzzel;
|
||||
logout = lib.getExe pkgs.wlogout;
|
||||
terminal = lib.getExe cfg.defaultApps.terminal;
|
||||
};
|
||||
|
||||
media = rec {
|
||||
bin = lib.getExe pkgs.playerctl;
|
||||
play = "${bin} play-pause";
|
||||
paus = "${bin} pause";
|
||||
next = "${bin} next";
|
||||
prev = "${bin} previous";
|
||||
};
|
||||
|
||||
screenshot = rec {
|
||||
bin = lib.getExe pkgs.hyprshot;
|
||||
folder = "${config.xdg.userDirs.pictures}/screenshots";
|
||||
screen = "${bin} -m output -o ${folder}";
|
||||
region = "${bin} -m region -o ${folder}";
|
||||
};
|
||||
|
||||
volume = rec {
|
||||
bin = lib.getExe' pkgs.swayosd "swayosd-client";
|
||||
up = "${bin} --output-volume=raise";
|
||||
down = "${bin} --output-volume=lower";
|
||||
mute = "${bin} --output-volume=mute-toggle";
|
||||
micMute = "${bin} --input-volume=mute-toggle";
|
||||
};
|
||||
in {
|
||||
"$mod" = "SUPER";
|
||||
|
||||
|
@ -37,7 +67,7 @@ in {
|
|||
bind =
|
||||
[
|
||||
"$mod CONTROL, F12, exec, ${screenshot.region}"
|
||||
"$mod CONTROL, L, exec, ${defaultApps.lock}"
|
||||
"$mod CONTROL, L, exec, ${lib.getExe pkgs.swaylock}"
|
||||
"$mod SHIFT, S, movetoworkspace, special:magic"
|
||||
"$mod SHIFT, V, togglefloating"
|
||||
"$mod SHIFT, W, fullscreen"
|
||||
|
@ -63,11 +93,11 @@ in {
|
|||
"CTRL ALT,M,submap,move"
|
||||
"CTRL ALT,R,submap,resize"
|
||||
]
|
||||
++ builtins.map (x: "$mod, ${toString x}, workspace, ${toString x}") defaultWorkspaces
|
||||
++ builtins.map (x: "$mod SHIFT, ${toString x}, movetoworkspace, ${toString x}") defaultWorkspaces
|
||||
++ lib.attrsets.mapAttrsToList (key: direction: "$mod, ${key}, movefocus, ${direction}") windowManagerBinds
|
||||
++ lib.attrsets.mapAttrsToList (key: direction: "$mod SHIFT, ${key}, movewindow, ${direction}") windowManagerBinds
|
||||
++ lib.attrsets.mapAttrsToList (key: direction: "$mod CONTROL SHIFT, ${key}, movecurrentworkspacetomonitor, ${direction}") windowManagerBinds;
|
||||
++ builtins.map (x: "$mod, ${toString x}, workspace, ${toString x}") cfg.desktop.hyprland.workspaces
|
||||
++ builtins.map (x: "$mod SHIFT, ${toString x}, movetoworkspace, ${toString x}") cfg.desktop.hyprland.workspaces
|
||||
++ lib.attrsets.mapAttrsToList (key: direction: "$mod, ${key}, movefocus, ${direction}") cfg.desktop.hyprland.windowManagerBinds
|
||||
++ lib.attrsets.mapAttrsToList (key: direction: "$mod SHIFT, ${key}, movewindow, ${direction}") cfg.desktop.hyprland.windowManagerBinds
|
||||
++ lib.attrsets.mapAttrsToList (key: direction: "$mod CONTROL SHIFT, ${key}, movecurrentworkspacetomonitor, ${direction}") cfg.desktop.hyprland.windowManagerBinds;
|
||||
|
||||
bindm = [
|
||||
# Move/resize windows with mainMod + LMB/RMB and dragging
|
||||
|
|
|
@ -151,6 +151,27 @@ in {
|
|||
type = lib.types.bool;
|
||||
};
|
||||
|
||||
workspaces = lib.mkOption {
|
||||
description = "Default numbered workspaces to create.";
|
||||
default = [1 2 3 4 5 6 7 8 9];
|
||||
type = lib.types.listOf lib.types.int;
|
||||
};
|
||||
|
||||
windowManagerBinds = lib.mkOption {
|
||||
description = "Default binds for window management.";
|
||||
default = {
|
||||
down = "d";
|
||||
left = "l";
|
||||
right = "r";
|
||||
up = "u";
|
||||
h = "l";
|
||||
j = "d";
|
||||
k = "u";
|
||||
l = "r";
|
||||
};
|
||||
type = lib.types.attrs;
|
||||
};
|
||||
|
||||
tabletMode = {
|
||||
enable = lib.mkEnableOption "Tablet mode for hyprland.";
|
||||
|
||||
|
|
Loading…
Reference in a new issue