Skip to content

Commit

Permalink
add initial hyprland & waybar config
Browse files Browse the repository at this point in the history
  • Loading branch information
redxtech committed Feb 28, 2024
1 parent 2502205 commit 269bf8a
Show file tree
Hide file tree
Showing 16 changed files with 1,471 additions and 10 deletions.
543 changes: 536 additions & 7 deletions flake.lock

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
inputs.nixpkgs.follows = "nixpkgs";
};

hyprland.url = "github:hyprwm/Hyprland";
hyprland-contrib.url = "github:hyprwm/contrib";
hyprland-contrib.inputs.nixpkgs.follows = "nixpkgs";
hyprland-plugins.url = "github:hyprwm/hyprland-plugins";
hyprland-plugins.inputs.hyprland.follows = "hyprland";

nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
Expand Down Expand Up @@ -39,7 +45,7 @@
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
nix-flatpak.url = "github:gmodena/nix-flatpak";
nix-autobahn.url = "github:lassulus/nix-autobahn";
# xremap-flake.url = "github:xremap/nix-flake";
xremap-flake.url = "github:xremap/nix-flake";
# nur.url = "github:nix-community/NUR";
# nix-minecraft.url = "github:Infinidoge/nix-minecraft";
};
Expand Down
1 change: 1 addition & 0 deletions home/gabe/bastion.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
imports = [
./global
./features/desktop/bspwm
# ./features/desktop/hyprland
./features/desktop/common/kdeconnect.nix
];

Expand Down
141 changes: 141 additions & 0 deletions home/gabe/features/desktop/hyprland/binds.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{ inputs, pkgs, ... }:

{
wayland.windowManager.hyprland = with pkgs; {
settings = {
"$mod" = "SUPER";
"$terminal" = "${kitty}/bin/kitty";
"$browser" =
"${firefox-devedition-bin}/bin/firefox-developer-edition -p gabe";
"$editor" = "${neovim}/bin/nvim";
"$explorer" = "${cinnamon.nemo-with-extensions}/bin/nemo";
"$music" = "${spotifywm}/bin/spotifywm";

bind = let hypr-contrib = inputs.hyprland-contrib.packages.${pkgs.system};
in [
# hyprland
"$mod, Q, killactive"
"$mod ALT, Q, exit"
"$mod, M, exec, hyprctl keyword general:layout master"
"$mod SHIFT, M, exec, hyprctl keyword general:layout dwindle"
"$mod CTRL, M, layoutmsg, orientationnext"

# move focus with super + arrow keys
"$mod, H, movefocus, l"
"$mod, L, movefocus, r"
"$mod, K, movefocus, u"
"$mod, J, movefocus, d"
"$mod ALT, J, cyclenext, prev"
"$mod ALT, K, cyclenext"
"$mod, grave, focuscurrentorlast"
"$mod, Tab, workspace, previous"

# move windows
"$mod SHIFT, H, movewindow, l"
"$mod SHIFT, L, movewindow, r"
"$mod SHIFT, K, movewindow, u"
"$mod SHIFT, J, movewindow, d"
"$mod SHIFT ALT, J, swapnext, prev"
"$mod SHIFT ALT, K, swapnext"

# state flags
"$mod, S, togglefloating"
"$mod, Y, pin"
"$mod, F, fullscreen"
"$mod SHIFT, F, fakefullscreen"
"$mod CTRL, J, togglesplit" # dwindle only
"$mod, P, pseudo" # dwindle only
"$mod, V, togglespecialworkspace, hidden"
"$mod SHIFT, V, movetoworkspacesilent, special:hidden"

# scroll through workspaces
"$mod, mouse_down, workspace, m-1"
"$mod, mouse_up, workspace, m+1"
"$mod, bracketleft, workspace, m-1"
"$mod, bracketright, workspace, m+1"

# selector
"$mod, Tab, exec, ${pyprland}/bin/pypr expose"

# lock and sleep
"$mod SHIFT, L, exec, loginctl lock-session"
"$mod CTRL, L, exec, loginctl sleep-session"

# app launchers
"$mod, Return, exec, $terminal"
"$mod SHIFT, Return, exec, [floating] $terminal"
"$mod, SPACE, exec, rofi -show drun"
"$mod, W, exec, $browser"
"$mod, F, exec, $explorer"
"$mod, N, exec, ${neovide}/bin/neovide"

# terminal apps
"$mod, U, exec, ${hdrop}/bin/hdrop -b $terminal --class kitty_btop btop"
"$mod, R, exec, $terminal ranger"
"$mod SHIFT, N, exec, [floating] $terminal zsh -c 'neofetch && exec zsh'"

# focus apps

# rofi
"$mod SHIFT, E, exec, ~/.config/rofi/scripts/wayland/rofi-powermenu"
"$mod, Backspace, exec, ~/.config/rofi/scripts/wayland/rofi-powermenu"

# notifications
"$mod ALT, H, exec, ${dunst}/bin/dunstctl history-pop"
"$mod SHIFT ALT, H, exec, ${dunst}/bin/dunstctl close-all"

# screenshot
", Print, exec, ${hypr-contrib.grimblast}/bin/grimblast --notify copy area"
"SHIFT, Print, exec, ${hypr-contrib.grimblast}/bin/grimblast --notify copy output"
"$mod, Print, exec, ${hypr-contrib.grimblast}/bin/grimblast --notify save area - | ${swappy}/bin/swappy -f -"
] ++ (
# workspaces
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
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}, movetoworkspacesilent, ${toString (x + 1)}"
]) 10));

