Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
number5 committed Jun 11, 2024
1 parent 8de8a6c commit 2a6f700
Show file tree
Hide file tree
Showing 9 changed files with 399 additions and 12 deletions.
11 changes: 9 additions & 2 deletions home/modules/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
inputs: {
{
inputs,
pkgs,
...
}: {
"home" = import ./home.nix inputs;
"wezterm" = import ./wezterm inputs;
"programs/nixpkgs" = import ./programs/nixpkgs inputs;
Expand All @@ -12,5 +16,8 @@ inputs: {
"anyrun" = import ./anyrun inputs;
"eww" = import ./wayland/eww inputs;
"swappy" = import ./swappy.nix inputs;
"hyprland" = import ./wayland/hyprland.nix inputs;
"hyprland" = import ./wayland/hyprland {
inputs = inputs;
pkgs = pkgs;
};
}
1 change: 0 additions & 1 deletion home/modules/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ in {
p = pkgs;
s = self';
in [
p.cachix
p.exercism
p.lefthook
];
Expand Down
124 changes: 124 additions & 0 deletions home/modules/wayland/hyprland/binds.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
let
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
workspaces = builtins.concatLists (builtins.genList (
x: let
ws = let
c = (x + 1) / 10;
in
builtins.toString (x + 1 - (c * 10));
in [
"$mod, ${ws}, workspace, ${toString (x + 1)}"
"$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
]
)
10);
in {
wayland.windowManager.hyprland.settings = {
# mouse movements
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
"$mod ALT, mouse:272, resizewindow"
];

# binds
bind = let
monocle = "dwindle:no_gaps_when_only";
in
[
# compositor commands
"$mod SHIFT, E, exec, pkill Hyprland"
"$mod, Q, killactive,"
"$mod, F, fullscreen,"
"$mod, G, togglegroup,"
"$mod SHIFT, N, changegroupactive, f"
"$mod SHIFT, P, changegroupactive, b"
"$mod, R, togglesplit,"
"$mod, T, togglefloating,"
"$mod, P, pseudo,"
"$mod ALT, ,resizeactive,"

# toggle "monocle" (no_gaps_when_only)
"$mod, M, exec, hyprctl keyword ${monocle} $(($(hyprctl getoption ${monocle} -j | jaq -r '.int') ^ 1))"

# utility
# terminal
"$mod, Return, exec, run-as-service foot"
# logout menu
"$mod, Escape, exec, wlogout -p layer-shell"
# lock screen
"$mod, L, exec, loginctl lock-session"
# lock screen, to be used with the F10 special key on my keyboard
"$mod, I, exec, loginctl lock-session"
# select area to perform OCR on
"$mod, O, exec, run-as-service wl-ocr"
", XF86Favorites, exec, run-as-service wl-ocr"
# open calculator
", XF86Calculator, exec, run-as-service gnome-calculator"
# open settings
"$mod, U, exec, XDG_CURRENT_DESKTOP=gnome gnome-control-center"

# move focus
"$mod, left, movefocus, l"
"$mod, right, movefocus, r"
"$mod, up, movefocus, u"
"$mod, down, movefocus, d"

# screenshot
# area
", Print, exec, grimblast --notify copysave area"
"$mod SHIFT, R, exec, grimblast --notify copysave area"

# current screen
"CTRL, Print, exec, grimblast --notify --cursor copysave output"
"$mod SHIFT CTRL, R, exec, grimblast --notify --cursor copysave output"

# all screens
"ALT, Print, exec, grimblast --notify --cursor copysave screen"
"$mod SHIFT ALT, R, exec, grimblast --notify --cursor copysave screen"

# special workspace
"$mod SHIFT, grave, movetoworkspace, special"
"$mod, grave, togglespecialworkspace, eDP-1"

# cycle workspaces
"$mod, bracketleft, workspace, m-1"
"$mod, bracketright, workspace, m+1"

# cycle monitors
"$mod SHIFT, bracketleft, focusmonitor, l"
"$mod SHIFT, bracketright, focusmonitor, r"

# send focused workspace to left/right monitors
"$mod SHIFT ALT, bracketleft, movecurrentworkspacetomonitor, l"
"$mod SHIFT ALT, bracketright, movecurrentworkspacetomonitor, r"
]
++ workspaces;

bindr = [
# launcher
"$mod, SUPER_L, exec, pkill .anyrun-wrapped || run-as-service anyrun"
];

bindl = [
# media controls
", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioPrev, exec, playerctl previous"
", XF86AudioNext, exec, playerctl next"

# volume
", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
];

bindle = [
# volume
", XF86AudioRaiseVolume, exec, wpctl set-volume -l '1.0' @DEFAULT_AUDIO_SINK@ 6%+"
", XF86AudioLowerVolume, exec, wpctl set-volume -l '1.0' @DEFAULT_AUDIO_SINK@ 6%-"

# backlight
", XF86MonBrightnessUp, exec, brillo -q -u 300000 -A 5"
", XF86MonBrightnessDown, exec, brillo -q -u 300000 -U 5"
];
};
}
34 changes: 34 additions & 0 deletions home/modules/wayland/hyprland/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
inputs,
pkgs,
...
}: {
imports = [
inputs.hyprland.homeManagerModules.default
./binds.nix
./rules.nix
./settings.nix
];

home.packages = [
inputs.hyprland-contrib.packages.${pkgs.system}.grimblast
];

# enable hyprland
wayland.windowManager.hyprland = {
enable = true;

plugins = with inputs.hyprland-plugins.packages.${pkgs.system}; [
# hyprbars
# hyprexpo
];

systemd = {
variables = ["--all"];
extraCommands = [
"systemctl --user stop graphical-session.target"
"systemctl --user start hyprland-session.target"
];
};
};
}
74 changes: 74 additions & 0 deletions home/modules/wayland/hyprland/rules.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{lib, ...}: {
wayland.windowManager.hyprland.settings = {
# layer rules
layerrule = let
toRegex = list: let
elements = lib.concatStringsSep "|" list;
in "^(${elements})$";

lowopacity = [
"bar"
"calendar"
"notifications"
"osd"
"system-menu"
];

highopacity = [
"anyrun"
"logout_dialog"
];

blurred = lib.concatLists [
lowopacity
highopacity
];
in [
"blur, ${toRegex blurred}"
"xray 1, ${toRegex ["bar"]}"
"ignorealpha 0.5, ${toRegex (highopacity ++ ["music"])}"
"ignorealpha 0.2, ${toRegex lowopacity}"
];

# window rules
windowrulev2 = [
# telegram media viewer
"float, title:^(Media viewer)$"

# gnome calculator
"float, class:^(org.gnome.Calculator)$"
"size 360 490, class:^(org.gnome.Calculator)$"

# allow tearing in games
"immediate, class:^(osu\!|cs2)$"

# make Firefox PiP window floating and sticky
"float, title:^(Picture-in-Picture)$"
"pin, title:^(Picture-in-Picture)$"

# throw sharing indicators away
"workspace special silent, title:^(Firefox — Sharing Indicator)$"
"workspace special silent, title:^(.*is sharing (your screen|a window)\.)$"

# start spotify in ws9
"workspace 9 silent, title:^(Spotify( Premium)?)$"

# idle inhibit while watching videos
"idleinhibit focus, class:^(mpv|.+exe|celluloid)$"
"idleinhibit focus, class:^(firefox)$, title:^(.*YouTube.*)$"
"idleinhibit fullscreen, class:^(firefox)$"

"dimaround, class:^(gcr-prompter)$"
"dimaround, class:^(xdg-desktop-portal-gtk)$"
"dimaround, class:^(polkit-gnome-authentication-agent-1)$"

# fix xwayland apps
"rounding 0, xwayland:1"
"center, class:^(.*jetbrains.*)$, title:^(Confirm Exit|Open Project|win424|win201|splash)$"
"size 640 400, class:^(.*jetbrains.*)$, title:^(splash)$"

# don't render hyprbars on tiling windows
"plugin:hyprbars:nobar, floating:0"
];
};
}
Loading

0 comments on commit 2a6f700

Please sign in to comment.