From 8e42dc2420bd3cbc6012f3f4683010e67b5f6abe Mon Sep 17 00:00:00 2001 From: Avery Date: Sat, 11 Jan 2025 22:52:22 +0100 Subject: [PATCH] Switch to Hyprland --- .../home-manager/desktop/ags/config/config.js | 23 +-- .../home-manager/desktop/ags/config/style.css | 2 +- .../home-manager/desktop/default.nix | 5 + .../home-manager/desktop/hypr/default.nix | 1 + .../home-manager/desktop/hypr/hyprland.nix | 171 ++++++++++++++++++ .../home-manager/desktop/hypr/hyprlock.nix | 65 +++++++ .../totsugeki/home-manager/desktop/kitty.nix | 2 +- hosts/totsugeki/nixos/default.nix | 120 ++++++++++-- hosts/totsugeki/nixos/filesystems.nix | 2 +- 9 files changed, 352 insertions(+), 39 deletions(-) create mode 100644 hosts/totsugeki/home-manager/desktop/hypr/default.nix create mode 100644 hosts/totsugeki/home-manager/desktop/hypr/hyprland.nix create mode 100644 hosts/totsugeki/home-manager/desktop/hypr/hyprlock.nix diff --git a/hosts/totsugeki/home-manager/desktop/ags/config/config.js b/hosts/totsugeki/home-manager/desktop/ags/config/config.js index 5f16dc3..7590280 100644 --- a/hosts/totsugeki/home-manager/desktop/ags/config/config.js +++ b/hosts/totsugeki/home-manager/desktop/ags/config/config.js @@ -5,12 +5,13 @@ import { graphics_card_usage, volume_widget, } from "./widgets/bar/system-stats.js"; -import { extended_bar } from "./widgets/bar-extended/extended-bar.js"; +// import { extended_bar } from "./widgets/bar-extended/extended-bar.js"; import { launcher } from "./widgets/launcher/launcher.js"; import { popup_clock } from "./widgets/popup-clock/popup-clock.js"; import { date } from "./state.js"; const mpris = await Service.import("mpris"); -const sway = await Service.import("sway"); +// const sway = await Service.import("sway"); +const hyprland = await Service.import("hyprland"); const players = mpris.bind("players"); App.addIcons(`${App.configDir}/assets`); @@ -23,20 +24,8 @@ function Workspaces() { class_name: "workspace-button", label: i.toString(), setup: (btn) => { - btn.hook( - sway, - (btn) => { - const ws = sway.getWorkspace(`${i}`); - btn.toggleClassName( - "occupied", - ws?.nodes.length + ws?.floating_nodes.length > 0, - ); - }, - "notify::workspaces", - ); - - btn.hook(sway.active.workspace, (btn) => { - btn.toggleClassName("active", sway.active.workspace.name == i); + btn.bind("prop", hyprland.active.workspace, "id", (id) => { + btn.toggleClassName("active", id == i); }); }, }); @@ -161,5 +150,5 @@ Utils.monitorFile( App.config({ style: "./style.css", - windows: [bar, extended_bar, launcher, popup_clock], + windows: [bar, launcher, popup_clock], }); diff --git a/hosts/totsugeki/home-manager/desktop/ags/config/style.css b/hosts/totsugeki/home-manager/desktop/ags/config/style.css index b9e54c7..608bb7b 100644 --- a/hosts/totsugeki/home-manager/desktop/ags/config/style.css +++ b/hosts/totsugeki/home-manager/desktop/ags/config/style.css @@ -1,4 +1,4 @@ -@define-color bg-bar rgba(0, 0, 0, 0.1); +@define-color bg-bar rgba(0, 0, 0, 0.3); @define-color bg rgba(0, 0, 0, 0.0); @define-color normal rgba(0, 0, 0, 0.6); @define-color hover rgba(0, 0, 0, 0.4); diff --git a/hosts/totsugeki/home-manager/desktop/default.nix b/hosts/totsugeki/home-manager/desktop/default.nix index 560cd52..1fb7cf7 100644 --- a/hosts/totsugeki/home-manager/desktop/default.nix +++ b/hosts/totsugeki/home-manager/desktop/default.nix @@ -5,6 +5,7 @@ ./dunst.nix ./firefox.nix ./gtk.nix + ./hypr ./kitty.nix ./sway.nix ./qt.nix @@ -38,6 +39,10 @@ qdiskinfo mangohud heroic + ungoogled-chromium + mediainfo-gui + android-tools + mitmproxy ]; }; nixpkgs.config.allowUnfree = true; diff --git a/hosts/totsugeki/home-manager/desktop/hypr/default.nix b/hosts/totsugeki/home-manager/desktop/hypr/default.nix new file mode 100644 index 0000000..8b9dd38 --- /dev/null +++ b/hosts/totsugeki/home-manager/desktop/hypr/default.nix @@ -0,0 +1 @@ +{ ... }: { imports = [ ./hyprland.nix ./hyprlock.nix ]; } diff --git a/hosts/totsugeki/home-manager/desktop/hypr/hyprland.nix b/hosts/totsugeki/home-manager/desktop/hypr/hyprland.nix new file mode 100644 index 0000000..3acdded --- /dev/null +++ b/hosts/totsugeki/home-manager/desktop/hypr/hyprland.nix @@ -0,0 +1,171 @@ +{ ... }: { + wayland.windowManager.hyprland = { + enable = true; + settings = { + monitor = "DP-1, 2560x1440@165, 0x0, 1"; + input = { + # Keyboard + kb_layout = "es"; + kb_variant = "dvorak"; + kb_options = "lv5:caps_switch"; + # Mouse + sensitivity = -0.4; + accel_profile = "flat"; + }; + + exec-once = + [ "hyprlock" "ags" "swww-daemon" "[workspace 10 silent] qbittorrent" ]; + + env = [ + "XDG_CURRENT_DESKTOP,Hyprland" + "XDG_SESSION_TYPE,wayland" + "XDG_SESSION_DESKTOP,Hyprland" + ]; + + general = { + border_size = 0; + gaps_in = 4; + gaps_out = 4; + }; + + decoration = { + rounding = 8; + dim_inactive = true; + dim_strength = 0.4; + blur = { + enabled = true; + size = 4; + passes = 3; + }; + shadow.enabled = false; + }; + + animations = { + animation = [ + "windows, 1, 4, wind, slide" + "windowsIn, 1, 4, winIn, slide" + "windowsOut, 1, 3, winOut, slide" + "windowsMove, 1, 3, wind, slide" + "workspaces, 1, 2, default, slidevert" + ]; + bezier = [ + "wind, 0.05, 0.92, 0.1, 1" + "winIn, 0.1, 1.1, 0.1, 1" + "winOut, 0.3, -0.3, 0, 1" + ]; + }; + + dwindle = { + pseudotile = true; + force_split = 2; + use_active_for_splits = true; + preserve_split = true; + }; + + bind = [ + "SUPER SHIFT CTRL ALT, Q, exit," + # Window management + "SUPER, W, killactive" + "SUPER, F, togglefloating, " + "SUPER, C, centerwindow" + "SUPER, F11, fullscreen, 0" + # Spawns + "CTRL ALT, T, exec, kitty" + "SUPER, Space, exec, ags -t launcher" + "SUPER, C, exec, ags -t bar_extended" + "SUPER, E, exec, pcmanfm-qt" + # Session locking + ", code:191, exec, hyprlock" + "MOD3, L, exec, hyprlock" + # Window navigation + "SUPER, k, movefocus, u" + "SUPER, j, movefocus, d" + "SUPER, h, movefocus, l" + "SUPER, l, movefocus, r" + # Workspace navigation + "SUPER, 1, workspace, 1" + "SUPER, 2, workspace, 2" + "SUPER, 3, workspace, 3" + "SUPER, 4, workspace, 4" + "SUPER, 5, workspace, 5" + "SUPER, 6, workspace, 6" + "SUPER, 7, workspace, 7" + "SUPER, 8, workspace, 8" + "SUPER, 9, workspace, 9" + "SUPER, 0, workspace, 10" + # Send window to workspace + "SUPER SHIFT, 1, movetoworkspace, 1" + "SUPER SHIFT, 2, movetoworkspace, 2" + "SUPER SHIFT, 3, movetoworkspace, 3" + "SUPER SHIFT, 4, movetoworkspace, 4" + "SUPER SHIFT, 5, movetoworkspace, 5" + "SUPER SHIFT, 6, movetoworkspace, 6" + "SUPER SHIFT, 7, movetoworkspace, 7" + "SUPER SHIFT, 8, movetoworkspace, 8" + "SUPER SHIFT, 9, movetoworkspace, 9" + "SUPER SHIFT, 0, movetoworkspace, 10" + # Screenshots + ", Print, exec, screenshot full" + "SHIFT, Print, exec, screenshot section" + "SUPER, S, exec, screenshot full" + "SUPER + SHIFT, S, exec, screenshot section" + ]; + + bindl = [ + # Submaps + "MOD3, m, submap, Música" + "MOD3, w, submap, Fondo de pantalla" + # Volume mute + ", XF86AudioMute, exec, volumectl output toggle-mute" + "SHIFT, XF86AudioMute, exec, volumectl input toggle-mute" + ]; + + bindle = [ + # Volume control + ", XF86AudioRaiseVolume, exec, volumectl output +5" + ", XF86AudioLowerVolume, exec, volumectl output -5" + "SHIFT, XF86AudioRaiseVolume, exec, volumectl input +5" + "SHIFT, XF86AudioLowerVolume, exec, volumectl input -5" + ]; + + bindm = + [ "SUPER, mouse:272, movewindow" "SUPER, mouse:273, resizewindow" ]; + + layerrule = [ + "blur, bar" + "ignorezero, bar" + "blur, launcher" + "ignorezero, launcher" + "blur, extended_bar" + "ignorezero, extended_bar" + ]; + + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; + vrr = 2; + }; + }; + extraConfig = '' + submap = Fondo de pantalla + + bind = , H, exec, change-wallpaper previous + bind = , L, exec, change-wallpaper next + bindl = , escape, submap, reset + bindl = MOD3, w, submap, reset + + submap = reset + + submap = Música + + bindl = , p, exec, playerctl play-pause + bindl = , h, exec, playerctl previous + bindl = , l, exec, playerctl next + bindl = , escape, submap, reset + bindl = MOD3, m, submap, reset + + submap = reset + ''; + + }; +} diff --git a/hosts/totsugeki/home-manager/desktop/hypr/hyprlock.nix b/hosts/totsugeki/home-manager/desktop/hypr/hyprlock.nix new file mode 100644 index 0000000..152f818 --- /dev/null +++ b/hosts/totsugeki/home-manager/desktop/hypr/hyprlock.nix @@ -0,0 +1,65 @@ +{ ... }: { + programs.hyprlock = { + enable = true; + settings = { + background = { + path = "$HOME/.local/share/wallpapers/.current_image"; + blur_size = 4; + blur_passes = 3; + }; + label = [ + { + text = "$TIME"; + color = "rgba(255, 255, 255, 1.0)"; + font_size = 96; + position = "0, -90"; + font_family = "Inter Medium"; + halign = "center"; + valign = "top"; + } + { + text = ''cmd[update:1000] date "+%A, %-e de %B del %Y"''; + font_family = "Inter"; + font_size = 20; + position = "0, -235"; + halign = "center"; + valign = "top"; + } + { + text = "$DESC"; + font_family = "Inter"; + position = "0, -35"; + font_size = 18; + halign = "center"; + valign = "center"; + } + ]; + image = { + size = "150, 150"; + position = "0, 65"; + path = "$HOME/.face.icon"; + rounding = -1; + halign = "center"; + valign = "center"; + }; + input-field = { + size = "300, 50"; + outline_thickness = 0; + dots_size = 0.2; + dots_spacing = 0.15; + dots_center = true; + dots_rounding = -1; + fade_on_empty = false; + placeholder_text = + ''Introduce la contraseña''; + outer_color = "rgba(255, 255, 255, 0.5)"; + inner_color = "rgba(255, 255, 255, 0.0)"; + font_color = "rgba(255, 255, 255, 1.0)"; + rounding = -1; + position = "0, -80"; + halign = "center"; + valign = "center"; + }; + }; + }; +} diff --git a/hosts/totsugeki/home-manager/desktop/kitty.nix b/hosts/totsugeki/home-manager/desktop/kitty.nix index 7a4a912..a3d115b 100644 --- a/hosts/totsugeki/home-manager/desktop/kitty.nix +++ b/hosts/totsugeki/home-manager/desktop/kitty.nix @@ -17,7 +17,7 @@ "ctrl+alt+9" = "goto_tab 9"; }; settings = { - "background_opacity" = "0.8"; + "background_opacity" = "0.85"; "dynamic_background_opacity" = true; "force_ltr" = "yes"; "disable_ligatures" = "never"; diff --git a/hosts/totsugeki/nixos/default.nix b/hosts/totsugeki/nixos/default.nix index 2055b98..bad8c1d 100644 --- a/hosts/totsugeki/nixos/default.nix +++ b/hosts/totsugeki/nixos/default.nix @@ -29,7 +29,7 @@ networking = { firewall = { enable = true; - allowedTCPPorts = [ 8000 42595 1420 7777 ]; + allowedTCPPorts = [ 8000 42595 1420 7777 8080 ]; allowedUDPPorts = [ 24642 ]; }; hostName = "totsugeki"; @@ -38,7 +38,7 @@ }; time = { - hardwareClockInLocalTime = true; + hardwareClockInLocalTime = false; timeZone = "Europe/Madrid"; }; @@ -79,28 +79,15 @@ }; dconf.enable = true; nix-ld.enable = true; + hyprland.enable = true; }; security.polkit = { enable = true; }; xdg.portal = { - config.common = { - default = "gtk"; - "org.freedesktop.impl.portal.ScreenCast" = "wlr"; - }; + config.common = { default = "gtk"; }; enable = true; extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - wlr = { - enable = true; - settings = { - screencast = { - output_name = "DP-1"; - max_fps = 165; - chooser_type = "simple"; - chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or"; - }; - }; - }; }; services = { @@ -109,6 +96,16 @@ nssmdns4 = true; openFirewall = true; }; + greetd = { + enable = true; + settings = rec { + initial_session = { + command = "${pkgs.zsh}/bin/zsh -c Hyprland"; + user = "avery"; + }; + default_session = initial_session; + }; + }; gvfs.enable = true; jellyfin = { enable = true; @@ -128,7 +125,93 @@ }; udisks2.enable = true; udev.extraRules = '' - SUBSYSTEM=="usb", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="3000", MODE="0666" + SUBSYSTEM=="usb", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="3000", MODE="0666" + # Atmel DFU + ### ATmega16U2 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2fef", TAG+="uaccess" + ### ATmega32U2 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff0", TAG+="uaccess" + ### ATmega16U4 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff3", TAG+="uaccess" + ### ATmega32U4 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff4", TAG+="uaccess" + ### AT90USB64 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff9", TAG+="uaccess" + ### AT90USB162 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ffa", TAG+="uaccess" + ### AT90USB128 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ffb", TAG+="uaccess" + + # Input Club + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1c11", ATTRS{idProduct}=="b007", TAG+="uaccess" + + # STM32duino + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1eaf", ATTRS{idProduct}=="0003", TAG+="uaccess" + # STM32 DFU + SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", TAG+="uaccess" + + # BootloadHID + SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05df", TAG+="uaccess" + + # USBAspLoader + SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", TAG+="uaccess" + + # USBtinyISP + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1782", ATTRS{idProduct}=="0c9f", TAG+="uaccess" + + # ModemManager should ignore the following devices + # Atmel SAM-BA (Massdrop) + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="6124", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + + # Caterina (Pro Micro) + ## pid.codes shared PID + ### Keyboardio Atreus 2 Bootloader + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2302", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ## Spark Fun Electronics + ### Pro Micro 3V3/8MHz + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9203", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ### Pro Micro 5V/16MHz + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9205", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ### LilyPad 3V3/8MHz (and some Pro Micro clones) + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9207", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ## Pololu Electronics + ### A-Star 32U4 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1ffb", ATTRS{idProduct}=="0101", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ## Arduino SA + ### Leonardo + SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ### Micro + SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0037", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ## Adafruit Industries LLC + ### Feather 32U4 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="239a", ATTRS{idProduct}=="000c", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ### ItsyBitsy 32U4 3V3/8MHz + SUBSYSTEMS=="usb", ATTRS{idVendor}=="239a", ATTRS{idProduct}=="000d", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ### ItsyBitsy 32U4 5V/16MHz + SUBSYSTEMS=="usb", ATTRS{idVendor}=="239a", ATTRS{idProduct}=="000e", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ## dog hunter AG + ### Leonardo + SUBSYSTEMS=="usb", ATTRS{idVendor}=="2a03", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ### Micro + SUBSYSTEMS=="usb", ATTRS{idVendor}=="2a03", ATTRS{idProduct}=="0037", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + + # hid_listen + KERNEL=="hidraw*", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl" + + # hid bootloaders + ## QMK HID + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2067", TAG+="uaccess" + ## PJRC's HalfKay + SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="0478", TAG+="uaccess" + + # APM32 DFU + SUBSYSTEMS=="usb", ATTRS{idVendor}=="314b", ATTRS{idProduct}=="0106", TAG+="uaccess" + + # GD32V DFU + SUBSYSTEMS=="usb", ATTRS{idVendor}=="28e9", ATTRS{idProduct}=="0189", TAG+="uaccess" + + # WB32 DFU + SUBSYSTEMS=="usb", ATTRS{idVendor}=="342d", ATTRS{idProduct}=="dfa0", TAG+="uaccess" ''; }; systemd = { services = { NetworkManager-wait-online.enable = false; }; }; @@ -139,7 +222,6 @@ }; virtualisation.virtualbox.host.enable = true; - system.stateVersion = "24.05"; users.users.avery.extraGroups = [ "corectrl" ]; diff --git a/hosts/totsugeki/nixos/filesystems.nix b/hosts/totsugeki/nixos/filesystems.nix index cf0d613..2c9e693 100644 --- a/hosts/totsugeki/nixos/filesystems.nix +++ b/hosts/totsugeki/nixos/filesystems.nix @@ -6,7 +6,7 @@ options = [ "compress=zstd:15" ]; }; "/boot" = { - device = "/dev/disk/by-uuid/8084-F762"; + device = "/dev/disk/by-uuid/590B-73B7"; fsType = "vfat"; }; "/home" = {