From 663777d8ec764a6ec9f855648b9e5305e3047e3f Mon Sep 17 00:00:00 2001 From: "Gu://em_" Date: Sat, 5 Apr 2025 18:16:17 +0200 Subject: [PATCH] Changed hyprland config structure, added switching keyboard functionnality + various fixes --- config/.config/hypr/config/custom/user.conf | 5 + .../hypr/config/{ => default}/appearance.conf | 0 .../config/{ => default}/environment.conf | 3 +- .../{input-en.conf => default/input.conf} | 17 +- .../hypr/config/default/kb_layouts/fr.conf | 35 +++++ .../hypr/config/default/kb_layouts/us.conf | 33 ++++ .../{ => default}/monitors_default.conf | 0 .../hypr/config/{ => default}/plugins.conf | 0 config/.config/hypr/config/input-fr.conf | 148 ------------------ .../minimalist_mod.conf} | 0 config/.config/hypr/hyprland.conf | 25 ++- .../.config/hypr/scripts/change-kb-layout.sh | 33 ++++ config/.config/hypr/status/kb_layout | 1 + config/.config/hypr/status/touchpad | 1 + packages/desktop.pkgs | 4 +- packages/laptop.pkgs | 3 + 16 files changed, 141 insertions(+), 167 deletions(-) create mode 100644 config/.config/hypr/config/custom/user.conf rename config/.config/hypr/config/{ => default}/appearance.conf (100%) rename config/.config/hypr/config/{ => default}/environment.conf (96%) rename config/.config/hypr/config/{input-en.conf => default/input.conf} (93%) create mode 100644 config/.config/hypr/config/default/kb_layouts/fr.conf create mode 100644 config/.config/hypr/config/default/kb_layouts/us.conf rename config/.config/hypr/config/{ => default}/monitors_default.conf (100%) rename config/.config/hypr/config/{ => default}/plugins.conf (100%) delete mode 100644 config/.config/hypr/config/input-fr.conf rename config/.config/hypr/config/{minimalist-mod.conf => mods/minimalist_mod.conf} (100%) create mode 100755 config/.config/hypr/scripts/change-kb-layout.sh create mode 100644 config/.config/hypr/status/kb_layout create mode 100644 config/.config/hypr/status/touchpad create mode 100644 packages/laptop.pkgs diff --git a/config/.config/hypr/config/custom/user.conf b/config/.config/hypr/config/custom/user.conf new file mode 100644 index 0000000..1b41f68 --- /dev/null +++ b/config/.config/hypr/config/custom/user.conf @@ -0,0 +1,5 @@ +################### +## USER SETTINGS ## +################### + +# This is meant to contain all user-defined settings (to not break all settings after updates) \ No newline at end of file diff --git a/config/.config/hypr/config/appearance.conf b/config/.config/hypr/config/default/appearance.conf similarity index 100% rename from config/.config/hypr/config/appearance.conf rename to config/.config/hypr/config/default/appearance.conf diff --git a/config/.config/hypr/config/environment.conf b/config/.config/hypr/config/default/environment.conf similarity index 96% rename from config/.config/hypr/config/environment.conf rename to config/.config/hypr/config/default/environment.conf index 1889195..fc79cac 100644 --- a/config/.config/hypr/config/environment.conf +++ b/config/.config/hypr/config/default/environment.conf @@ -6,8 +6,7 @@ # Set programs that you use $terminal = kitty -#$fileManager = cosmic-files -$fileManager = nautilus +$fileManager = cosmic-files $menu = albert toggle $notificationsManager = fnott diff --git a/config/.config/hypr/config/input-en.conf b/config/.config/hypr/config/default/input.conf similarity index 93% rename from config/.config/hypr/config/input-en.conf rename to config/.config/hypr/config/default/input.conf index 09a7df3..5f32978 100644 --- a/config/.config/hypr/config/input-en.conf +++ b/config/.config/hypr/config/default/input.conf @@ -2,15 +2,9 @@ ### INPUT ### ############# -### English configuration (not finished yet) - # https://wiki.hyprland.org/Configuring/Variables/#input input { - kb_layout = us - kb_variant = - kb_model = - kb_options = - kb_rules = + numlock_by_default = true follow_mouse = 1 @@ -57,7 +51,7 @@ bind = $mainMod SHIFT, M, exit, # Exit desktop session # Shortcuts bind = $mainMod, RETURN, exec, $terminal -bind = $mainMod, SPACE, exec, $terminal +bind = $mainMod, SPACE, exec, $menu bind = $mainMod, E, exec, $fileManager bindel = , XF86Launch1, exec, kitty vim ~/.config/hypr/config @@ -146,5 +140,10 @@ bind = , Print, exec, ~/.config/hypr/scripts/screenshot.sh ### CONTROL keys, this is why there are present here bind = SUPER CONTROL, XF86TouchpadToggle, exec, ~/.config/hypr/scripts/toggle-touchpad.sh -## Overview +## 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 +bind = $mainMod CONTROL, SPACE, exec, ~/.config/hypr/scripts/change-kb-layout.sh + +## Testing #bind = $mainMod, TAB, overview:toggle, toggle diff --git a/config/.config/hypr/config/default/kb_layouts/fr.conf b/config/.config/hypr/config/default/kb_layouts/fr.conf new file mode 100644 index 0000000..89133a9 --- /dev/null +++ b/config/.config/hypr/config/default/kb_layouts/fr.conf @@ -0,0 +1,35 @@ +## Overrides inputs for AZERTY layout + +input { + kb_layout = fr + kb_variant = + kb_model = + kb_options = + kb_rules = +} + +## Keybindings + +## Switch workspaces with mainMod + [0-9] +bind = $mainMod, ampersand, workspace, 1 +bind = $mainMod, eacute, workspace, 2 +bind = $mainMod, quotedbl, workspace, 3 +bind = $mainMod, apostrophe, workspace, 4 +bind = $mainMod, parenleft, workspace, 5 +bind = $mainMod, minus, workspace, 6 +bind = $mainMod, egrave, workspace, 7 +bind = $mainMod, underscore, workspace, 8 +bind = $mainMod, ccedilla, workspace, 9 +bind = $mainMod, agrave, workspace, 10 + +## Move active window to a workspace with mainMod + SHIFT + [0-9] +bind = $mainMod SHIFT, ampersand, movetoworkspace, 1 +bind = $mainMod SHIFT, eacute, movetoworkspace, 2 +bind = $mainMod SHIFT, quotedbl, movetoworkspace, 3 +bind = $mainMod SHIFT, apostrophe, movetoworkspace, 4 +bind = $mainMod SHIFT, parenleft, movetoworkspace, 5 +bind = $mainMod SHIFT, minus, movetoworkspace, 6 +bind = $mainMod SHIFT, egrave, movetoworkspace, 7 +bind = $mainMod SHIFT, underscore, movetoworkspace, 8 +bind = $mainMod SHIFT, ccedilla, movetoworkspace, 9 +bind = $mainMod SHIFT, agrave, movetoworkspace, 10 \ No newline at end of file diff --git a/config/.config/hypr/config/default/kb_layouts/us.conf b/config/.config/hypr/config/default/kb_layouts/us.conf new file mode 100644 index 0000000..2f6a2e5 --- /dev/null +++ b/config/.config/hypr/config/default/kb_layouts/us.conf @@ -0,0 +1,33 @@ +## Overrides inputs for QWERTY layout + +input { + kb_layout = us + kb_variant = + kb_model = + kb_options = + kb_rules = +} + +# Switch workspaces with mainMod + [0-9] +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, workspace, 10 + +# Move active window to a workspace with mainMod + SHIFT + [0-9] +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +bind = $mainMod SHIFT, 0, movetoworkspace, 10 \ No newline at end of file diff --git a/config/.config/hypr/config/monitors_default.conf b/config/.config/hypr/config/default/monitors_default.conf similarity index 100% rename from config/.config/hypr/config/monitors_default.conf rename to config/.config/hypr/config/default/monitors_default.conf diff --git a/config/.config/hypr/config/plugins.conf b/config/.config/hypr/config/default/plugins.conf similarity index 100% rename from config/.config/hypr/config/plugins.conf rename to config/.config/hypr/config/default/plugins.conf diff --git a/config/.config/hypr/config/input-fr.conf b/config/.config/hypr/config/input-fr.conf deleted file mode 100644 index 72d48d9..0000000 --- a/config/.config/hypr/config/input-fr.conf +++ /dev/null @@ -1,148 +0,0 @@ -############# -### INPUT ### -############# - -# https://wiki.hyprland.org/Configuring/Variables/#input -input { - kb_layout = fr - kb_variant = - kb_model = - kb_options = - kb_rules = - numlock_by_default = true - - follow_mouse = 1 - - sensitivity = 0.1 # -1.0 - 1.0, 0 means no modification. - - touchpad { - natural_scroll = true - disable_while_typing = false - } -} - -# https://wiki.hyprland.org/Configuring/Variables/#gestures -gestures { - workspace_swipe = true -} - -# Example per-device config -# See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more -device { - name = epic-mouse-v1 - sensitivity = -0.5 -} - - -################### -### KEYBINDINGS ### -################### - -# See https://wiki.hyprland.org/Configuring/Keywords/ -$mainMod = SUPER # Sets "Windows" key as main modifier - -# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more - -# Main desktop controls -bind = $mainMod, Q, killactive, -bind = $mainMod, R, exec, $menu # Omnibar -bind = $mainMod, D, exec, $menu # Legacy menu shortcut -bind = $mainMod, L, exec, hyprlock # Lockscreen -bind = $mainMod, B, exec, ~/.config/hypr/scripts/toggle-waybar.sh # Toggle sidebar -bind = $mainMod SHIFT, R, exec, ~/.config/hypr/scripts/reload.sh # Reload desktop -bind = $mainMod, F11, exec, ~/.config/hypr/scripts/gamemode.sh # Gamemode -bind = $mainMod SHIFT, M, exit, # Exit desktop session - -# Shortcuts -bind = $mainMod, RETURN, exec, $terminal -bind = $mainMod, SPACE, exec, $terminal -bind = $mainMod, E, exec, $fileManager -bindel = , XF86Launch1, exec, kitty vim ~/.config/hypr/config - -# Move focus with mainMod + arrow keys -bind = $mainMod, left, movefocus, l -bind = $mainMod, right, movefocus, r -bind = $mainMod, up, movefocus, u -bind = $mainMod, down, movefocus, d - -# Layout -bind = $mainMod, F, fullscreen, -bind = $mainMod, V, togglesplit, # Horizontal/vertical split -bind = $mainMod, T, togglefloating, -bind = $mainMod, H, pseudo, # Toggle pseudo-tiling - -# Switch workspaces with mainMod + [0-9] -bind = $mainMod, ampersand, workspace, 1 -bind = $mainMod, eacute, workspace, 2 -bind = $mainMod, quotedbl, workspace, 3 -bind = $mainMod, apostrophe, workspace, 4 -bind = $mainMod, parenleft, workspace, 5 -bind = $mainMod, minus, workspace, 6 -bind = $mainMod, egrave, workspace, 7 -bind = $mainMod, underscore, workspace, 8 -bind = $mainMod, ccedilla, workspace, 9 -bind = $mainMod, agrave, workspace, 10 - -# Move active window to a workspace with mainMod + SHIFT + [0-9] -bind = $mainMod SHIFT, ampersand, movetoworkspace, 1 -bind = $mainMod SHIFT, eacute, movetoworkspace, 2 -bind = $mainMod SHIFT, quotedbl, movetoworkspace, 3 -bind = $mainMod SHIFT, apostrophe, movetoworkspace, 4 -bind = $mainMod SHIFT, parenleft, movetoworkspace, 5 -bind = $mainMod SHIFT, minus, movetoworkspace, 6 -bind = $mainMod SHIFT, egrave, movetoworkspace, 7 -bind = $mainMod SHIFT, underscore, movetoworkspace, 8 -bind = $mainMod SHIFT, ccedilla, movetoworkspace, 9 -bind = $mainMod SHIFT, agrave, movetoworkspace, 10 - -# Example special workspace (scratchpad) -bind = $mainMod, S, togglespecialworkspace, magic -bind = $mainMod SHIFT, S, movetoworkspace, special:magic - -# Minimize function (uses scratchpad) -# For testing, may be removed in future releases -bind = $mainMod, N, togglespecialworkspace, magic -bind = $mainMod, N, movetoworkspace, +0 -bind = $mainMod, N, togglespecialworkspace, magic -bind = $mainMod, N, movetoworkspace, special:magic -bind = $mainMod, N, togglespecialworkspace, magic - -# Scroll through existing workspaces with mainMod + scroll -bind = $mainMod, mouse_down, workspace, e+1 -bind = $mainMod, mouse_up, workspace, e-1 - -# Move/resize windows with mainMod + LMB/RMB and dragging -bindm = $mainMod, mouse:272, movewindow -bindm = $mainMod, mouse:273, resizewindow - - -# Function keys - -## Volume -bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ -bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- -bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle -bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle - -## Brightness -bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 5%+ -bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 5%- -bindel = SHIFT, XF86MonBrightnessUp, exec, brightnessctl s 1%+ -bindel = SHIFT, XF86MonBrightnessDown, exec, brightnessctl s 1%- - -## Player controls -bindl = , XF86AudioNext, exec, playerctl next -bindl = , XF86AudioPause, exec, playerctl play-pause -bindl = , XF86AudioPlay, exec, playerctl play-pause -bindl = , XF86AudioPrev, exec, playerctl previous - -## Screenshot -bind = , Print, exec, ~/.config/hypr/scripts/screenshot.sh - -## Touchpad toggle -### On galaxy books, pressing the disable touchpad key also triggers SUPER and -### CONTROL keys, this is why there are present here -bind = SUPER CONTROL, XF86TouchpadToggle, exec, ~/.config/hypr/scripts/toggle-touchpad.sh - -## Testing -#bind = $mainMod, TAB, overview:toggle, toggle diff --git a/config/.config/hypr/config/minimalist-mod.conf b/config/.config/hypr/config/mods/minimalist_mod.conf similarity index 100% rename from config/.config/hypr/config/minimalist-mod.conf rename to config/.config/hypr/config/mods/minimalist_mod.conf diff --git a/config/.config/hypr/hyprland.conf b/config/.config/hypr/hyprland.conf index 11f8322..1f4ee32 100644 --- a/config/.config/hypr/hyprland.conf +++ b/config/.config/hypr/hyprland.conf @@ -5,10 +5,21 @@ # Please note not all available settings / options are set here. # For a full list, see the wiki -#source = ~/.config/hypr/config/monitors_default.conf -source = ~/.config/hypr/config/monitors.conf -source = ~/.config/hypr/config/environment.conf -source = ~/.config/hypr/config/input-fr.conf -source = ~/.config/hypr/config/appearance.conf -source = ~/.config/hypr/config/plugins.conf -#source = ~/.config/hypr/config/minimalist-mod.conf +# If you want to modify some settings, go to ./config/custom/user.conf and add them +# They'll automatically override the default ones + +# Default settings +source = ~/.config/hypr/config/default/monitors.conf +source = ~/.config/hypr/config/default/environment.conf +source = ~/.config/hypr/config/default/input.conf +source = ~/.config/hypr/config/default/kb_layouts/fr.conf +source = ~/.config/hypr/config/default/appearance.conf + +# Hyprland plugins +# source = ~/.config/hypr/config/default/plugins.conf + +# Desktop mods +#source = ~/.config/hypr/config/default/minimalist_mod.conf + +# Custom settings +source = ~/.config/hypr/config/custom/user.conf diff --git a/config/.config/hypr/scripts/change-kb-layout.sh b/config/.config/hypr/scripts/change-kb-layout.sh new file mode 100755 index 0000000..5509aa7 --- /dev/null +++ b/config/.config/hypr/scripts/change-kb-layout.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +status_file="$HOME/.config/hypr/status/kb_layout" +hyprland_cfg_file="$HOME/.config/hypr/hyprland.conf" + + +fr_to_en() { + printf "en" > "${status_file}" + + hyprctl notify 1 2000 0 "Keyboard set to QWERTY" + + sed -i 's/kb_layouts\/fr/kb_layouts\/us/g' "$hyprland_cfg_file" +} + +en_to_fr() { + printf "fr" > "${status_file}" + + hyprctl notify 1 2000 0 "Keyboard set to AZERTY" + + sed -i 's/kb_layouts\/us/kb_layouts\/fr/g' "$hyprland_cfg_file" +} + +if ! [ -f "${status_file}" ]; then + hyprctl notify 3 3000 0 "Status file missing" + hyprctl notify 2 6000 0 "Use Mod + Ctrl + Space to change keyboard layout" + en_to_fr +else + if [ $(cat "${status_file}") = "fr" ]; then + fr_to_en + elif [ $(cat "${status_file}") = "en" ]; then + en_to_fr + fi +fi \ No newline at end of file diff --git a/config/.config/hypr/status/kb_layout b/config/.config/hypr/status/kb_layout new file mode 100644 index 0000000..717280a --- /dev/null +++ b/config/.config/hypr/status/kb_layout @@ -0,0 +1 @@ +fr \ No newline at end of file diff --git a/config/.config/hypr/status/touchpad b/config/.config/hypr/status/touchpad new file mode 100644 index 0000000..e8fd903 --- /dev/null +++ b/config/.config/hypr/status/touchpad @@ -0,0 +1 @@ +on \ No newline at end of file diff --git a/packages/desktop.pkgs b/packages/desktop.pkgs index 7b5f36a..9629dd7 100644 --- a/packages/desktop.pkgs +++ b/packages/desktop.pkgs @@ -13,4 +13,6 @@ xdg-desktop-portal-hyprland waybar power-profiles-daemon fnott -kitty \ No newline at end of file +kitty +grim +slurp \ No newline at end of file diff --git a/packages/laptop.pkgs b/packages/laptop.pkgs new file mode 100644 index 0000000..bd0e936 --- /dev/null +++ b/packages/laptop.pkgs @@ -0,0 +1,3 @@ +bluez +bluez-utils +blueman \ No newline at end of file