From 690ab55e10dcbf90390a5e025d420af482c016ec Mon Sep 17 00:00:00 2001 From: "info@data-pro.nu" Date: Fri, 6 Mar 2026 22:57:30 +0100 Subject: [PATCH] Added basic hyprland with custom bindings.conf --- Droidnix/README.org | 98 ++++++++++--- Droidnix/assets/hyprland/conf/bindings.conf | 150 ++++++++++++++++++++ 2 files changed, 228 insertions(+), 20 deletions(-) create mode 100644 Droidnix/assets/hyprland/conf/bindings.conf diff --git a/Droidnix/README.org b/Droidnix/README.org index e4c71f39e..067475254 100644 --- a/Droidnix/README.org +++ b/Droidnix/README.org @@ -439,7 +439,7 @@ This code defines the machine to build. Just search and replace traveldroid to p } #+END_SRC -* Now we reach the top of the hierarchiy which will call all other imports +* Now we reach the top of the hierarchy which will call all other imports ** =generated/top.nix= The ./generated/top.nix file acts as an anchor or entry point for the entire chain of imports in the pyramid structure. @@ -461,20 +461,6 @@ The ./generated/top.nix file acts as an anchor or entry point for the entire cha } #+END_SRC -** =generated/top.nix= -This is top file of this level which contains the bare necessities for this subject + an import statement for all the subfolder in this folder -#+BEGIN_SRC nix :tangle generated/top.nix :noweb tangle :mkdirp yes :eval never-html -{ config, pkgs, lib, user, inputs, ... }: -{ - imports = [ - ./hyprland/top.nix - ./mangowc/top.nix - ./system/top.nix - ]; - # .. put any code here -} -#+END_SRC - ** =generated/hyprland/top.nix= This is top file of this level which contains the bare necessities for this subject + an import statement for all the subfolder in this folder #+BEGIN_SRC nix :tangle generated/hyprland/top.nix :noweb tangle :mkdirp yes :eval never-html @@ -490,7 +476,73 @@ This is top file of this level which contains the bare necessities for this subj ./task_window_workspace_switcher/top.nix ./window_rules/top.nix ]; - # .. put any code here + + # Nix settings to use Hyprland's cache for packages + # This allows Nix to download pre-built packages from the Hyprland cache, + # which can speed up the installation process and ensure compatibility. + nix.settings = { + substituters = [ "https://hyprland.cachix.org" ]; + trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; + }; + + # Enable essential services for a Wayland session + services.dbus.enable = true; # D-Bus is required for inter-process communication + services.pipewire = { + enable = true; + alsa.enable = true; # Basic audio support using ALSA + pulse.enable = true; # PulseAudio support for better audio management + wireplumber.enable = true; # Audio device management and routing + }; + + # XDG Desktop Portal settings for better application integration + # The XDG Desktop Portal provides a way for applications to interact with the desktop environment. + xdg.portal = { + enable = true; + config.common.default = [ "hyprland" "gtk" ]; # Use Hyprland and GTK as default portal implementations + }; + + # Environment variables for a Wayland session with Hyprland + # These variables help applications understand the desktop environment and session type. + environment.sessionVariables = { + XDG_SESSION_TYPE = "wayland"; # Use Wayland instead of X11 for the session + XDG_CURRENT_DESKTOP = "Hyprland"; # Define the current desktop environment as Hyprland + XCURSOR_SIZE = "24"; # Set the size of the mouse cursor to 24 pixels + }; + + # Install Hyprland and enable it as the window manager + # Here, we're only installing the Hyprland package itself for a minimal setup. + environment.systemPackages = with pkgs; [ hyprland ]; + + # Configure Hyprland as the window manager + # This section enables Hyprland as the window manager and sets basic configurations. + programs.hyprland = { + enable = true; # Start Hyprland as the window manager + xwayland.enable = true; # Enable XWayland to run X11 applications within the Wayland session + }; + + # Home-manager configuration for user-specific settings + # Home-manager is used to manage user-specific configurations and packages. + home-manager = { + # Enable Hyprland as the Wayland window manager for the user session + wayland.windowManager.hyprland = { + enable = true; # Enable Hyprland as the window manager for the user + settings = { + # Minimal configuration, customize later as needed + # This is where you would add custom keybinds, workspace settings, etc. + }; + }; + + # XDG portal settings for user sessions + # These settings ensure that applications can interact properly with the Hyprland session. + xdg.portal = { + enable = true; + extraPortals = with pkgs; [ xdg-desktop-portal-hyprland ]; # Hyprland-specific portal implementation + config.hyprland = { + "org.freedesktop.impl.portal.Screencast" = [ "hyprland" ]; # Enable screencasting support + }; + }; + } + } #+END_SRC @@ -612,11 +664,17 @@ This is top file of this level which contains the bare necessities for this subj This is top file of this level which contains the bare necessities for this subject + an import statement for all the subfolder in this folder #+BEGIN_SRC nix :tangle generated/hyprland/keyboard_binds/top.nix :noweb tangle :mkdirp yes :eval never-html { config, pkgs, lib, user, inputs, ... }: +let + # Read the contents of the bindings.conf file + bindingsContent = builtins.readFile ./assets/hyprland/conf/bindings.conf; + # Create a configuration file from the bindings content + configFile = pkgs.writeText "hyprland.conf" bindingsContent; +in { - imports = [ - # No subfolders to import - ]; - # .. put any code here + wayland.windowManager.hyprland = { + enable = true; # Enable Hyprland as the window manager + config = configFile; # Use the generated configuration file + }; } #+END_SRC diff --git a/Droidnix/assets/hyprland/conf/bindings.conf b/Droidnix/assets/hyprland/conf/bindings.conf new file mode 100644 index 000000000..8a330a713 --- /dev/null +++ b/Droidnix/assets/hyprland/conf/bindings.conf @@ -0,0 +1,150 @@ +$mainMod = SUPER + +# use walker to show exec menu +bind = $mainMod, Space , exec, walker +bind = $mainMod, P, pseudo +bind = $mainMod, T, togglesplit + +# grimblast +bind = $mainMod SHIFT, p, exec, grimblast -n -f copysave active +bind = $mainMod SHIFT, a, exec, grimblast -n -f copysave area +bind = $mainMod ALT, p, exec, grimblast -n -f copysave output +bind = $mainMod CTRL, p, exec, grimblast -n -f copysave screen + +# Terminal / launcher / kill / reload +bind = $mainMod, E, exec, thunar +bind = $mainMod, RETURN, exec, kitty +bind = $mainMod, D, exec, wofi --show drun +bind = $mainMod, Q, killactive, +bind = $mainMod SHIFT, Q, exit, +bind = $mainMod SHIFT, R, exec, hyprctl reload + +# Switch windows +bind = ALT, TAB, cyclenext, +# bind = ALT SHIFT, TAB, cyclenext prev + +# Hyprscrolling +bind = $mainMod, period, layoutmsg, move +col +bind = $mainMod, comma, layoutmsg, swapcol l +# Make / break a tab-group (stack) +bind = $mainMod, S, togglegroup +# Cycle tabs in the group +bind = $mainMod, L, changegroupactive, f +bind = $mainMod, H, changegroupactive, b +bind = $mainMod, T, exec, ~/.config/hypr/scripts/toggle-layout-scrolling-dwindle.sh + +# Focus movement +bind = $mainMod, H, movefocus, l +bind = $mainMod, L, movefocus, r +bind = $mainMod, K, movefocus, u +bind = $mainMod, J, movefocus, d +bind = $mainMod, left, movefocus, l +bind = $mainMod, right, movefocus, r +bind = $mainMod, up, movefocus, u +bind = $mainMod, down, movefocus, d + +# Move windows +bind = $mainMod SHIFT, H, movewindow, l +bind = $mainMod SHIFT, L, movewindow, r +bind = $mainMod SHIFT, K, movewindow, u +bind = $mainMod SHIFT, J, movewindow, d +bind = $mainMod SHIFT, left, movewindow, l +bind = $mainMod SHIFT, right, movewindow, r +bind = $mainMod SHIFT, up, movewindow, u +bind = $mainMod SHIFT, down, movewindow, d + +# Resize windows +bind = $mainMod CTRL, H, resizeactive, -30 0 +bind = $mainMod CTRL, L, resizeactive, 30 0 +bind = $mainMod CTRL, K, resizeactive, 0 -30 +bind = $mainMod CTRL, J, resizeactive, 0 30 + +# Floating / fullscreen +bind = $mainMod, V, togglefloating, +bind = $mainMod, F, fullscreen, 0 +bind = $mainMod SHIFT, F, fullscreen, 1 + +# Workspaces +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, workspace, 10 + +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +bind = $mainMod SHIFT, 0, movetoworkspace, 10 + +# Cycle workspaces +bind = $mainMod, mouse_down, workspace, e+1 +bind = $mainMod, mouse_up, workspace, e-1 + +# Mouse drag +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow + +######################### +# Screenshots +######################### +bind = $mainMod SHIFT, s, exec, grim -g "$(slurp)" - | wl-copy +bind = , XF86Screenshot, exec, grim - | wl-copy + +######################### +# Audio (pamixer) +######################### +bind = , XF86AudioRaiseVolume, exec, pamixer -i 5 +bind = , XF86AudioLowerVolume, exec, pamixer -d 5 +bind = , XF86AudioMute, exec, pamixer -t +bind = , XF86AudioMicMute, exec, pamixer --default-source -t + +######################### +# Media (playerctl) +######################### +bind = , XF86AudioPlay, exec, playerctl play-pause +bind = , XF86AudioPause, exec, playerctl pause +bind = , XF86AudioNext, exec, playerctl next +bind = , XF86AudioPrev, exec, playerctl previous +bind = , XF86AudioStop, exec, playerctl stop + +######################### +# Brightness (brightnessctl) +######################### +bind = , XF86MonBrightnessUp, exec, brightnessctl set +10% +bind = , XF86MonBrightnessDown, exec, brightnessctl set 10%- +bind = , XF86KbdBrightnessUp, exec, brightnessctl -d '*kbd_backlight*' set +10% +bind = , XF86KbdBrightnessDown, exec, brightnessctl -d '*kbd_backlight*' set 10%- + +######################### +# Power / session +######################### +bind = , XF86Sleep, exec, systemctl suspend +bind = , XF86PowerOff, exec, systemctl poweroff +bind = , XF86WakeUp, exec, systemctl suspend +bind = $mainMod, L, exec, loginctl lock-session +bind = $mainMod, X, exec, ~/.config/hypr/scripts/powermenu.sh + +######################### +# Laptop lid settings +######################### +bindl = , switch:on:Lid Switch, exec, ~/.config/hypr/scripts/lid-action.sh +bindl = , switch:off:Lid Switch, exec, ~/.config/hypr/scripts/lid-restore.sh + +######################### +# Start apps +######################### +bind = CTRL ALT, B, exec, flatpak run eu.betterbird.Betterbird +bind = CTRL ALT, S, exec, spotify +bind = $mainMod, z, exec, zeditor +bind = $mainMod, w, exec, zen --url https://nextcloud.data-pro.nu