local launchPrefix = "uwsm app -- " local function is_ipc_call(command) -- check if this is an ipc call to a running programm is_dms_ipc = starts_with(command, "dms ipc") is_hyprctl = starts_with(command, "hyprctl") is_ipc = any({is_dms_ipc, is_hyprctl}, function(v) return v end) return is_ipc end function create_launcher(command) if is_ipc_call(command) then return command end return launchPrefix .. command end function execute(command) return hl.dsp.exec_cmd(create_launcher(command)) end -- Program Launchers hl.bind("SUPER + Return", execute(programs.terminal), { description = "Open Terminal" }) hl.bind("SUPER + Space", execute(programs.menu), { description = "Open Application Menu" }) hl.bind("SUPER + W", execute(programs.browser), { description = "Start Webbrowser"}) hl.bind("SUPER + E", execute(programs.explorer), { description = "Start Webbrowser"}) hl.bind("CTRL + SHIFT + Escape", execute("dms ipc call processlist focusOrToggle"), { description = "Process Manager" }) hl.bind("SUPER + Comma", execute("dms ipc call settings focusOrToggle"), { description = "Open DMS Settings" }) hl.bind("SUPER + Escape", execute("dms ipc call powermenu toggle"), { description = "Open Power Menu" }) hl.bind("SUPER + Plus", execute(programs.calculator), { description = "Open Calculator" }) hl.bind("SUPER + B", execute("dms ipc call night toggle"), { description = "Toggle Night Mode" }) hl.bind("SUPER + SHIFT + I", execute("dms ipc call inhibit toggle"), { description = "Toggle Idle Inhibitor" }) -- Workspaces for i = 1, 10 do local workspace_num = i%10 local workspace_name = i hl.bind("SUPER + " .. workspace_num, hl.dsp.focus({ workspace = workspace_name}), { description = "Focus Workspace "..workspace_name }) end hl.bind("SUPER + Page_Down", hl.dsp.focus({ workspace = "e+1" }), { description = "Focus Next Workspace" }) hl.bind("SUPER + mouse_down", hl.dsp.focus({ workspace = "e+1" }), { description = "Focus Next Workspace" }) hl.bind("SUPER + Page_Up", hl.dsp.focus({ workspace = "e-1" }), { description = "Focus Previous Workspace" }) hl.bind("SUPER + mouse_up", hl.dsp.focus({ workspace = "e-1" }), { description = "Focus Previous Workspace" }) -- Windows hl.bind("SUPER + Q", hl.dsp.window.close() , { description = "Close Window" }) hl.bind("SUPER + SHIFT + Q", hl.dsp.window.kill() , { description = "Close Window" }) hl.bind("SUPER + F", hl.dsp.window.fullscreen({ mode = "maximized", action = "toggle" }), { description = "Maximize Window"}) hl.bind("SUPER + SHIFT + F", hl.dsp.window.fullscreen({ mode = "fullscreen", action = "toggle" }), { description = "Fullscreen Window"}) hl.bind("SUPER + V", function() hl.dispatch(hl.dsp.window.float({action="float"})) hl.dispatch(hl.dsp.window.center()) end, { description = "Flaot & Center Window"}) hl.bind("SUPER + C", hl.dsp.window.center(), { description = "Center Window" }) hl.bind("SUPER + G", hl.dsp.group.toggle(), { description = "Toggle Group" }) hl.bind("SUPER + S", hl.dsp.window.pin({action="toggle"}), { description = "Pin Window (Sticky)" }) hl.bind("SUPER + mouse:272", hl.dsp.window.drag(), { description = "Move Window", mouse = true }) hl.bind("SUPER + mouse:273", hl.dsp.window.resize(), { description = "Resize Window", mouse = true }) local function smart_focus(direction) local window = hl.get_active_window() if not window then return end local group = window.group if not group or not group.members or #group.members == 0 then hl.dispatch(hl.dsp.focus({direction=direction})) return end -- when in a group, try to focus next grouped window local members = group.members or {} local index = nil for i, member in ipairs(members) do if member.address == window.address then index = i break end end if not index then hl.dispatch(hl.dsp.focus({direction=direction})) return end next = members[direction == "left" and index - 1 or index + 1] if next then hl.dispatch(hl.dsp.focus({ window = next })) return end hl.dispatch(hl.dsp.focus({direction=direction})) end hl.bind("SUPER + H", function() smart_focus("left") end, { description = "Move Focus Left" }) hl.bind("SUPER + J", hl.dsp.focus({direction="down"}), { description = "Move Focus Down" }) hl.bind("SUPER + K", hl.dsp.focus({direction="up"}), { description = "Move Focus Up" }) hl.bind("SUPER + L", function() smart_focus("right") end, { description = "Move Focus Right" }) hl.bind("SUPER + SHIFT + H", hl.dsp.window.move({direction="left", group_aware = true}), { description = "Move Window Left" }) hl.bind("SUPER + SHIFT + J", hl.dsp.window.move({direction="down", group_aware = true}), { description = "Move Window Down" }) hl.bind("SUPER + SHIFT + K", hl.dsp.window.move({direction="up", group_aware = true}), { description = "Move Window Up" }) hl.bind("SUPER + SHIFT + L", hl.dsp.window.move({direction="right", group_aware = true}), { description = "Move Window Right" }) for i = 1, 10 do local workspace_num = i%10 local workspace_name = i hl.bind("SUPER + SHIFT + " .. workspace_num, hl.dsp.window.move({ workspace = workspace_name, follow = true}), { description = "Move Window to Workspace " .. workspace_name }) hl.bind("SUPER + CTRL + SHIFT + " .. workspace_num, hl.dsp.window.move({ workspace = workspace_name, follow = false}), { description = "Move Window to Workspace " .. workspace_name .. " (silent)" }) end -- Resizing Submap local resizeSubmapName = "Resize Window: [hjkl]" hl.bind("SUPER + R", hl.dsp.submap(resizeSubmapName), { description = "Resize..." }) hl.define_submap(resizeSubmapName, function() hl.bind("h", hl.dsp.window.resize({ x = -10, y = 0, relative = true}), { repeating = true }) hl.bind("j", hl.dsp.window.resize({ x = 0, y = -10, relative = true}), { repeating = true }) hl.bind("k", hl.dsp.window.resize({ x = 0, y = 10, relative = true}), { repeating = true }) hl.bind("l", hl.dsp.window.resize({ x = 10, y = 0, relative = true}), { repeating = true }) hl.bind("escape", hl.dsp.submap("reset")) hl.bind("catchall", function() hl.dispatch(submap_toast) end) end) -- Move Workspaces local workspaceSubmapName = "Workspace: [hjkl]" hl.bind("SUPER + T", hl.dsp.submap(workspaceSubmapName), { description = "Workspace..." }) hl.define_submap(workspaceSubmapName, function() hl.bind("escape", hl.dsp.submap("reset")) hl.bind("catchall", function() hl.dispatch(submap_toast) end) end) -- Master Layout hl.bind("SUPER + M", hl.dsp.layout("focusmaster"), { description = "Focus Master" }) hl.bind("SUPER + SHIFT + M", hl.dsp.layout("swapwithmaster ignoremaster"), { description = "Swap With Master" }) -- Clipboard hl.bind("SUPER + SHIFT + V", execute("dms ipc call clipboard toggle"), { description = "Open Clipboard Manager" }) -- Screenshot hl.bind("Print", execute("dms screenshot region -d ~/Pictures/Screenshots"), { description = "Screenshot" }) hl.bind("CTRL + Print", execute("dms screenshot full -d ~/Pictures/Screenshots"), { description = "Full Screenshot" }) hl.bind("ALT + Print", execute("dms screenshot window -d ~/Pictures/Screenshots"), { description = "Window Screenshot" }) -- Notifications hl.bind("SUPER + N", execute("dms ipc call notifications toggle"), { description = "Toggle Notifications" }) hl.bind("SUPER + SHIFT + N", execute("dms ipc call notifications clearAll"), { description = "Toggle Notifications" }) -- Multimedia hl.bind("XF86AudioRaiseVolume", execute("dms ipc call audio increment 1"), { description = "Increase Volume", repeating = true }) hl.bind("XF86AudioLowerVolume", execute("dms ipc call audio decrement 1"), { description = "Decrease Volume", repeating = true }) hl.bind("CTRL + XF86AudioRaiseVolume", execute("dms ipc call mpris increment 1"), { description = "Increase Player Volume", repeating = true }) hl.bind("CTRL + XF86AudioLowerVolume", execute("dms ipc call mpris decrement 1"), { description = "Decrease Player Volume", repeating = true }) hl.bind("XF86AudioMute", execute("dms ipc call audio mute"), { description = "Mute Audio"}) hl.bind("XF86AudioMicMute", execute("dms ipc call audio micmute"), { description = "Mute Microphone"}) hl.bind("XF86AudioPause", execute("dms ipc call mpris playPause"), { description = "Play / Pause"}) hl.bind("XF86AudioPlay", execute("dms ipc call mpris playPause"), { description = "Play / Pause"}) hl.bind("XF86AudioPrev", execute("dms ipc call mpris previous"), { description = "Previous"}) hl.bind("XF86AudioNext", execute("dms ipc call mpris next"), { description = "Next"}) hl.bind("XF86MonBrightnessUp", execute("dms ipc call brightness increment 5 \"\""), { description = "Increase Brightness", repeating = true, locked = true}) hl.bind("XF86MonBrightnessDown", execute("dms ipc call brightness decrement 5 \"\""), { description = "Decrease Brightness", repeating = true, locked = true}) -- Hyprland hl.bind("SUPER + SHIFT + ALT + CTRL + Escape", hl.dsp.exit(), { description = "Exit Hyprland" })