diff --git a/home-manager/flake.lock b/home-manager/flake.lock new file mode 100644 index 0000000..10bd312 --- /dev/null +++ b/home-manager/flake.lock @@ -0,0 +1,73 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1758463745, + "narHash": "sha256-uhzsV0Q0I9j2y/rfweWeGif5AWe0MGrgZ/3TjpDYdGA=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "3b955f5f0a942f9f60cdc9cacb7844335d0f21c3", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-25.05", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1763334038, + "narHash": "sha256-LBVOyaH6NFzQ3X/c6vfMZ9k4SV2ofhpxeL9YnhHNJQQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "4c8cdd5b1a630e8f72c9dd9bf582b1afb3127d2c", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "zen-browser": "zen-browser" + } + }, + "zen-browser": { + "inputs": { + "home-manager": [ + "home-manager" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1763521945, + "narHash": "sha256-Zcrafbe4niRJMbzaVOwg7+iedJhwBFttre2DpyCC6qA=", + "owner": "0xc000022070", + "repo": "zen-browser-flake", + "rev": "24d7381b9231c23daceec5d372cc28e877f7785d", + "type": "github" + }, + "original": { + "owner": "0xc000022070", + "repo": "zen-browser-flake", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/home-manager/home.nix b/home-manager/home.nix index 5b1c50b..5a4a8d6 100755 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -16,6 +16,8 @@ ./modules/tmux.nix ]; + # programs.bash.bashrcExtra = ''echo "entering zsh" && zsh''; + home.pointerCursor = let getFrom = url: hash: name: { gtk.enable = true; @@ -35,8 +37,6 @@ in getFrom "https://github.com/catppuccin/cursors/releases/download/v2.0.0/catppuccin-mocha-dark-cursors.zip" "sha256-EbBzbSBalFx6oo85I7at/wYyoGZuJxIbOWBNrfqHey0=" "Catppuccin-Mocha-Dark"; - # "https://github.com/ful1e5/fuchsia-cursor/releases/download/v2.0.1/Fuchsia.tar.xz" - # "sha256-TuhU8UFo0hbVShqsWy9rTKnMV8/WHqsxmpqWg1d9f84=" "Fuchsia"; # TODO: make it universal home.username = "krosh"; diff --git a/home-manager/modules/hypr/hypr.nix b/home-manager/modules/hypr/hypr.nix index f6ed3b8..ef45a99 100644 --- a/home-manager/modules/hypr/hypr.nix +++ b/home-manager/modules/hypr/hypr.nix @@ -1,14 +1,29 @@ { config, pkgs, ... }: # TODO: -# - make shortcuts for hyprctl commands # - split into multiple files # - configure comands like hyprpaper, waybar, etc. +# - make hyprexpo work { + imports = [ + # ./hyprland/env.nix + # ./hyprland/execs.nix + # ./hyprland/general.nix + # ./hyprland/rules.nix + # ./hyprland/colors.nix + # ./hyprland/active.nix + ./hyprland/keybinds.nix # in process + ./hyprlock.nix # done + ./hypridle.nix # done + ]; home.packages = with pkgs; [ - hyprland # already in nixos modules, but here for hyprctl + hyprland brightnessctl + playerctl + wl-clipboard + hyprshot + tesseract ]; programs.hyprpanel = { enable = true; @@ -16,35 +31,194 @@ }; programs.fuzzel.enable = true; - wayland.windowManager.hyprland.settings = { - exec-once = [ - # Fixes cursor themes in gnome apps under hyprland - "gsettings set org.gnome.desktop.interface cursor-theme '${config.home.pointerCursor.name}'" - "gsettings set org.gnome.desktop.interface cursor-size ${ - toString config.home.pointerCursor.size - }" - ]; + wayland.windowManager.hyprland = { + enable = true; + # plugins = [ hyprexpo ]; + settings = { + env = [ "XCURSOR_SIZE,24" "HYPRCURSOR_SIZE,24" ]; + + exec-once = [ + "hyprlock" + "hyprpanel &" + "gsettings set org.gnome.desktop.interface cursor-theme '${config.home.pointerCursor.name}'" + "gsettings set org.gnome.desktop.interface cursor-size ${ + toString config.home.pointerCursor.size + }" + ]; + + exec = "hyprctl dispatch submap global"; + submap = "global"; + debug = { disable_logs = false; }; + + monitor = + [ "eDP-1,preferred,auto,auto" "HDMI-A-1,preferred,auto-left,auto" ]; + + input = { + kb_layout = "us,ru"; + kb_options = "grp:win_space_toggle,ctrl:swap_lalt_lctl"; + natural_scroll = true; + follow_mouse = 1; + numlock_by_default = true; + + touchpad = { + disable_while_typing = true; + clickfinger_behavior = true; + natural_scroll = true; + }; + }; + cursor = { + no_hardware_cursors = true; + min_refresh_rate = 60; + inactive_timeout = 5; + hide_on_key_press = true; + }; + + binds.scroll_event_delay = 0; + + gestures = { + workspace_swipe = true; + workspace_swipe_distance = 700; + workspace_swipe_fingers = 3; + workspace_swipe_cancel_ratio = 0.2; + workspace_swipe_min_speed_to_force = 5; + workspace_swipe_direction_lock = true; + workspace_swipe_direction_lock_threshold = 10; + workspace_swipe_create_new = true; + }; + + general = { + # Gaps and border + gaps_in = 5; + gaps_out = 10; + gaps_workspaces = 50; + border_size = 0; + + # Fallback colors + "col.active_border" = "rgba(0DB7D4FF)"; + "col.inactive_border" = "rgba(31313600)"; + + resize_on_border = true; + no_focus_fallback = true; + # layout = dwindle + + #focus_to_other_workspaces = true # ahhhh i still haven't properly implemented this + allow_tearing = + true; # This just allows the `immediate` window rule to work + snap.enabled = true; + }; + + dwindle = { + preserve_split = true; + smart_split = false; + smart_resizing = false; + }; + + decoration = { + rounding = 20; + + blur = { + enabled = true; + xray = false; + special = false; + new_optimizations = true; + ignore_opacity = true; + size = 4; + passes = 2; + brightness = 1; + noise = "0.01"; + contrast = 1; + popups = true; + popups_ignorealpha = "0.6"; + vibrancy = 0; + }; + + shadow = { + enabled = true; + ignore_window = true; + range = 20; + offset = "0 2"; + render_power = 4; + color = "rgba(0000002A)"; + }; + + active_opacity = "0.95"; + inactive_opacity = "0.5"; + fullscreen_opacity = 1; + + dim_inactive = true; + dim_strength = "0.025"; + dim_special = "0.07"; + }; + + animations = { + enabled = true; + + bezier = [ + "expressiveFastSpatial, 0.42, 1.67, 0.21, 0.90" + "expressiveSlowSpatial, 0.39, 1.29, 0.35, 0.98" + "expressiveDefaultSpatial, 0.38, 1.21, 0.22, 1.00" + "emphasizedDecel, 0.05, 0.7, 0.1, 1" + "emphasizedAccel, 0.3, 0, 0.8, 0.15" + "standardDecel, 0, 0, 0, 1" + "menu_decel, 0.1, 1, 0, 1" + "menu_accel, 0.52, 0.03, 0.72, 0.08" + ]; + + animation = [ + "windowsIn, 1, 3, emphasizedDecel, popin 80%" + "windowsOut, 1, 2, emphasizedDecel, popin 90%" + "windowsMove, 1, 3, emphasizedDecel, slide" + "border, 1, 10, emphasizedDecel" + "layersIn, 1, 2.7, emphasizedDecel, popin 93%" + "layersOut, 1, 2.4, menu_accel, popin 94%" + "fadeLayersIn, 1, 0.5, menu_decel" + "fadeLayersOut, 1, 2.7, menu_accel" + "workspaces, 1, 7, menu_decel, slide" + "specialWorkspaceIn, 1, 2.8, emphasizedDecel, slidevert" + "specialWorkspaceOut, 1, 1.2, emphasizedAccel, slidevert" + ]; + }; + + misc = { + mouse_move_enables_dpms = true; + key_press_enables_dpms = true; + disable_splash_rendering = true; + focus_on_activate = true; + + # TODO: enable after rules.nix + + # vfr = 1; + # vrr = 1; + animate_manual_resizes = false; + animate_mouse_windowdragging = false; + # enable_swallow = false; + # swallow_regex = "(foot|kitty|allacritty|Alacritty)"; + + # disable_hyprland_logo = true; + # force_default_wallpaper = 0; + new_window_takes_over_fullscreen = 2; + allow_session_lock_restore = true; + + initial_workspace_tracking = false; + }; + + plugin.hyprexpo = { + columns = 3; + gap_size = 5; + bg_col = "rgb(000000)"; + workspace_method = + "first 1"; # [center/first] [workspace] e.g. first 1 or center m+1 + + enable_gesture = false; # laptop touchpad, 4 fingers + gesture_distance = 300; # how far is the "max" + gesture_positive = false; + }; + }; }; - # wayland.windowManager.hyprland = { - # enable = true; + home.file.".config/hypr/scripts" = { + source = ./scripts; + recursive = true; + }; - # settings = { - # exec = "hyprctl dispatch submap global"; - # submap = "global"; - # debug = { disable_logs = false; }; - # }; - # }; - - # imports = [ - # ./hyprland/env.nix - # ./hyprland/execs.nix - # ./hyprland/general.nix - # ./hyprland/rules.nix - # ./hyprland/colors.nix - # ./hyprland/keybinds.nix # in process - # ./hyprland/active.nix - # ./hyprlock.nix # done - # ./hypridle.nix # done - # ]; } diff --git a/home-manager/modules/hypr/hypridle.nix b/home-manager/modules/hypr/hypridle.nix index 62e7a0b..06344f8 100644 --- a/home-manager/modules/hypr/hypridle.nix +++ b/home-manager/modules/hypr/hypridle.nix @@ -6,27 +6,29 @@ suspend_cmd = "systemctl suspend || loginctl suspend"; in { enable = true; - general = { - lock_cmd = lock_cmd; - before_sleep_cmd = "loginctl lock-session"; - after_sleep_cmd = "hyprctl dispatch global quickshell:lockFocus"; - inhibit_sleep = 3; - }; + settings = { + general = { + lock_cmd = lock_cmd; + before_sleep_cmd = "loginctl lock-session"; + after_sleep_cmd = "hyprctl dispatch global quickshell:lockFocus"; + inhibit_sleep = 3; + }; - listener = [ - { - timeout = 300; # 5 mins - on-timeout = "loginctl lock-session"; - } - { - timeout = 600; # 10 mins - on-timeout = "hyprctl dispatch dpms off"; - on-resume = "hyprctl dispatch dpms on"; - } - { - timeout = 900; # 15 mins - on-timeout = suspend_cmd; - } - ]; + listener = [ + { + timeout = 300; # 5 mins + on-timeout = "loginctl lock-session"; + } + { + timeout = 600; # 10 mins + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + { + timeout = 900; # 15 mins + on-timeout = suspend_cmd; + } + ]; + }; }; } diff --git a/home-manager/modules/hypr/hyprland/keybinds.conf b/home-manager/modules/hypr/hyprland/keybinds.conf deleted file mode 100644 index f2c7ba5..0000000 --- a/home-manager/modules/hypr/hyprland/keybinds.conf +++ /dev/null @@ -1,114 +0,0 @@ -# -- Missing -- -# Toggle cheatsheet -# Clipboard history -# Emoji -# Toggle media controls ? -# Change wallpaper -# Restart hyprland and plugins -# AI -# Move from silent to normal workspace -# ---- - -# -- Missing scripts -- -# switch_config.sh -# hide_window.sh -# workspace_action.sh -# launch_first_available.sh -# tesseract -# ---- - -# -- To fix now -- -# add hyprshot -# wl-clipboard -# ---- - -bind = Super, Super_L, exec, pkill fuzzel || fuzzel # [hidden] Launcher - -bindle=, XF86MonBrightnessUp, exec, brightnessctl s 5%+ # [hidden] -bindle=, XF86MonBrightnessDown, exec, brightnessctl s 5%- # [hidden] -bindle=, XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 2%+ # [hidden] -bindle=, XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%- # [hidden] -bindl = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_SINK@ toggle # [hidden] - -bindd = Super, M, Toggle power profile, exec, ~/.config/hypr/hyprland/scripts/switch_config.sh # [hidden] Toggle power profile -bind = Super, H, exec, ~/.config/hypr/hyprland/scripts/hide_window.sh h # hide active window -bind = Super, I, exec, ~/.config/hypr/hyprland/scripts/hide_window.sh u # show hide window - -bind = Super, P, pseudo, # [hidden] dwindle -bindd = Super+Shift, S, Screen snip, exec, hyprshot --freeze --clipboard-only --mode region --silent # Screen snip -bindld = ,Print, Screenshot >> clipboard ,exec, hyprshot -m output -bindd = Super+Shift, T, Character recognition,exec,hyprshot -m region --raw | tesseract stdin stdout # OCR - -bindm = Super, mouse:272, movewindow # Move -bindm = Super, mouse:274, movewindow # [hidden] -bindm = Super, mouse:273, resizewindow # Resize -#/# bind = Super, ←/↑/→/↓,, # Focus in direction -bind = Super, Left, movefocus, l # [hidden] -bind = Super, Right, movefocus, r # [hidden] -bind = Super, Up, movefocus, u # [hidden] -bind = Super, Down, movefocus, d # [hidden] -#/# bind = Super+Shift, ←/↑/→/↓,, # Move in direction -bind = Super+Shift, Left, movewindow, l # [hidden] -bind = Super+Shift, Right, movewindow, r # [hidden] -bind = Super+Shift, Up, movewindow, u # [hidden] -bind = Super+Shift, Down, movewindow, d # [hidden] -bind = Alt, F4, killactive, # [hidden] Close (Windows) -bind = Super, Q, killactive, # Close -bind = Super+Shift+Alt, Q, exec, hyprctl kill # Forcefully zap a window - -#/# binde = Super, -/+,, # Adjust split ratio -binde = Super, Minus, splitratio, -0.1 -binde = Super, Equal, splitratio, +0.1 -bind = Super+Alt, F, togglefloating, -bind = Super, D, fullscreen, 1 # Maximize -bind = Super, F, fullscreen, 0 # Fullscreen - -#/# bind = Super+Alt, Hash,, # Send to workspace # (1, 2, 3,...) -bind = Super+Alt, 1, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 1 # [hidden] -bind = Super+Alt, 2, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 2 # [hidden] -bind = Super+Alt, 3, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 3 # [hidden] -bind = Super+Alt, 4, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 4 # [hidden] -bind = Super+Alt, 5, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 5 # [hidden] -bind = Super+Alt, 6, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 6 # [hidden] -bind = Super+Alt, 7, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 7 # [hidden] -bind = Super+Alt, 8, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 8 # [hidden] -bind = Super+Alt, 9, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 9 # [hidden] -bind = Super+Alt, 0, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 10 # [hidden] - -bind = Super+Alt, S, movetoworkspacesilent, special # Send to scratchpad -bind = Super, S, togglespecialworkspace, # Toggle scratchpad -bind = Super, mouse:275, togglespecialworkspace, # [hidden] - -#/# bind = Super, Hash,, # Focus workspace # (1, 2, 3,...) -bind = Super, 1, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 1 # [hidden] -bind = Super, 2, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 2 # [hidden] -bind = Super, 3, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 3 # [hidden] -bind = Super, 4, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 4 # [hidden] -bind = Super, 5, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 5 # [hidden] -bind = Super, 6, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 6 # [hidden] -bind = Super, 7, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 7 # [hidden] -bind = Super, 8, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 8 # [hidden] -bind = Super, 9, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 9 # [hidden] -bind = Super, 0, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 10 # [hidden] - -#/# bind = Ctrl+Super, ←/→,, # Focus left/right -bind = Ctrl+Super, Right, workspace, r+1 # [hidden] -bind = Ctrl+Super, Left, workspace, r-1 # [hidden] - -#/# bind = Ctrl+Super, ←/→,, # Focus left/right -bind = Ctrl+Super, Right, workspace, r+1 # [hidden] -bind = Ctrl+Super, Left, workspace, r-1 # [hidden] - -bindd = Super, L, Lock, exec, loginctl lock-session # Lock - -bindl= ,XF86AudioNext, exec, playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` # [hidden] -bindl= ,XF86AudioPrev, exec, playerctl previous # [hidden] -bindl= ,XF86AudioNext, exec, playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` # [hidden] -bindl= ,XF86AudioPrev, exec, playerctl previous # [hidden] - -bind = Super, Return, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "kitty" "foot" "alacritty" "wezterm" "konsole" "kgx" "uxterm" "xterm" # Terminal -bind = Super, T, exec, Telegram -bind = Super, E, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "dolphin" "nautilus" "nemo" "thunar" "kitty -1 fish -c yazi" # File manager -bind = Super, W, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "google-chrome-stable" "zen" "firefox" "brave" "chromium" "microsoft-edge-stable" "opera" "librewolf" # Browser -bind = Super, C, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "code" "codium" "cursor" "zed" "zedit" "zeditor" "kate" "gnome-text-editor" "emacs" "command -v nvim && kitty -1 nvim" # Code editor -bind = Ctrl+Shift, Escape, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "kitty -1 fish -c btop" # Task manager \ No newline at end of file diff --git a/home-manager/modules/hypr/hyprland/keybinds.nix b/home-manager/modules/hypr/hyprland/keybinds.nix index 13a29c2..f80bf13 100644 --- a/home-manager/modules/hypr/hyprland/keybinds.nix +++ b/home-manager/modules/hypr/hyprland/keybinds.nix @@ -11,23 +11,14 @@ # Move from silent to normal workspace # ---- -# -- Missing scripts -- -# switch_config.sh -# hide_window.sh -# workspace_action.sh -# launch_first_available.sh -# ---- - { - home.packages = with pkgs; [ wl-clipboard hyprshot tesseract ]; - wayland.windowManager.hyprland.settings = let super = "Super"; in { bind = [ "${super}, Super_L, exec, pkill fuzzel || fuzzel" - "${super}, H, exec, ~/.config/hypr/hyprland/scripts/hide_window.sh h" - "${super}, I, exec, ~/.config/hypr/hyprland/scripts/hide_window.sh u" + "${super}, H, exec, ~/.config/hypr/scripts/hide_window.sh h" + "${super}, I, exec, ~/.config/hypr/scripts/hide_window.sh u" "${super}, P, pseudo" "${super}, Q, killactive" @@ -43,22 +34,20 @@ "${super}+Shift, Up, movewindow, u" "${super}+Shift, Down, movewindow, d" - "Alt, F4, killactive" - "${super}, D, fullscreen, 1" "${super}, F, fullscreen, 0" "${super}+Alt, F, togglefloating" - "${super}, 1, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 1" - "${super}, 2, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 2" - "${super}, 3, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 3" - "${super}, 4, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 4" - "${super}, 5, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 5" - "${super}, 6, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 6" - "${super}, 7, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 7" - "${super}, 8, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 8" - "${super}, 9, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 9" - "${super}, 0, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 10" + "${super}, 1, exec, ~/.config/hypr/scripts/workspace_action.sh workspace 1" + "${super}, 2, exec, ~/.config/hypr/scripts/workspace_action.sh workspace 2" + "${super}, 3, exec, ~/.config/hypr/scripts/workspace_action.sh workspace 3" + "${super}, 4, exec, ~/.config/hypr/scripts/workspace_action.sh workspace 4" + "${super}, 5, exec, ~/.config/hypr/scripts/workspace_action.sh workspace 5" + "${super}, 6, exec, ~/.config/hypr/scripts/workspace_action.sh workspace 6" + "${super}, 7, exec, ~/.config/hypr/scripts/workspace_action.sh workspace 7" + "${super}, 8, exec, ~/.config/hypr/scripts/workspace_action.sh workspace 8" + "${super}, 9, exec, ~/.config/hypr/scripts/workspace_action.sh workspace 9" + "${super}, 0, exec, ~/.config/hypr/scripts/workspace_action.sh workspace 10" "Ctrl+${super}, Right, workspace, r+1" "Ctrl+${super}, Left, workspace, r-1" @@ -66,23 +55,35 @@ "${super}, L, exec, loginctl lock-session" '' - ${super}, Return, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "kitty" "foot" "alacritty" "wezterm" "konsole" "kgx" "uxterm" "xterm"'' + ${super}, Return, exec, ~/.config/hypr/scripts/launch_first_available.sh "kitty" "foot" "alacritty" "wezterm" "konsole" "kgx" "uxterm" "xterm"'' "${super}, T, exec, Telegram" '' - ${super}, E, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "dolphin" "nautilus" "nemo" "thunar" "kitty -1 fish -c yazi"'' + ${super}, E, exec, ~/.config/hypr/scripts/launch_first_available.sh "dolphin" "nautilus" "nemo" "thunar" "kitty -1 fish -c yazi"'' '' - ${super}, W, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "google-chrome-stable" "zen" "firefox" "brave" "chromium" "microsoft-edge-stable" "opera" "librewolf"'' + ${super}, W, exec, ~/.config/hypr/scripts/launch_first_available.sh "google-chrome-stable" "zen" "firefox" "brave" "chromium" "microsoft-edge-stable" "opera" "librewolf"'' '' - ${super}, C, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "code" "codium" "cursor" "zed" "zedit" "zeditor" "kate" "gnome-text-editor" "emacs" "command -v nvim && kitty -1 nvim"'' + ${super}, C, exec, ~/.config/hypr/scripts/launch_first_available.sh "code" "codium" "cursor" "zed" "zedit" "zeditor" "kate" "gnome-text-editor" "emacs" "command -v nvim && kitty -1 nvim"'' '' - Ctrl+Shift, Escape, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "kitty -1 fish -c btop"'' + Ctrl+Shift, Escape, exec, ~/.config/hypr/scripts/launch_first_available.sh "kitty -1 fish -c btop"'' + "${super}+Alt, 1, exec, ~/.config/hypr/scripts/workspace_action.sh movetoworkspacesilent 1" + "${super}+Alt, 2, exec, ~/.config/hypr/scripts/workspace_action.sh movetoworkspacesilent 2" + "${super}+Alt, 3, exec, ~/.config/hypr/scripts/workspace_action.sh movetoworkspacesilent 3" + "${super}+Alt, 4, exec, ~/.config/hypr/scripts/workspace_action.sh movetoworkspacesilent 4" + "${super}+Alt, 5, exec, ~/.config/hypr/scripts/workspace_action.sh movetoworkspacesilent 5" + "${super}+Alt, 6, exec, ~/.config/hypr/scripts/workspace_action.sh movetoworkspacesilent 6" + "${super}+Alt, 7, exec, ~/.config/hypr/scripts/workspace_action.sh movetoworkspacesilent 7" + "${super}+Alt, 8, exec, ~/.config/hypr/scripts/workspace_action.sh movetoworkspacesilent 8" + "${super}+Alt, 9, exec, ~/.config/hypr/scripts/workspace_action.sh movetoworkspacesilent 9" + "${super}+Alt, 0, exec, ~/.config/hypr/scripts/workspace_action.sh movetoworkspacesilent 10" + "${super}+Alt, S, movetoworkspacesilent, special" + "${super}, S, togglespecialworkspace" ]; bindd = [ - "${super}, M, exec, ~/.config/hypr/hyprland/scripts/switch_config.sh" - "${super}+Shift, S, exec, hyprshot --freeze --clipboard-only --mode region --silent" - "${super}+Shift, T, exec, hyprshot -m region --raw | tesseract stdin stdout" + "${super}, M, Toggle power profile,exec, ~/.config/hypr/scripts/switch_config.sh" + "${super}+Shift, S, Screenshot, exec, hyprshot --freeze --clipboard-only --mode region --silent" + "${super}+Shift, T, OCR, exec, hyprshot -m region --raw | tesseract stdin stdout" ]; bindm = [ @@ -111,21 +112,5 @@ "${super}, Minus, splitratio, -0.1" "${super}, Equal, splitratio, +0.1" ]; - - # Move window to workspace - bindwsMove = [ - "${super}+Alt, 1, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 1" - "${super}+Alt, 2, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 2" - "${super}+Alt, 3, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 3" - "${super}+Alt, 4, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 4" - "${super}+Alt, 5, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 5" - "${super}+Alt, 6, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 6" - "${super}+Alt, 7, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 7" - "${super}+Alt, 8, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 8" - "${super}+Alt, 9, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 9" - "${super}+Alt, 0, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 10" - "${super}+Alt, S, movetoworkspacesilent, special" - "${super}, S, togglespecialworkspace" - ]; }; } diff --git a/home-manager/modules/hypr/hyprland/rules.nix b/home-manager/modules/hypr/hyprland/rules.nix new file mode 100644 index 0000000..fa3821c --- /dev/null +++ b/home-manager/modules/hypr/hyprland/rules.nix @@ -0,0 +1,160 @@ +{ + wayland.windowManager.hyprland.settings = { + # Window rules + windowrule = [ + "opacity 0.97 override 0.85 override 1 override, class:^(firefox|Code|obsidian|zen)$" + ]; + + windowrulev2 = [ + # Basic rules + "noblur,class:^()$,title:^()$" + "idleinhibit fullscreen, class:^(*)$" + "idleinhibit fullscreen, title:^(*)$" + "idleinhibit fullscreen, fullscreen:1" + + # Floating windows + "float, class:^(blueberry.py)$" + "float, class:^(steam)$" + "float, class:^(guifetch)$" # FlafyDev/guifetch + "float, class:^(pavucontrol)$" + "size 45%, class:^(pavucontrol)$" + "center, class:^(pavucontrol)$" + "float, class:^(org.pulseaudio.pavucontrol)$" + "size 45%, class:^(org.pulseaudio.pavucontrol)$" + "center, class:^(org.pulseaudio.pavucontrol)$" + "float, class:^(nm-connection-editor)$" + "size 45%, class:^(nm-connection-editor)$" + "center, class:^(nm-connection-editor)$" + "float, class:.*plasmawindowed.*" + "float, class:kcm_.*" + "float, class:.*bluedevilwizard" + "float, title:.*Welcome" + "float, title:^(illogical-impulse Settings)$" + "float, class:org.freedesktop.impl.portal.desktop.kde" + "float, class:^(Zotero)$" + "size 45%, class:^(Zotero)$" + + # Move rules + "float, class:^(plasma-changeicons)$" + "noinitialfocus, class:^(plasma-changeicons)$" + "move 999999 999999, class:^(plasma-changeicons)$" + "move 40 80, title:^(Copying — Dolphin)$" + + # Tiling + "tile, class:^dev.warp.Warp$" + + # Picture-in-Picture + "float, title:^([Pp]icture[-s]?[Ii]n[-s]?[Pp]icture)(.*)$" + "keepaspectratio, title:^([Pp]icture[-s]?[Ii]n[-s]?[Pp]icture)(.*)$" + "move 73% 72%, title:^([Pp]icture[-s]?[Ii]n[-s]?[Pp]icture)(.*)$" + "size 25%, title:^([Pp]icture[-s]?[Ii]n[-s]?[Pp]icture)(.*)$" + "pin, title:^([Pp]icture[-s]?[Ii]n[-s]?[Pp]icture)(.*)$" + + # Dialog windows - float+center + "center, title:^(Open File)(.*)$" + "center, title:^(Select a File)(.*)$" + "center, title:^(Choose wallpaper)(.*)$" + "center, title:^(Open Folder)(.*)$" + "center, title:^(Save As)(.*)$" + "center, title:^(Library)(.*)$" + "center, title:^(File Upload)(.*)$" + "center, title:^(.*)(wants to save)$" + "center, title:^(.*)(wants to open)$" + "float, title:^(Open File)(.*)$" + "float, title:^(Select a File)(.*)$" + "float, title:^(Choose wallpaper)(.*)$" + "float, title:^(Open Folder)(.*)$" + "float, title:^(Save As)(.*)$" + "float, title:^(Library)(.*)$" + "float, title:^(File Upload)(.*)$" + "float, title:^(.*)(wants to save)$" + "float, title:^(.*)(wants to open)$" + + # Tearing + "immediate, title:.*.exe" + "immediate, title:.*minecraft.*" + "immediate, class:^(steam_app).*" + + # No shadow for tiled windows + "noshadow, floating:0" + ]; + + # Workspace rules + workspace = [ "special:special, gapsout:30" ]; + + # Layer rules + layerrule = [ + # Basic layer rules + "noanim, walker" + "noanim, selection" + "noanim, overview" + "noanim, anyrun" + "noanim, indicator.*" + "noanim, osk" + "noanim, hyprpicker" + "noanim, noanim" + + # Blur effects + "blur, gtk-layer-shell" + "ignorezero, gtk-layer-shell" + "blur, launcher" + "ignorealpha 0.5, launcher" + "blur, notifications" + "ignorealpha 0.69, notifications" + "blur, logout_dialog" # wlogout + + # AGS rules + "animation slide left, sideleft.*" + "animation slide right, sideright.*" + "blur, session[0-9]*" + "blur, bar[0-9]*" + "ignorealpha 0.6, bar[0-9]*" + "blur, barcorner.*" + "ignorealpha 0.6, barcorner.*" + "blur, dock[0-9]*" + "ignorealpha 0.6, dock[0-9]*" + "blur, indicator.*" + "ignorealpha 0.6, indicator.*" + "blur, overview[0-9]*" + "ignorealpha 0.6, overview[0-9]*" + "blur, cheatsheet[0-9]*" + "ignorealpha 0.6, cheatsheet[0-9]*" + "blur, sideright[0-9]*" + "ignorealpha 0.6, sideright[0-9]*" + "blur, sideleft[0-9]*" + "ignorealpha 0.6, sideleft[0-9]*" + "blur, osk[0-9]*" + "ignorealpha 0.6, osk[0-9]*" + + # Quickshell rules + "blurpopups, quickshell:.*" + "blur, quickshell:.*" + "ignorealpha 0.79, quickshell:.*" + "animation slide top, quickshell:bar" + "animation fade, quickshell:screenCorners" + "animation slide right, quickshell:sidebarRight" + "animation slide left, quickshell:sidebarLeft" + "animation slide bottom, quickshell:osk" + "animation slide bottom, quickshell:dock" + "blur, quickshell:session" + "noanim, quickshell:session" + "ignorealpha 0, quickshell:session" + "animation fade, quickshell:notificationPopup" + "blur, quickshell:backgroundWidgets" + "ignorealpha 0.05, quickshell:backgroundWidgets" + "noanim, quickshell:screenshot" + "animation popin 120%, quickshell:screenCorners" + "noanim, quickshell:lockWindowPusher" + + # Launchers need to be FAST + "noanim, quickshell:overview" + "noanim, gtk4-layer-shell" + + # outfoxxed's stuff + "blur, shell:bar" + "ignorezero, shell:bar" + "blur, shell:notifications" + "ignorealpha 0.1, shell:notifications" + ]; + }; +} diff --git a/home-manager/modules/hypr/hyprlock.nix b/home-manager/modules/hypr/hyprlock.nix index 2498fff..a4f3c4c 100644 --- a/home-manager/modules/hypr/hyprlock.nix +++ b/home-manager/modules/hypr/hyprlock.nix @@ -2,7 +2,7 @@ { programs.hyprlock = { - nable = true; + enable = true; extraConfig = '' $text_color = rgba(ffdad9FF) $entry_background_color = rgba(40000a11) @@ -158,7 +158,7 @@ label { # Status monitor = - text = cmd[update:5000] ${HOME}/.config/hypr/hyprlock/status.sh + text = cmd[update:5000] ${config.home.homeDirectory}/.config/hypr/scripts/hyprlock-status.sh color = $text_color shadow_passes = 3 diff --git a/home-manager/modules/hypr/scripts/hide_window.sh b/home-manager/modules/hypr/scripts/hide_window.sh new file mode 100755 index 0000000..e43606f --- /dev/null +++ b/home-manager/modules/hypr/scripts/hide_window.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +stack_file="/tmp/hide_window_pid_stack.txt" + +function hide_window(){ + pid=$(hyprctl activewindow -j | jq '.pid') + hyprctl dispatch movetoworkspacesilent 88,pid:$pid + echo $pid >> $stack_file +} + +function show_window(){ + pid=$(tail -1 $stack_file && sed -i '$d' $stack_file) + [ -z $pid ] && exit + + current_workspace=$(hyprctl activeworkspace -j | jq '.id') + hyprctl dispatch movetoworkspacesilent $current_workspace,pid:$pid +} + + +if [ ! -z $1 ] +then + if [ "$1" == "h" ] + then + hide_window + else + show_window + fi +fi \ No newline at end of file diff --git a/home-manager/modules/hypr/scripts/hyprlock-status.sh b/home-manager/modules/hypr/scripts/hyprlock-status.sh new file mode 100755 index 0000000..dd80633 --- /dev/null +++ b/home-manager/modules/hypr/scripts/hyprlock-status.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +############ Variables ############ +enable_battery=false +battery_charging=false + +####### Check availability ######## +for battery in /sys/class/power_supply/*BAT*; do + if [[ -f "$battery/uevent" ]]; then + enable_battery=true + if [[ $(cat /sys/class/power_supply/*/status | head -1) == "Charging" ]]; then + battery_charging=true + fi + break + fi +done + +############# Output ############# +if [[ $enable_battery == true ]]; then + if [[ $battery_charging == true ]]; then + echo -n "(+) " + fi + echo -n "$(cat /sys/class/power_supply/*/capacity | head -1)"% + if [[ $battery_charging == false ]]; then + echo -n " remaining" + fi +fi + +echo '' \ No newline at end of file diff --git a/home-manager/modules/hypr/scripts/launch_first_available.sh b/home-manager/modules/hypr/scripts/launch_first_available.sh new file mode 100755 index 0000000..499947a --- /dev/null +++ b/home-manager/modules/hypr/scripts/launch_first_available.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +for cmd in "$@"; do + eval "command -v ${cmd%% *}" >/dev/null 2>&1 || continue + eval "$cmd" & + exit +done +exit 1 diff --git a/home-manager/modules/hypr/scripts/switch_config.sh b/home-manager/modules/hypr/scripts/switch_config.sh new file mode 100755 index 0000000..d920ac0 --- /dev/null +++ b/home-manager/modules/hypr/scripts/switch_config.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +CONFIG_DIR="$HOME/.config/hypr/hyprland/configs" +CURRENT_CONFIG_FILE="$HOME/.config/hypr/hyprland/active.conf" + +# List of available configs in order to cycle through +CONFIGS=("powersave" "balanced" "performance") + +# Read current config or set default +if [[ -f "$CURRENT_CONFIG_FILE" ]]; then + CURRENT_CONFIG=$(grep -oP '^#\s*\K\w+' "$CURRENT_CONFIG_FILE" | head -n1) +else + CURRENT_CONFIG="${CONFIGS[0]}" +fi + +# Find current config index +INDEX=0 +for i in "${!CONFIGS[@]}"; do + if [[ "${CONFIGS[$i]}" = "$CURRENT_CONFIG" ]]; then + INDEX=$i + break + fi +done + +# Calculate next config index (with wrap-around) +NEXT_INDEX=$(( (INDEX + 1) % ${#CONFIGS[@]} )) +NEXT_CONFIG="${CONFIGS[$NEXT_INDEX]}" + +# Update current config file +printf "# ${NEXT_CONFIG}\n" > "$CURRENT_CONFIG_FILE" +printf "# AUTO-GENERATED FILE\n" >> "$CURRENT_CONFIG_FILE" +cat "${CONFIG_DIR}/${NEXT_CONFIG}.conf" >> "$CURRENT_CONFIG_FILE" + +if [[ "$NEXT_CONFIG" == "powersave" ]]; then + sudo auto-cpufreq --force powersave +elif [[ "$NEXT_CONFIG" == "performance" ]]; then + sudo auto-cpufreq --force performance +elif [[ "$NEXT_CONFIG" == "balanced" ]]; then + sudo auto-cpufreq --force reset +else + notify-send -u critical "Unknown config: $NEXT_CONFIG" +fi + +# Reload Hyprland +hyprctl reload + +# Notification +notify-send -t 3000 "Hyprland Config" "Switched to ${NEXT_CONFIG} config" \ No newline at end of file diff --git a/home-manager/modules/hypr/scripts/workspace_action.sh b/home-manager/modules/hypr/scripts/workspace_action.sh new file mode 100755 index 0000000..a43badf --- /dev/null +++ b/home-manager/modules/hypr/scripts/workspace_action.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +hyprctl dispatch "$1" $(((($(hyprctl activeworkspace -j | jq -r .id) - 1) / 10) * 10 + $2)) diff --git a/home-manager/modules/programs.nix b/home-manager/modules/programs.nix index 5de125a..a8bfe0d 100644 --- a/home-manager/modules/programs.nix +++ b/home-manager/modules/programs.nix @@ -10,6 +10,7 @@ obsidian lmstudio plantuml + # amnezia-vpn ]; # do i really need it? diff --git a/home-manager/modules/zsh/zsh.nix b/home-manager/modules/zsh/zsh.nix index 6094b9b..7a0325f 100644 --- a/home-manager/modules/zsh/zsh.nix +++ b/home-manager/modules/zsh/zsh.nix @@ -16,6 +16,7 @@ ignoreAllDups = true; ignoreDups = true; saveNoDups = true; + share = false; }; plugins = with pkgs; [ diff --git a/nixos/custom-low-power.nix b/nixos/custom-low-power.nix index 3c3a989..3887309 100644 --- a/nixos/custom-low-power.nix +++ b/nixos/custom-low-power.nix @@ -1,3 +1,5 @@ +# # Возможно проблемы с оптимизацией USB (лагает клавиатура/мышь) + { config, lib, vars, ... }: let cfg = config.custom; @@ -12,7 +14,8 @@ in { }; }; - config = lib.mkIf cfg.battery.enable { + # config = lib.mkIf cfg.battery.enable { + config = { boot.kernelParams = [ "amd_pstate=active" ]; powerManagement.powertop.enable = @@ -20,8 +23,8 @@ in { services.system76-scheduler.settings.cfsProfiles.enable = true; # Better scheduling for CPU cycles - thanks System76!!! - services.thermald.enable = - true; # Enable thermald, the temperature management daemon. (only necessary if on Intel CPUs) + # services.thermald.enable = + # true; # Enable thermald, the temperature management daemon. (only necessary if on Intel CPUs) services.power-profiles-daemon.enable = false; # Disable GNOMEs power management services.tlp = { @@ -38,7 +41,7 @@ in { CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; AMDGPU_ABM_LEVEL_ON_AC = 0; - AMDGPU_ABM_LEVEL_ON_BAT = 3; + AMDGPU_ABM_LEVEL_ON_BAT = 0; PLATFORM_PROFILE_ON_AC = "performance"; PLATFORM_PROFILE_ON_BAT = "low-power"; PCIE_ASPM_ON_BAT = "powersupersave"; @@ -50,13 +53,13 @@ in { SOUND_POWER_SAVE_ON_BAT = 1; SOUND_POWER_SAVE_CONTROLLER = "Y"; CPU_MAX_PERF_ON_AC = 100; - CPU_MAX_PERF_ON_BAT = 10; + CPU_MAX_PERF_ON_BAT = 50; NMI_WATCHDOG = 0; - USB_AUTOSUSPEND = 1; + USB_AUTOSUSPEND = 0; USB_BLACKLIST_BTUSB = 0; - START_CHARGE_THRESH_BAT0 = 70; - STOP_CHARGE_THRESH_BAT0 = 86; + START_CHARGE_THRESH_BAT0 = 0; + STOP_CHARGE_THRESH_BAT0 = 1; }; }; }; diff --git a/nixos/custom.nix b/nixos/custom.nix index 4840982..0388233 100644 --- a/nixos/custom.nix +++ b/nixos/custom.nix @@ -15,7 +15,16 @@ programs.firefox.enable = true; nixpkgs.config.allowUnfree = true; - environment.systemPackages = with pkgs; [ kitty amnezia-vpn lenovo-legion ]; + environment.systemPackages = with pkgs; [ + kitty + amnezia-vpn + powertop + system76-scheduler + tlp + # lenovo-legion + ]; + + # starting the following units: accounts-daemon.service, systemd-modules-load.service, systemd-tmpfiles-resetup.service, tlp.ser # TODO: Добавить настройку вентиляторов @@ -27,6 +36,17 @@ }]; }]; # TODO: fix amnezia-service loading on startup + # systemd.services.amnezia-vpn-service = { + # description = "Amnezia VPN Service"; + # after = [ "network-online.target" ]; + # wantedBy = [ "multi-user.target" ]; + # serviceConfig = { + # ExecStart = "${pkgs.amnezia-vpn}/bin/AmneziaVPN-service"; + # Restart = "on-failure"; + # User = "root"; + # }; + # }; + programs.neovim = { enable = true; defaultEditor = true; @@ -80,11 +100,8 @@ consoleLogLevel = 3; initrd.verbose = false; - kernelModules = - [ "tun" "lenovo-legion-module" ]; # check if tun really needed + kernelModules = [ "tun" ]; # check if tun really needed kernelPackages = pkgs.linuxPackages_latest; - extraModulePackages = with config.boot.kernelPackages; - [ lenovo-legion-module ]; kernelParams = [ "quiet" "splash"