diff --git a/config/hypr/hyprland.lua b/config/hypr/hyprland.lua index 62d4a9e..1e37f9f 100644 --- a/config/hypr/hyprland.lua +++ b/config/hypr/hyprland.lua @@ -171,40 +171,35 @@ hl.animation({ leaf = "specialWorkspaceOut", enabled = true, speed = 2, bezier = -- Keybindings -hl.bind(LEADER .. "SHIFT + return", hl.dsp.exec_cmd("gtk-launch herdr.desktop"), { description = "Open herdr terminal" }) -hl.bind(LEADER .. "return", hl.dsp.exec_cmd("gtk-launch tmux.desktop"), { description = "Open tmux terminal" }) -hl.bind(LEADER .. "N", hl.dsp.exec_cmd(terminal .. " -a quicknotes -e nvim +'Obsidian today'"), +hl.bind("SUPER + SHIFT + return", hl.dsp.exec_cmd("gtk-launch herdr.desktop"), { description = "Open herdr terminal" }) +hl.bind("SUPER + return", hl.dsp.exec_cmd("gtk-launch tmux.desktop"), { description = "Open tmux terminal" }) +hl.bind("SUPER + N", hl.dsp.exec_cmd(terminal .. " -a quicknotes -e nvim +'Obsidian today'"), { description = "Open Obsidian today in a centered floating window" }) -hl.bind(LEADER .. "B", hl.dsp.exec_raw(browser), { description = "Open browser" }) -hl.bind(LEADER .. "S", hl.dsp.exec_raw("ostt launch --paste"), { description = "Open ostt" }) -hl.bind(LEADER .. "I", sysinfo, { description = "Show system info" }) +hl.bind("SUPER + B", hl.dsp.exec_raw(browser), { description = "Open browser" }) +hl.bind("SUPER + I", sysinfo, { description = "Show system info" }) + +hl.bind("SUPER + CONTROL + X", hl.dsp.exec_raw("ostt launch --paste"), { description = "Open ostt" }) +hl.bind("F9", hl.dsp.exec_raw("ostt launch --paste"), { description = "Open ostt" }) hl.bind( - LEADER .. "Y", + "SUPER + Y", toggle_master_scrolling, { description = "Layout: Toggle master/scrolling" } ) -- Open rofi on first press, closes it on second -hl.bind(LEADER .. "Space", hl.dsp.exec_raw("rofi -show combi --modes combi"), +hl.bind("SUPER + Space", hl.dsp.exec_raw("rofi -show combi --modes combi"), { release = true, description = "Open Application Menu" }) -hl.bind(LEADER .. "SHIFT + SPACE", hl.dsp.exec_cmd("~/.local/bin/hyprland-fetch-client"), +hl.bind("SUPER + SHIFT + SPACE", hl.dsp.exec_cmd("~/.local/bin/hyprland-fetch-client"), { release = true, description = "Fetch client" }) -hl.bind(LEADER .. "CONTROL + SPACE", +hl.bind("SUPER + CONTROL + SPACE", hl.dsp.exec_cmd("~/.local/bin/hyprland-focus-client"), { release = true, description = "Focus client" } ) -hl.bind(LEADER .. "slash", +hl.bind("SUPER + slash", hl.dsp.exec_cmd("ROFI_PASS_BACKEND=wtype ROFI_PASS_CLIPBOARD_BACKEND=wl-clipboard ~/.local/bin/rofi-pass"), - { release = true, description = "Open rofi-pass" } -) - -hl.bind(HYPR .. "V", hl.dsp.exec_cmd("pavucontrol"), { description = "Volume control" }) -hl.bind(HYPR .. "B", hl.dsp.exec_cmd("blueberry"), { description = "Bluetooth manager" }) - -hl.bind(HYPR .. "semicolon", hl.dsp.exec_cmd("~/.local/bin/set-wallpaper.sh categories/quotes"), - { description = "get new wallpaper" }) + { release = true, description = "Open rofi-pass" }) hl.bind("Print", hl.dsp.exec_cmd("hyprshot -m window -o ~/Pictures/ -- tensaku-edit"), @@ -225,6 +220,267 @@ hl.bind("SUPER + SHIFT + Print", hl.dsp.exec_cmd("~/.local/bin/screen-recorder stop"), { description = "Stop screen recording" }) + +hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), + { repeating = true, description = "Volume down" }) +hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"), + { repeating = true, description = "Volume up" }) +hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { description = "Toggle mute" }) +hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), + { description = "Toggle mic mute" }) +hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl s 10%+"), + { repeating = true, description = "Brightness up" }) +hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl s 10%-"), + { repeating = true, description = "Brightness down" }) +hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { description = "Play/pause media" }) +hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { description = "Previous media" }) +hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { description = "Next media" }) + +hl.bind("SUPER + Y", hl.dsp.exec_cmd("makoctl dismiss"), { description = "Dismiss notifications" }) + + +hl.bind("SUPER + W", hl.dsp.window.close(), { description = "Window: Close" }) +hl.bind("SUPER + F", hl.dsp.window.fullscreen({ mode = "fullscreen", action = "toggle" }), + { description = "Window: Toggle fullscreen" }) +hl.bind("SUPER + CONTROL + F", hl.dsp.window.fullscreen_state({ internal = 2, client = 0, action = "toggle" }), + { description = "Window: Toggle fullscreen state 2" }) +hl.bind("SUPER + ALT + F", hl.dsp.window.fullscreen_state({ internal = 0, client = 2, action = "toggle" }), + { description = "Window: Toggle fullscreen state 2" }) + +hl.bind("SUPER + T", toggle_float_with_limit, + { description = "Window: Toggle floating/tiling (max 80%)" }) + +-- hl.bind("SUPER + P", hl.dsp.window.pseudo(), { description = "Window: Toggle pseudo tiling" }) +hl.bind("SUPER + P", toggle_pin, { description = "Window: Toggle Pin" }) + +hl.bind("SUPER + A", hl.dsp.window.alter_zorder({ mode = "top" }), { description = "Window: Move to top" }) + +hl.bind("SUPER + left", hl.dsp.focus({ direction = "l" }), { description = "Window: Focus left" }) +hl.bind("SUPER + right", hl.dsp.focus({ direction = "r" }), { description = "Window: Focus right" }) +hl.bind("SUPER + up", hl.dsp.focus({ direction = "u" }), { description = "Window: Focus up" }) +hl.bind("SUPER + down", hl.dsp.focus({ direction = "d" }), { description = "Window: Focus down" }) + +hl.bind("SUPER + H", hl.dsp.focus({ direction = "l" }), { description = "Window: Focus left" }) +hl.bind("SUPER + L", hl.dsp.focus({ direction = "r" }), { description = "Window: Focus right" }) +hl.bind("SUPER + K", hl.dsp.focus({ direction = "u" }), { description = "Window: Focus up" }) +hl.bind("SUPER + J", hl.dsp.focus({ direction = "d" }), { description = "Window: Focus down" }) -- hl.bind("SUPER + H", hl.dsp.window.resize("left"), { repeating = true, description = "Window: Resize left" }) + +-- hl.bind("SUPER + z", hl.dsp.focus({ last = true }), { description = "Window: Focus last" }) +hl.bind("SUPER + Z", hl.dsp.focus({ urgent_or_last = true }), { description = "Window: Focus last" }) + +hl.bind("SUPER + ALT + period", function() + hl.dispatch(hl.dsp.layout("cycleprev")) +end, { description = "Window: Swap with next" }) +hl.bind("SUPER + ALT + comma", function() + hl.dispatch(hl.dsp.layout("cyclenext")) +end, { description = "Window: Swap with prev" }) + +hl.bind("ALT + Tab", cycle_next_window({ next = true }), { description = "Window: Cycle next" }) +hl.bind("ALT + SHIFT + Tab", cycle_next_window({ next = false }), { description = "Window: Cycle prev" }) + +hl.bind("CONTROL + ALT + TAB", hl.dsp.focus({ monitor = "+1" }), { description = "Focus on next monitor" }) +hl.bind("CONTROL + ALT + SHIFT + TAB", hl.dsp.focus({ monitor = "-1" }), { description = "Focus on previous monitor" }) + +hl.bind("SUPER + S", hl.dsp.workspace.toggle_special("scratchpad"), { description = "Toggle scratchpad" }) +hl.bind("SUPER + ALT + S", hl.dsp.window.move({ workspace = "special:scratchpad", follow = false }), + { description = "Move window to scratchpad" }) +hl.bind("SUPER + grave", hl.dsp.workspace.toggle_special("scratchpad"), { description = "Toggle scratchpad" }) +hl.bind("SUPER + SHIFT + grave", hl.dsp.window.move({ workspace = "special:scratchpad", follow = false }), + { description = "Move window to scratchpad" }) + +-- hl.bind("SUPER + TAB", hl.dsp.focus({ monitor = "+1" }), { description = "Monitor: move focus to next monitor" }) +hl.bind("SUPER + TAB", hl.dsp.focus({ workspace = "e+1" }), { description = "Next workspace" }) +hl.bind("SUPER + SHIFT + TAB", hl.dsp.focus({ workspace = "e-1" }), { description = "Previous workspace" }) +hl.bind("SUPER + CONTROL + TAB", hl.dsp.focus({ workspace = "previous" }), { description = "Former workspace" }) + +hl.bind("SUPER + ALT + SHIFT + LEFT", hl.dsp.workspace.move({ monitor = "l" }), + { description = "Move workspace to left monitor" }) +hl.bind("SUPER + ALT + SHIFT + RIGHT", hl.dsp.workspace.move({ monitor = "r" }), + { description = "Move workspace to right monitor" }) +hl.bind("SUPER + ALT + SHIFT + UP", hl.dsp.workspace.move({ monitor = "u" }), + { description = "Move workspace to up monitor" }) +hl.bind("SUPER + ALT + SHIFT + DOWN", hl.dsp.workspace.move({ monitor = "d" }), + { description = "Move workspace to down monitor" }) + +hl.bind("SUPER + SHIFT + LEFT", hl.dsp.window.swap({ direction = "l" }), { description = "Swap window to the left" }) +hl.bind("SUPER + SHIFT + RIGHT", hl.dsp.window.swap({ direction = "r" }), { description = "Swap window to the right" }) +hl.bind("SUPER + SHIFT + UP", hl.dsp.window.swap({ direction = "u" }), { description = "Swap window up" }) +hl.bind("SUPER + SHIFT + DOWN", hl.dsp.window.swap({ direction = "d" }), { description = "Swap window down" }) + +hl.bind("ALT + TAB", hl.dsp.window.cycle_next(), { description = "Focus on next window" }) +hl.bind("ALT + SHIFT + TAB", hl.dsp.window.cycle_next({ next = false }), { description = "Focus on previous window" }) +hl.bind("ALT + TAB", hl.dsp.window.bring_to_top(), { description = "Reveal active window on top" }) +hl.bind("ALT + SHIFT + TAB", hl.dsp.window.bring_to_top(), { description = "Reveal active window on top" }) + +hl.bind("SUPER + ALT + Tab", hl.dsp.focus({ workspace = "next", on_current_monitor = true }), + { description = "Window: Focus previous in workspace" }) +hl.bind("SUPER + ALT + SHIFT + Tab", hl.dsp.focus({ workspace = "previous", on_current_monitor = true }), + { description = "Window: Focus previous in workspace" }) + +-- arrange split ratio +hl.bind("SUPER + X", toggle_master, { description = "Layout: Toggle master size" }) +-- hl.bind("SUPER + equal", hl.dsp.layout("mfact exact 0.5")) +hl.bind("SUPER + M", function() + local current_layout = hl.get_config("general.layout") + if current_layout == "master" then + hl.dispatch(hl.dsp.layout("swapwithmaster")) + end + if current_layout == "scrolling" then + hl.dispatch(hl.dsp.layout("consume_or_expel next")) + end +end, { description = "Layout: Swap with master" }) + +-- hl.bind("SUPER + M", hl.dsp.layout("rollnext")) +hl.bind("SUPER + period", function() + local current_layout = hl.get_config("general.layout") + if current_layout == "master" then + hl.dispatch(hl.dsp.layout("cycleprev")) + hl.dispatch(hl.dsp.layout("swapwithmaster")) + end + + if current_layout == "scrolling" then + hl.dispatch(hl.dsp.layout("swapcol r")) + hl.dispatch(hl.dsp.layout("focus l")) + end + -- hl.dispatch(hl.dsp.layout("focus r")) +end, { description = "Layout: Cycle next" }) + +hl.bind("SUPER + comma", function() + local current_layout = hl.get_config("general.layout") + if current_layout == "master" then + hl.dispatch(hl.dsp.layout("cyclenext")) + hl.dispatch(hl.dsp.layout("swapwithmaster")) + end + + if current_layout == "scrolling" then + hl.dispatch(hl.dsp.layout("swapcol l")) + hl.dispatch(hl.dsp.layout("focus r")) + end + -- hl.dispatch(hl.dsp.layout("focus l")) +end, { description = "Layout: Cycle previous" }) + +hl.bind("SUPER + SHIFT + comma", hl.dsp.window.move({ workspace = "-1" }), + { description = "Window: Move to previous workspace" }) + +hl.bind("SUPER + SHIFT + period", hl.dsp.window.move({ workspace = "+1" }), + { description = "Window: Move to next workspace" }) + +hl.bind("SUPER + ALT + comma", hl.dsp.workspace.move({ monitor = "-1" }), + { description = "Window: Move to previous workspace and follow" }) + +hl.bind("SUPER + ALT + period", hl.dsp.workspace.move({ monitor = "+1" }), + { description = "Window: Move to next workspace and follow" }) + +hl.bind("SUPER + C", hl.dsp.window.center(), { description = "Window: Center" }) + +hl.bind("SUPER + CONTROL + SHIFT + slash", + hl.dsp.exec_cmd("makoctl mode -t do-not-disturb"), + { description = "Toggle do-not-disturb" }) + +hl.bind("SUPER + CONTROL + Delete", hl.dsp.exec_cmd("hyprland-toggle-monitor eDP-1"), + { description = "Toggle laptop display" }) + +hl.bind("SUPER + Escape", hl.dsp.exec_raw("loginctl lock-session"), { description = "Lock screen" }) +hl.bind("SUPER + SHIFT + escape", hl.dsp.exec_raw("systemctl suspend"), { description = "Suspend" }) +--hl.bind("SUPER + ALT + escape", hl.dsp.exec_raw("uwsm stop"), { description = "Stop UWSM" }) +hl.bind("SUPER + ALT + escape", hl.dsp.exit(), { description = "Exit Hyprland" }) +hl.bind("SUPER + CONTROL + escape", hl.dsp.exec_raw("reboot"), { description = "Reboot" }) +hl.bind("SUPER + SHIFT + CONTROL + escape", hl.dsp.exec_raw("systemctl poweroff"), { description = "Power off" }) + +-- hl.bind("SUPER + L", hl.dsp.window.resize("right"), { repeating = true, description = "Window: Resize right" }) +-- hl.bind("SUPER + J", hl.dsp.window.resize("down"), { repeating = true, description = "Window: Resize down" }) +-- hl.bind("SUPER + K", hl.dsp.window.resize("up"), { repeating = true, description = "Window: Resize up" }) + +-- # Change Workspace Mode +-- +-- bind = SUPER SHIFT, X, workspaceopt, allfloat +-- bind = SUPER SHIFT, X, exec, $notifycmd "Toggled All Float Mode" + +-- bind = SUPER SHIFT, Z, workspaceopt, allpseudo +-- bind = SUPER SHIFT, Z, exec, $notifycmd "Toggled All Pseudo Mode" + +hl.on("keybinds.submap", function(name) + if name == "" then + hl.notification.create({ text = "Exited submap", duration = 2000, icon = "hint" }) + return + end + hl.notification.create({ text = "Entered submap: " .. name, duration = 2000, icon = "hint" }) +end) + +hl.bind(HYPR .. "Z", hl.dsp.submap("passthru"), { description = "Passthru Menu" }) +hl.define_submap("passthru", function() + hl.bind("escape", hl.dsp.submap("reset"), { description = "Passthru: Exit" }) +end) + +hl.bind("SUPER + F9", hl.dsp.submap("resize"), { description = "Resize Menu" }) +hl.define_submap("resize", function() + hl.bind("period", hl.dsp.window.resize({ x = 10, y = 10, relative = true }), + { repeating = true, description = "Resize: Increase" }) + hl.bind("comma", hl.dsp.window.resize({ x = -10, y = -10, relative = true }), + { repeating = true, description = "Resize: Decrease" }) + hl.bind("R", function() + window_resize_percentage(0.5, 0.5) + end, { description = "Resize: Reset" }) + hl.bind("S", function() + window_resize_percentage(0.25, 0.25) + end, { description = "Resize: Small" }) + hl.bind("D", function() + window_resize_percentage(0.7, 0.96) + hl.dispatch(hl.dsp.window.center()) + end, { description = "Resize: Large" }) + hl.bind("C", hl.dsp.window.center(), { description = "Resize: Center" }) + hl.bind("P", hl.dsp.window.pin(), { description = "Resize: Pin" }) + hl.bind("up", hl.dsp.window.move({ direction = "up" }), { description = "Resize: Move up" }) + hl.bind("down", hl.dsp.window.move({ direction = "down" }), { description = "Resize: Move down" }) + hl.bind("left", hl.dsp.window.move({ direction = "left" }), { description = "Resize: Move left" }) + hl.bind("right", hl.dsp.window.move({ direction = "right" }), { description = "Resize: Move right" }) + hl.bind("escape", hl.dsp.submap("reset"), { description = "Resize: Exit" }) + hl.bind("catchall", hl.dsp.submap("reset"), { description = "Resize: Exit" }) +end) + +local workspaceGroupSize = 10 +local numberkey = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 } + +function workspace_in_group(i) + local curr = hl.get_active_workspace().id + local newVal = math.floor((curr - 1) / workspaceGroupSize) * workspaceGroupSize + i + return newVal +end + +for i = 1, 10 do + hl.bind("SUPER + CONTROL + code:" .. numberkey[i], function() + hl.dispatch(hl.dsp.workspace.move({ monitor = "+1", workspace = workspace_in_group(i), follow = true })) + end, { description = "Workspace: Move monitor " .. i }) +end + +for i = 1, 10 do + hl.bind("SUPER + SHIFT + code:" .. numberkey[i], function() + hl.dispatch(hl.dsp.window.move({ workspace = workspace_in_group(i), follow = true })) + end, { description = "Workspace: Move " .. i }) +end + +for i = 1, 10 do + hl.bind("SUPER + code:" .. numberkey[i], function() + hl.dispatch(hl.dsp.focus({ workspace = workspace_in_group(i), on_current_monitor = true })) + end, { description = "Workspace: Focus " .. i }) +end + +-- Scroll through existing workspaces with mainMod + scroll +hl.bind("SUPER + mouse_down", hl.dsp.focus({ workspace = "e+1" }), { description = "Workspace: Next" }) +hl.bind("SUPER + mouse_up", hl.dsp.focus({ workspace = "e-1" }), { description = "Workspace: Previous" }) + +-- Move/resize windows with mainMod + LMB/RMB and dragging +hl.bind("SUPER + mouse:272", hl.dsp.window.drag(), { mouse = true, description = "Window: Drag" }) +hl.bind("SUPER + mouse:273", hl.dsp.window.resize(), { mouse = true, description = "Window: Resize" }) +hl.bind("mouse:275", hl.dsp.window.cycle_next({ next = true }), { click = true, description = "Window: Cycle next" }) +hl.bind("mouse:276", hl.dsp.window.cycle_next({ next = false }), { click = true, description = "Window: Cycle previous" }) + +hl.bind(HYPR .. "V", hl.dsp.exec_cmd("pavucontrol"), { description = "Volume control" }) +hl.bind(HYPR .. "B", hl.dsp.exec_cmd("blueberry"), { description = "Bluetooth manager" }) + +hl.bind(HYPR .. "semicolon", hl.dsp.exec_cmd("~/.local/bin/set-wallpaper.sh categories/quotes"), + { description = "get new wallpaper" }) + hl.bind(HYPR .. "A", hl.dsp.exec_cmd("gtk-launch pi.desktop"), { description = "Open pi tui" }) hl.bind(HYPR .. "C", dispatch_focus_or_launch({ match = "chrome-chatgpt.com", @@ -276,239 +532,6 @@ hl.bind(HYPR .. "F", dispatch_focus_or_launch({ cmd = "pcmanfm", }), { description = "File Manager" }) -hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), - { repeating = true, description = "Volume down" }) -hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"), - { repeating = true, description = "Volume up" }) -hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { description = "Toggle mute" }) -hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), - { description = "Toggle mic mute" }) -hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl s 10%+"), - { repeating = true, description = "Brightness up" }) -hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl s 10%-"), - { repeating = true, description = "Brightness down" }) -hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { description = "Play/pause media" }) -hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { description = "Previous media" }) -hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { description = "Next media" }) - -hl.bind(LEADER .. "Y", hl.dsp.exec_cmd("makoctl dismiss"), { description = "Dismiss notifications" }) - - -hl.bind(LEADER .. "W", hl.dsp.window.close(), { description = "Window: Close" }) -hl.bind(LEADER .. "F", hl.dsp.window.fullscreen({ mode = "fullscreen", action = "toggle" }), - { description = "Window: Toggle fullscreen" }) -hl.bind(LEADER .. "CTRL + F", hl.dsp.window.fullscreen_state({ internal = 2, client = 0, action = "toggle" }), - { description = "Window: Toggle fullscreen state 2" }) -hl.bind(LEADER .. "ALT + F", hl.dsp.window.fullscreen_state({ internal = 0, client = 2, action = "toggle" }), - { description = "Window: Toggle fullscreen state 2" }) - -hl.bind(LEADER .. "T", toggle_float_with_limit, - { description = "Window: Toggle floating/tiling (max 80%)" }) - --- hl.bind(LEADER .. "P", hl.dsp.window.pseudo(), { description = "Window: Toggle pseudo tiling" }) -hl.bind(LEADER .. "P", toggle_pin, { description = "Window: Toggle Pin" }) - -hl.bind(LEADER .. "A", hl.dsp.window.alter_zorder({ mode = "top" }), { description = "Window: Move to top" }) - -hl.bind(LEADER .. "left", hl.dsp.focus({ direction = "l" }), { description = "Window: Focus left" }) -hl.bind(LEADER .. "right", hl.dsp.focus({ direction = "r" }), { description = "Window: Focus right" }) -hl.bind(LEADER .. "up", hl.dsp.focus({ direction = "u" }), { description = "Window: Focus up" }) -hl.bind(LEADER .. "down", hl.dsp.focus({ direction = "d" }), { description = "Window: Focus down" }) - -hl.bind(LEADER .. "H", hl.dsp.focus({ direction = "l" }), { description = "Window: Focus left" }) -hl.bind(LEADER .. "L", hl.dsp.focus({ direction = "r" }), { description = "Window: Focus right" }) -hl.bind(LEADER .. "K", hl.dsp.focus({ direction = "u" }), { description = "Window: Focus up" }) -hl.bind(LEADER .. "J", hl.dsp.focus({ direction = "d" }), { description = "Window: Focus down" }) -- hl.bind("SUPER + H", hl.dsp.window.resize("left"), { repeating = true, description = "Window: Resize left" }) - --- hl.bind(LEADER .. "z", hl.dsp.focus({ last = true }), { description = "Window: Focus last" }) -hl.bind(LEADER .. "Z", hl.dsp.focus({ urgent_or_last = true }), { description = "Window: Focus last" }) - -hl.bind(LEADER .. "ALT + period", function() - hl.dispatch(hl.dsp.layout("cycleprev")) -end, { description = "Window: Swap with next" }) -hl.bind(LEADER .. "ALT + comma", function() - hl.dispatch(hl.dsp.layout("cyclenext")) -end, { description = "Window: Swap with prev" }) - -hl.bind("ALT + Tab", cycle_next_window({ next = true }), { description = "Window: Cycle next" }) -hl.bind("ALT + SHIFT + Tab", cycle_next_window({ next = false }), { description = "Window: Cycle prev" }) - -hl.bind(LEADER .. "ALT + Tab", hl.dsp.focus({ workspace = "previous", on_current_monitor = true }), - { description = "Window: Focus previous in workspace" }) - --- arrange split ratio -hl.bind(LEADER .. "X", toggle_master, { description = "Layout: Toggle master size" }) --- hl.bind(LEADER .. "equal", hl.dsp.layout("mfact exact 0.5")) -hl.bind(LEADER .. "M", function() - local current_layout = hl.get_config("general.layout") - if current_layout == "master" then - hl.dispatch(hl.dsp.layout("swapwithmaster")) - end - if current_layout == "scrolling" then - hl.dispatch(hl.dsp.layout("consume_or_expel next")) - end -end, { description = "Layout: Swap with master" }) - --- hl.bind(LEADER .. "M", hl.dsp.layout("rollnext")) -hl.bind(LEADER .. "period", function() - local current_layout = hl.get_config("general.layout") - if current_layout == "master" then - hl.dispatch(hl.dsp.layout("cycleprev")) - hl.dispatch(hl.dsp.layout("swapwithmaster")) - end - - if current_layout == "scrolling" then - hl.dispatch(hl.dsp.layout("swapcol r")) - hl.dispatch(hl.dsp.layout("focus l")) - end - -- hl.dispatch(hl.dsp.layout("focus r")) -end, { description = "Layout: Cycle next" }) - -hl.bind(LEADER .. "comma", function() - local current_layout = hl.get_config("general.layout") - if current_layout == "master" then - hl.dispatch(hl.dsp.layout("cyclenext")) - hl.dispatch(hl.dsp.layout("swapwithmaster")) - end - - if current_layout == "scrolling" then - hl.dispatch(hl.dsp.layout("swapcol l")) - hl.dispatch(hl.dsp.layout("focus r")) - end - -- hl.dispatch(hl.dsp.layout("focus l")) -end, { description = "Layout: Cycle previous" }) - -hl.bind(LEADER .. "semicolon", hl.dsp.workspace.toggle_special("special")) -hl.bind(LEADER .. "SHIFT + semicolon", hl.dsp.window.move({ workspace = "special:special", follow = false }), - { description = "Window: Move to special workspace" }) -hl.bind(LEADER .. "C", hl.dsp.window.center(), { description = "Window: Center" }) - -hl.bind(LEADER .. "Escape", hl.dsp.exec_raw("loginctl lock-session"), { description = "Lock screen" }) -hl.bind(LEADER .. "SHIFT + escape", hl.dsp.exec_raw("systemctl suspend"), { description = "Suspend" }) -hl.bind(LEADER .. "ALT + escape", hl.dsp.exec_raw("uwsm stop,"), { description = "Stop UWSM" }) -hl.bind(LEADER .. "CTRL + escape", hl.dsp.exec_raw("reboot"), { description = "Reboot" }) -hl.bind(LEADER .. "SHIFT + CTRL + escape", hl.dsp.exec_raw("systemctl poweroff"), { description = "Power off" }) - --- hl.bind("SUPER + L", hl.dsp.window.resize("right"), { repeating = true, description = "Window: Resize right" }) --- hl.bind("SUPER + J", hl.dsp.window.resize("down"), { repeating = true, description = "Window: Resize down" }) --- hl.bind("SUPER + K", hl.dsp.window.resize("up"), { repeating = true, description = "Window: Resize up" }) - --- # Change Workspace Mode --- --- bind = SUPER SHIFT, X, workspaceopt, allfloat --- bind = SUPER SHIFT, X, exec, $notifycmd "Toggled All Float Mode" - --- bind = SUPER SHIFT, Z, workspaceopt, allpseudo --- bind = SUPER SHIFT, Z, exec, $notifycmd "Toggled All Pseudo Mode" - -hl.on("keybinds.submap", function(name) - if name == "" then - hl.notification.create({ text = "Exited submap", duration = 2000, icon = "hint" }) - return - end - hl.notification.create({ text = "Entered submap: " .. name, duration = 2000, icon = "hint" }) -end) - -hl.bind(LEADER .. "F10", hl.dsp.submap("notification menu")) -hl.define_submap("notification menu", function() - hl.bind("Q", hl.dsp.exit()) - hl.bind("S", function() - hl.dispatch(hl.dsp.exec_cmd("makoctl -a do-not-disturb")) - hl.dispatch(hl.dsp.submap("reset")) - end) - hl.bind("N", function() - hl.dispatch(hl.dsp.exec_cmd("makoctl -r do-not-disturb")) - hl.dispatch(hl.dsp.submap("reset")) - end) - - hl.bind("M", function() - hl.dispatch(hl.dsp.exec_cmd("hyprland-toggle-monitor eDP-1")) - hl.dispatch(hl.dsp.submap("reset")) - end) - hl.bind("escape", hl.dsp.submap("reset")) - hl.bind("catchall", hl.dsp.submap("reset")) -end) - -hl.bind(HYPR .. "Z", hl.dsp.submap("passthru")) -hl.define_submap("passthru", function() - hl.bind("escape", hl.dsp.submap("reset")) -end) - -hl.bind(LEADER .. "F9", hl.dsp.submap("resize")) -hl.define_submap("resize", function() - hl.bind("period", hl.dsp.window.resize({ x = 10, y = 10, relative = true }), { repeating = true }) - hl.bind("comma", hl.dsp.window.resize({ x = -10, y = -10, relative = true }), { repeating = true }) - hl.bind("R", function() - window_resize_percentage(0.5, 0.5) - end, { description = "Resize: Reset" }) - hl.bind("S", function() - window_resize_percentage(0.25, 0.25) - end, { description = "Resize: Small" }) - hl.bind("D", function() - window_resize_percentage(0.7, 0.96) - hl.dispatch(hl.dsp.window.center()) - end, { description = "Resize: Large" }) - hl.bind("C", hl.dsp.window.center(), { description = "Resize: Center" }) - hl.bind("P", hl.dsp.window.pin(), { description = "Resize: Pin" }) - hl.bind("up", hl.dsp.window.move({ direction = "up" }), { description = "Resize: Move up" }) - hl.bind("down", hl.dsp.window.move({ direction = "down" }), { description = "Resize: Move down" }) - hl.bind("left", hl.dsp.window.move({ direction = "left" }), { description = "Resize: Move left" }) - hl.bind("right", hl.dsp.window.move({ direction = "right" }), { description = "Resize: Move right" }) - hl.bind("escape", hl.dsp.submap("reset"), { desceription = "Resize: Exit" }) - hl.bind("catchall", hl.dsp.submap("reset"), { description = "Resize: Exit" }) -end) - -hl.bind(LEADER .. "tab", hl.dsp.focus({ monitor = "+1" }), { description = "Monitor: move focus to next monitor" }) - -hl.bind(LEADER .. "SHIFT + comma", hl.dsp.window.move({ workspace = "-1" }), - { description = "Window: Move to previous workspace" }) - -hl.bind(LEADER .. "SHIFT + period", hl.dsp.window.move({ workspace = "+1" }), - { description = "Window: Move to next workspace" }) - -hl.bind(LEADER .. "CONTROL + comma", hl.dsp.workspace.move({ monitor = "-1" }), - { description = "Window: Move to previous workspace and follow" }) - -hl.bind(LEADER .. "CONTROL + period", hl.dsp.workspace.move({ monitor = "+1" }), - { description = "Window: Move to next workspace and follow" }) - -local workspaceGroupSize = 10 -local numberkey = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 } - -function workspace_in_group(i) - local curr = hl.get_active_workspace().id - local newVal = math.floor((curr - 1) / workspaceGroupSize) * workspaceGroupSize + i - return newVal -end - -for i = 1, 10 do - hl.bind(LEADER .. "CONTROL + code:" .. numberkey[i], function() - hl.dispatch(hl.dsp.workspace.move({ monitor = "+1", workspace = workspace_in_group(i), follow = true })) - end) -end - -for i = 1, 10 do - hl.bind(LEADER .. "SHIFT + code:" .. numberkey[i], function() - hl.dispatch(hl.dsp.window.move({ workspace = workspace_in_group(i), follow = true })) - end) -end - -for i = 1, 10 do - hl.bind(LEADER .. "code:" .. numberkey[i], function() - hl.dispatch(hl.dsp.focus({ workspace = workspace_in_group(i), on_current_monitor = true })) - end, { description = "Workspace: Focus " .. i }) -end - --- Scroll through existing workspaces with mainMod + scroll -hl.bind(LEADER .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" })) -hl.bind(LEADER .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" })) - --- Move/resize windows with mainMod + LMB/RMB and dragging -hl.bind(LEADER .. " + mouse:272", hl.dsp.window.drag(), { mouse = true }) -hl.bind(LEADER .. " + mouse:273", hl.dsp.window.resize(), { mouse = true }) -hl.bind("mouse:275", hl.dsp.window.cycle_next({ next = true }), { click = true, description = "Window: Cycle next" }) -hl.bind("mouse:276", hl.dsp.window.cycle_next({ next = false }), { click = true, description = "Window: Cycle previous" }) - -- Gestures -- hl.gesture({ fingers = 3, direction = "horizontal", action = "workspace" }) -- hl.gesture({ fingers = 3, direction = "down", mods = "ALT", action = "close" }) diff --git a/config/hypr/rules.lua b/config/hypr/rules.lua index 9482829..79cc365 100644 --- a/config/hypr/rules.lua +++ b/config/hypr/rules.lua @@ -1,4 +1,4 @@ -hl.workspace_rule({ workspace = "special:special", border_size = 3 }) +hl.workspace_rule({ workspace = "special:scratchpad", border_size = 3 }) hl.window_rule({ match = { class = "(blueberry.py|Impala|Wiremix|org.gnome.NautilusPreviewer|com.gabm.satty|Omarchy|About|TUI.float|org.pulseaudio.pavucontrol)" }, tag = @@ -9,7 +9,7 @@ hl.window_rule({ match = { class = "terminal-pi" }, float = true, center = true, - workspace = "special:special", + workspace = "special:scratchpad", size = { "monitor_w/2", "monitor_h/2" } }) diff --git a/script/hyprland-keybindings b/script/hyprland-keybindings index 2017540..48f5fcc 100755 --- a/script/hyprland-keybindings +++ b/script/hyprland-keybindings @@ -33,6 +33,7 @@ dynamic_bindings() { -e 's/^68,/SUPER CTRL,/' \ -e 's/^69,/SUPER SHIFT CTRL,/' \ -e 's/^72,/SUPER ALT,/' \ + -e 's/^73,/SUPER SHIFT ALT,/' \ -e 's/^77,/HYPR,/' }