diff --git a/.config/hypr/config/appearance.lua b/.config/hypr/config/appearance.lua index 8caaf8f..3984d57 100644 --- a/.config/hypr/config/appearance.lua +++ b/.config/hypr/config/appearance.lua @@ -147,9 +147,9 @@ hl.config({ }) ------- Windows rules - ----- Desktop behavior +------------------------------- +---- WINDOWS AND WORKSPACES --- +------------------------------- -- Ignore maximize requests from apps. You'll probably like this. hl.window_rule({ @@ -175,8 +175,6 @@ hl.window_rule({ no_focus = true, }) ----- Applications - -- Prism Launcher hl.window_rule({ name = "prismlauncher-all", @@ -300,8 +298,6 @@ hl.window_rule({ --# TODO --windowrulev2 = size 100 100,floating:1 ------- Workspace rules - -- Increase gaps for single apps --# Usless since I changed the default gap but may be useful if you decide to reset it to 0 --workspace=w[t1], gapsout:2 diff --git a/.config/hypr/config/environment.lua b/.config/hypr/config/environment.lua index 8901229..1d2dfcc 100644 --- a/.config/hypr/config/environment.lua +++ b/.config/hypr/config/environment.lua @@ -1,11 +1,15 @@ ------- Programs +----------------- +---- PROGRAMS --- +----------------- -Terminal = "foot" -FileManager = "nautilus" -Menu = "rofi -show drun" -NotificationManager = "swaync-client -t" +terminal = "foot" +fileManager = "nautilus" +menu = "rofi -show drun" +notificationManager = "swaync-client -t" ------- Autostart +------------------ +---- AUTOSTART --- +------------------ -- Autostart necessary processes (like notifications daemons, status bars, etc.) @@ -15,25 +19,23 @@ hl.on("hyprland.start", function() hl.exec_cmd("wl-paste --type text --watch cliphist store") -- Stores only text data hl.exec_cmd("wl-paste --type image --watch cliphist store") -- Stores only image data -- SSH Agent - hl.exec_cmd("ssh-agent") + hl.exec_cmd("ssh-agent") end) ------- Permissions +-------------------- +---- 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 = false, -- Disabled for the moment + enforce_permissions = true, }, }) -hl.permission({ binary = "/usr/bin/grim", type = "screencopy", mode = "allow" }) -hl.permission({ binary = "/usr/bin/hyprlock", type = "screencopy", mode = "allow" }) --- XDG Desktop Portal -hl.permission({ binary = "/usr/(lib|libexec|lib64)/xdg-desktop-portal-hyprland", type = "screencopy", mode = "allow" }) ------------------------------ ---- ENVIRONMENT VARIABLES --- diff --git a/.config/hypr/config/input.lua b/.config/hypr/config/input.lua index 39cf63a..a99320d 100644 --- a/.config/hypr/config/input.lua +++ b/.config/hypr/config/input.lua @@ -1,12 +1,3 @@ -function ToggleFloatingWindow() - local monitor = hl.get_active_monitor() - local width = math.floor(monitor.width * 0.8) - local height = math.floor(monitor.height * 0.8) - - hl.dispatch(hl.dsp.window.float({ action = "toggle" })) - hl.dispatch(hl.dsp.window.resize({ x = width, y = height, window = "active", })) -end - -------------- ---- INPUT --- -------------- @@ -30,85 +21,80 @@ hl.gesture({ action = "workspace", }) -hl.gesture({ - fingers = 3, - direction = "vertical", - action = ToggleFloatingWindow, -}) - -------------------- ---- KEYBINDINGS --- -------------------- -MainMod = "SUPER" -- Sets META ("Windows") key as main modifier +mainMod = "SUPER" -- Sets META ("Windows") key as main modifier -- Main desktop controls -hl.bind(MainMod .. " + Q" , hl.dsp.window.close()) -hl.bind(MainMod .. " + R" , hl.dsp.exec_cmd(Menu)) -- Omnibar -hl.bind(MainMod .. " + D" , hl.dsp.exec_cmd(Menu)) -- Legacy menu shortcut -hl.bind(MainMod .. " + I" , hl.dsp.exec_cmd("hyprlock")) -- Lockscreen -hl.bind(MainMod .. " + B" , hl.dsp.exec_cmd("~/.config/hypr/scripts/toggle-waybar.sh")) -- Toggle sidebar -hl.bind(MainMod .. " + SHIFT + R", hl.dsp.exec_cmd("~/.config/hypr/scripts/reload.sh")) -- Reload desktop -hl.bind(MainMod .. " + F11" , hl.dsp.exec_cmd("~/.config/hypr/scripts/gamemode.sh")) -- Gamemode -hl.bind(MainMod .. " + F10" , hl.dsp.exec_cmd("~/.config/hypr/scripts/sharp_mode.sh")) -- Sharp mode -hl.bind(MainMod .. " + SHIFT + M", hl.dsp.exit()) -- Exit desktop session +hl.bind(mainMod .. " + Q" , hl.dsp.window.close()) +hl.bind(mainMod .. " + R" , hl.dsp.exec_cmd(menu)) -- Omnibar +hl.bind(mainMod .. " + D" , hl.dsp.exec_cmd(menu)) -- Legacy menu shortcut +hl.bind(mainMod .. " + I" , hl.dsp.exec_cmd("hyprlock")) -- Lockscreen +hl.bind(mainMod .. " + B" , hl.dsp.exec_cmd("~/.config/hypr/scripts/toggle-waybar.sh")) -- Toggle sidebar +hl.bind(mainMod .. " + SHIFT + R", hl.dsp.exec_cmd("~/.config/hypr/scripts/reload.sh")) -- Reload desktop +hl.bind(mainMod .. " + F11" , hl.dsp.exec_cmd("~/.config/hypr/scripts/gamemode.sh")) -- Gamemode +hl.bind(mainMod .. " + F10" , hl.dsp.exec_cmd("~/.config/hypr/scripts/sharp_mode.sh")) -- Sharp mode +hl.bind(mainMod .. " + SHIFT + M", hl.dsp.exit()) -- Exit desktop session -- Shortcuts -hl.bind(MainMod .. " + RETURN", hl.dsp.exec_cmd(Terminal)) -hl.bind(MainMod .. " + X" , hl.dsp.exec_cmd(Terminal)) -- Absolutely not because I dislocated my arm -hl.bind(MainMod .. " + SPACE" , hl.dsp.exec_cmd(Menu)) -hl.bind(MainMod .. " + E" , hl.dsp.exec_cmd(FileManager)) -hl.bind(MainMod .. " + A" , hl.dsp.exec_cmd(NotificationManager)) +hl.bind(mainMod .. " + RETURN", hl.dsp.exec_cmd(terminal)) +hl.bind(mainMod .. " + X" , hl.dsp.exec_cmd(terminal)) -- Absolutely not because I dislocated my arm +hl.bind(mainMod .. " + SPACE" , hl.dsp.exec_cmd(menu)) +hl.bind(mainMod .. " + E" , hl.dsp.exec_cmd(fileManager)) +hl.bind(mainMod .. " + A" , hl.dsp.exec_cmd(notificationManager)) -- TODO Replace by default editor -hl.bind("XF86Launch1" , hl.dsp.exec_cmd(Terminal .. " hx ~/.config/hypr/config")) +hl.bind("XF86Launch1" , hl.dsp.exec_cmd(terminal .. " hx ~/.config/hypr/config")) -- Move focus with mainMod + arrow keys -hl.bind(MainMod .. " + left" , hl.dsp.focus({ direction = "left" })) -hl.bind(MainMod .. " + right", hl.dsp.focus({ direction = "right" })) -hl.bind(MainMod .. " + up" , hl.dsp.focus({ direction = "up" })) -hl.bind(MainMod .. " + down" , hl.dsp.focus({ direction = "down" })) +hl.bind(mainMod .. " + left" , hl.dsp.focus({ direction = "left" })) +hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = "right" })) +hl.bind(mainMod .. " + up" , hl.dsp.focus({ direction = "up" })) +hl.bind(mainMod .. " + down" , hl.dsp.focus({ direction = "down" })) -- Move focus with mainMod + hjkl (vim keybinds) -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 .. " + 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" })) -- Move windows with mainMod + shift + arrow keys -hl.bind(MainMod .. " + SHIFT + left" , hl.dsp.window.move{ direction = "left" }) -hl.bind(MainMod .. " + SHIFT + right", hl.dsp.window.move{ direction = "right" }) -hl.bind(MainMod .. " + SHIFT + up" , hl.dsp.window.move{ direction = "up" }) -hl.bind(MainMod .. " + SHIFT + down" , hl.dsp.window.move{ direction = "down" }) +hl.bind(mainMod .. " + SHIFT + left" , hl.dsp.window.move{ direction = "left" }) +hl.bind(mainMod .. " + SHIFT + right", hl.dsp.window.move{ direction = "right" }) +hl.bind(mainMod .. " + SHIFT + up" , hl.dsp.window.move{ direction = "up" }) +hl.bind(mainMod .. " + SHIFT + down" , hl.dsp.window.move{ direction = "down" }) -- Layout -hl.bind(MainMod .. " + " .. "F", hl.dsp.window.fullscreen()) -hl.bind(MainMod .. " + " .. "V", hl.dsp.layout("togglesplit")) -- Horizontal/vertical split --- Toggle floating -hl.bind(MainMod .. " + T", ToggleFloatingWindow ) -hl.bind(MainMod .. " + " .. "Y", hl.dsp.window.pseudo()) -- Toggle pseudo-tiling +hl.bind(mainMod .. " + " .. "F", hl.dsp.window.fullscreen()) +hl.bind(mainMod .. " + " .. "V", hl.dsp.layout("togglesplit")) + +-- Horizontal/vertical split +hl.bind(mainMod .. " + " .. "T", hl.dsp.window.float()) +hl.bind(mainMod .. " + " .. "Y", hl.dsp.window.pseudo()) -- Toggle pseudo-tiling -- Switch workspaces with mainMod + [0-9] -- Move active window to a workspace with mainMod + SHIFT + [0-9] for i = 0, 10 do - local key = i % 10 - hl.bind(MainMod .. " + " .. key, hl.dsp.focus({ workspace = i})) - hl.bind(MainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i })) + key = i % 10 + hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i})) + hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i })) end -- 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" })) +hl.bind(mainMod .. " + S", hl.dsp.workspace.toggle_special("magic")) +hl.bind(mainMod .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" })) -- TODO -- Minimize function (uses scratchpad) -- 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 .. " + 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 }) +hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true }) +hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true }) -- Function keys @@ -136,7 +122,7 @@ hl.bind("Print", hl.dsp.exec_cmd("~/.config/hypr/scripts/screenshot.sh")) hl.bind("SHIFT" .. " + " .. "Print", hl.dsp.exec_cmd("~/.config/hypr/scripts/screenshot.sh --fullscreen")) -- Color picker -hl.bind(MainMod .. " + " .. "SHIFT" .. " + " .. "C", hl.dsp.exec_cmd("hyprpicker -a")) +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "C", hl.dsp.exec_cmd("hyprpicker -a")) --- Touchpad toggle hl.bind("XF86TouchpadToggle", hl.dsp.exec_cmd("~/.config/hypr/scripts/toggle-touchpad.sh"), { locked = true }) @@ -147,7 +133,7 @@ hl.bind("SUPER + CONTROL" .. " + " .. "XF86TouchpadToggle", hl.dsp.exec_cmd("~/. --- Keyboard layout toggle ---- Only works between AZERTY and QWERTY because of differences in the numbers row ---- that prevent using the default way provided by hyprland -hl.bind(MainMod .. " + " .. "CONTROL" .. " + " .. "SPACE", hl.dsp.exec_cmd("~/.config/hypr/scripts/change-kb-layout.sh")) +hl.bind(mainMod .. " + " .. "CONTROL" .. " + " .. "SPACE", hl.dsp.exec_cmd("~/.config/hypr/scripts/change-kb-layout.sh")) -- Lock laptop on lid close hl.bind("switch:off:Lid Switch", hl.dsp.exec_cmd("hyprlock --immediate"), { locked = true }) diff --git a/.config/hypr/config/kb_layouts/fr.lua b/.config/hypr/config/kb_layouts/fr.lua index f2f6742..748e31a 100644 --- a/.config/hypr/config/kb_layouts/fr.lua +++ b/.config/hypr/config/kb_layouts/fr.lua @@ -9,10 +9,10 @@ hl.config({ -- Switch workspaces with mainMod + [0-9] -- Move active window to a workspace with mainMod + SHIFT + [0-9] -local fr_digits_layout = { "ampersand", "eacute", "quotedbl", "apostrophe", "parenleft", "minus", "egrave", "underscore", "ccedilla", "agrave", } -for i = 1, 10 do - local key = fr_digits_layout[(i%11)] - hl.bind(MainMod.. " + " .. key, hl.dsp.focus({ workspace = i })) - hl.bind(MainMod.. " + SHIFT + " .. key, hl.dsp.focus({ workspace = i })) +local fr_digits_layout = [ "ampersand", "eacute", "quotedbl", "apostrophe", "parenleft", "minus", "egrave", "underscore", "ccedilla", "agrave", ] +for i = 0, 10 do + key = fr_digits_layout[i%10] + hl.bind(mainMod.. " + " .. key, hl.dsp.focus({ workspace = i })) + hl.bind(mainMod.. " + SHIFT + " .. key, hl.dsp.focus({ workspace = i })) end diff --git a/.config/hypr/scripts/change-kb-layout.sh b/.config/hypr/scripts/change-kb-layout.sh index 49de73b..5509aa7 100755 --- a/.config/hypr/scripts/change-kb-layout.sh +++ b/.config/hypr/scripts/change-kb-layout.sh @@ -1,7 +1,7 @@ #!/bin/sh status_file="$HOME/.config/hypr/status/kb_layout" -hyprland_cfg_file="$HOME/.config/hypr/hyprland.lua" +hyprland_cfg_file="$HOME/.config/hypr/hyprland.conf" fr_to_en() { @@ -9,7 +9,7 @@ fr_to_en() { hyprctl notify 1 2000 0 "Keyboard set to QWERTY" - sed -i 's/kb_layouts.fr/kb_layouts.us/g' "$hyprland_cfg_file" + sed -i 's/kb_layouts\/fr/kb_layouts\/us/g' "$hyprland_cfg_file" } en_to_fr() { @@ -17,7 +17,7 @@ en_to_fr() { hyprctl notify 1 2000 0 "Keyboard set to AZERTY" - sed -i 's/kb_layouts\.us/kb_layouts\.fr/g' "$hyprland_cfg_file" + sed -i 's/kb_layouts\/us/kb_layouts\/fr/g' "$hyprland_cfg_file" } if ! [ -f "${status_file}" ]; then @@ -30,4 +30,4 @@ else elif [ $(cat "${status_file}") = "en" ]; then en_to_fr fi -fi +fi \ No newline at end of file