diff --git a/.gitignore b/.gitignore index 66e0378..f5d0d1d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ hyprland.conf +plugins.lua diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..62faf36 --- /dev/null +++ b/.luarc.json @@ -0,0 +1,10 @@ +{ + "workspace": { + "library": [ + "/usr/share/hypr/stubs" + ] + }, + "diagnostics": { + "globals": ["hl"] + } +} diff --git a/common.lua b/common.lua new file mode 100644 index 0000000..6fdeaee --- /dev/null +++ b/common.lua @@ -0,0 +1,11 @@ +-- Shared globals accessible across all required files +terminal = "alacritty" +fileManager = "nautilus" +menu = "rofi -show combi -combi-modi drun,window,ssh,run" +mainMod = "SUPER" + +require("mocha") +require("startup") +require("keys") +require("styles") +require("misc") diff --git a/device/laptop.lua b/device/laptop.lua new file mode 100644 index 0000000..2a0130c --- /dev/null +++ b/device/laptop.lua @@ -0,0 +1,5 @@ +hl.monitor({ output = "eDP-1", mode = "2560x1600@120", position = "0x0", scale = 1 }) + +for i = 1, 10 do + hl.workspace_rule({ workspace = tostring(i), monitor = "eDP-1", default = (i == 1) }) +end diff --git a/device/pc.lua b/device/pc.lua new file mode 100644 index 0000000..941534e --- /dev/null +++ b/device/pc.lua @@ -0,0 +1,17 @@ +-- Monitors +hl.monitor({ output = "HDMI-A-1", mode = "1920x1080@60.04", position = "1920x1440", scale = 1.0 }) +hl.monitor({ output = "DP-1", mode = "1920x1080@60.0", position = "0x0", scale = 1.0 }) +hl.monitor({ output = "DP-2", mode = "1920x1080@60.0", position = "5760x0", scale = 1.0 }) +hl.monitor({ output = "DP-3", mode = "3840x2160@60.0", position = "1920x-720", scale = 1.0 }) + +-- Workspaces: 1-10 → DP-3, 11-20 → DP-1, 21-30 → DP-2, 31-40 → HDMI-A-1 +for i = 1, 10 do hl.workspace_rule({ workspace = tostring(i), monitor = "DP-3", default = (i == 1) }) end +for i = 11, 20 do hl.workspace_rule({ workspace = tostring(i), monitor = "DP-1", default = (i == 11) }) end +for i = 21, 30 do hl.workspace_rule({ workspace = tostring(i), monitor = "DP-2", default = (i == 21) }) end +for i = 31, 40 do hl.workspace_rule({ workspace = tostring(i), monitor = "HDMI-A-1", default = (i == 31) }) end + +-- Monitor focus (Numpad keys) +hl.bind(mainMod .. " + KP_Left", hl.dsp.focus({ monitor = 1 })) -- Numpad 4 +hl.bind(mainMod .. " + KP_Begin", hl.dsp.focus({ monitor = 3 })) -- Numpad 5 +hl.bind(mainMod .. " + KP_Right", hl.dsp.focus({ monitor = 2 })) -- Numpad 6 +hl.bind(mainMod .. " + KP_Down", hl.dsp.focus({ monitor = 0 })) -- Numpad 2 diff --git a/hyprland.conf b/hyprland.conf index 0eb00b0..c14ffab 120000 --- a/hyprland.conf +++ b/hyprland.conf @@ -1 +1 @@ -/nix/store/5l586v13b5sk7jijffgsbqwdjd8w11jy-home-manager-files/.config/hypr/hyprland.conf \ No newline at end of file +/nix/store/cbpxjx51q5djxmv7gcs1zz0sxy9arf2x-home-manager-files/.config/hypr/hyprland.conf \ No newline at end of file diff --git a/hyprland.lua b/hyprland.lua new file mode 100644 index 0000000..ae119c4 --- /dev/null +++ b/hyprland.lua @@ -0,0 +1,4 @@ +require("plugins") + +require("common") +require("device.pc") diff --git a/keys.lua b/keys.lua new file mode 100644 index 0000000..c4a942c --- /dev/null +++ b/keys.lua @@ -0,0 +1,79 @@ +-- App launchers +hl.bind(mainMod .. " + Q", hl.dsp.exec_cmd(terminal)) +hl.bind(mainMod .. " + C", hl.dsp.window.close()) +hl.bind(mainMod .. " + M", hl.dsp.exit()) +hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(fileManager)) +hl.bind(mainMod .. " + V", hl.dsp.window.float({ action = "toggle" })) +hl.bind(mainMod .. " + R", hl.dsp.exec_cmd(menu)) +hl.bind(mainMod .. " + P", hl.dsp.window.pseudo({ action = "toggle" })) +hl.bind(mainMod .. " + J", hl.dsp.layout("togglesplit")) +hl.bind(mainMod .. " + D", hl.dsp.exec_cmd("rofi -show combi -combi-modi drun,window,ssh,run")) +hl.bind("Print", hl.dsp.exec_cmd("hyprshot --freeze -m region")) + +hl.bind("CTRL + ALT + T", hl.dsp.exec_cmd("alacritty")) +hl.bind("CTRL + ALT + F", hl.dsp.exec_cmd("firefox")) +hl.bind("CTRL + ALT + V", hl.dsp.exec_cmd("vesktop --enable-wayland-ime --ozone-platform=wayland")) +hl.bind("CTRL + ALT + P", hl.dsp.exec_cmd("prismlauncher")) +hl.bind("CTRL + ALT + C", hl.dsp.exec_cmd("hyprpicker")) +hl.bind("CTRL + ALT + O", hl.dsp.exec_cmd("obsidian")) +hl.bind("CTRL + ALT + R", hl.dsp.exec_cmd("google-chrome-stable http://iot.local --password-store=basic")) +hl.bind("SUPER + F", hl.dsp.exec_cmd("~/.config/hypr/scripts/toggle-firefox.sh")) + +hl.bind(mainMod .. " + Space", hl.dsp.focus({ urgent_or_last = true })) + +-- Focus direction +hl.bind(mainMod .. " + left", hl.dsp.focus({ direction = "l" })) +hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = "r" })) +hl.bind(mainMod .. " + up", hl.dsp.focus({ direction = "u" })) +hl.bind(mainMod .. " + down", hl.dsp.focus({ direction = "d" })) + +-- Move window +hl.bind(mainMod .. " + SHIFT + left", hl.dsp.window.move({ direction = "l" })) +hl.bind(mainMod .. " + SHIFT + right", hl.dsp.window.move({ direction = "r" })) +hl.bind(mainMod .. " + SHIFT + up", hl.dsp.window.move({ direction = "u" })) +hl.bind(mainMod .. " + SHIFT + down", hl.dsp.window.move({ direction = "d" })) + +-- Workspaces via split-monitor-workspaces plugin +for i = 1, 9 do + local n = tostring(i) + hl.bind(mainMod .. " + " .. n, function() + hl.plugin.split_monitor_workspaces.workspace(n) + end) + hl.bind(mainMod .. " + SHIFT + " .. n, function() + hl.plugin.split_monitor_workspaces.move_to_workspace_silent(n) + end) +end +hl.bind(mainMod .. " + 0", function() + hl.plugin.split_monitor_workspaces.workspace(10) +end) +hl.bind(mainMod .. " + SHIFT + 0", function() + hl.plugin.split_monitor_workspaces.move_to_workspace_silent(10) +end) + +-- Special workspace +hl.bind(mainMod .. " + S", hl.dsp.workspace.toggle_special("magic")) +hl.bind(mainMod .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" })) + +-- Scroll through workspaces +hl.bind(mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" })) +hl.bind(mainMod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" })) + +-- Mouse window management +hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true }) +hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true }) + +-- Volume +hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), { repeating = true }) +hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), { repeating = true }) +hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { repeating = true }) +hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { repeating = true }) + +-- Brightness +hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%+"), { repeating = true }) +hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-"), { repeating = true }) + +-- Media +hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true }) +hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true }) +hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true }) +hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true }) diff --git a/misc.lua b/misc.lua new file mode 100644 index 0000000..7ad498d --- /dev/null +++ b/misc.lua @@ -0,0 +1,44 @@ +-- Environment variables +hl.env("XCURSOR_THEME", "Cyberpunk") +hl.env("XCURSOR_SIZE", "24") +hl.env("HYPRCURSOR_THEME", "Cyberpunk") +hl.env("HYPRCURSOR_SIZE", "24") + +hl.config({ + misc = { + middle_click_paste = false, + force_default_wallpaper = -1, + disable_hyprland_logo = false, + }, + input = { + kb_layout = "us", + follow_mouse = 1, + sensitivity = 0, + touchpad = { + natural_scroll = true, + clickfinger_behavior = 1, + }, + }, + xwayland = { + force_zero_scaling = true, + }, + debug = { + disable_logs = false, + }, +}) + +-- Device config: top-level hl.device(), not inside hl.config() +hl.device({ name = "epic-mouse-v1", sensitivity = -0.5 }) + +-- Plugin config: via hl.plugin namespace after plugin is loaded +hl.on("hyprland.start", function() + hl.plugin["split-monitor-workspaces"].count = 10 + hl.plugin["split-monitor-workspaces"].keep_focused = 0 + hl.plugin["split-monitor-workspaces"].enable_notifications = 0 + hl.plugin["split-monitor-workspaces"].enable_persistent_workspaces = 1 +end) + +-- Window rules +hl.window_rule({ match = { class = "FreeCAD" }, no_initial_focus = true }) +hl.window_rule({ match = { class = "^(OMEdit)$" }, no_initial_focus = true }) +hl.window_rule({ match = { class = "^$", title = "^$", xwayland = true, float = true, fullscreen = false, pin = false }, no_focus = true }) diff --git a/mocha.lua b/mocha.lua new file mode 100644 index 0000000..c659e89 --- /dev/null +++ b/mocha.lua @@ -0,0 +1,27 @@ +-- Catppuccin Mocha palette (globals, accessible in all required files) +rosewater = "rgb(f5e0dc)" rosewaterAlpha = "f5e0dc" +flamingo = "rgb(f2cdcd)" flamingoAlpha = "f2cdcd" +pink = "rgb(f5c2e7)" pinkAlpha = "f5c2e7" +mauve = "rgb(cba6f7)" mauveAlpha = "cba6f7" +red = "rgb(f38ba8)" redAlpha = "f38ba8" +maroon = "rgb(eba0ac)" maroonAlpha = "eba0ac" +peach = "rgb(fab387)" peachAlpha = "fab387" +yellow = "rgb(f9e2af)" yellowAlpha = "f9e2af" +green = "rgb(a6e3a1)" greenAlpha = "a6e3a1" +teal = "rgb(94e2d5)" tealAlpha = "94e2d5" +sky = "rgb(89dceb)" skyAlpha = "89dceb" +sapphire = "rgb(74c7ec)" sapphireAlpha = "74c7ec" +blue = "rgb(89b4fa)" blueAlpha = "89b4fa" +lavender = "rgb(b4befe)" lavenderAlpha = "b4befe" +text = "rgb(cdd6f4)" textAlpha = "cdd6f4" +subtext1 = "rgb(bac2de)" subtext1Alpha = "bac2de" +subtext0 = "rgb(a6adc8)" subtext0Alpha = "a6adc8" +overlay2 = "rgb(9399b2)" overlay2Alpha = "9399b2" +overlay1 = "rgb(7f849c)" overlay1Alpha = "7f849c" +overlay0 = "rgb(6c7086)" overlay0Alpha = "6c7086" +surface2 = "rgb(585b70)" surface2Alpha = "585b70" +surface1 = "rgb(45475a)" surface1Alpha = "45475a" +surface0 = "rgb(313244)" surface0Alpha = "313244" +base = "rgb(1e1e2e)" baseAlpha = "1e1e2e" +mantle = "rgb(181825)" mantleAlpha = "181825" +crust = "rgb(11111b)" crustAlpha = "11111b" diff --git a/startup.lua b/startup.lua new file mode 100644 index 0000000..87c1f40 --- /dev/null +++ b/startup.lua @@ -0,0 +1,10 @@ +hl.on("hyprland.start", function() + hl.exec_cmd(terminal) + hl.exec_cmd("gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'") + hl.exec_cmd("waybar") + hl.exec_cmd("swww --transition-type none") + hl.exec_cmd("fcitx5") + hl.exec_cmd("waypaper --restore") + hl.exec_cmd("wl-paste -p --watch wl-copy -p -c") + hl.dsp.focus({ workspace = 1 }) +end) diff --git a/styles.lua b/styles.lua new file mode 100644 index 0000000..503df71 --- /dev/null +++ b/styles.lua @@ -0,0 +1,39 @@ +hl.config({ + general = { + gaps_in = 0, + gaps_out = 0, + border_size = 2, + ["col.active_border"] = "rgba(eb3489ff)", + ["col.inactive_border"] = "rgba(595959ff)", + resize_on_border = false, + allow_tearing = false, + layout = "dwindle", + }, + decoration = { + rounding = 0, + active_opacity = 1.0, + inactive_opacity = 1.0, + shadow = { + enabled = true, + range = 4, + render_power = 3, + color = "rgba(1a1a1aee)", + }, + blur = { + enabled = true, + size = 3, + passes = 1, + vibrancy = 0.1696, + }, + }, + animations = { + enabled = false, + }, + dwindle = { + -- pseudotile = true, + preserve_split = true, + }, + master = { + new_status = "master", + }, +})