Compare commits

...

2 commits

5 changed files with 88 additions and 72 deletions

View file

@ -147,9 +147,9 @@ hl.config({
}) })
------------------------------- ------ Windows rules
---- WINDOWS AND WORKSPACES ---
------------------------------- ---- Desktop behavior
-- Ignore maximize requests from apps. You'll probably like this. -- Ignore maximize requests from apps. You'll probably like this.
hl.window_rule({ hl.window_rule({
@ -175,6 +175,8 @@ hl.window_rule({
no_focus = true, no_focus = true,
}) })
---- Applications
-- Prism Launcher -- Prism Launcher
hl.window_rule({ hl.window_rule({
name = "prismlauncher-all", name = "prismlauncher-all",
@ -298,6 +300,8 @@ hl.window_rule({
--# TODO --# TODO
--windowrulev2 = size 100 100,floating:1 --windowrulev2 = size 100 100,floating:1
------ Workspace rules
-- Increase gaps for single apps -- Increase gaps for single apps
--# Usless since I changed the default gap but may be useful if you decide to reset it to 0 --# Usless since I changed the default gap but may be useful if you decide to reset it to 0
--workspace=w[t1], gapsout:2 --workspace=w[t1], gapsout:2

View file

@ -1,15 +1,11 @@
----------------- ------ Programs
---- PROGRAMS ---
-----------------
terminal = "foot" Terminal = "foot"
fileManager = "nautilus" FileManager = "nautilus"
menu = "rofi -show drun" Menu = "rofi -show drun"
notificationManager = "swaync-client -t" NotificationManager = "swaync-client -t"
------------------ ------ Autostart
---- AUTOSTART ---
------------------
-- Autostart necessary processes (like notifications daemons, status bars, etc.) -- Autostart necessary processes (like notifications daemons, status bars, etc.)
@ -23,19 +19,21 @@ hl.on("hyprland.start", function()
end) end)
-------------------- ------ Permissions
---- PERMISSIONS ---
--------------------
-- Please note permission changes here require a Hyprland restart and are not applied on-the-fly -- Please note permission changes here require a Hyprland restart and are not applied on-the-fly
-- for security reasons -- for security reasons
hl.config({ hl.config({
ecosystem = { ecosystem = {
enforce_permissions = true, enforce_permissions = false, -- Disabled for the moment
}, },
}) })
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 --- ---- ENVIRONMENT VARIABLES ---

View file

@ -1,3 +1,12 @@
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 --- ---- INPUT ---
-------------- --------------
@ -21,80 +30,85 @@ hl.gesture({
action = "workspace", action = "workspace",
}) })
hl.gesture({
fingers = 3,
direction = "vertical",
action = ToggleFloatingWindow,
})
-------------------- --------------------
---- KEYBINDINGS --- ---- KEYBINDINGS ---
-------------------- --------------------
mainMod = "SUPER" -- Sets META ("Windows") key as main modifier MainMod = "SUPER" -- Sets META ("Windows") key as main modifier
-- Main desktop controls -- Main desktop controls
hl.bind(mainMod .. " + Q" , hl.dsp.window.close()) hl.bind(MainMod .. " + Q" , hl.dsp.window.close())
hl.bind(mainMod .. " + R" , hl.dsp.exec_cmd(menu)) -- Omnibar 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 .. " + D" , hl.dsp.exec_cmd(Menu)) -- Legacy menu shortcut
hl.bind(mainMod .. " + I" , hl.dsp.exec_cmd("hyprlock")) -- Lockscreen 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 .. " + 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 .. " + 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 .. " + 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 .. " + 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 .. " + SHIFT + M", hl.dsp.exit()) -- Exit desktop session
-- Shortcuts -- Shortcuts
hl.bind(mainMod .. " + RETURN", hl.dsp.exec_cmd(terminal)) 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 .. " + 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 .. " + SPACE" , hl.dsp.exec_cmd(Menu))
hl.bind(mainMod .. " + E" , hl.dsp.exec_cmd(fileManager)) hl.bind(MainMod .. " + E" , hl.dsp.exec_cmd(FileManager))
hl.bind(mainMod .. " + A" , hl.dsp.exec_cmd(notificationManager)) hl.bind(MainMod .. " + A" , hl.dsp.exec_cmd(NotificationManager))
-- TODO Replace by default editor -- 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 -- Move focus with mainMod + arrow keys
hl.bind(mainMod .. " + left" , hl.dsp.focus({ direction = "left" })) hl.bind(MainMod .. " + left" , hl.dsp.focus({ direction = "left" }))
hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = "right" })) hl.bind(MainMod .. " + right", hl.dsp.focus({ direction = "right" }))
hl.bind(mainMod .. " + up" , hl.dsp.focus({ direction = "up" })) hl.bind(MainMod .. " + up" , hl.dsp.focus({ direction = "up" }))
hl.bind(mainMod .. " + down" , hl.dsp.focus({ direction = "down" })) hl.bind(MainMod .. " + down" , hl.dsp.focus({ direction = "down" }))
-- Move focus with mainMod + hjkl (vim keybinds) -- Move focus with mainMod + hjkl (vim keybinds)
hl.bind(mainMod .. " + H", hl.dsp.focus({ direction = "left" })) hl.bind(MainMod .. " + H", hl.dsp.focus({ direction = "left" }))
hl.bind(mainMod .. " + L", hl.dsp.focus({ direction = "right" })) hl.bind(MainMod .. " + L", hl.dsp.focus({ direction = "right" }))
hl.bind(mainMod .. " + K", hl.dsp.focus({ direction = "up" })) hl.bind(MainMod .. " + K", hl.dsp.focus({ direction = "up" }))
hl.bind(mainMod .. " + J", hl.dsp.focus({ direction = "down" })) hl.bind(MainMod .. " + J", hl.dsp.focus({ direction = "down" }))
-- Move windows with mainMod + shift + arrow keys -- Move windows with mainMod + shift + arrow keys
hl.bind(mainMod .. " + SHIFT + left" , hl.dsp.window.move{ direction = "left" }) 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 + right", hl.dsp.window.move{ direction = "right" })
hl.bind(mainMod .. " + SHIFT + up" , hl.dsp.window.move{ direction = "up" }) 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 + down" , hl.dsp.window.move{ direction = "down" })
-- Layout -- Layout
hl.bind(mainMod .. " + " .. "F", hl.dsp.window.fullscreen()) hl.bind(MainMod .. " + " .. "F", hl.dsp.window.fullscreen())
hl.bind(mainMod .. " + " .. "V", hl.dsp.layout("togglesplit")) hl.bind(MainMod .. " + " .. "V", hl.dsp.layout("togglesplit")) -- Horizontal/vertical split
-- Toggle floating
-- Horizontal/vertical split hl.bind(MainMod .. " + T", ToggleFloatingWindow )
hl.bind(mainMod .. " + " .. "T", hl.dsp.window.float()) hl.bind(MainMod .. " + " .. "Y", hl.dsp.window.pseudo()) -- Toggle pseudo-tiling
hl.bind(mainMod .. " + " .. "Y", hl.dsp.window.pseudo()) -- Toggle pseudo-tiling
-- Switch workspaces with mainMod + [0-9] -- Switch workspaces with mainMod + [0-9]
-- Move active window to a workspace with mainMod + SHIFT + [0-9] -- Move active window to a workspace with mainMod + SHIFT + [0-9]
for i = 0, 10 do for i = 0, 10 do
key = i % 10 local key = i % 10
hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i})) hl.bind(MainMod .. " + " .. key, hl.dsp.focus({ workspace = i}))
hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i })) hl.bind(MainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i }))
end end
-- Example special workspace (scratchpad) -- Example special workspace (scratchpad)
hl.bind(mainMod .. " + S", hl.dsp.workspace.toggle_special("magic")) 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 .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" }))
-- TODO -- TODO
-- Minimize function (uses scratchpad) -- Minimize function (uses scratchpad)
-- Scroll through existing workspaces with mainMod + scroll -- Scroll through existing workspaces with mainMod + scroll
hl.bind(mainMod .. " + mouse_down", 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" })) hl.bind(MainMod .. " + mouse_up" , hl.dsp.focus({ workspace = "e-1" }))
-- Move/resize windows with mainMod + LMB/RMB and dragging -- Move/resize windows with mainMod + LMB/RMB and dragging
hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true }) 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:273", hl.dsp.window.resize(), { mouse = true })
-- Function keys -- Function keys
@ -122,7 +136,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")) hl.bind("SHIFT" .. " + " .. "Print", hl.dsp.exec_cmd("~/.config/hypr/scripts/screenshot.sh --fullscreen"))
-- Color picker -- 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 --- Touchpad toggle
hl.bind("XF86TouchpadToggle", hl.dsp.exec_cmd("~/.config/hypr/scripts/toggle-touchpad.sh"), { locked = true }) hl.bind("XF86TouchpadToggle", hl.dsp.exec_cmd("~/.config/hypr/scripts/toggle-touchpad.sh"), { locked = true })
@ -133,7 +147,7 @@ hl.bind("SUPER + CONTROL" .. " + " .. "XF86TouchpadToggle", hl.dsp.exec_cmd("~/.
--- Keyboard layout toggle --- Keyboard layout toggle
---- Only works between AZERTY and QWERTY because of differences in the numbers row ---- Only works between AZERTY and QWERTY because of differences in the numbers row
---- that prevent using the default way provided by hyprland ---- 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 -- Lock laptop on lid close
hl.bind("switch:off:Lid Switch", hl.dsp.exec_cmd("hyprlock --immediate"), { locked = true }) hl.bind("switch:off:Lid Switch", hl.dsp.exec_cmd("hyprlock --immediate"), { locked = true })

View file

@ -9,10 +9,10 @@ hl.config({
-- Switch workspaces with mainMod + [0-9] -- Switch workspaces with mainMod + [0-9]
-- Move active window to a workspace with mainMod + SHIFT + [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", ] local fr_digits_layout = { "ampersand", "eacute", "quotedbl", "apostrophe", "parenleft", "minus", "egrave", "underscore", "ccedilla", "agrave", }
for i = 0, 10 do for i = 1, 10 do
key = fr_digits_layout[i%10] local key = fr_digits_layout[(i%11)]
hl.bind(mainMod.. " + " .. key, hl.dsp.focus({ workspace = i })) hl.bind(MainMod.. " + " .. key, hl.dsp.focus({ workspace = i }))
hl.bind(mainMod.. " + SHIFT + " .. key, hl.dsp.focus({ workspace = i })) hl.bind(MainMod.. " + SHIFT + " .. key, hl.dsp.focus({ workspace = i }))
end end

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
status_file="$HOME/.config/hypr/status/kb_layout" status_file="$HOME/.config/hypr/status/kb_layout"
hyprland_cfg_file="$HOME/.config/hypr/hyprland.conf" hyprland_cfg_file="$HOME/.config/hypr/hyprland.lua"
fr_to_en() { fr_to_en() {
@ -9,7 +9,7 @@ fr_to_en() {
hyprctl notify 1 2000 0 "Keyboard set to QWERTY" 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() { en_to_fr() {
@ -17,7 +17,7 @@ en_to_fr() {
hyprctl notify 1 2000 0 "Keyboard set to AZERTY" 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 if ! [ -f "${status_file}" ]; then