Skip to content

Commit

Permalink
big changes
Browse files Browse the repository at this point in the history
  • Loading branch information
number5 committed Nov 27, 2024
1 parent dc6765f commit 440b2eb
Show file tree
Hide file tree
Showing 8 changed files with 419 additions and 271 deletions.
261 changes: 31 additions & 230 deletions flake.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

nixos-hardware.url = "github:NixOS/nixos-hardware";

nixd.url = "github:nix-community/nixd";
nuenv.url = "github:DeterminateSystems/nuenv";
# nixd.url = "github:nix-community/nixd";
# nuenv.url = "github:DeterminateSystems/nuenv";

# Fast nix search client
nix-search = {
Expand Down
123 changes: 123 additions & 0 deletions home/modules/wayland/hyprland/binds.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
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);

toggle = program: let
prog = builtins.substring 0 14 program;
in "pkill ${prog} || uwsm app -- ${program}";

runOnce = program: "pgrep ${program} || uwsm app -- ${program}";
in {
wayland.windowManager.hyprland.settings = {
# mouse movements
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
"$mod ALT, mouse:272, resizewindow"
];

# binds
bind =
[
# 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,"

# utility
# terminal
"$mod, Return, exec, uwsm app -- foot"
# logout menu
"$mod, Escape, exec, ${toggle "wlogout"} -p layer-shell"
# lock screen
"$mod, L, exec, ${runOnce "hyprlock"}"
# lock screen, to be used with the special key Fn+F10 on my keyboard
"$mod, I, exec, ${runOnce "hyprlock"}"
# select area to perform OCR on
"$mod, O, exec, ${runOnce "wl-ocr"}"
", XF86Favorites, exec, ${runOnce "wl-ocr"}"
# open settings
# "$mod, U, exec, XDG_CURRENT_DESKTOP=gnome ${runOnce "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, ${runOnce "grimblast"} --notify copysave area"
"$mod SHIFT, R, exec, ${runOnce "grimblast"} --notify copysave area"

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

# all screens
"ALT, Print, exec, ${runOnce "grimblast"} --notify --cursor copysave screen"
"$mod SHIFT ALT, R, exec, ${runOnce "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, ${toggle "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"
];
};
}
32 changes: 18 additions & 14 deletions home/modules/wayland/hyprland/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@
wpctl = "${pkgs.wireplumber}/bin/wpctl";
in {
imports = [
# ../../shared
# ../../foot
../../hyprlock
../../hyprpaper
# ../../programs/pyprland
# ../../programs/waybar
../../hypridle
./binds.nix
./rules.nix
./settings.nix
];

home = {
Expand Down Expand Up @@ -98,28 +97,33 @@ in {
wayland.windowManager.hyprland = {
enable = true;
extraConfig =
(builtins.readFile ./hyprland.conf)
+ ''
''
# debug
debug:disable_scale_checks=true
# bindings
bind=SUPER,P,exec,${lib.getExe pkgs.wofi} --show run --style=${./wofi.css} --term=footclient --prompt=Run
bind=SUPER,A,exec,${gblast} save area
bind=SUPER,S,exec,${gblast} save screen
bind=SUPERCTRL,L,exec,${lib.getExe pkgs.hyprlock}
# audio volume bindings
bindel=,XF86AudioRaiseVolume,exec,${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 5%+
bindel=,XF86AudioLowerVolume,exec,${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindl=,XF86AudioMute,exec,${wpctl} set-mute @DEFAULT_AUDIO_SINK@ toggle
exec-once=~/.config/hypr/start-way-displays.sh
exec-once=${lib.getExe pkgs.hyprpaper}
exec-once=${pkgs.pyprland}/bin/pypr
exec-once=${pkgs.blueman}/bin/blueman-applet
exec-once=${pkgs.networkmanagerapplet}/bin/nm-applet --sm-disable --indicator
exec-once=${lib.getExe pkgs.pasystray}
'';
plugins = [];

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

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

highopacity = [
"anyrun"
"osd"
"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)$"

# Bitwarden extension
"float, title:^(.*Bitwarden Password Manager.*)$"

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

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

# make Firefox/Zen 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:^(Zen — 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:^(zen)$, title:^(.*YouTube.*)$"
"idleinhibit fullscreen, class:^(zen)$"

"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 440b2eb

Please sign in to comment.