diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..adacab7 --- /dev/null +++ b/.luarc.json @@ -0,0 +1,5 @@ +{ + "diagnostics": { + "globals": ["hl", "ipc", "mainMod"] + } +} diff --git a/basic/keybinds.conf b/basic/keybinds.conf index 5a129bb..9df5b1c 100644 --- a/basic/keybinds.conf +++ b/basic/keybinds.conf @@ -222,7 +222,7 @@ submap = wifi-sub bind = , catchall, exec, hyprctl dispatch submap reset && qs -c noctalia-shell ipc call network togglePanel submap = reset -submap = bt-sub +submap = bt-subbind = SUPER, Space, exec, rofi -- This launches the menu $call = exec, $ipc bluetooth bind = , T, $call toggle bind = , S, $call togglePanel diff --git a/basic/keybinds.lua b/basic/keybinds.lua index e69de29..0a39ff5 100644 --- a/basic/keybinds.lua +++ b/basic/keybinds.lua @@ -0,0 +1,264 @@ +---- KEYBINDINGS ---- +--------------------- +------@meta +--## @declaration hl, ipc, mainMod + +local mainMod = "SUPER" -- Sets "Windows" key as main modifier +local ipc = "qs -c noctalia-shell ipc call " + +-- 1. Basic Binds +hl.bind(mainMod .. " + Q ", hl.dsp.exec_cmd(terminal)) +hl.bind(" ALT + Q " , hl.dsp.exec_cmd(terminal, {window = "class:popup-term"})) +hl.bind(mainMod .. " + W ", hl.dsp.exec_cmd(terminal, {window = "class:popup-term"})) +hl.bind(mainMod .. " + C ", hl.dsp.window.close()) +hl.bind(mainMod .. " + SHIFT + CTRL + M ", hl.dsp.exit()) +-- hl.bind(mainMod .. " + E ", hl.dsp.exec(fileManager)) + +-- Workspace movement and tiling rule +hl.bind(mainMod .. "+ P" ,hl.dsp.window.float({ action = "toggle" })) +hl.bind(mainMod .. "+ P" ,hl.dsp.window.pin()) +hl.bind(mainMod .. "+ SHIFT + BACKSLASH" ,hl.dsp.window.float({ action = "toggle"})) +hl.bind(mainMod .. "+ BACKSLASH" ,hl.dsp.layout ("togglesplit")) +hl.bind(mainMod .. "+ CTRL + BACKSLASH " ,hl.dsp.window.pseudo({action = "toggle"})) + +-- hl.bind(mainMod .. " + SEMICOLON ", hl.dsp.exec_cmd( hyprctl general:layout master ) +-- hl.bind(mainMod .. " + APOSTROPHE ", hl.dsp.exec_cmd( hyprctl general:layout dwindle ) + +-- Compiler window +-- hl.bind(mainMod .. " + SHIFT + A ", "tagwindow", "compiler") +--hl.bind(mainMod .. " + A ", hl.dsp.exec_cmd( $XDG_CONFIG_HOME/hypr/scripts/compile.sh) + +-- 2. Navigation +-- 2.1 Vim Binds +hl.bind(mainMod .. " + H " , hl.dsp.focus( { direction = "left" })) +hl.bind(mainMod .. " + L " , hl.dsp.focus( { direction = "right" })) +hl.bind(mainMod .. " + K " , hl.dsp.focus( { direction = "up" })) +hl.bind(mainMod .. " + J " , hl.dsp.focus( { direction = "down" })) +hl.bind(mainMod .. " + SHIFT + H" , hl.dsp.window.move( { direction = "left" })) +hl.bind(mainMod .. " + SHIFT + L" , hl.dsp.window.move( { direction = "right" })) +hl.bind(mainMod .. " + SHIFT + K" , hl.dsp.window.move( { direction = "up" })) +hl.bind(mainMod .. " + SHIFT + J" , hl.dsp.window.move( { direction = "down" })) +-- 2.2 Workspace and monitor keys +hl.bind(mainMod .. " + mouse_up" , hl.dsp.focus ({ workspace = "m-1"})) +hl.bind(mainMod .. " + mouse_down" , hl.dsp.focus ({ workspace = "m+1"})) +hl.bind(mainMod .. " + SHIFT + mouse_up " , hl.dsp.focus ({ workspace = "e-1"})) +hl.bind(mainMod .. " + SHIFT + mouse_down " , hl.dsp.focus ({ workspace = "e+1"})) +hl.bind(mainMod .. " + CTRL + right" , hl.dsp.focus ({ workspace = "m+1"})) +hl.bind(mainMod .. " + CTRL + left" , hl.dsp.focus ({ workspace = "m-1"})) +hl.bind(mainMod .. " + TAB " , hl.dsp.focus ({ monitor = "-1"})) +hl.bind(mainMod .. " + SHIFT + TAB " , hl.dsp.focus ({ monitor = "+1"})) + +---- 3. resize with arrows +hl.bind(mainMod .. " + right " , hl.dsp.window.resize({ x = 20, y = 0, relative = true}) , {repeating = true}) +hl.bind(mainMod .. " + left " , hl.dsp.window.resize({ x =-20, y = 0, relative = true}) , {repeating = true}) +hl.bind(mainMod .. " + up " , hl.dsp.window.resize({ x = 0, y = -20, relative = true}) , {repeating = true}) +hl.bind(mainMod .. " + down " , hl.dsp.window.resize({ x = 0, y = 20, relative = true}) , {repeating = true}) + +---- 4. Switch workspaces with mainMod + [0-9] +hl.bind(mainMod .. " + 1 ", hl.dsp.focus({workspace = 1 })) +hl.bind(mainMod .. " + 2 ", hl.dsp.focus({workspace = 2 })) +hl.bind(mainMod .. " + 3 ", hl.dsp.focus({workspace = 3 })) +hl.bind(mainMod .. " + 4 ", hl.dsp.focus({workspace = 4 })) +hl.bind(mainMod .. " + 5 ", hl.dsp.focus({workspace = 5 })) +hl.bind(mainMod .. " + 6 ", hl.dsp.focus({workspace = 6 })) +hl.bind(mainMod .. " + 7 ", hl.dsp.focus({workspace = 7 })) +hl.bind(mainMod .. " + 8 ", hl.dsp.focus({workspace = 8 })) +hl.bind(mainMod .. " + 9 ", hl.dsp.focus({workspace = 9 })) +hl.bind(mainMod .. " + 0 ", hl.dsp.focus({workspace = 10})) + +---- 5. Move actihe window to a workspace with mainMod + SHIFT + [0-9] +hl.bind(mainMod .. " + SHIFT + 1 ", hl.dsp.window.move({workspace = 1 })) +hl.bind(mainMod .. " + SHIFT + 2 ", hl.dsp.window.move({workspace = 2 })) +hl.bind(mainMod .. " + SHIFT + 3 ", hl.dsp.window.move({workspace = 3 })) +hl.bind(mainMod .. " + SHIFT + 4 ", hl.dsp.window.move({workspace = 4 })) +hl.bind(mainMod .. " + SHIFT + 5 ", hl.dsp.window.move({workspace = 5 })) +hl.bind(mainMod .. " + SHIFT + 6 ", hl.dsp.window.move({workspace = 6 })) +hl.bind(mainMod .. " + SHIFT + 7 ", hl.dsp.window.move({workspace = 7 })) +hl.bind(mainMod .. " + SHIFT + 8 ", hl.dsp.window.move({workspace = 8 })) +hl.bind(mainMod .. " + SHIFT + 9 ", hl.dsp.window.move({workspace = 9 })) +hl.bind(mainMod .. " + SHIFT + 0 ", hl.dsp.window.move({workspace = 10})) + +---- 6. special workspace (scratchpad) +hl.bind(mainMod .. " + S ", hl.dsp.workspace.toggle_special("magic ")) +hl.bind(mainMod .. " + B ", hl.dsp.workspace.toggle_special("magic2 ")) +hl.bind(mainMod .. " + X ", hl.dsp.workspace.toggle_special("phantom ")) +hl.bind(mainMod .. " + X ", hl.dsp.workspace.toggle_special("phantom ")) + +hl.bind(mainMod .. " + SHIFT + S ", hl.dsp.window.move({ workspace = "special:magic" })) +hl.bind(mainMod .. " + SHIFT + B ", hl.dsp.window.move({ workspace = "special:book" })) + +-- TODO Rework this with lua +hl.bind(mainMod .. " + D ", hl.dsp.exec_cmd("vesktop")) +hl.bind(mainMod .. " + E ", hl.dsp.exec_cmd(email)) +hl.bind(mainMod .. " + G ", hl.dsp.exec_cmd("steam -forcedesktopscaling 0.5")) +hl.bind(mainMod .. " + D ", hl.dsp.workspace.toggle_special("discord ")) +hl.bind(mainMod .. " + E ", hl.dsp.workspace.toggle_special("email ")) +hl.bind(mainMod .. " + G ", hl.dsp.workspace.toggle_special("gaming ")) +hl.bind(mainMod .. " + N ", hl.dsp.workspace.toggle_special("notes ")) + +-- 8. 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}) + +---- 9. Multimedia keys for volume and LCD brightness +hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+")) +hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-")) +hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle")) +hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle")) +hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%+")) +hl.bind("XF86MonBrightnessDown",hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-")) + +---- Requires playerctl +hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next")) +hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause")) +hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause")) +hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous")) +hl.bind("ALT + mouse:274", hl.dsp.exec_cmd("playerctl play-pause")) +hl.bind(mainMod .. " + SPACE " ,hl.dsp.exec_cmd("playerctl play-pause")) + + +---- 10. Application launching +-- hl.bind(mainMod, hl.dsp.exec_cmd(menu)) +hl.bind(mainMod .. " + F " ,hl.dsp.exec_cmd(browser)) +hl.bind("ALT + C" ,hl.dsp.exec_cmd(ipc .. "plugin:clipper openPanel")) +hl.bind("code:148" ,hl.dsp.exec_cmd("kitty --class calc-term -o 'confirm_os_window_close 0' /home/venus/.cargo/bin/mathypad ")) + +-- TODO rework with LUA +-- hl.bind(mainMod .. " + escape" ,hl.dsp.exec_cmd("kitty --class btop -o "confirm_os_window_close 0" /usr/bin/btop")) +-- hl.bind(mainMod .. " + SHIFT + escape" ,hl.dsp.exec_cmd("kitty --class btop -o "confirm_os_window_close 0" /usr/bin/nvtop")) +hl.bind(mainMod .. " + escape" ,hl.dsp.exec_cmd("kitty btop" ,{float = true, border_size = 5})) +hl.bind("CTRL + SHIFT + ESCAPE" ,hl.dsp.exec_cmd("kitty btop" ,{float = true, border_size = 5})) +hl.bind(mainMod .. " + SHIFT + escape" ,hl.dsp.exec_cmd("kitty nvtop",{float = true, border_size = 5})) +hl.bind(mainMod .. " + I" ,hl.dsp.exec_cmd("/home/venus/.config/scripts/connectPhone.sh ")) +hl.bind(mainMod .. " + I" ,hl.dsp.exec_cmd("scrcpy --no-audio --no-video --keyboard=uhid --mouse=uhid")) +hl.bind(mainMod .. " + SHIFT + I" ,hl.dsp.exec_cmd("/home/venus/.config/scripts/connectPhone.sh ")) +hl.bind(mainMod .. " + SHIFT + I" ,hl.dsp.exec_cmd("scrcpy --no-audio --keyboard=uhid --mouse=uhid")) + + +---- 10.1 Shortcuts +hl.bind(mainMod .. " + CTRL + L ", hl.dsp.exec_cmd(ipc .. "lockScreen lock")) + +-- TODO update in LUA +--hl.bind(mainMod .. " + T ", hl.dsp.exec_cmd( notify-send "$(/home/venus/.config/hypr/scripts/getIp.sh)") +-- hl.bind(mainMod .. " + T ", hl.dsp.exec_cmd( kdeconnect-app) + +-- TODO Implement these +---- Change background opacity of terminal window +-- hl.bind(mainMod .. " + ALT + k ", hl.dsp.exec_cmd("kitty +kitten @ set-background-opacity -a 1")) +---- hande lid switch +-- bindl = , switch:Lid Switch, hl.dsp.exec_cmd( s$ipc lockScreen lock + +---- 12. quick access to controls submap +hl.bind(mainMod .. " + comma" , hl.dsp.exec_cmd(ipc .. "controlCenter toggle")) +hl.bind(mainMod .. " + period" , hl.dsp.exec_cmd(ipc .. "settings toggle")) +hl.bind("PRINT" , hl.dsp.exec_cmd("hyprshot -m active -m window --output-folder ~/Images/Screenshots")) +hl.bind("SHIFT + PRINT" , hl.dsp.exec_cmd("hyprshot -m region --output-folder ~/Images/Screenshots")) +hl.bind("ALT + PRINT" , hl.dsp.exec_cmd("hyprshot -m active -m output --output-folder ~/Images/Screenshots")) + +hl.bind(mainMod .. " + M ", function() + hl.dispatch(hl.dsp.exec_cmd(ipc .. "controlCenter toggle ")) + hl.dispatch(hl.dsp.submap("quick-settings")) +end) +-- +hl.bind(mainMod .. " + O ", hl.dsp.submap("open-apps")) + +---- 13. Mouse binds + +---- 14. submaps! +hl.define_submap("quick-settings", function () + hl.bind("V" ,hl.dsp.exec_cmd("protonvpn-app & hyprctl dispatch submap vpn")) + hl.bind("S" ,hl.dsp.exec_cmd(ipc .. "settings toggle")) + hl.bind("C" ,hl.dsp.exec_cmd(ipc .. "plugin:clipper togglePanel ")) + hl.bind("P" ,hl.dsp.exec_cmd(ipc .. "sessionMenu toggle")) + hl.bind("T" ,hl.dsp.exec_cmd(ipc .. "systemMonitor toggle")) + hl.bind("M" ,hl.dsp.exec_cmd(ipc .. "controlCenter toggle")) + hl.bind("D" ,hl.dsp.exec_cmd(ipc .. "notifications toggleDND")) + hl.bind("A" ,hl.dsp.exec_cmd(ipc .. "notifications dismissAll")) + hl.bind("SHIFT + B" ,hl.dsp.exec_cmd(ipc .. "bar toggle")) + hl.bind("SHIFT + W" ,hl.dsp.exec_cmd(ipc .. "wifi toggle -- toggle wifi")) + hl.bind("I" ,hl.dsp.exec_cmd(ipc .. "wallpaper toggle")) + hl.bind(" L " ,hl.dsp.exec_cmd(ipc .. "sessionMenu toggle")) + hl.bind("B " ,hl.dsp.exec_cmd(ipc .. "battery togglePanel -- toggle battery panel")) + hl.bind("SHIFT + C " ,hl.dsp.exec_cmd(ipc .. "calendar toggle")) + -- Bind Submaps + hl.bind("L" ,hl.dsp.submap("layouts")) + hl.bind("N" ,function () + hl.dispatch(hl.dsp.submap("notifications-sub")) + hl.dispatch(hl.dsp.exec_cmd(ipc .. "notifications toggleHistory")) + end) + hl.bind("B" ,function() + hl.dispatch(hl.dsp.submap("bt-sub")) + hl.dispatch(hl.dsp.exec_cmd(ipc .. "bluetooth togglePanel")) + end) + hl.bind("W" ,function () + hl.dispatch(hl.dsp.submap("wifi-sub")) + hl.dispatch(hl.dsp.exec_cmd(ipc .. "network togglePanel")) + end) + -- TODO Implement layout switching + -- hl.bind(, L, hl.dsp.exec_cmd( notify-send "layout switching" & hyprctl dispatch submap layouts) + hl.bind("catchall" ,function () + hl.dispatch(hl.dsp.submap("reset")) + hl.dispatch(hl.dsp.exec_cmd(ipc .. "controlCenter toggle ")) + end) +end) +hl.define_submap("notifications-sub", function() + hl.bind("D" ,hl.dsp.exec_cmd(ipc .. "notifications toggleDND")) + hl.bind("S" ,hl.dsp.exec_cmd(ipc .. "notifications toggleDND")) + hl.bind("Q" ,hl.dsp.exec_cmd(ipc .. "notifications toggleDND")) + hl.bind("A" ,hl.dsp.exec_cmd(ipc .. "notifications dismissAll")) + hl.bind("C" ,hl.dsp.exec_cmd(ipc .. "notifications clear")) + hl.bind("CTRL + D" ,hl.dsp.exec_cmd(ipc .. "notifications dismissAll")) + hl.bind("SHIFT + D" ,hl.dsp.exec_cmd(ipc .. "notifications dismissAll")) + hl.bind(mainMod .. " + D " ,hl.dsp.exec_cmd(ipc .. "notifications dismissAll")) + hl.bind("escape" ,function () + hl.dispatch(hl.dsp.exec_cmd(ipc .. "notifications toggleHistory")) + hl.dispatch(hl.dsp.submap("reset")) + end) +end) + +hl.define_submap("wifi-sub", "reset", function() + hl.bind("T" ,hl.dsp.exec_cmd(ipc .. "wifi toggle")) + hl.bind("S" ,hl.dsp.exec_cmd(ipc .. "wifi togglePanel")) + hl.bind("D" ,hl.dsp.exec_cmd(ipc .. "wifi disable")) + hl.bind("E" ,hl.dsp.exec_cmd(ipc .. "wifi enable")) + hl.bind("R" ,hl.dsp.exec_cmd("sudo systemctl restart iwd")) + hl.bind("escape" ,hl.dsp.exec_cmd(ipc .. "network togglePanel")) +end) + +hl.define_submap("bt-sub", function() + hl.bind("T" ,hl.dsp.exec_cmd(ipc .. "bluetooth toggle")) + hl.bind("S" ,hl.dsp.exec_cmd(ipc .. "bluetooth togglePanel")) + hl.bind("D" ,hl.dsp.exec_cmd(ipc .. "bluetooth disable")) + hl.bind("E" ,hl.dsp.exec_cmd(ipc .. "bluetooth enable")) + hl.bind("H" ,hl.dsp.exec_cmd('bluetoothctl connect 88:92:CC:53:88:7E && notify-send "connected to headphones"')) + hl.bind("J" ,hl.dsp.exec_cmd('bluetoothctl disconnect 88:92:CC:53:88:7E && notify-send "disconnected from headphones"')) + hl.bind("SHIFT + H" ,hl.dsp.exec_cmd('bluetoothctl disconnect 88:92:CC:53:88:7E && notify-send "disconnected from headphones"')) + hl.bind("P" ,hl.dsp.exec_cmd('bluetoothctl connect 64:9D:38:E0:4D:02 && notify-send "Connected to phone"')) + hl.bind("M" ,hl.dsp.exec_cmd('bluetoothctl disconnect 64:9D:38:E0:4D:02 && notify-send "Disconnected from phone"')) + hl.bind("escape" ,function () + hl.dispatch(hl.dsp.exec_cmd(ipc .. "bluetooth togglePanel")) + hl.dispatch(hl.dsp.submap("reset")) + end) + end) + + +-- TODO Implement a VPN subnet + +hl.define_submap("open-apps", "reset", function() + hl.bind("S" ,hl.dsp.exec_cmd("signal-desktop")) + hl.bind("D" ,hl.dsp.exec_cmd("vesktop")) + hl.bind("F" ,hl.dsp.exec_cmd("firefox")) + hl.bind("M" ,hl.dsp.exec_cmd("feishin")) + hl.bind("R" ,hl.dsp.exec_cmd("calibre")) + hl.bind("E" ,hl.dsp.exec_cmd("darktable")) + hl.bind("catchall" ,hl.dsp.submap("reset")) +end) + +--hl.define_submap("layouts, reset +-- hl.bind(, D, hl.dsp.exec_cmd( hyprctl general:layout dwindle) +-- hl.bind(, M, hl.dsp.exec_cmd( hyprctl general:layout master) +--hl.define_submap("reset + +---- 13. Misc tools. +--hl.bind(ALT, SPACE, hl.dsp.exec_cmd( $menu) + diff --git a/hyprland.lua b/hyprland.lua index c15e1ab..0743695 100644 --- a/hyprland.lua +++ b/hyprland.lua @@ -39,10 +39,10 @@ local basic = base .. "/basic" require("basic/looks") ---require(basic .. "/keybinds.lua") ---require(basic .. "/windows.lua") ---require(basic .. "/plugins.lua") ---require(basic .. "/inputs.lua") +require("basic/keybinds") +--require("basic/windows.lua") +--require("basic/plugins.lua") +--require("basic/inputs.lua") require("basic/permissions") --require(base .. "/monitors.lua") --require(base .. "/noctalia/noctalia-colors.lua")