diff --git a/home/default.nix b/home/default.nix index 46d886d..42e6273 100644 --- a/home/default.nix +++ b/home/default.nix @@ -10,7 +10,7 @@ ./programs/git.nix ./programs/lf/. ./programs/zsh.nix - ./programs/tmux/. + ./programs/tmux.nix ]; programs.home-manager.enable = true; diff --git a/home/desktop/hyprland/default.nix b/home/desktop/hyprland/default.nix index 81efc71..7e7311d 100644 --- a/home/desktop/hyprland/default.nix +++ b/home/desktop/hyprland/default.nix @@ -6,11 +6,18 @@ }: let modifier = config.windowManager.modifierKey; menu = config.programs.menu.dmenuCommand; + lock_cmd = "${config.programs.hyprlock.package}/bin/hyprlock"; + color = { + inherit (config.lib.stylix.colors) yellow red; + bg = config.lib.stylix.colors.base00; + fg = config.lib.stylix.colors.base07; + text = config.lib.stylix.colors.base05; + }; + rgb = color: "rgb(${color})"; in { imports = [ (import ../utils/waybar.nix) (import ../utils/display.nix) - (import ../utils/hypridle.nix) ../../workstation.nix ]; xdg.portal = { @@ -19,6 +26,64 @@ in { extraPortals = [pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr]; }; + services.hypridle = { + enable = true; + settings = { + general = { + before_sleep_cmd = "rbw lock; hyprlock"; + after_sleep_cmd = "hyprctl dispatch dpms on"; + ignore_dbus_inhibit = false; + lock_cmd = "pidof ${lock_cmd} || ${lock_cmd}"; + }; + + listener = [ + { + timeout = 300; + on-timeout = "loginctl lock-session"; + } + { + timeout = 1200; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + ]; + }; + }; + + programs.hyprlock = { + enable = true; + settings = lib.mkForce { + # https://wiki.hyprland.org/Hypr-Ecosystem/hyprlock/ + general = { + hide_cursor = true; + grace = 10; + ignore_empty_input = true; + }; + + background = [ + { + path = "screenshot"; + blur_passes = 3; + blur_size = 8; + } + ]; + + input-field = [ + { + dots_center = true; + fade_on_empty = true; + outline_thickness = 5; + shadow_passes = 2; + inner_color = rgb color.bg; + outer_color = rgb color.fg; + font_color = rgb color.text; + fail_color = rgb color.red; + check_color = rgb color.yellow; + } + ]; + }; + }; + wayland.windowManager.hyprland = { enable = true; systemd = { diff --git a/home/desktop/niri/default.nix b/home/desktop/niri/default.nix index 9fd5805..fcfa0a8 100644 --- a/home/desktop/niri/default.nix +++ b/home/desktop/niri/default.nix @@ -4,14 +4,6 @@ config, ... }: { - imports = [ - (import ../utils/hypridle.nix) - (import ../utils/waybar.nix) - ../../workstation.nix - ]; - - programs.waybar.settings.mainBar.modules-left = ["niri/workspaces" "niri/window"]; - programs.fuzzel = { enable = true; settings = { @@ -23,18 +15,15 @@ }; services.hyprpaper.enable = true; systemd.user.services.hyprpaper.Unit.WantedBy = ["niri.service"]; - systemd.user.services.waybar.Unit.WantedBy = ["niri.service"]; home.packages = with pkgs; [brightnessctl]; services.mako.enable = true; - systemd.user.services.mako.Unit.WantedBy = ["niri.service"]; programs.niri = { settings = { input.keyboard = { xkb.layout = "us"; xkb.variant = "dvorak"; - xkb.options = "caps:escape"; }; input.mouse = { accel-profile = "flat"; @@ -45,35 +34,8 @@ prefer-no-csd = true; spawn-at-startup = [ {command = [(lib.getExe pkgs.xwayland-satellite)];} + {command = [(lib.getExe config.services.mako.package)];} ]; - layout = { - preset-column-widths = [ - {proportion = 1.0;} - {proportion = 1.0 / 2.0;} - ]; - }; - environment = { - NIXOS_OZONE_WL = "1"; - DISPLAY = ":1"; - }; - outputs."DP-3" = { - mode = { - width = 1920; - height = 1080; - refresh = 143.855; - }; - variable-refresh-rate = true; - scale = 1.0; - }; - outputs."HDMI-A-1" = { - mode = { - width = 3840; - height = 2160; - refresh = 120.0; - }; - variable-refresh-rate = true; - scale = 2.5; - }; binds = with config.lib.niri.actions; { "Mod+Return".action.spawn = [(lib.getExe config.programs.terminal)]; "Mod+O".action.spawn = [(lib.getExe pkgs.cosmic-files)]; @@ -85,14 +47,12 @@ "Mod+Ctrl+WheelScrollRight".action = move-column-right; "Mod+Right".action = focus-column-right; - "Mod+Ctrl+Right".action = move-column-right; "Mod+L".action = focus-column-right; "Mod+Ctrl+L".action = move-column-right; "Mod+WheelScrollLeft".action = focus-column-left; "Mod+Ctrl+WheelScrollLeft".action = move-column-left; "Mod+Left".action = focus-column-left; - "Mod+Ctrl+Left".action = move-column-left; "Mod+H".action = focus-column-left; "Mod+Ctrl+H".action = move-column-left; @@ -102,28 +62,16 @@ "Mod+Comma".action = consume-or-expel-window-left; "Mod+Period".action = consume-or-expel-window-right; - "Mod+F".action = fullscreen-window; "Mod+Q".action = close-window; "Mod+Shift+Escape".action = quit; - "Mod+Escape".action.spawn = lib.getExe config.programs.hyprlock.package; "Mod+WheelScrollDown".action = focus-workspace-down; "Mod+WheelScrollUp".action = focus-workspace-up; "Mod+Ctrl+WheelScrollDown".action = move-column-to-workspace-down; "Mod+Ctrl+WheelScrollUp".action = move-column-to-workspace-up; - "Mod+J".action = focus-workspace-down; - "Mod+K".action = focus-workspace-up; - "Mod+Ctrl+J".action = move-column-to-workspace-down; - "Mod+Ctrl+K".action = move-column-to-workspace-up; - - "Mod+Down".action = focus-workspace-down; - "Mod+Up".action = focus-workspace-up; - "Mod+Ctrl+Down".action = move-column-to-workspace-down; - "Mod+Ctrl+Up".action = move-column-to-workspace-up; - - "Mod+M".action = switch-preset-column-width; + "Mod+M".action = maximize-column; "Mod+G".action = toggle-window-floating; "Print".action = screenshot; diff --git a/home/desktop/utils/hypridle.nix b/home/desktop/utils/hypridle.nix deleted file mode 100644 index d0c0316..0000000 --- a/home/desktop/utils/hypridle.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ - config, - lib, - ... -}: let - rgb = color: "rgb(${color})"; - lock_cmd = "${config.programs.hyprlock.package}/bin/hyprlock"; - color = { - inherit (config.lib.stylix.colors) yellow red; - bg = config.lib.stylix.colors.base00; - fg = config.lib.stylix.colors.base07; - text = config.lib.stylix.colors.base05; - }; -in { - services.hypridle = { - enable = true; - settings = { - general = { - before_sleep_cmd = "rbw lock; hyprlock"; - after_sleep_cmd = "hyprctl dispatch dpms on"; - ignore_dbus_inhibit = false; - lock_cmd = "pidof ${lock_cmd} || ${lock_cmd}"; - }; - - listener = [ - { - timeout = 300; - on-timeout = "loginctl lock-session"; - } - { - timeout = 1200; - on-timeout = "hyprctl dispatch dpms off"; - on-resume = "hyprctl dispatch dpms on"; - } - ]; - }; - }; - - programs.hyprlock = { - enable = true; - settings = lib.mkForce { - # https://wiki.hyprland.org/Hypr-Ecosystem/hyprlock/ - general = { - hide_cursor = true; - grace = 10; - ignore_empty_input = true; - }; - - background = [ - { - path = "screenshot"; - blur_passes = 3; - blur_size = 8; - } - ]; - - input-field = [ - { - dots_center = true; - fade_on_empty = true; - outline_thickness = 5; - shadow_passes = 2; - inner_color = rgb color.bg; - outer_color = rgb color.fg; - font_color = rgb color.text; - fail_color = rgb color.red; - check_color = rgb color.yellow; - } - ]; - }; - }; -} diff --git a/home/desktop/utils/waybar.nix b/home/desktop/utils/waybar.nix index 02d90cb..f03354f 100644 --- a/home/desktop/utils/waybar.nix +++ b/home/desktop/utils/waybar.nix @@ -7,24 +7,9 @@ layer = "bottom"; position = "top"; height = 36; - modules-right = ["mpris" "power-profiles-daemon" "cpu" "idle_inhibitor" "pulseaudio" "clock" "tray" "battery"]; - "cpu" = { - "format" = "{icon}"; - "format-icons" = ["▁" "▂" "▃" "▄" "▅" "▆" "▇" "█"]; - }; - "power-profiles-daemon" = { - "format" = "{icon}"; - "tooltip-format" = "Power profile: {profile}\nDriver: {driver}"; - "tooltip" = true; - "format-icons" = { - "default" = ""; - "performance" = ""; - "balanced" = ""; - "power-saver" = ""; - }; - }; + modules-right = ["mpris" "idle_inhibitor" "pulseaudio" "clock" "tray" "battery"]; clock = { - format = "📅 {:%a %b-%d, %I:%M %p}"; + format = "📅 {:%a %b-%d %I:%M %p}"; }; idle_inhibitor = { format = "{icon}"; diff --git a/home/programs/tmux/default.nix b/home/programs/tmux.nix similarity index 76% rename from home/programs/tmux/default.nix rename to home/programs/tmux.nix index d964aae..4d645ca 100644 --- a/home/programs/tmux/default.nix +++ b/home/programs/tmux.nix @@ -1,10 +1,4 @@ { - pkgs, - lib, - ... -}: let - sessionizer = lib.getExe (pkgs.writeShellScriptBin "tmux-sessionizer" (lib.readFile ./sessionizer.sh)); -in { programs.tmux = { enable = true; baseIndex = 1; @@ -31,12 +25,8 @@ in { bind -n M-u copy-mode bind -n M-p previous-window bind -n M-n next-window - bind-key -r f run-shell "tmux neww ${sessionizer}" set-option -g renumber-windows on ''; }; - programs.zsh.initContent = '' - bindkey -s ^f "${sessionizer}\n" - ''; } diff --git a/home/programs/tmux/sessionizer.sh b/home/programs/tmux/sessionizer.sh deleted file mode 100644 index 33ac5fc..0000000 --- a/home/programs/tmux/sessionizer.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -if [[ $# -eq 1 ]]; then - selected=$1 -else - selected=$(find ~/Documents/code ~/Documents/infra -mindepth 1 -maxdepth 1 -type d | fzf) -fi - -if [[ -z $selected ]]; then - exit 0 -fi - -selected_name=$(basename "$selected" | tr . _) -tmux_running=$(pgrep tmux) - -if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then - tmux new-session -s $selected_name -c $selected - exit 0 -fi - -if ! tmux has-session -t=$selected_name 2> /dev/null; then - tmux new-session -ds $selected_name -c $selected -fi - -if [[ -z $TMUX ]]; then - tmux attach -t $selected_name -else - tmux switch-client -t $selected_name -fi diff --git a/home/workstation.nix b/home/workstation.nix index 2e9b0c2..f4e68c0 100644 --- a/home/workstation.nix +++ b/home/workstation.nix @@ -28,7 +28,6 @@ playerctl quickemu devenv - bottles ]; services.udiskie = {