From 00e4931d29b4f750cabfbb7b9ee8b4e6537686c3 Mon Sep 17 00:00:00 2001 From: Mathias Date: Mon, 12 Oct 2026 11:40:05 +0100 Subject: [PATCH] some tweaks --- hypr/.config/hypr/modules/keybinds.lua | 125 ++++++++++----------- hypr/.config/hypr/modules/variables.lua | 3 +- hypr/.config/hypr/scripts/show-keybinds.sh | 31 ++--- 3 files changed, 77 insertions(+), 82 deletions(-) diff --git a/hypr/.config/hypr/modules/keybinds.lua b/hypr/.config/hypr/modules/keybinds.lua index e66c0c6..d6cd22d 100644 --- a/hypr/.config/hypr/modules/keybinds.lua +++ b/hypr/.config/hypr/modules/keybinds.lua @@ -9,135 +9,128 @@ local exec = reg.exec -- See https://wiki.hypr.land/Configuring/Keywords/ -- Example binds, see https://wiki.hypr.land/Configuring/Binds/ for more -bind(var.mainMod .. " + RETURN", exec(var.terminal), { description = "Open terminal (kitty)" }) -bind(var.mainMod .. " + ALT + RETURN", exec(var.terminal_tmux), { description = "Open terminal (kitty)" }) +bind(var.mainMod .. " + RETURN", exec(var.terminal), { description = "Open terminal" }) +bind(var.mainMod .. " + ALT + RETURN", exec(var.terminal_tmux), { description = "Open tmux in terminal" }) bind(var.mainMod .. " + Q", hl.dsp.window.close(), { description = "Close focused window" }) bind( var.mainMod .. " + ESCAPE", exec(command.session), { description = "Session menu (logout/reboot/shutdown)" } ) -bind(var.mainMod .. " + SHIFT + ESCAPE", exec(command.logout), { description = "Exit Hyprland" }) -bind(var.mainMod .. " + CTRL + ESCAPE", exec(command.shutdown), { description = "Power off the system" }) -bind(var.mainMod .. " + ALT + ESCAPE", exec(command.reboot), { description = "Reboot the system" }) -bind(var.mainMod .. " + E", exec(var.fileManager), { description = "Open file manager (dolphin)" }) -bind(var.mainMod .. " + V", hl.dsp.window.float({ action = "toggle" }), { description = "Toggle floating window" }) +bind(var.mainMod .. " + SHIFT + ESCAPE", exec(command.logout), { description = "Session: logout" }) +bind(var.mainMod .. " + CTRL + ESCAPE", exec(command.shutdown), { description = "Session: power off" }) +bind(var.mainMod .. " + ALT + ESCAPE", exec(command.reboot), { description = "Session: reboot" }) +bind(var.mainMod .. " + E", exec(var.fileManager), { description = "Open file manager" }) +bind(var.mainMod .. " + V", hl.dsp.window.float({ action = "toggle" }), { description = "Floating window toggle" }) bind(var.mainMod .. " + SPACE", exec(command.menu), { description = "Open app launcher" }) -bind(var.mainMod .. " + P", hl.dsp.window.pseudo(), { description = "Toggle pseudo-tiling" }) -bind(var.mainMod .. " + SHIFT + J", hl.dsp.layout("togglesplit"), { description = "Toggle split layout" }) -bind(var.mainMod .. " + I", exec("firefox &"), { description = "Open Firefox" }) -bind(var.mainMod .. " + n", exec("nm-connection-editor"), { description = "Network manager" }) -bind(var.mainMod .. " + comma", exec(command.settings), { description = "settings menu" }) -bind(var.mainMod .. " + S", exec(command.control_center), { description = "Control center" }) +bind(var.mainMod .. " + P", hl.dsp.window.pseudo(), { description = "Pseudo-tiling toggle" }) +bind(var.mainMod .. " + SHIFT + J", hl.dsp.layout("togglesplit"), { description = "Split layout toggle" }) +bind(var.mainMod .. " + I", exec(var.internet_explorer), { description = "Open internet explorer" }) +bind(var.mainMod .. " + n", exec("nm-connection-editor"), { description = "Open network manager" }) +bind(var.mainMod .. " + comma", exec(command.settings), { description = "Open settings" }) +bind(var.mainMod .. " + S", exec(command.control_center), { description = "Open start menu" }) +bind(var.mainMod .. " + ALT + H", exec("hyprmod"), {description = "Open Hyprland config GUI"}) -- Move focus with mainMod or Vim-style -bind(var.mainMod .. " + CTRL + h", hl.dsp.focus({ direction = "left" }), { description = "Focus window left" }) -bind(var.mainMod .. " + CTRL + l", hl.dsp.focus({ direction = "right" }), { description = "Focus window right" }) -bind(var.mainMod .. " + CTRL + k", hl.dsp.focus({ direction = "up" }), { description = "Focus window up" }) -bind(var.mainMod .. " + CTRL + j", hl.dsp.focus({ direction = "down" }), { description = "Focus window down" }) +bind(var.mainMod .. " + CTRL + h", hl.dsp.focus({ direction = "left" }), { description = "Window: focus left" }) +bind(var.mainMod .. " + CTRL + l", hl.dsp.focus({ direction = "right" }), { description = "Window: focus right" }) +bind(var.mainMod .. " + CTRL + k", hl.dsp.focus({ direction = "up" }), { description = "Window: focus up" }) +bind(var.mainMod .. " + CTRL + j", hl.dsp.focus({ direction = "down" }), { description = "Window: focus down" }) -- Move windows with mainMod or Vim-style -bind(var.mainMod .. " + SHIFT + h", hl.dsp.window.move({ direction = "left" }), { description = "Move window left" }) +bind(var.mainMod .. " + SHIFT + h", hl.dsp.window.move({ direction = "left" }), { description = "Window: move left" }) bind( var.mainMod .. " + SHIFT + l", hl.dsp.window.move({ direction = "right" }), - { description = "Move window right" } + { description = "Window: move right" } ) -bind(var.mainMod .. " + SHIFT + k", hl.dsp.window.move({ direction = "up" }), { description = "Move window up" }) -bind(var.mainMod .. " + SHIFT + j", hl.dsp.window.move({ direction = "down" }), { description = "Move window down" }) +bind(var.mainMod .. " + SHIFT + k", hl.dsp.window.move({ direction = "up" }), { description = "Window: move up" }) +bind(var.mainMod .. " + SHIFT + j", hl.dsp.window.move({ direction = "down" }), { description = "Window: move down" }) -- Resize focused window with mainMod + Arrows bind( var.mainMod .. " + left", hl.dsp.window.resize({ x = -10, y = 0, relative = true }), - { description = "Resize window left" } + { description = "Window: resize left" } ) bind( var.mainMod .. " + right", hl.dsp.window.resize({ x = 10, y = 0, relative = true }), - { description = "Resize window right" } + { description = "Window: resize right" } ) bind( var.mainMod .. " + up", hl.dsp.window.resize({ x = 0, y = -10, relative = true }), - { description = "Resize window up" } + { description = "Window: resize up" } ) bind( var.mainMod .. " + down", hl.dsp.window.resize({ x = 0, y = 10, relative = true }), - { description = "Resize window down" } + { description = "Window: resize down" } ) -- Switch workspaces with mainMod + [0-9] -bind(var.mainMod .. " + 1", hl.dsp.focus({ workspace = 1 }), { description = "Switch to workspace 1" }) -bind(var.mainMod .. " + 2", hl.dsp.focus({ workspace = 2 }), { description = "Switch to workspace 2" }) -bind(var.mainMod .. " + 3", hl.dsp.focus({ workspace = 3 }), { description = "Switch to workspace 3" }) -bind(var.mainMod .. " + 4", hl.dsp.focus({ workspace = 4 }), { description = "Switch to workspace 4" }) -bind(var.mainMod .. " + 5", hl.dsp.focus({ workspace = 5 }), { description = "Switch to workspace 5" }) -bind(var.mainMod .. " + 6", hl.dsp.focus({ workspace = 6 }), { description = "Switch to workspace 6" }) -bind(var.mainMod .. " + 7", hl.dsp.focus({ workspace = 7 }), { description = "Switch to workspace 7" }) -bind(var.mainMod .. " + 8", hl.dsp.focus({ workspace = 8 }), { description = "Switch to workspace 8" }) -bind(var.mainMod .. " + 9", hl.dsp.focus({ workspace = 9 }), { description = "Switch to workspace 9" }) -bind(var.mainMod .. " + 0", hl.dsp.focus({ workspace = 10 }), { description = "Switch to workspace 10" }) -bind("XF86AudioRaiseVolume", exec("wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"), { - repeating = true, - description = "Volume up", -}) -bind("XF86AudioLowerVolume", exec("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), { - locked = true, - description = "Volume down", -}) +bind(var.mainMod .. " + 1", hl.dsp.focus({ workspace = 1 }), { description = "Workspace: switch to 1" }) +bind(var.mainMod .. " + 2", hl.dsp.focus({ workspace = 2 }), { description = "Workspace: Switch to 2" }) +bind(var.mainMod .. " + 3", hl.dsp.focus({ workspace = 3 }), { description = "Workspace: Switch to 3" }) +bind(var.mainMod .. " + 4", hl.dsp.focus({ workspace = 4 }), { description = "Workspace: Switch to 4" }) +bind(var.mainMod .. " + 5", hl.dsp.focus({ workspace = 5 }), { description = "Workspace: Switch to 5" }) +bind(var.mainMod .. " + 6", hl.dsp.focus({ workspace = 6 }), { description = "Workspace: Switch to 6" }) +bind(var.mainMod .. " + 7", hl.dsp.focus({ workspace = 7 }), { description = "Workspace: Switch to 7" }) +bind(var.mainMod .. " + 8", hl.dsp.focus({ workspace = 8 }), { description = "Workspace: Switch to 8" }) +bind(var.mainMod .. " + 9", hl.dsp.focus({ workspace = 9 }), { description = "Workspace: Switch to 9" }) +bind(var.mainMod .. " + 0", hl.dsp.focus({ workspace = 10 }), { description = "Workspace: Switch to 10" }) -- Move active window to a workspace with mainMod + SHIFT + [0-9] bind( var.mainMod .. " + SHIFT + 1", hl.dsp.window.move({ workspace = 1 }), - { description = "Move window to workspace 1" } + { description = "Window: move to workspace 1" } ) bind( var.mainMod .. " + SHIFT + 2", hl.dsp.window.move({ workspace = 2 }), - { description = "Move window to workspace 2" } + { description = "Window: move to workspace 2" } ) bind( var.mainMod .. " + SHIFT + 3", hl.dsp.window.move({ workspace = 3 }), - { description = "Move window to workspace 3" } + { description = "Window: move to workspace 3" } ) bind( var.mainMod .. " + SHIFT + 4", hl.dsp.window.move({ workspace = 4 }), - { description = "Move window to workspace 4" } + { description = "Window: move to workspace 4" } ) bind( var.mainMod .. " + SHIFT + 5", hl.dsp.window.move({ workspace = 5 }), - { description = "Move window to workspace 5" } + { description = "Window: move to workspace 5" } ) bind( var.mainMod .. " + SHIFT + 6", hl.dsp.window.move({ workspace = 6 }), - { description = "Move window to workspace 6" } + { description = "Window: move to workspace 6" } ) bind( var.mainMod .. " + SHIFT + 7", hl.dsp.window.move({ workspace = 7 }), - { description = "Move window to workspace 7" } + { description = "Window: move to workspace 7" } ) bind( var.mainMod .. " + SHIFT + 8", hl.dsp.window.move({ workspace = 8 }), - { description = "Move window to workspace 8" } + { description = "Window: move to workspace 8" } ) bind( var.mainMod .. " + SHIFT + 9", hl.dsp.window.move({ workspace = 9 }), - { description = "Move window to workspace 9" } + { description = "Window: move to workspace 9" } ) bind( var.mainMod .. " + SHIFT + 0", hl.dsp.window.move({ workspace = 10 }), - { description = "Move window to workspace 10" } + { description = "Window: move to workspace 10" } ) -- # Example special workspace (scratchpad) @@ -150,44 +143,44 @@ bind( bind( var.mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }), - { description = "Next workspace (scroll down)" } + { description = "Workspace: next (scroll down)" } ) bind( var.mainMod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" }), - { description = "Previous workspace (scroll up)" } + { description = "Workspace: previous (scroll up)" } ) -- Move/resize windows with mainMod + LMB/RMB and dragging bind(var.mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true, - description = "Move window with mouse", + description = "Window: move with mouse", }) bind(var.mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true, - description = "Resize window with mouse", + description = "Window: resize with mouse", }) -- Laptop multimedia keys for volume and LCD brightness bind("XF86AudioRaiseVolume", exec("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), { repeating = true, locked = true, - description = "Volume up (repeat)", + description = "Media: volume up (repeat)", }) bind("XF86AudioLowerVolume", exec("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), { repeating = true, locked = true, - description = "Volume down (repeat)", + description = "Media: volume down (repeat)", }) bind("XF86AudioMute", exec("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { repeating = true, locked = true, - description = "Mute audio", + description = "Media: mute audio", }) bind("XF86AudioMicMute", exec("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { repeating = true, locked = true, - description = "Mute microphone", + description = "Media: mute microphone", }) bind("XF86MonBrightnessUp", exec("brightnessctl -e4 -n2 set 5%+"), { repeating = true, @@ -203,19 +196,19 @@ bind("XF86MonBrightnessDown", exec("brightnessctl -e4 -n2 set 5%-"), { -- Requires playerctl bind("XF86AudioNext", exec("playerctl next"), { locked = true, - description = "Next track", + description = "Media: next track", }) bind("XF86AudioPause", exec("playerctl play-pause"), { locked = true, - description = "Play/Pause", + description = "Media: play/pause", }) bind("XF86AudioPlay", exec("playerctl play-pause"), { locked = true, - description = "Play/Pause", + description = "Media: play/pause", }) bind("XF86AudioPrev", exec("playerctl previous"), { locked = true, - description = "Previous track", + description = "Media: previous track", }) -- Screenshots @@ -233,7 +226,7 @@ bind("SHIFT + PRINT", exec("hyprshot -m active --output-folder " .. var.screensh }) bind(var.mainMod .. " + L", exec(command.lock), { locked = true, description = "Lock screen" }) -bind(var.mainMod .. " + K", exec(command.keybinds_show), { description = "Show keybind overview" }) +bind(var.mainMod .. " + K", exec(command.keybinds_show), { description = "Keybinds: show overview" }) bind(var.mainMod .. " + W", exec(command.wallpaper_select), { description = "Wallpaper select" }) -- Caelestia extras diff --git a/hypr/.config/hypr/modules/variables.lua b/hypr/.config/hypr/modules/variables.lua index 96e7897..5b79135 100644 --- a/hypr/.config/hypr/modules/variables.lua +++ b/hypr/.config/hypr/modules/variables.lua @@ -18,6 +18,7 @@ return { mainMod = "SUPER", terminal = terminal, terminal_tmux = terminal .. " -e tmux", - fileManager = "dolphin", + fileManager = terminal .. " -e yazi"; -- "dolphin", screenshot_folder = "~/Bilder/Screenshots/", + internet_explorer = "firefox" } diff --git a/hypr/.config/hypr/scripts/show-keybinds.sh b/hypr/.config/hypr/scripts/show-keybinds.sh index 1d8039a..1f419be 100755 --- a/hypr/.config/hypr/scripts/show-keybinds.sh +++ b/hypr/.config/hypr/scripts/show-keybinds.sh @@ -42,16 +42,16 @@ if [[ "${1:-}" == "--internal-pick" ]]; then rc=0 sel="$(fzf --delimiter "$SEP" --with-nth 2.. --cycle --info=inline \ --prompt 'keybinds> ' --header 'type to filter · Enter executes · Esc closes' \ - < "$pick_file")" || rc=$? + <"$pick_file")" || rc=$? rm -f "$pick_file" - if (( rc != 0 )) || [[ -z "$sel" ]]; then + if ((rc != 0)) || [[ -z "$sel" ]]; then exit 0 fi cmd="${sel%%"$SEP"*}" if [[ -n "$cmd" ]]; then # Detach into its own session so the command outlives the picker # window (kitty/pty teardown would otherwise signal its process group). - setsid -f sh -c "$cmd" >/dev/null 2>&1 < /dev/null + setsid -f sh -c "$cmd" >/dev/null 2>&1 /dev/null 2>&1; then +if ((! have_sidecar)) && ! hyprctl binds -j >/dev/null 2>&1; then echo "show-keybinds: nothing to show: no keybind registry ($SIDECAR) and no Hyprland session" >&2 exit 1 fi @@ -74,7 +74,7 @@ rows=() cmds=() keys=() -if (( have_sidecar )); then +if ((have_sidecar)); then while IFS="$SEP" read -r key description cmd; do key="${key//mouse:272/LMB}" key="${key//mouse:273/RMB}" @@ -84,21 +84,21 @@ if (( have_sidecar )); then rows+=("$(printf '%-26s %s' "$key" "$description")") cmds+=("$cmd") keys+=("$key") - done < "$SIDECAR" + done <"$SIDECAR" else while IFS="$SEP" read -r modmask key description submap; do case "$key" in - mouse:272) key="LMB" ;; - mouse:273) key="RMB" ;; + mouse:272) key="LMB" ;; + mouse:273) key="RMB" ;; esac chord="" # Rebuild "SUPER + SHIFT + Q" from the modmask bits. i=0 - while (( i < ${#MOD_ORDER[@]} )); do + while ((i < ${#MOD_ORDER[@]})); do bit=${MOD_ORDER[i]} name=${MOD_ORDER[i + 1]} - if (( modmask & bit )); then + if ((modmask & bit)); then chord+="${name} + " fi i=$((i + 2)) @@ -119,7 +119,7 @@ else done < <(hyprctl binds -j | jq -r '.[] | [(.modmask | tostring), .key, .description, .submap] | join("\u001f")') fi -if (( ${#rows[@]} == 0 )); then +if ((${#rows[@]} == 0)); then echo "show-keybinds: no keybinds found." >&2 exit 1 fi @@ -135,7 +135,7 @@ for i in "${!rows[@]}"; do lines+=("${cmds[$i]}$SEP${rows[$i]}") fi done -mapfile -t lines < <(printf '%s\n' "${lines[@]}" | LC_ALL=C sort -f -t "$SEP" -k2) +mapfile -t lines < <(printf '%s\n' "${lines[@]}" | LC_ALL=C sort -f -t "$SEP" -k2.29,2) if [[ "${1:-}" == "--print" ]]; then printf '%s\n' "${lines[@]}" | cut -d "$SEP" -f2- @@ -149,13 +149,14 @@ fi # --------------------------------------------------------------------------- rm -f /tmp/keybinds.??????.list 2>/dev/null || true list="$(mktemp /tmp/keybinds.XXXXXX.list)" -printf '%s\n' "${lines[@]}" > "$list" +printf '%s\n' "${lines[@]}" >"$list" if command -v kitty >/dev/null 2>&1; then - kitty --class keybinds --title Keybinds "$0" --internal-pick "$list" + kitty --override font_size=16 --class keybinds --title Keybinds "$0" \ + --internal-pick "$list" exit 0 fi # No kitty: fall back to a plain printout. printf '%s\n' "${lines[@]}" | cut -d "$SEP" -f2- -rm -f "$list" \ No newline at end of file +rm -f "$list"