diff --git a/autoload.lua b/autoload.lua index 7b87b89..19e210b 100644 --- a/autoload.lua +++ b/autoload.lua @@ -12,6 +12,7 @@ end -- Recursively search and return modules for path in p:lines() do local ok, err = pcall(dofile, path) + -- If you fucked up the syntax like an idiot if not ok then hl.notification.create({ text = "autoload: " .. path .. "\n" .. tostring(err), diff --git a/hyprland.lua b/hyprland.lua index ddf92b2..3f2eae0 100644 --- a/hyprland.lua +++ b/hyprland.lua @@ -1,6 +1,8 @@ +-- Get hostname from envvars or something local handle = io.popen("hostname") Hostname = "unknown" -- Default fallback +-- If there is a hostname at all if handle then local result = handle:read("*l") -- Read the first line handle:close() @@ -9,213 +11,5 @@ if handle then end end -if Hostname == "HACKSTATION" then - hl.bind("SUPER + c", hl.dsp.exec_cmd("dunstify " .. tostring(Hostname))) -end - +-- Import everything else require("autoload") - ------------------------ ------ PERMISSIONS ----- ------------------------ - --- See https://wiki.hypr.land/Configuring/Advanced-and-Cool/Permissions/ --- Please note permission changes here require a Hyprland restart and are not applied on-the-fly --- for security reasons - --- hl.config({ --- ecosystem = { --- enforce_permissions = true, --- }, --- }) - --- hl.permission("/usr/(bin|local/bin)/grim", "screencopy", "allow") --- hl.permission("/usr/(lib|libexec|lib64)/xdg-desktop-portal-hyprland", "screencopy", "allow") --- hl.permission("/usr/(bin|local/bin)/hyprpm", "plugin", "allow") - ------------------------ ----- LOOK AND FEEL ---- ------------------------ - --- Refer to https://wiki.hypr.land/Configuring/Basics/Variables/ - --- Default curves and animations, see https://wiki.hypr.land/Configuring/Advanced-and-Cool/Animations/ -hl.curve("easeOutQuint", { type = "bezier", points = { { 0.23, 1 }, { 0.32, 1 } } }) -hl.curve("easeInOutCubic", { type = "bezier", points = { { 0.65, 0.05 }, { 0.36, 1 } } }) -hl.curve("linear", { type = "bezier", points = { { 0, 0 }, { 1, 1 } } }) -hl.curve("almostLinear", { type = "bezier", points = { { 0.5, 0.5 }, { 0.75, 1 } } }) -hl.curve("quick", { type = "bezier", points = { { 0.15, 0 }, { 0.1, 1 } } }) - --- Default springs -hl.curve("easy", { type = "spring", mass = 1, stiffness = 71.2633, dampening = 15.8273644 }) - -hl.animation({ leaf = "global", enabled = true, speed = 10, bezier = "default" }) -hl.animation({ leaf = "border", enabled = true, speed = 5.39, bezier = "easeOutQuint" }) -hl.animation({ leaf = "windows", enabled = true, speed = 4.79, spring = "easy" }) -hl.animation({ leaf = "windowsIn", enabled = true, speed = 4.1, spring = "easy", style = "popin 87%" }) -hl.animation({ leaf = "windowsOut", enabled = true, speed = 1.49, bezier = "linear", style = "popin 87%" }) -hl.animation({ leaf = "fadeIn", enabled = true, speed = 1.73, bezier = "almostLinear" }) -hl.animation({ leaf = "fadeOut", enabled = true, speed = 1.46, bezier = "almostLinear" }) -hl.animation({ leaf = "fade", enabled = true, speed = 3.03, bezier = "quick" }) -hl.animation({ leaf = "layers", enabled = true, speed = 3.81, bezier = "easeOutQuint" }) -hl.animation({ leaf = "layersIn", enabled = true, speed = 4, bezier = "easeOutQuint", style = "fade" }) -hl.animation({ leaf = "layersOut", enabled = true, speed = 1.5, bezier = "linear", style = "fade" }) -hl.animation({ leaf = "fadeLayersIn", enabled = true, speed = 1.79, bezier = "almostLinear" }) -hl.animation({ leaf = "fadeLayersOut", enabled = true, speed = 1.39, bezier = "almostLinear" }) -hl.animation({ leaf = "workspaces", enabled = true, speed = 1.94, bezier = "almostLinear", style = "fade" }) -hl.animation({ leaf = "workspacesIn", enabled = true, speed = 1.21, bezier = "almostLinear", style = "fade" }) -hl.animation({ leaf = "workspacesOut", enabled = true, speed = 1.94, bezier = "almostLinear", style = "fade" }) -hl.animation({ leaf = "zoomFactor", enabled = true, speed = 7, bezier = "quick" }) - --- Ref https://wiki.hypr.land/Configuring/Basics/Workspace-Rules/ --- "Smart gaps" / "No gaps when only" --- uncomment all if you wish to use that. --- hl.workspace_rule({ workspace = "w[tv1]", gaps_out = 0, gaps_in = 0 }) --- hl.workspace_rule({ workspace = "f[1]", gaps_out = 0, gaps_in = 0 }) --- hl.window_rule({ --- name = "no-gaps-wtv1", --- match = { float = false, workspace = "w[tv1]" }, --- border_size = 0, --- rounding = 0, --- }) --- hl.window_rule({ --- name = "no-gaps-f1", --- match = { float = false, workspace = "f[1]" }, --- border_size = 0, --- rounding = 0, --- }) - --- See https://wiki.hypr.land/Configuring/Layouts/Dwindle-Layout/ for more -hl.config({ - dwindle = { - preserve_split = true, -- You probably want this - }, -}) - --- See https://wiki.hypr.land/Configuring/Layouts/Master-Layout/ for more -hl.config({ - master = { - new_status = "master", - }, -}) - --- See https://wiki.hypr.land/Configuring/Layouts/Scrolling-Layout/ for more -hl.config({ - scrolling = { - fullscreen_on_one_column = true, - }, -}) - ----------------- ----- MISC ---- ----------------- - -hl.config({ - misc = { - force_default_wallpaper = -1, -- Set to 0 or 1 to disable the anime mascot wallpapers - disable_hyprland_logo = false, -- If true disables the random hyprland logo / anime girl background. :( - }, -}) ---------------------- ----- KEYBINDINGS ---- ---------------------- - -local mainMod = "SUPER" -- Sets "Windows" key as main modifier - --- Example binds, see https://wiki.hypr.land/Configuring/Basics/Binds/ for more - --- Move focus with mainMod + arrow keys --- Switch workspaces with mainMod + [0-9] --- Move active window to a workspace with mainMod + SHIFT + [0-9] - --- Example special workspace (scratchpad) -hl.bind(mainMod .. " + S", hl.dsp.workspace.toggle_special("magic")) -hl.bind(mainMod .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" })) - --- Scroll through existing workspaces with mainMod + scroll -hl.bind(mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" })) -hl.bind(mainMod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" })) - --- Move/resize windows with mainMod + LMB/RMB and dragging -hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true }) -hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true }) - --- Laptop multimedia keys for volume and LCD brightness -hl.bind( - "XF86AudioRaiseVolume", - hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), - { locked = true, repeating = true } -) -hl.bind( - "XF86AudioLowerVolume", - hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), - { locked = true, repeating = true } -) -hl.bind( - "XF86AudioMute", - hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), - { locked = true, repeating = true } -) -hl.bind( - "XF86AudioMicMute", - hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), - { locked = true, repeating = true } -) -hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%+"), { locked = true, repeating = true }) -hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-"), { locked = true, repeating = true }) - --- Requires playerctl -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 }) - --------------------------------- ----- WINDOWS AND WORKSPACES ---- --------------------------------- - --- See https://wiki.hypr.land/Configuring/Basics/Window-Rules/ --- and https://wiki.hypr.land/Configuring/Basics/Workspace-Rules/ - --- Example window rules that are useful - -local suppressMaximizeRule = hl.window_rule({ - -- Ignore maximize requests from all apps. You'll probably like this. - name = "suppress-maximize-events", - match = { class = ".*" }, - - suppress_event = "maximize", -}) --- suppressMaximizeRule:set_enabled(false) - -hl.window_rule({ - -- Fix some dragging issues with XWayland - name = "fix-xwayland-drags", - match = { - class = "^$", - title = "^$", - xwayland = true, - float = true, - fullscreen = false, - pin = false, - }, - - no_focus = true, -}) - --- Layer rules also return a handle. --- local overlayLayerRule = hl.layer_rule({ --- name = "no-anim-overlay", --- match = { namespace = "^my-overlay$" }, --- no_anim = true, --- }) --- overlayLayerRule:set_enabled(false) - --- Hyprland-run windowrule -hl.window_rule({ - name = "move-hyprland-run", - match = { class = "hyprland-run" }, - - move = "20 monitor_h-120", - float = true, -}) diff --git a/modules/binds.lua b/modules/binds.lua index 09507ef..4d5fdb4 100644 --- a/modules/binds.lua +++ b/modules/binds.lua @@ -51,6 +51,8 @@ for index, bind in ipairs(keyboardSplit) do hl.bind(mainMod .. "SHIFT + " .. bind, hl.dsp.window.move({ workspace = index, follow = false })) end + + -- Music workspace hl.bind(mainMod .. "m", hl.dsp.workspace.toggle_special("music")) @@ -110,7 +112,7 @@ hl.bind(mainMod .. "minus", hl.dsp.workspace.toggle_special("scratch")) hl.bind(mainMod .. "SHIFT + minus", hl.dsp.window.move({ workspace = "special:scratch", follow = false })) -- Float resize and move window with mouse -hl.bind(subMod .. "mouse:272", hl.dsp.window.drag(), { mouse = true, drag = true }) +hl.bind(subMod .. "mouse:272", hl.dsp.window.drag(), { mouse = true }) hl.bind(subMod .. "mouse:272", hl.dsp.window.float(), { mouse = true, click = true }) hl.bind(subMod .. "mouse:272", hl.dsp.layout("promote"), { mouse = true, release = true }) diff --git a/modules/events.lua b/modules/events.lua new file mode 100644 index 0000000..9b40e3e --- /dev/null +++ b/modules/events.lua @@ -0,0 +1,32 @@ +local appList = { + "waybar", + "dunst", + "wpaperd -d", + "wayvnc 0.0.0.0 --output=DP-1", + "syncthing -home=/home/user01/.config/syncthing -no-browser", + "gotify-desktop", + "sleep 10 && curl -X POST -H 'Content-Type: application/json' -d '{'ref':'$(git -C ~/.dotfiles rev-parse HEAD)', 'status':'$(git -C ~/.dotfiles diff --quiet && echo 'clean' || echo 'dirty')'}' https://n8n.voidarc.co.uk/webhook/config-checker", +} + +local localAppList +if Hostname == "HACKSTATION" then + -- If on desktop do all the decoration nonsense + localAppList = { + "kitten panel --edge=background -o background_opacity=0 --output-name HDMI-A-1 sh -c 'cmatrix -b -C magenta -a -u 10'", + "kitten panel --edge=background -o background_opacity=0 --output-name DP-2 sh -c 'cava'", + } +elseif Hostname == "mobile02" then + -- If on laptop, launch way-edges + localAppList = { + "way-edges", + } +end + +table.insert(appList, localAppList) + +-- For everything in the applist run it on startup +hl.on("hyprland.start", function() + for _, command in ipairs(appList) do + hl.exec_cmd(command) + end +end) diff --git a/modules/rules.lua b/modules/rules.lua index d8c0114..be323ab 100644 --- a/modules/rules.lua +++ b/modules/rules.lua @@ -1,17 +1,66 @@ +-- Size for otter launcher hl.window_rule({ name = "otter-launcher", match = { class = "otter", }, float = true, + animation = "popin 80%", size = { 410, 220 }, opaque = true, }) +-- Dont dim youtube windows hl.window_rule({ name = "nodim-youtube", + match = { + class = "^(firefox|Firefox)$", + title = "^(.*YouTube.*)$", + }, + no_dim = true, + opaque = true, }) +-- Define windows that float +local standardFloatingWindows = { + { class = "^(xdg-desktop-portal-gtk)$" }, + { class = "^(firefox)$", title = "^(.*Save.*)" }, +} + +-- For every window that floats make a rule +for _, window in ipairs(standardFloatingWindows) do + hl.window_rule({ + name = "float file selector", + match = { + -- both are optional ig + class = window.class or "", + title = window.title or "", + }, + float = true, + animation = "popin 70%", + size = { 800, 500 }, + }) +end + +-- Don't dim fullscreen windows +hl.window_rule({ + name = "nodim fullscreen", + match = { + fullscreen = true, + }, + no_dim = true, + opaque = true, +}) + +hl.window_rule({ + name = "jelly slide", + match = { + class = "^(jf-tui)$", + }, + animation = "slide top", +}) + +-- Define gaps for music workspace hl.workspace_rule({ workspace = "special:music", gaps_out = { @@ -19,4 +68,29 @@ hl.workspace_rule({ right = 400, bottom = 400, }, + animation = "slidefadevert", +}) + +-- Something from the example idk +hl.window_rule({ + name = "move-hyprland-run", + match = { class = "hyprland-run" }, + + move = "20 monitor_h-120", + float = true, +}) + +-- Fix some dragging issues with XWayland +hl.window_rule({ + name = "fix-xwayland-drags", + match = { + class = "^$", + title = "^$", + xwayland = true, + float = true, + fullscreen = false, + pin = false, + }, + + no_focus = true, }) diff --git a/modules/settings/animations.lua b/modules/settings/animations.lua index 8b13789..c79a321 100644 --- a/modules/settings/animations.lua +++ b/modules/settings/animations.lua @@ -1 +1,77 @@ +local beziers = { + -- Overshoot + { name = "heavyOvershoot", points = { 0.53, 0.51, 0.4, 1.22 } }, + { name = "lightOvershoot", points = { 0.33, 0.61, 0.63, 1.19 } }, + -- Linear + { name = "smoothSnap", points = { 0.32, 0.51, 0.44, 1 } }, + { name = "smoothIn", points = { 0.25, 1, 0.5, 1 } }, + { name = "smoothOutOvershoot", points = { 0.46, -0.25, 0.81, 0.51 } }, + + -- Springs + { name = "hardSpring", kind = "spring" }, + { name = "mediumSpring", kind = "spring", stiffness = 50, dampening = 10 }, + { name = "looseSpring", kind = "spring", dampening = 5, stiffness = 50 }, +} + +-- For every curve in the table (ik it says bezier stfu) +for _, bezier in ipairs(beziers) do + -- If there are points then its not a spring + if bezier.points then + hl.curve(bezier.name, { + type = "bezier", + points = { { bezier.points[1], bezier.points[2] }, { bezier.points[3], bezier.points[4] } }, + }) + -- If its a spring + elseif bezier.kind == "spring" then + hl.curve(bezier.name, { + type = "spring", + -- If all the parameters are empty make a spring with the values from the wiki + mass = bezier.mass or 1, + stiffness = bezier.stiffness or 70, + dampening = bezier.dampening or 10, + }) + else + -- You fucked something up + hl.notification.create({ text = "invalid curve generated", icon = "warning", timeout = 8000 }) + end +end + +local animations = { + -- Default animation + { leaf = "global", speed = 5, spring = "mediumSpring" }, + + -- Window animations + { leaf = "windows", speed = 2, spring = "mediumSpring", style = "slide right" }, + { leaf = "windowsOut", speed = 2, bezier = "heavyOvershoot", style = "popin 30%" }, + + -- Fade + { leaf = "fade", speed = 2, bezier = "smoothIn" }, + + -- Workspaces and Special + { leaf = "workspaces", speed = 2, bezier = "heavyOvershoot", style = "slidefade 20%" }, + { leaf = "specialWorkspace", speed = 5, spring = "mediumSpring", style = "slidefadevert -80%" }, +} + +-- For every entry in the animation table +for _, anim in ipairs(animations) do + -- If there is a bezier param + if anim.bezier then + hl.animation({ + leaf = anim.leaf, + enabled = true, + speed = anim.speed, + bezier = anim.bezier or "", + style = anim.style or "", + }) + elseif anim.spring then + -- Make a spring instead bcs apparently they're different idk + hl.animation({ + leaf = anim.leaf, + enabled = true, + speed = anim.speed, + spring = anim.spring or "", + style = anim.style or "", + }) + end +end diff --git a/modules/settings/input.lua b/modules/settings/input.lua index 28df91d..70bb48f 100644 --- a/modules/settings/input.lua +++ b/modules/settings/input.lua @@ -1,24 +1,33 @@ hl.config({ input = { - kb_layout = "gb", - follow_mouse = 1, + kb_layout = "gb", -- Goddamn kier starmer + follow_mouse = 1, -- Moving to a window will focus it touchpad = { - natural_scroll = true, - disable_while_typing = true, + natural_scroll = true, -- Better scrolling + disable_while_typing = true, -- Sanity }, - sensitivity = -0.3, - force_no_accel = false, + sensitivity = -0.3, -- DPI is too high ffs + force_no_accel = false, -- I love mouse acceleration tablet = { - left_handed = true, - output = "current", + left_handed = true, -- Top 10 disabilities + output = "current", -- Make the tablet usable }, }, cursor = { - inactive_timeout = 2, - warp_on_change_workspace = 1, - hide_on_key_press = true, - warp_on_toggle_special = 1, + inactive_timeout = 2, -- Hide white thing on the screen + hide_on_key_press = true, -- Hide white thing when typing + warp_on_change_workspace = 1, -- Make it go to workspaces + warp_on_toggle_special = 1, -- Go to special workspaces too + persistent_warps = true, -- Go back to where it was when I warp }, }) + +if Hostname == "mobile02" then + hl.config({ + input = { -- If on laptop make caps the escape key but make it be capslock when shift caps is pressed + kb_options = "caps:escape_shifted_capslock", + }, + }) +end diff --git a/modules/startup.lua b/modules/startup.lua deleted file mode 100644 index 6e58604..0000000 --- a/modules/startup.lua +++ /dev/null @@ -1,15 +0,0 @@ -local appList = { - "waybar", - "dunst", - "wpaperd -d", - "wayvnc 0.0.0.0 --output=DP-1", - "syncthing -home=/home/user01/.config/syncthing -no-browser", - "gotify-desktop", - "sleep 10 && curl -X POST -H 'Content-Type: application/json' -d '{'ref':'$(git -C ~/.dotfiles rev-parse HEAD)', 'status':'$(git -C ~/.dotfiles diff --quiet && echo 'clean' || echo 'dirty')'}' https://n8n.voidarc.co.uk/webhook/config-checker", -} - -hl.on("hyprland.start", function() - for _, command in ipairs(appList) do - hl.exec_cmd(command) - end -end)