From 6ab819268e562a6137e52086347e1fe1110e1f24 Mon Sep 17 00:00:00 2001 From: meml0rz Date: Mon, 9 Dec 2024 20:49:04 +0100 Subject: [PATCH] kekl --- flake.nix | 18 ++- modules/home.nix | 19 ++- modules/nix/hypr/kitty.nix | 5 + modules/nix/nvim/default.nix | 2 +- modules/nix/sway/default.nix | 15 ++ modules/nix/sway/raw/rofi/config.rasi | 76 +++++++++ modules/nix/sway/raw/waybar/config | 189 +++++++++++++++++++++++ modules/nix/sway/raw/waybar/style.css | 134 ++++++++++++++++ modules/nix/sway/raw/wezterm/wezterm.lua | 139 +++++++++++++++++ modules/nix/sway/sway.nix | 107 +++++++++++++ 10 files changed, 692 insertions(+), 12 deletions(-) create mode 100644 modules/nix/sway/default.nix create mode 100755 modules/nix/sway/raw/rofi/config.rasi create mode 100755 modules/nix/sway/raw/waybar/config create mode 100644 modules/nix/sway/raw/waybar/style.css create mode 100755 modules/nix/sway/raw/wezterm/wezterm.lua create mode 100644 modules/nix/sway/sway.nix diff --git a/flake.nix b/flake.nix index 6442652..cdceb9b 100644 --- a/flake.nix +++ b/flake.nix @@ -19,6 +19,11 @@ nixvim, ... }: + let + system = "x86_64-linux"; + pkgs = inputs.nixpkgs.legacyPackages.${system}; + pkgs-stable = inputs.nixpkgs-stable.legacyPackages.${system}; + in { nixosConfigurations = { poggers = nixpkgs.lib.nixosSystem { @@ -27,17 +32,24 @@ ./configuration.nix home-manager.nixosModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.fabian = import ./modules/home.nix; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.fabian = import ./modules/home.nix; + }; home-manager.extraSpecialArgs = { inherit nixvim; + inherit inputs; + inherit pkgs; + inherit pkgs-stable; }; } ]; }; specialArgs = { inherit inputs; + inherit pkgs; + inherit pkgs-stable; }; }; }; diff --git a/modules/home.nix b/modules/home.nix index b7898cd..24b37bd 100644 --- a/modules/home.nix +++ b/modules/home.nix @@ -3,15 +3,18 @@ imports = [ ./nix/user.nix ./nix/nvim/default.nix - ./nix/hypr/default.nix - ./nix/bspwm/default.nix + #./nix/hypr/default.nix + #./nix/bspwm/default.nix + ./nix/sway/default.nix ]; - home.enableNixpkgsReleaseCheck = false; - home.stateVersion = "24.05"; - home.file = { - ".wp/temple.png".source = ./raw/wp/temple.png; - ".wp/skull_purple.png".source = ./raw/wp/skull_purple.png; - ".wp/gruvbox-dark-blue.png".source = ./raw/wp/gruvbox-dark-blue.png; + home = { + enableNixpkgsReleaseCheck = false; + stateVersion = "24.05"; + file = { + ".wp/temple.png".source = ./raw/wp/temple.png; + ".wp/skull_purple.png".source = ./raw/wp/skull_purple.png; + ".wp/gruvbox-dark-blue.png".source = ./raw/wp/gruvbox-dark-blue.png; + }; }; } diff --git a/modules/nix/hypr/kitty.nix b/modules/nix/hypr/kitty.nix index 9fa7ccc..42c1877 100644 --- a/modules/nix/hypr/kitty.nix +++ b/modules/nix/hypr/kitty.nix @@ -7,6 +7,11 @@ font_size 15.0 cursor_shape beam close_window true + confirm_os_window_close 0 + + foreground #e6e6dc + background #161616 + ''; }; tmux = { diff --git a/modules/nix/nvim/default.nix b/modules/nix/nvim/default.nix index 1043322..3d11af2 100644 --- a/modules/nix/nvim/default.nix +++ b/modules/nix/nvim/default.nix @@ -18,6 +18,6 @@ ]; programs.nixvim = { enable = true; - colorschemes.gruvbox.enable = true; + colorschemes.oxocarbon.enable = true; }; } diff --git a/modules/nix/sway/default.nix b/modules/nix/sway/default.nix new file mode 100644 index 0000000..691e7c9 --- /dev/null +++ b/modules/nix/sway/default.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: +{ + imports = [ + ./sway.nix + ]; + home.file = { + # ROFI + ".config/rofi/config.rasi".source = ./raw/rofi/config.rasi; + # WEZTERM + ".config/wezterm/wezterm.lua".source = ./raw/wezterm/wezterm.lua; + # WAYBAR + ".config/waybar/style.css".source = ./raw/waybar/style.css; + ".config/waybar/config".source = ./raw/waybar/config; + }; +} diff --git a/modules/nix/sway/raw/rofi/config.rasi b/modules/nix/sway/raw/rofi/config.rasi new file mode 100755 index 0000000..f1ab9c7 --- /dev/null +++ b/modules/nix/sway/raw/rofi/config.rasi @@ -0,0 +1,76 @@ +configuration { + display-drun: "Applications:"; + drun-display-format: "{icon} {name}"; + font: "JetBrainsMono Nerd Font Medium 10"; + show-icons: true; + modi: "drun"; +} + +@theme "/dev/null" + +* { + + opacity: 0.5; + color0: #39305320; + color1: #494d6420; + color3: #d8dee9; + color4: #7b68ee; + color5: #cbe3e7; + + + background-color: transparent; + text-color: @color3; + accent-color: @color5; + + margin: 0px; + border: 0px; + padding: 0px; + spacing: 0px; +} + +window { + background-color: @color0; + border-color: @accent-color; + + width: 50%; + border: 2px; +} + +inputbar { + padding: 10px 12px; + spacing: 12px; + children: [ prompt, entry ]; +} + +prompt, entry, element-text, element-icon { + vertical-align: 0.5; +} + +prompt { + text-color: @accent-color; + enabled: true; + text-color: @color4; +} + +listview { + lines: 8; + columns: 2; + +} + +element { + padding: 8px; + spacing: 8px; +} + +element selected { + text-color: @color4; +} + +element-icon { + size: 20; +} + +element-text { + text-color: inherit; +} diff --git a/modules/nix/sway/raw/waybar/config b/modules/nix/sway/raw/waybar/config new file mode 100755 index 0000000..7b1b733 --- /dev/null +++ b/modules/nix/sway/raw/waybar/config @@ -0,0 +1,189 @@ +[ + { + "battery": { + "format": "{icon} {capacity}%", + "format-alt": "{icon} {time}", + "format-charging": " {capacity}%", + "format-icons": [ + "", + "", + "", + "", + "" + ], + "format-plugged": " {capacity}% ", + "states": { + "critical": 15, + "good": 95, + "warning": 30 + } + }, + "cava#left": { + "autosens": 1, + "bar_delimiter": 0, + "bars": 18, + "format-icons": [ + "", + "", + "", + "", + "", + "", + "", + "" + ], + "framerate": 60, + "higher_cutoff_freq": 10000, + "input_delay": 2, + "lower_cutoff_freq": 50, + "method": "pulse", + "monstercat": false, + "reverse": false, + "source": "auto", + "stereo": true, + "waves": false + }, + "cava#right": { + "autosens": 1, + "bar_delimiter": 0, + "bars": 18, + "format-icons": [ + "", + "", + "", + "", + "", + "", + "", + "" + ], + "framerate": 60, + "higher_cutoff_freq": 10000, + "input_delay": 2, + "lower_cutoff_freq": 50, + "method": "pulse", + "monstercat": false, + "reverse": false, + "source": "auto", + "stereo": true, + "waves": false + }, + "clock": { + "format": " {:%a, %d %b, %I:%M %p}", + "format-alt": " {:%d/%m}", + "tooltip": "true", + "tooltip-format": "{:%Y %B}\n{calendar}" + }, + "cpu": { + "format": "󰻠 {usage}%", + "format-alt": "󰻠 {avg_frequency} GHz", + "interval": 5 + }, + "custom/launcher": { + "format": "", + "tooltip": "false" + }, + "custom/playerctl#backward": { + "format": "󰙣 ", + "on-click": "playerctl previous", + "on-scroll-down": "playerctl volume .05-", + "on-scroll-up": "playerctl volume .05+" + }, + "custom/playerctl#foward": { + "format": "󰙡 ", + "on-click": "playerctl next", + "on-scroll-down": "playerctl volume .05-", + "on-scroll-up": "playerctl volume .05+" + }, + "custom/playerctl#play": { + "exec": "playerctl -a metadata --format '{\"text\": \"{{artist}} - {{markup_escape(title)}}\", \"tooltip\": \"{{playerName}} : {{markup_escape(title)}}\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}' -F", + "format": "{icon}", + "format-icons": { + "Paused": "", + "Playing": "󰏥 ", + "Stopped": "" + }, + "on-click": "playerctl play-pause", + "on-scroll-down": "playerctl volume .05-", + "on-scroll-up": "playerctl volume .05+", + "return-type": "json" + }, + "custom/playerlabel": { + "exec": "playerctl -a metadata --format '{\"text\": \"{{artist}} - {{markup_escape(title)}}\", \"tooltip\": \"{{playerName}} : {{markup_escape(title)}}\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}' -F", + "format": "󰎈 {} 󰎈", + "max-length": 40, + "on-click": "", + "return-type": "json" + }, + "custom/randwall": { + "format": "󰏘" + }, + "height": 35, + "layer": "top", + "margin-bottom": 0, + "margin-left": 0, + "margin-right": 0, + "margin-top": 0, + "memory": { + "format": "󰍛 {}%", + "format-alt": "󰍛 {used}/{total} GiB", + "interval": 5 + }, + "modules-center": [ + "custom/playerlabel", + ], + "modules-left": [ + "cava#left", + "custom/playerctl#backward", + "custom/playerctl#play", + "custom/playerctl#foward", + ], + "modules-right": [ + "tray", + "battery", + "pulseaudio", + "network", + ], + + "network": { + "format-disconnected": "󰖪 0% ", + "format-ethernet": "󰈀 100% ", + "format-linked": "{ifname} (No IP)", + "format-wifi": " {signalStrength}%", + "tooltip-format": "Connected to {essid} {ifname} via {gwaddr}" + }, + "position": "top", + "pulseaudio": { + "format": "{icon} {volume}%", + "format-icons": { + "default": [ + "󰕿", + "󰖀", + "󰕾" + ] + }, + "format-muted": "󰝟", + "on-click": "pavucontrol", + "scroll-step": 5 + }, + "tray": { + "icon-size": 20, + "spacing": 8 + }, + "wlr/workspaces": { + "active-only": false, + "all-outputs": false, + "disable-scroll": false, + "format": "{name}", + "format-icons": { + "active": "", + "default": "", + "sort-by-number": true, + "urgent": "" + }, + "on-click": "activate", + "on-scroll-down": "hyprctl dispatch workspace e+1", + "on-scroll-up": "hyprctl dispatch workspace e-1" + } + } +] diff --git a/modules/nix/sway/raw/waybar/style.css b/modules/nix/sway/raw/waybar/style.css new file mode 100644 index 0000000..a1f056e --- /dev/null +++ b/modules/nix/sway/raw/waybar/style.css @@ -0,0 +1,134 @@ +* { + border: none; + border-radius: 0px; + font-family: RobotoMono Nerd Font; + font-size: 14px; + min-height: 0; +} + +window#waybar { + /* background: rgba(17,17,27,1); */ + background: transparent; +} + +#cava.left, #cava.right { + /* background: #25253a; */ + + /*background: #25253a;*/ + background: #010101; + margin: 5px; + padding: 8px 16px; + color: #cba6f7; +} +#cava.left { + border-radius: 24px 24px 24px 24px; +} +#cava.right { + border-radius: 10px 24px 10px 24px; +} +#workspaces { + background: #11111b; + margin: 5px 5px; + padding: 8px 5px; + border-radius: 16px; + color: #cba6f7 +} +#workspaces button { + padding: 0px 5px; + margin: 0px 3px; + border-radius: 16px; + color: transparent; + background: rgba(17,17,27,1); + transition: all 0.3s ease-in-out; +} + +#workspaces button.active { + background-color: #89b4fa; + color: #11111B; + border-radius: 16px; + min-width: 50px; + background-size: 400% 400%; + transition: all 0.3s ease-in-out; +} + +#workspaces button:hover { + background-color: #f5f5f5; + color: #11111B; + border-radius: 16px; + min-width: 50px; + background-size: 400% 400%; +} + +#tray, #pulseaudio, #network, #battery, +#custom-playerctl.backward, #custom-playerctl.play, #custom-playerctl.foward{ + background: #010101; + font-weight: bold; + margin: 5px 0px; + opacity: 1; +} +#tray, #pulseaudio, #network, #battery{ + color: #f5f5f5; + border-radius: 24px 24px 24px 24px; + padding: 0 20px; + margin-left: 7px; +} +#clock { + color: #f5f5f5; + background: #010101; + border-radius: 0px 0px 0px 40px; + padding: 10px 10px 15px 25px; + margin-left: 7px; + font-weight: bold; + font-size: 16px; +} +#custom-launcher { + color: #89b4fa; + background: #010101; + border-radius: 0px 0px 40px 0px; + margin: 0px; + padding: 0px 35px 0px 15px; + font-size: 28px; +} + +#custom-playerctl.backward, #custom-playerctl.play, #custom-playerctl.foward { + background: #010101; + font-size: 22px; +} +#custom-playerctl.backward:hover, #custom-playerctl.play:hover, #custom-playerctl.foward:hover{ + color: #f5f5f5; +} +#custom-playerctl.backward { + color: #cba6f7; + border-radius: 24px 0px 0px 24px; + padding-left: 16px; + margin-left: 7px; +} +#custom-playerctl.play { + color: #89b4fa; + padding: 0 5px; +} +#custom-playerctl.foward { + color: #cba6f7; + border-radius: 0px 24px 24px 0px; + padding-right: 12px; + margin-right: 7px +} +#custom-playerlabel { + background: #010101; + color: #f5f5f5; + padding: 0 20px; + border-radius: 24px 24px 24px 24px; + margin: 5px 0; + font-weight: bold; +} +#window{ + /*background: #25253a; */ + padding-left: 15px; + padding-right: 15px; + border-radius: 16px; + margin-top: 5px; + margin-bottom: 5px; + font-weight: normal; + font-style: normal; + opacity: 0.1; +} diff --git a/modules/nix/sway/raw/wezterm/wezterm.lua b/modules/nix/sway/raw/wezterm/wezterm.lua new file mode 100755 index 0000000..88e10ae --- /dev/null +++ b/modules/nix/sway/raw/wezterm/wezterm.lua @@ -0,0 +1,139 @@ +local wezterm = require 'wezterm' +local act = wezterm.action + +mb = { +} + +for i = 1,99,1 +do + table.insert(mb, + { + event = { Down = { streak = i, button = 'Middle' } }, + mods = 'NONE', + action = act.PasteFrom("PrimarySelection") + }) + table.insert(mb, { + event = { Down = { streak = i, button = 'Right' } }, + mods = 'NONE', + action = wezterm.action_callback(function(window, pane) + local has_selection = window:get_selection_text_for_pane(pane) ~= '' + if has_selection then + window:perform_action( + act.CopyTo 'ClipboardAndPrimarySelection', + pane + ) + + window:perform_action(act.ClearSelection, pane) + else + window:perform_action(act.PasteFrom("PrimarySelection"), pane) + end + end), + }) +end + +return { + disable_default_key_bindings = true, + pane_focus_follows_mouse = false, + mouse_bindings = mb, +-- leader = { key = 'VoidSymbol', timeout_milliseconds = 1000 }, + keys = { +-- { +-- key = 'c', +-- mods = 'CTRL|SHIFT', +-- action = wezterm.action.SpawnCommandInNewTab { +-- args = { 'zsh' }, +-- cwd = '~' +-- }, +-- }, + { + key = 'v', + mods = 'CTRL|SHIFT', + action = act.PasteFrom("Clipboard"), + }, + { + key = 'c', + mods = 'CTRL|SHIFT', + action = act.CopyTo("Clipboard"), + }, + { + key = 't', + mods = 'CTRL|SHIFT', + action = wezterm.action.SpawnCommandInNewTab { + args = { 'fish' }, + cwd = '~' + }, + }, + { + key = 'f', + mods = 'CTRL', + action = wezterm.action.TogglePaneZoomState, + }, +-- { +-- key = 'p', +-- mods = 'LEADER', +-- action = act.ActivateTabRelative(-1), +-- }, +-- { +-- key = 'n', +-- mods = 'LEADER', +-- action = act.ActivateTabRelative(1), +-- }, + + }, + window_padding = { + left = 2, + right = 2, + top = 0, + bottom = 0, + }, + window_frame = { + border_left_width = '0.5cell', + border_right_width = '0.5cell', + }, + window_background_opacity = 0.50, + window_decorations = "NONE", + tab_bar_at_bottom = true, + hide_tab_bar_if_only_one_tab = true, + warn_about_missing_glyphs = false, + use_fancy_tab_bar = true, + scrollback_lines = 999999, + enable_scroll_bar = false, + adjust_window_size_when_changing_font_size=false, + -- font = wezterm.font_with_fallback({"Hack", "Twemoji"}), + font_size = 15, + force_reverse_video_cursor = false, + colors = { + ansi = { + '#1d1f21', + '#cc6666', + '#b5bd68', + '#f0c674', + '#81a2be', + '#b294bb', + '#8abeb7', + '#c5c8c6' + }, + background = '#010101', + brights = { + '#969896', + '#cc6666', + '#b5bd68', + '#f0c674', + '#81a2be', + '#b294bb', + '#8abeb7', + '#ffffff' + }, + foreground = '#c5c8c6', + selection_bg = '#373b41', + selection_fg = '#c5c8c6', + cursor_bg = '#c5c8c6', + cursor_border = '#c5c8c6', + cursor_fg = '#1d1f21', + }, +-- color_scheme = 'Catppuccin Macchiato', +-- default_cursor_style = 'BlinkingBlock', +-- cursor_blink_rate = 500, +-- animation_fps = 100, +-- front_end = "Software", +} diff --git a/modules/nix/sway/sway.nix b/modules/nix/sway/sway.nix new file mode 100644 index 0000000..4da447e --- /dev/null +++ b/modules/nix/sway/sway.nix @@ -0,0 +1,107 @@ +{ config, pkgs, ... }: +{ + wayland.windowManager.sway = { + enable = true; + xwayland = true; + package = pkgs.swayfx-unwrapped; + wrapperFeatures.gtk = true; + checkConfig = false; + extraSessionCommands = '' + export _JAVA_AWT_WM_NONREPARENTING=1 + export QT_QPA_PLATFORM=wayland + export XDG_CURRENT_DESKTOP=sway + ''; + + config = rec { + modifier = "Mod4"; + terminal = "wezterm"; + menu = "${pkgs.rofi}/bin/rofi -show drun -c .config/rofi/config.rasi"; + startup = [ + { command = "swaybg -i $HOME/.wp/skull_purple.png"; } + ]; + bars = [ { command = "waybar"; } ]; + gaps = { + outer = 5; + inner = 10; + }; + + window = { + border = 0; + }; + + keybindings = { + # IMPORTANT STUFF # + "${modifier}+Return" = "exec ${terminal}"; + "${modifier}+space" = "exec ${menu}"; + "${modifier}+Q" = "kill"; + "${modifier}+Shift+R" = "reload"; + # WINDOW STUFF # + "${modifier}+Shift+space" = "floating toggle"; + "${modifier}+Shift+F" = "fullscreen toggle"; + "${modifier}+Left" = "focus left"; + "${modifier}+Down" = "focus down"; + "${modifier}+Up" = "focus up"; + "${modifier}+Right" = "focus right"; + + "${modifier}+Ctrl+Right" = "resize shrink width 3 px or 3 ppt"; + "${modifier}+Ctrl+Down" = "resize grow height 3 px or 3 ppt"; + "${modifier}+Ctrl+Up" = "resize shrink height 3 px or 3 ppt"; + "${modifier}+Ctrl+Left" = "resize grow width 3 px or 3 ppt"; + + "${modifier}+Shift+Left" = "move left"; + "${modifier}+Shift+Down" = "move down"; + "${modifier}+Shift+Up" = "move up"; + "${modifier}+Shift+Right" = "move right"; + + # WORKSPACES # + "${modifier}+1" = "workspace number 1"; + "${modifier}+2" = "workspace number 2"; + "${modifier}+3" = "workspace number 3"; + "${modifier}+4" = "workspace number 4"; + "${modifier}+5" = "workspace number 5"; + "${modifier}+6" = "workspace number 6"; + "${modifier}+7" = "workspace number 7"; + "${modifier}+8" = "workspace number 8"; + "${modifier}+9" = "workspace number 9"; + + # MOVE WINDOW TO OTHER WS # + "${modifier}+Shift+1" = "move container to workspace number 1"; + "${modifier}+Shift+2" = "move container to workspace number 2"; + "${modifier}+Shift+3" = "move container to workspace number 3"; + "${modifier}+Shift+4" = "move container to workspace number 4"; + "${modifier}+Shift+5" = "move container to workspace number 5"; + "${modifier}+Shift+6" = "move container to workspace number 6"; + "${modifier}+Shift+7" = "move container to workspace number 7"; + "${modifier}+Shift+8" = "move container to workspace number 8"; + "${modifier}+Shift+9" = "move container to workspace number 9"; + + # Audio + "XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +10%"; + "XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -10%"; + "XF86AudioMute" = "exec set-volume toggle-mute"; + "XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop"; + "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous"; + "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next"; + "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; + + "XF86MonBrightnessDown" = "exec brightnessctl set 15%-"; + "XF86MonBrightnessUp" = "exec brightnessctl set +15%"; + + }; + }; + + extraConfig = '' + shadows enable + corner_radius 12 + blur_radius 7 + blur_passes 4 + default_dim_inactive 0.2 + for_window [app_id="wezterm"] blur enable + for_window [app_id="code"] blur enable + for_window [app_id="rofi"] blur enable + default_border pixel 0px + default_floating_border none + titlebar_border_thickness 0 + ''; + }; +}