bindl = let
pctl = "${playerctl}/bin/playerctl";
spot = "${pctl} --player=$music";
chrome = "${pctl} --player=chromium";
mpv = "${pctl} --player=mpv";
wp = "${wireplumber}/bin/wpctl";
volume = ''${wp} set-volume "@DEFAULT_AUDIO_SINK@"'';
mute = ''${wp} set-mute "@DEFAULT_AUDIO_SINK@" toggle'';
in [
# media control
", XF86AudioPlay, exec, ${spot} --play-pause"
", XF86AudioNext, exec, ${spot} --next"
", XF86AudioPrev, exec, ${spot} --previous"

"SHIFT, XF86AudioPlay, exec, ${chrome} --play-pause"
"SHIFT, XF86AudioNext, exec, ${chrome} --next"
"SHIFT, XF86AudioPrev, exec, ${chrome} --previous"

"ALT, XF86AudioPlay, exec, ${mpv} --play-pause"
"ALT, XF86AudioNext, exec, ${mpv} --next"
"ALT, XF86AudioPrev, exec, ${mpv} --previous"

"CTRL, XF86AudioPlay, exec, ${pctl} --play-pause"
"CTRL, XF86AudioNext, exec, ${pctl} --next"
"CTRL, XF86AudioPrev, exec, ${pctl} --previous"

# volume
", XF86AudioRaiseVolume, exec, ${volume} 5%+"
", XF86AudioLowerVolume, exec, ${volume} 5%-"
", XF86AudioMuteVolume, exec, ${mute}"
];

bindm = [
# move & resize windows
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
};
};
}
160 changes: 160 additions & 0 deletions home/gabe/features/desktop/hyprland/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{ inputs, pkgs, ... }:

{
imports = [
inputs.hyprland.homeManagerModules.default

./binds.nix
./exec.nix
./rules.nix
./pypr.nix

# ./waybar

../common
../bspwm/autorandr.nix
../bspwm/default-apps.nix
../bspwm/dunst.nix
../rofi

../wayland
];

home.packages = with pkgs;
let
core = inputs.hyprland.packages.${pkgs.system};
contrib = inputs.hyprland-contrib.packages.${pkgs.system};
in [
core.xdg-desktop-portal-hyprland

contrib.hdrop
contrib.grimblast
contrib.scratchpad
pyprland

cliphist
dunst
swww
pipewire
wireplumber

qt6.qtwayland
libsForQt5.qt5.qtwayland
];

wayland.windowManager.hyprland = {
enable = true;

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

settings = with pkgs; {
monitor = [ "DP-1,2560x1440,0x0,1" "DP-2,2560x1440,2560x0,1" ];

input = {
# kb_layout = us
# kb_options = caps:hyper,shift:both_capslock_cancel
# kb_file = "$HOME/.config/xkb/hyper-caps-mod3.xkb";

follow_mouse = 1;

touchpad = { natural_scroll = "no"; };

repeat_rate = 40;
repeat_delay = 240;
sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
};

general = {
gaps_in = 7;
gaps_out = 10;
border_size = 2;
# "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
"col.active_border" = "rgba(8be9fdee) rgba(6c71c4ee) 45deg";
"col.inactive_border" = "rgba(073642aa)";

layout = "dwindle";
};

misc = {
mouse_move_enables_dpms = true;
key_press_enables_dpms = true;
focus_on_activate = true;
enable_swallow = false;
swallow_regex = "^(kitty)$";
};

decoration = {
# See https://wiki.hyprland.org/Configuring/Variables/ for more

rounding = 0;

drop_shadow = "yes";
shadow_range = 4;
shadow_render_power = 3;
"col.shadow" = "rgba(1a1a1aee)";

blur = {
enabled = "yes";
size = 8;
passes = 2;
ignore_opacity = "yes";

};
};

animations = {
enabled = "yes";

# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more

bezier = "myBezier, 0.05, 0.9, 0.1, 1.05";

animation = [
"windows, 1, 4, myBezier"
"windowsOut, 1, 4, default, popin 80%"
"border, 1, 8, default"
"borderangle, 1, 6, default"
"fade, 1, 4, default"
"workspaces, 1, 4, default"
];

};

dwindle = {
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
pseudotile =
"yes"; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below;
preserve_split = "yes"; # you probably want this
force_split = 2;
};

master = {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
new_is_master = false;
};

gestures = {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = "off";
};

# Example per-device config
# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more
# "device:epic mouse V1" = { sensitivity = -0.5; };

env = [
"XCURSOR_SIZE,32"
"GRIMBLAST_EDITOR,swappy"
"XDG_SCREENSHOTS_DIR,~/Pictures/Screenshots"
"SWWW_TRANSITION,wipe"
"SWWW_TRANSITION_FPS,60"
"SWWW_TRANSITION_STEP,2"
"SWWW_TRANSITION_ANGLE,30"
];
};
};
}
Loading

0 comments on commit 269bf8a

Please sign in to comment.