diff options
Diffstat (limited to 'common/home')
| -rw-r--r-- | common/home/default.nix | 2 | ||||
| -rw-r--r-- | common/home/hyprland/default.nix | 264 | ||||
| -rw-r--r-- | common/home/hyprland/hl.nix | 38 | ||||
| -rw-r--r-- | common/home/programs/waybar/default.nix | 45 | ||||
| -rw-r--r-- | common/home/programs/waybar/style.css | 78 |
5 files changed, 169 insertions, 258 deletions
diff --git a/common/home/default.nix b/common/home/default.nix index 4a33662..2296d0d 100644 --- a/common/home/default.nix +++ b/common/home/default.nix @@ -105,7 +105,7 @@ packages = [ accounts = import ./accounts { }; - wayland.windowManager.hyprland = import ./hyprland { inherit pkgs; }; + wayland.windowManager.hyprland = import ./hyprland { inherit pkgs; inherit lib; }; home.packages = packages ++ scripts; diff --git a/common/home/hyprland/default.nix b/common/home/hyprland/default.nix index 5ce838d..9ddb9bd 100644 --- a/common/home/hyprland/default.nix +++ b/common/home/hyprland/default.nix @@ -1,4 +1,8 @@ -{ pkgs, ... }: { +{ pkgs, lib, ... }: +let + hl = import ./hl.nix { inherit lib; }; +in +{ enable = true; systemd = { @@ -6,196 +10,130 @@ variables = [ "--all" ]; }; xwayland.enable = true; - #plugins = [ pkgs.hyprlandPlugins.hyprsplit ]; - configType = "hyprlang"; + configType = "lua"; settings = { - plugin = { - #hyprsplit = { - # num_workspaces = 10; - # persistent_workspaces = false; - #}; + mod = { + _var = "SUPER"; }; - "$mod" = "SUPER"; bind = [ - "$mod+Shift, Q, exit" - "$mod, C, killactive," - "$mod+Ctrl, F, togglefloating," - "$mod+Ctrl, S, togglesplit," + (hl.bind { mod = true; keys = [ "Q" ]; flags = { long_press = true; locked = true; }; } (hl.dsp.exec "shutdown")) - "$mod, Escape, exec, hyprlock" - "$mod, Space, exec, wofi --show drun" - "$mod, Shift+Space, exec, wofi --show run" - "$mod, O, exec, openproject" - "$mod, V, exec, openproject -e nvim" - "$mod, B, exec, bluemenu" - "$mod, P, pseudo" + (hl.bind { mod = true; keys = [ "h" ]; } (hl.dsp.focus { direction = "left"; })) + (hl.bind { mod = true; keys = [ "j" ]; } (hl.dsp.focus { direction = "down"; })) + (hl.bind { mod = true; keys = [ "k" ]; } (hl.dsp.focus { direction = "up"; })) + (hl.bind { mod = true; keys = [ "l" ]; } (hl.dsp.focus { direction = "right"; })) + (hl.bind { mod = true; keys = [ "i" ]; } (hl.dsp.layout "removemaster")) + (hl.bind { mod = true; keys = [ "d" ]; } (hl.dsp.layout "addmaster")) - "$mod, F1, exec, loadconfig" + (hl.bind { mod = true; shift = true; keys = [ "h" ]; } (hl.dsp.window.move { direction = "left"; })) + (hl.bind { mod = true; shift = true; keys = [ "j" ]; } (hl.dsp.window.move { direction = "down"; })) + (hl.bind { mod = true; shift = true; keys = [ "k" ]; } (hl.dsp.window.move { direction = "up"; })) + (hl.bind { mod = true; shift = true; keys = [ "l" ]; } (hl.dsp.window.move { direction = "right"; })) - "$mod, S, exec, sshconnect" + (hl.bind { mod = true; keys = [ "c" ]; } hl.dsp.window.close) + (hl.bind { mod = true; keys = [ "f" ]; } hl.dsp.window.fullscreen) - "$mod+Shift, Return, exec, alacritty" - "$mod+Shift, B, exec, firefox" - "$mod+Shift, P, exec, wofi-pass" - "$mod+Shift, O, exec, wofi-pass otp" - "$mod+Shift, E, exec, webtrayctl show https://chat.nathanreiner.xyz" - "$mod+Shift+Alt, J, exec, webtrayctl show https://jellyfin.nathanreiner.xyz" - "$mod+Shift, S, exec, signal-desktop" + (hl.bind { mod = true; keys = [ "Escape" ]; } (hl.dsp.exec "hyprlock")) + (hl.bind { mod = true; keys = [ "Space" ]; } (hl.dsp.exec "wofi --show drun")) + (hl.bind { mod = true; keys = [ "o" ]; } (hl.dsp.exec "openproject")) + (hl.bind { mod = true; keys = [ "v" ]; } (hl.dsp.exec "openproject -e nvim")) + (hl.bind { mod = true; keys = [ "b" ]; } (hl.dsp.exec "bluemenu")) + (hl.bind { mod = true; keys = [ "F1" ]; } (hl.dsp.exec "bluemenu")) + (hl.bind { mod = true; keys = [ "s" ]; } (hl.dsp.exec "sshconnect")) - ", Print, exec, grimshot copy area" + (hl.bind { mod = true; shift = true; keys = [ "Space" ]; } (hl.dsp.exec "wofi --show run")) - "$mod, h, movefocus, l" - "$mod, l, movefocus, r" - "$mod, k, movefocus, u" - "$mod, j, movefocus, d" + (hl.bind { mod = true; shift = true; keys = [ "Return" ]; } (hl.dsp.exec "alacritty")) + (hl.bind { mod = true; shift = true; keys = [ "b" ]; } (hl.dsp.exec "firefox")) + (hl.bind { mod = true; shift = true; keys = [ "p" ]; } (hl.dsp.exec "wofi-pass")) + (hl.bind { mod = true; shift = true; keys = [ "o" ]; } (hl.dsp.exec "wofi-pass otp")) + (hl.bind { mod = true; shift = true; keys = [ "e" ]; } (hl.dsp.exec "webtrayctl show https://chat.nathanreiner.xyz")) + (hl.bind { mod = true; shift = true; keys = [ "m" ]; } (hl.dsp.exec "webtrayctl show https://jellyfin.nathanreiner.xyz")) + (hl.bind { mod = true; shift = true; keys = [ "s" ]; } (hl.dsp.exec "signal-desktop")) - "$mod, f, fullscreen" - "$mod, Return, layoutmsg, swapwithmaster master" - "$mod, i, layoutmsg, addmaster" - "$mod, d, layoutmsg, removemaster" + (hl.bind { mod = true; shift = false; keys = [ "period" ]; flags = { repeating = true; }; } (hl.dsp.window.resize { x = 20; y = 0; relative = true; })) + (hl.bind { mod = true; shift = false; keys = [ "comma" ]; flags = { repeating = true; }; } (hl.dsp.window.resize { x = -20; y = 0; relative = true; })) + (hl.bind { mod = true; shift = true; keys = [ "period" ]; flags = { repeating = true; }; } (hl.dsp.window.resize { x = 0; y = 20; relative = true; })) + (hl.bind { mod = true; shift = true; keys = [ "comma" ]; flags = { repeating = true; }; } (hl.dsp.window.resize { x = 0; y = -20; relative = true; })) - "$mod+Shift, h, movewindow, l" - "$mod+Shift, l, movewindow, r" - "$mod+Shift, k, movewindow, u" - "$mod+Shift, j, movewindow, d" + (hl.bind { keys = [ "Print" ]; } (hl.dsp.exec "grimshot copy area")) + (hl.bind { keys = [ "XF86AudioMute" ]; flags = { repeating = true; }; } (hl.dsp.exec "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle")) + (hl.bind { keys = [ "XF86AudioRaiseVolume" ]; flags = { repeating = true; }; } (hl.dsp.exec "wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+")) + (hl.bind { keys = [ "XF86AudioLowerVolume" ]; flags = { repeating = true; }; } (hl.dsp.exec "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-")) + (hl.bind { keys = [ "XF86AudioPlay" ]; flags = { repeating = true; }; } (hl.dsp.exec "playerctl play-pause")) + (hl.bind { keys = [ "XF86MonBrightnessDown" ]; flags = { repeating = true; }; } (hl.dsp.exec "brightnessctl set 10%-")) + (hl.bind { keys = [ "XF86MonBrightnessUp" ]; flags = { repeating = true; }; } (hl.dsp.exec "brightnessctl set +10%")) - "$mod, 1, split:workspace, 1" - "$mod, 2, split:workspace, 2" - "$mod, 3, split:workspace, 3" - "$mod, 4, split:workspace, 4" - "$mod, 5, split:workspace, 5" - "$mod, 6, split:workspace, 6" - "$mod, 7, split:workspace, 7" - "$mod, 8, split:workspace, 8" - "$mod, 9, split:workspace, 9" - "$mod, 0, split:workspace, 10" - - "$mod+Shift, 1, split:movetoworkspacesilent, 1" - "$mod+Shift, 2, split:movetoworkspacesilent, 2" - "$mod+Shift, 3, split:movetoworkspacesilent, 3" - "$mod+Shift, 4, split:movetoworkspacesilent, 4" - "$mod+Shift, 5, split:movetoworkspacesilent, 5" - "$mod+Shift, 6, split:movetoworkspacesilent, 6" - "$mod+Shift, 7, split:movetoworkspacesilent, 7" - "$mod+Shift, 8, split:movetoworkspacesilent, 8" - "$mod+Shift, 9, split:movetoworkspacesilent, 9" - "$mod+Shift, 0, split:movetoworkspacesilent, 10" - ]; - - binde = [ - "$mod, period, resizeactive, 20 0" - "$mod, comma, resizeactive, -20 0" - "$mod+Shift, period, resizeactive, 0 20" - "$mod+Shift, comma, resizeactive, 0 -20" - - ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" - ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+" - ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" - ", XF86AudioPlay, exec, playerctl play-pause" - - ", XF86MonBrightnessDown, exec, brightnessctl set 10%-" - ", XF86MonBrightnessUp, exec, brightnessctl set +10%" - ]; - - bindm = [ - "$mod, mouse:272, movewindow" + (hl.bind { mod = true; keys = [ "mouse:272" ]; flags = { mouse = true; }; } (hl.dsp.window.drag)) ]; - general = { - gaps_in = 5; - gaps_out = 5; - layout = "master"; - border_size = 1; - "col.active_border" = "rgba(3c3836ff)"; - "col.inactive_border" = "rgba(3c3836ff)"; - }; - - decoration = { - rounding = 4; - shadow = { - enabled = true; - range = true; - render_power = 4; - }; - }; - - animations = { + animation = [ { enabled = true; - animation = [ - "windows, 1, 2, default" - "layers, 1, 2, default" - "border, 1, 2, default" - "borderangle, 1, 2, default" - "fade, 1, 2, default" - "workspaces, 1, 2, default" - ]; - }; - - dwindle = { - pseudotile = true; - preserve_split = true; - }; + speed = 1; + leaf = "global"; + bezier = "default"; + } ]; - master = { - new_on_top = true; - new_status = "master"; - }; - - input = { - kb_layout = "us,ch"; - kb_options = "caps:escape,grp:alt_space_toggle"; + config = { + general = { + gaps_in = 5; + gaps_out = 5; + layout = "scrolling"; + border_size = 1; + "col.active_border" = "rgba(665c54ff)"; + "col.inactive_border" = "rgba(3c3836ff)"; + }; - touchpad = { - natural_scroll = true; - clickfinger_behavior = true; + decoration = { + rounding = 4; + shadow = { + enabled = true; + range = true; + render_power = 4; + }; }; - tablet = { - output = "DP-3"; + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; + enable_swallow = false; + swallow_regex = "^(Alacritty)$"; + animate_manual_resizes = true; }; - }; - misc = { - disable_hyprland_logo = true; - disable_splash_rendering = true; - enable_swallow = false; - swallow_regex = "^(Alacritty)$"; - animate_manual_resizes = true; - }; + input = { + kb_layout = "us,ch"; + kb_options = "caps:escape,grp:alt_space_toggle"; - windowrule = [ - "pin,class:^(Hyprland::WinClass::Floating)$" - "float,class:^(Hyprland::WinClass::Floating)$" - "center,class:^(Hyprland::WinClass::Floating)$" + touchpad = { + natural_scroll = true; + clickfinger_behavior = true; + disable_while_typing = true; + }; - # KDE Connect Presentation - "opacity 1, title: KDE Connect Daemon" - "noblur, title: KDE Connect Daemon" - "noborder, title: KDE Connect Daemon" - "noshadow, title: KDE Connect Daemon" - "noanim, title: KDE Connect Daemon" - "nofocus, title: KDE Connect Daemon" - "suppressevent fullscreen, title: KDE Connect Daemon" - "float, title: KDE Connect Daemon" - "pin, title: KDE Connect Daemon" - "move 0 0, title: KDE Connect Daemon" - "size 1920 1080, title: KDE Connect Daemon" + tablet = { + output = "DP-3"; + }; - # Waydroid - "float, size 500 900, class:^(waydroid\\..*)$" - "float, size 500 900, class:^(Waydroid)$" + }; - # Nextcloud - "float, move 100%-500 20, size 500 800, noborder, noblur, xray, pin, class:^(com.nextcloud\\..*)$, title:^(Nextcloud)$" - ]; + master = { + new_on_top = true; + new_status = "master"; + }; - ecosystem = { - no_update_news = true; + scrolling = { + direction = "down"; + explicit_column_widths = "0.8, 1.0"; + column_width = 0.8; + }; }; - exec-once = [ - "signal-desktop" - "kdeconnect-indicator" + on = [ + (hl.on.start [ + (hl.dsp.exec "signal-desktop") + (hl.dsp.exec "kdeconnect-indicator") + ]) ]; }; } diff --git a/common/home/hyprland/hl.nix b/common/home/hyprland/hl.nix new file mode 100644 index 0000000..fb2565d --- /dev/null +++ b/common/home/hyprland/hl.nix @@ -0,0 +1,38 @@ +{ lib }: let + Lua = lib.generators.mkLuaInline; + toLua = lib.generators.toLua; + join = builtins.concatStringsSep; + call = name: opts: (Lua "${name}(${if opts == null then "" else (toLua {} opts)})"); +in +{ + bind = { mod ? false, shift ? false, keys, flags ? null }: lua: { + _args = [ + (Lua ( + (if mod then "mod .. ' + " else "'") + + (if shift then "SHIFT + " else "") + + (join " + " keys) + "'") + ) + lua + flags + ]; + }; + on.start = luas: { + _args = [ + "hyprland.start" + (Lua "function()${join ";" (map (l: l.expr) luas)}end") + ]; + }; + dsp = { + exec = call "hl.dsp.exec_cmd"; + exit = call "hl.dsp.exit" null; + focus = call "hl.dsp.focus"; + layout = call "hl.dsp.layout"; + window = { + drag = call "hl.dsp.window.drag" null; + move = call "hl.dsp.window.move"; + close = call "hl.dsp.window.close" null; + fullscreen = call "hl.dsp.window.fullscreen" null; + resize = call "hl.dsp.window.resize"; + }; + }; +} diff --git a/common/home/programs/waybar/default.nix b/common/home/programs/waybar/default.nix index 5cdf011..8415b02 100644 --- a/common/home/programs/waybar/default.nix +++ b/common/home/programs/waybar/default.nix @@ -9,52 +9,19 @@ height = 20; outputs = "*"; spacing = 0; - modules-left = [ "hyprland/workspaces" ]; - modules-center = [ ]; - modules-right = [ + modules-left = [ "pulseaudio" "bluetooth" "hyprland/language" "battery" + ]; + modules-center = [ + "clock" + ]; + modules-right = [ "tray" ]; - "hyprland/workspaces" = { - format = "{icon}"; - format-icons = { - "1" = "α"; - "2" = "β"; - "3" = "γ"; - "4" = "δ"; - "5" = "ε"; - "6" = "ζ"; - "7" = "η"; - "8" = "θ"; - "9" = "ι"; - "10" = "κ"; - "11" = "α"; - "12" = "β"; - "13" = "γ"; - "14" = "δ"; - "15" = "ε"; - "16" = "ζ"; - "17" = "η"; - "18" = "θ"; - "19" = "ι"; - "20" = "κ"; - "21" = "α"; - "22" = "β"; - "23" = "γ"; - "24" = "δ"; - "25" = "ε"; - "26" = "ζ"; - "27" = "η"; - "28" = "θ"; - "29" = "ι"; - "30" = "κ"; - }; - all-outputs = false; - }; "hyprland/window" = { separate-outputs = true; diff --git a/common/home/programs/waybar/style.css b/common/home/programs/waybar/style.css index de8f3d4..1d646c0 100644 --- a/common/home/programs/waybar/style.css +++ b/common/home/programs/waybar/style.css @@ -7,57 +7,19 @@ window { color: #ebdbb2; } -#language { +#language, +#pulseaudio, +#bluetooth, +#battery, +#clock { font-size: 12px; - padding-right: 10px; -} - -#pulseaudio { - font-size: 12px; -} - -#bluetooth { - padding-left: 10px; - padding-right: 10px; - font-size: 12px; -} - -#workspaces { - padding: 5px; - background: #252525; - border-radius: 5px; -} - -#workspaces button { - padding: 0px; - border-radius: 3px; - min-width: 20px; - min-height: 20px; - border: none; - font-size: 12px; -} - -#workspaces button.active { - background: #504945; -} - -#workspaces button:hover { - background: #3c3836; - padding: 0px; - border: none; -} - -#workspaces button.active:hover { - background: #504945; - padding: 0px; + margin-left: 5px; + margin-right: 5px; } #battery { background: #458588; color: #282828; - margin-right: 5px; - padding-left: 5px; - padding-right: 5px; } #battery.charging { @@ -72,17 +34,23 @@ window { background: #fb4934; } -.modules-left { - margin: 5px; - margin-bottom: 0px; - border-radius: 5px; +.modules-center, .modules-right, .modules-left { + padding: 5px; + margin: 0px; + background: #3c3836; +} + +.modules-center { + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; } .modules-right { - padding-left: 10px; - padding-right: 10px; - background: #3c3836; - border-radius: 5px; - margin: 5px; - margin-bottom: 0px; + border-bottom-left-radius: 5px; + padding-right: 8px; + padding-left: 8px; +} + +.modules-left { + border-bottom-right-radius: 5px; } |