176 lines
11 KiB
Lua
176 lines
11 KiB
Lua
-- HyprFlux — https://github.com/ahmad9059/HyprFlux
|
|
-- Ported from UserConfigs/Keybinds.conf
|
|
-- See https://wiki.hypr.land/Configuring/Basics/Binds/ and .../Basics/Dispatchers/
|
|
|
|
local mainMod = "SUPER"
|
|
local scriptsDir = os.getenv("HOME") .. "/.config/hypr/scripts"
|
|
local userScripts = os.getenv("HOME") .. "/.config/hypr/UserScripts"
|
|
|
|
-- settings for user default apps
|
|
local edit = os.getenv("EDITOR") or "nvim"
|
|
|
|
-- These two are for UserKeybinds.conf & Waybar Modules
|
|
local term = "foot" -- Terminal
|
|
local files = "thunar" -- File Manager
|
|
|
|
-- Default Search Engine for ROFI Search (SUPER S)
|
|
local searchEngine = "https://www.google.com/search?q={}"
|
|
|
|
-- common shortcuts
|
|
hl.bind(mainMod .. " + SPACE", hl.dsp.exec_cmd(".config/rofi/launchers/type-4/launcher.sh")) -- desktop overview (if installed)
|
|
hl.bind(mainMod .. " + Q", hl.dsp.window.close()) -- close active (not kill)
|
|
hl.bind(mainMod .. " + SHIFT + Q", hl.dsp.exec_cmd(scriptsDir .. "/KillActiveProcess.sh")) -- Kill active process
|
|
hl.bind(mainMod .. " + Return", hl.dsp.exec_cmd(term)) -- terminal
|
|
hl.bind(mainMod .. " + F", hl.dsp.exec_cmd(files)) -- file manager
|
|
hl.bind(mainMod .. " + B", hl.dsp.exec_cmd("zen-browser")) -- Launch Zen Browser New Everytime
|
|
hl.bind(mainMod .. " + V", hl.dsp.exec_cmd(scriptsDir .. "/ClipManager.sh")) -- Clipboard Manager
|
|
hl.bind(mainMod .. " + C", hl.dsp.exec_cmd("code --ozone-platform=x11")) -- Visual Studio Code
|
|
hl.bind(mainMod .. " + O", hl.dsp.exec_cmd("obsidian --ozone-platform=x11")) -- Obsidian
|
|
hl.bind(mainMod .. " + X", hl.dsp.exec_cmd("vesktop")) -- Vesktop(Discord)
|
|
hl.bind(mainMod .. " + M", hl.dsp.exec_cmd("fdm")) -- Free Download Manager
|
|
hl.bind(mainMod .. " + W", hl.dsp.exec_cmd("waypaper")) -- Wayland Wallpaper Setter
|
|
hl.bind(mainMod .. " + L", hl.dsp.exec_cmd("hyprlock")) -- Screen Locker
|
|
hl.bind(mainMod .. " + DELETE", hl.dsp.exec_cmd("~/.config/rofi/powermenu/type-2/powermenu.sh")) -- Power Menu
|
|
hl.bind(mainMod .. " + S", hl.dsp.exec_cmd("cd /home/thomas/hyprmod && uv run hyprmod")) -- Hyprmod - A Hyprland settings manager (if installed)
|
|
hl.bind(mainMod .. " + SHIFT + R", hl.dsp.exec_cmd(scriptsDir .. "/Refresh.sh")) -- Refresh waybar, swaync, rofirrr
|
|
hl.bind(mainMod .. " + N", hl.dsp.exec_cmd("swaync-client -t -sw")) -- swayNC notification panel
|
|
|
|
-- FEATURES / EXTRAS
|
|
hl.bind(mainMod .. " + SHIFT + F", hl.dsp.window.fullscreen({ mode = "fullscreen" })) -- whole full screen
|
|
hl.bind(mainMod .. " + SHIFT + SPACE", hl.dsp.window.float({ action = "toggle" })) -- Float Mode
|
|
|
|
-- Desktop zooming or magnifier
|
|
hl.bind(mainMod .. " + ALT + mouse_down", hl.dsp.exec_cmd([[hyprctl keyword cursor:zoom_factor "$(hyprctl getoption cursor:zoom_factor | awk 'NR==1 {factor = $2; if (factor < 1) {factor = 1}; print factor * 2.0}')"]]))
|
|
hl.bind(mainMod .. " + ALT + mouse_up", hl.dsp.exec_cmd([[hyprctl keyword cursor:zoom_factor "$(hyprctl getoption cursor:zoom_factor | awk 'NR==1 {factor = $2; if (factor < 1) {factor = 1}; print factor / 2.0}')"]]))
|
|
|
|
-- Waybar / Bar related
|
|
hl.bind(mainMod .. " + CTRL + ALT + B", hl.dsp.exec_cmd("pkill -SIGUSR1 waybar")) -- Toggle hide/show waybar
|
|
|
|
-- FEATURES / EXTRAS (UserScripts)
|
|
hl.bind(mainMod .. " + SHIFT + A", hl.dsp.exec_cmd(scriptsDir .. "/Animations.sh")) -- hyprland animations menu
|
|
hl.bind(mainMod .. " + SHIFT + Z", hl.dsp.exec_cmd(userScripts .. "/ZshChangeTheme.sh")) -- Change oh-my-zsh theme
|
|
|
|
--------------------------------------------------------------------------------------
|
|
-- Default Keybinds
|
|
--------------------------------------------------------------------------------------
|
|
|
|
hl.bind("CTRL + ALT + Delete", hl.dsp.exit()) -- exit Hyprland
|
|
|
|
-- Master Layout
|
|
hl.bind(mainMod .. " + CTRL + D", hl.dsp.layout("removemaster"))
|
|
hl.bind(mainMod .. " + I", hl.dsp.layout("addmaster"))
|
|
hl.bind(mainMod .. " + J", hl.dsp.layout("cyclenext"))
|
|
hl.bind(mainMod .. " + K", hl.dsp.layout("cycleprev"))
|
|
hl.bind(mainMod .. " + CTRL + Return", hl.dsp.layout("swapwithmaster"))
|
|
|
|
-- Dwindle Layout
|
|
hl.bind(mainMod .. " + P", hl.dsp.window.pseudo()) -- dwindle
|
|
|
|
-- Special Keys / Hot Keys
|
|
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd(scriptsDir .. "/Volume.sh --inc"), { repeating = true, locked = true }) -- volume up
|
|
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd(scriptsDir .. "/Volume.sh --dec"), { repeating = true, locked = true }) -- volume down
|
|
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd(scriptsDir .. "/Volume.sh --toggle-mic"), { locked = true }) -- mic mute
|
|
hl.bind("XF86AudioMute", hl.dsp.exec_cmd(scriptsDir .. "/Volume.sh --toggle"), { locked = true }) -- mute
|
|
hl.bind("XF86Sleep", hl.dsp.exec_cmd("systemctl suspend"), { locked = true }) -- sleep button
|
|
hl.bind("XF86RFKill", hl.dsp.exec_cmd(scriptsDir .. "/AirplaneMode.sh"), { locked = true }) -- Airplane mode
|
|
|
|
-- media controls using keyboards
|
|
hl.bind("XF86MediaPlayPause", hl.dsp.exec_cmd(scriptsDir .. "/MediaCtrl.sh --pause"), { locked = true })
|
|
hl.bind("XF86AudioPause", hl.dsp.exec_cmd(scriptsDir .. "/MediaCtrl.sh --pause"), { locked = true })
|
|
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd(scriptsDir .. "/MediaCtrl.sh --pause"), { locked = true })
|
|
hl.bind("XF86AudioNext", hl.dsp.exec_cmd(scriptsDir .. "/MediaCtrl.sh --nxt"), { locked = true })
|
|
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd(scriptsDir .. "/MediaCtrl.sh --prv"), { locked = true })
|
|
hl.bind("XF86AudioStop", hl.dsp.exec_cmd(scriptsDir .. "/MediaCtrl.sh --stop"), { locked = true })
|
|
|
|
-- Resize windows
|
|
hl.bind(mainMod .. " + SHIFT + left", hl.dsp.window.resize({ x = -50, y = 0, relative = true }), { repeating = true })
|
|
hl.bind(mainMod .. " + SHIFT + right", hl.dsp.window.resize({ x = 50, y = 0, relative = true }), { repeating = true })
|
|
hl.bind(mainMod .. " + SHIFT + up", hl.dsp.window.resize({ x = 0, y = -50, relative = true }), { repeating = true })
|
|
hl.bind(mainMod .. " + SHIFT + down", hl.dsp.window.resize({ x = 0, y = 50, relative = true }), { repeating = true })
|
|
|
|
-- Move windows
|
|
hl.bind(mainMod .. " + CTRL + left", hl.dsp.window.move({ direction = "l" }))
|
|
hl.bind(mainMod .. " + CTRL + right", hl.dsp.window.move({ direction = "r" }))
|
|
hl.bind(mainMod .. " + CTRL + up", hl.dsp.window.move({ direction = "u" }))
|
|
hl.bind(mainMod .. " + CTRL + down", hl.dsp.window.move({ direction = "d" }))
|
|
|
|
-- Swap windows
|
|
hl.bind(mainMod .. " + ALT + left", hl.dsp.window.swap({ direction = "l" }))
|
|
hl.bind(mainMod .. " + ALT + right", hl.dsp.window.swap({ direction = "r" }))
|
|
hl.bind(mainMod .. " + ALT + up", hl.dsp.window.swap({ direction = "u" }))
|
|
hl.bind(mainMod .. " + ALT + down", hl.dsp.window.swap({ direction = "d" }))
|
|
|
|
-- Move focus with mainMod + arrow keys
|
|
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" }))
|
|
|
|
-- Workspaces related
|
|
hl.bind(mainMod .. " + tab", hl.dsp.focus({ workspace = "m+1" }))
|
|
hl.bind(mainMod .. " + SHIFT + tab", hl.dsp.focus({ workspace = "m-1" }))
|
|
|
|
-- Special workspace
|
|
-- hl.bind(mainMod .. " + SHIFT + U", hl.dsp.window.move({ workspace = "special" }))
|
|
-- hl.bind(mainMod .. " + U", hl.dsp.workspace.toggle_special())
|
|
hl.bind(mainMod .. " + U", hl.dsp.workspace.toggle_special("nyx"))
|
|
hl.bind(mainMod .. " + SHIFT + U", hl.dsp.window.move({ workspace = "special:nyx" }))
|
|
|
|
-- Number-row keys (the Lua bind parser does not accept the code:NN keycode syntax)
|
|
-- Switch workspaces with mainMod + [0-9]
|
|
for i, key in ipairs({ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }) do
|
|
hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i }))
|
|
end
|
|
|
|
-- Move active window and follow to workspace mainMod + SHIFT + [0-9]
|
|
for i, key in ipairs({ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }) do
|
|
hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i, follow = true }))
|
|
end
|
|
hl.bind(mainMod .. " + SHIFT + bracketleft", hl.dsp.window.move({ workspace = -1, follow = true })) -- brackets [
|
|
hl.bind(mainMod .. " + SHIFT + bracketright", hl.dsp.window.move({ workspace = 1, follow = true })) -- brackets ]
|
|
|
|
-- Move active window to a workspace silently mainMod + CTRL + [0-9]
|
|
for i, key in ipairs({ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }) do
|
|
hl.bind(mainMod .. " + CTRL + " .. key, hl.dsp.window.move({ workspace = i, follow = false }))
|
|
end
|
|
hl.bind(mainMod .. " + CTRL + bracketleft", hl.dsp.window.move({ workspace = -1, follow = false })) -- brackets [
|
|
hl.bind(mainMod .. " + CTRL + bracketright", hl.dsp.window.move({ workspace = 1, follow = false })) -- brackets ]
|
|
|
|
-- 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" }))
|
|
hl.bind(mainMod .. " + period", hl.dsp.focus({ workspace = "e+1" }))
|
|
hl.bind(mainMod .. " + comma", 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 }) -- mouse:272 = left click
|
|
hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true }) -- mouse:273 = right click
|
|
|
|
--------------------------------------------------------------------------------------
|
|
-- Laptop specific keybinds
|
|
--------------------------------------------------------------------------------------
|
|
|
|
-- for disabling Touchpad. hyprctl devices to get device name.
|
|
local touchpadDevice = "asue1209:00-04f3:319f-touchpad"
|
|
|
|
hl.bind("XF86KbdBrightnessDown", hl.dsp.exec_cmd(scriptsDir .. "/BrightnessKbd.sh --dec"), { repeating = true }) -- decrease keyboard brightness
|
|
hl.bind("XF86KbdBrightnessUp", hl.dsp.exec_cmd(scriptsDir .. "/BrightnessKbd.sh --inc"), { repeating = true }) -- increase keyboard brightness
|
|
hl.bind("XF86Launch1", hl.dsp.exec_cmd("rog-control-center")) -- ASUS Armory crate button
|
|
hl.bind("XF86Launch3", hl.dsp.exec_cmd("asusctl led-mode -n")) -- FN+F4 Switch keyboard RGB profile
|
|
hl.bind("XF86Launch4", hl.dsp.exec_cmd("asusctl profile -n")) -- FN+F5 change of fan profiles (Quiet, Balance, Performance)
|
|
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd(scriptsDir .. "/Brightness.sh --dec"), { repeating = true }) -- decrease monitor brightness
|
|
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd(scriptsDir .. "/Brightness.sh --inc"), { repeating = true }) -- increase monitor brightness
|
|
hl.bind("XF86TouchpadToggle", hl.dsp.exec_cmd(scriptsDir .. "/TouchPad.sh")) -- disable touchpad
|
|
|
|
-- Screenshot keybindings using F6 (no PrintSrc button)
|
|
-- hl.bind(mainMod .. " + F6", hl.dsp.exec_cmd(scriptsDir .. "/ScreenShot.sh --now")) -- screenshot
|
|
-- hl.bind(mainMod .. " + SHIFT + F6", hl.dsp.exec_cmd(scriptsDir .. "/ScreenShot.sh --area")) -- screenshot (area)
|
|
-- hl.bind(mainMod .. " + CTRL + F6", hl.dsp.exec_cmd(scriptsDir .. "/ScreenShot.sh --in5")) -- screenshot (5 secs delay)
|
|
-- hl.bind(mainMod .. " + ALT + F6", hl.dsp.exec_cmd(scriptsDir .. "/ScreenShot.sh --in10")) -- screenshot (10 secs delay)
|
|
-- hl.bind("ALT + F6", hl.dsp.exec_cmd(scriptsDir .. "/ScreenShot.sh --active")) -- screenshot (active window only)
|
|
|
|
hl.device({
|
|
name = touchpadDevice,
|
|
enabled = true,
|
|
})
|