From aaaf37e85c1c9302cb9bc475049daf62c41b1f9b Mon Sep 17 00:00:00 2001 From: Jelle Teijema Date: Fri, 25 Jul 2025 14:51:53 +0200 Subject: Add plex to waybar icons --- config/waybar/ModulesWorkspaces | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/waybar/ModulesWorkspaces b/config/waybar/ModulesWorkspaces index 283d6449..f267856d 100644 --- a/config/waybar/ModulesWorkspaces +++ b/config/waybar/ModulesWorkspaces @@ -226,6 +226,7 @@ "class": "󰕼 ", "title<.*cmus.*>": " ", "class<[Ss]potify>": " ", + "class": "󰚺 ", "class": " ", "class<.virt-manager-wrapped>": " ", @@ -264,4 +265,4 @@ "class": "󰹛", } }, -} \ No newline at end of file +} -- cgit v1.2.3 From 2d4daaba06699b1e1975b734a186cb6701d74c6d Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sat, 26 Jul 2025 08:28:57 +0900 Subject: added ags in refresh.sh and refreshnowaybar.sh --- config/hypr/scripts/Refresh.sh | 3 +++ config/hypr/scripts/RefreshNoWaybar.sh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/config/hypr/scripts/Refresh.sh b/config/hypr/scripts/Refresh.sh index d04570b1..719c368d 100755 --- a/config/hypr/scripts/Refresh.sh +++ b/config/hypr/scripts/Refresh.sh @@ -25,6 +25,9 @@ done # added since wallust sometimes not applying killall -SIGUSR2 waybar +# quit ags & relaunch ags +#ags -q && ags & + # quit quickshell & relaunch quickshell #pkill qs && qs & diff --git a/config/hypr/scripts/RefreshNoWaybar.sh b/config/hypr/scripts/RefreshNoWaybar.sh index cdbb82db..b8279047 100755 --- a/config/hypr/scripts/RefreshNoWaybar.sh +++ b/config/hypr/scripts/RefreshNoWaybar.sh @@ -25,6 +25,9 @@ for _prs in "${_ps[@]}"; do fi done +# quit ags & relaunch ags +#ags -q && ags & + # quit ags & relaunch ags #pkill qs && qs & -- cgit v1.2.3 From 00cd3523e410ae8d1f106ae7df1a7a379a5b286f Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sat, 26 Jul 2025 08:32:07 +0900 Subject: implemented sddm wallpaper v2 --- config/hypr/scripts/sddm_wallpaper-v2.sh | 76 -------------------------------- config/hypr/scripts/sddm_wallpaper.sh | 44 +++++++++++++----- 2 files changed, 32 insertions(+), 88 deletions(-) delete mode 100644 config/hypr/scripts/sddm_wallpaper-v2.sh diff --git a/config/hypr/scripts/sddm_wallpaper-v2.sh b/config/hypr/scripts/sddm_wallpaper-v2.sh deleted file mode 100644 index a781156e..00000000 --- a/config/hypr/scripts/sddm_wallpaper-v2.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ -# SDDM Wallpaper and Wallust Colors Setter - -# for the upcoming changes on the simple_sddm_theme - -# variables -terminal=kitty -wallDIR="$HOME/Pictures/wallpapers" -SCRIPTSDIR="$HOME/.config/hypr/scripts" -wallpaper_current="$HOME/.config/hypr/wallpaper_effects/.wallpaper_current" -wallpaper_modified="$HOME/.config/hypr/wallpaper_effects/.wallpaper_modified" -sddm_simple="/usr/share/sddm/themes/simple_sddm_2" - -# rofi-wallust-sddm colors path -rofi_wallust="$HOME/.config/rofi/wallust/colors-rofi.rasi" -sddm_theme_conf="$sddm_simple/theme.conf" - -# Directory for swaync -iDIR="$HOME/.config/swaync/images" -iDIRi="$HOME/.config/swaync/icons" - -# Parse arguments -mode="effects" # default -if [[ "$1" == "--normal" ]]; then - mode="normal" -elif [[ "$1" == "--effects" ]]; then - mode="effects" -fi - -# Extract colors from rofi wallust config - -color0=$(grep -oP 'color1:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") -color1=$(grep -oP 'color0:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") -color7=$(grep -oP 'color14:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") -color10=$(grep -oP 'color10:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") -color12=$(grep -oP 'color12:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") -color13=$(grep -oP 'color13:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") -foreground=$(grep -oP 'foreground:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") -#background-color=$(grep -oP 'background:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") - -# wallpaper to use -if [[ "$mode" == "normal" ]]; then - wallpaper_path="$wallpaper_current" -else - wallpaper_path="$wallpaper_modified" -fi - -# Launch terminal and apply changes -$terminal -e bash -c " -echo 'Enter your password to update SDDM wallpapers and colors'; - -# Update the colors in the SDDM config -sudo sed -i \"s/HeaderTextColor=\\\"#.*\\\"/HeaderTextColor=\\\"$color13\\\"/\" \"$sddm_theme_conf\" -sudo sed -i \"s/DateTextColor=\\\"#.*\\\"/DateTextColor=\\\"$color13\\\"/\" \"$sddm_theme_conf\" -sudo sed -i \"s/TimeTextColor=\\\"#.*\\\"/TimeTextColor=\\\"$color13\\\"/\" \"$sddm_theme_conf\" -sudo sed -i \"s/DropdownSelectedBackgroundColor=\\\"#.*\\\"/DropdownSelectedBackgroundColor=\\\"$color13\\\"/\" \"$sddm_theme_conf\" -sudo sed -i \"s/SystemButtonsIconsColor=\\\"#.*\\\"/SystemButtonsIconsColor=\\\"$color13\\\"/\" \"$sddm_theme_conf\" -sudo sed -i \"s/SessionButtonTextColor=\\\"#.*\\\"/SessionButtonTextColor=\\\"$color13\\\"/\" \"$sddm_theme_conf\" -sudo sed -i \"s/VirtualKeyboardButtonTextColor=\\\"#.*\\\"/VirtualKeyboardButtonTextColor=\\\"$color13\\\"/\" \"$sddm_theme_conf\" -sudo sed -i \"s/HighlightBackgroundColor=\\\"#.*\\\"/HighlightBackgroundColor=\\\"$color12\\\"/\" \"$sddm_theme_conf\" -sudo sed -i \"s/LoginFieldTextColor=\\\"#.*\\\"/LoginFieldTextColor=\\\"$color12\\\"/\" \"$sddm_theme_conf\" -sudo sed -i \"s/PasswordFieldTextColor=\\\"#.*\\\"/PasswordFieldTextColor=\\\"$color12\\\"/\" \"$sddm_theme_conf\" - -sudo sed -i \"s/DropdownBackgroundColor=\\\"#.*\\\"/DropdownBackgroundColor=\\\"$color1\\\"/\" \"$sddm_theme_conf\" -sudo sed -i \"s/HighlightTextColor=\\\"#.*\\\"/HighlightTextColor=\\\"$color10\\\"/\" \"$sddm_theme_conf\" - -sudo sed -i \"s/PlaceholderTextColor=\\\"#.*\\\"/PlaceholderTextColor=\\\"$color7\\\"/\" \"$sddm_theme_conf\" -sudo sed -i \"s/UserIconColor=\\\"#.*\\\"/UserIconColor=\\\"$color7\\\"/\" \"$sddm_theme_conf\" -sudo sed -i \"s/PasswordIconColor=\\\"#.*\\\"/PasswordIconColor=\\\"$color7\\\"/\" \"$sddm_theme_conf\" - -# Copy wallpaper to SDDM theme -sudo cp \"$wallpaper_path\" \"$sddm_simple/Backgrounds/default\" - -notify-send -i \"$iDIR/ja.png\" \"SDDM\" \"Background SET\" -" \ No newline at end of file diff --git a/config/hypr/scripts/sddm_wallpaper.sh b/config/hypr/scripts/sddm_wallpaper.sh index fd385fcd..a781156e 100755 --- a/config/hypr/scripts/sddm_wallpaper.sh +++ b/config/hypr/scripts/sddm_wallpaper.sh @@ -2,6 +2,8 @@ # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ # SDDM Wallpaper and Wallust Colors Setter +# for the upcoming changes on the simple_sddm_theme + # variables terminal=kitty wallDIR="$HOME/Pictures/wallpapers" @@ -27,11 +29,15 @@ elif [[ "$1" == "--effects" ]]; then fi # Extract colors from rofi wallust config -main_color=$(grep -oP 'color13:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") -accent_color=$(grep -oP 'color12:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") -bg_color=$(grep -oP 'color0:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") -placeholder_color="$accent_color" -icon_color=$(grep -oP 'foreground:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") + +color0=$(grep -oP 'color1:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") +color1=$(grep -oP 'color0:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") +color7=$(grep -oP 'color14:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") +color10=$(grep -oP 'color10:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") +color12=$(grep -oP 'color12:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") +color13=$(grep -oP 'color13:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") +foreground=$(grep -oP 'foreground:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") +#background-color=$(grep -oP 'background:\s*\K#[A-Fa-f0-9]+' "$rofi_wallust") # wallpaper to use if [[ "$mode" == "normal" ]]; then @@ -43,14 +49,28 @@ fi # Launch terminal and apply changes $terminal -e bash -c " echo 'Enter your password to update SDDM wallpapers and colors'; -sudo sed -i \"s/MainColor=\\\"#.*\\\"/MainColor=\\\"$main_color\\\"/\" \"$sddm_theme_conf\" -sudo sed -i \"s/AccentColor=\\\"#.*\\\"/AccentColor=\\\"$accent_color\\\"/\" \"$sddm_theme_conf\" -sudo sed -i \"s/BackgroundColor=\\\"#.*\\\"/BackgroundColor=\\\"$bg_color\\\"/\" \"$sddm_theme_conf\" -sudo sed -i \"s/placeholderColor=\\\"#.*\\\"/placeholderColor=\\\"$placeholder_color\\\"/\" \"$sddm_theme_conf\" -sudo sed -i \"s/IconColor=\\\"#.*\\\"/IconColor=\\\"$icon_color\\\"/\" \"$sddm_theme_conf\" -# Copy wallpaper +# Update the colors in the SDDM config +sudo sed -i \"s/HeaderTextColor=\\\"#.*\\\"/HeaderTextColor=\\\"$color13\\\"/\" \"$sddm_theme_conf\" +sudo sed -i \"s/DateTextColor=\\\"#.*\\\"/DateTextColor=\\\"$color13\\\"/\" \"$sddm_theme_conf\" +sudo sed -i \"s/TimeTextColor=\\\"#.*\\\"/TimeTextColor=\\\"$color13\\\"/\" \"$sddm_theme_conf\" +sudo sed -i \"s/DropdownSelectedBackgroundColor=\\\"#.*\\\"/DropdownSelectedBackgroundColor=\\\"$color13\\\"/\" \"$sddm_theme_conf\" +sudo sed -i \"s/SystemButtonsIconsColor=\\\"#.*\\\"/SystemButtonsIconsColor=\\\"$color13\\\"/\" \"$sddm_theme_conf\" +sudo sed -i \"s/SessionButtonTextColor=\\\"#.*\\\"/SessionButtonTextColor=\\\"$color13\\\"/\" \"$sddm_theme_conf\" +sudo sed -i \"s/VirtualKeyboardButtonTextColor=\\\"#.*\\\"/VirtualKeyboardButtonTextColor=\\\"$color13\\\"/\" \"$sddm_theme_conf\" +sudo sed -i \"s/HighlightBackgroundColor=\\\"#.*\\\"/HighlightBackgroundColor=\\\"$color12\\\"/\" \"$sddm_theme_conf\" +sudo sed -i \"s/LoginFieldTextColor=\\\"#.*\\\"/LoginFieldTextColor=\\\"$color12\\\"/\" \"$sddm_theme_conf\" +sudo sed -i \"s/PasswordFieldTextColor=\\\"#.*\\\"/PasswordFieldTextColor=\\\"$color12\\\"/\" \"$sddm_theme_conf\" + +sudo sed -i \"s/DropdownBackgroundColor=\\\"#.*\\\"/DropdownBackgroundColor=\\\"$color1\\\"/\" \"$sddm_theme_conf\" +sudo sed -i \"s/HighlightTextColor=\\\"#.*\\\"/HighlightTextColor=\\\"$color10\\\"/\" \"$sddm_theme_conf\" + +sudo sed -i \"s/PlaceholderTextColor=\\\"#.*\\\"/PlaceholderTextColor=\\\"$color7\\\"/\" \"$sddm_theme_conf\" +sudo sed -i \"s/UserIconColor=\\\"#.*\\\"/UserIconColor=\\\"$color7\\\"/\" \"$sddm_theme_conf\" +sudo sed -i \"s/PasswordIconColor=\\\"#.*\\\"/PasswordIconColor=\\\"$color7\\\"/\" \"$sddm_theme_conf\" + +# Copy wallpaper to SDDM theme sudo cp \"$wallpaper_path\" \"$sddm_simple/Backgrounds/default\" notify-send -i \"$iDIR/ja.png\" \"SDDM\" \"Background SET\" -" +" \ No newline at end of file -- cgit v1.2.3 From 7e958b7fdfb233d7c0ebd56aaf1935b7e4c4cba2 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sat, 26 Jul 2025 09:49:25 +0900 Subject: updated follow mouse to 1 (as per wiki) --- config/hypr/UserConfigs/UserSettings.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/hypr/UserConfigs/UserSettings.conf b/config/hypr/UserConfigs/UserSettings.conf index 067a3810..e7d37bcf 100644 --- a/config/hypr/UserConfigs/UserSettings.conf +++ b/config/hypr/UserConfigs/UserSettings.conf @@ -39,7 +39,7 @@ input { #accel_profile = # flat or adaptive or blank or EMPTY means libinput’s default mode numlock_by_default = true left_handed = false - follow_mouse = true + follow_mouse = 1 float_switch_override_focus = false touchpad { -- cgit v1.2.3 From a2651ce31761301b5ac9c1c5915ef16c3f13ce6f Mon Sep 17 00:00:00 2001 From: tak0dan Date: Sat, 26 Jul 2025 17:20:35 +0200 Subject: Small technical additions for keyboard layout and app dispatch fixesSmall technical additions for keyboard layout and app dispatch fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit introduces two minor but useful scripts aimed at solving specific edge cases in Hyprland usage: 1. Tak0-Per-Window-Switch.sh: Enables per-window keyboard layout switching. This is useful for multilingual workflows where the global layout model becomes inconvenient. The script listens to window focus events and restores the last-used layout for that specific window. 2. Tak0-Autodispatch.sh: Fixes a recurring issue where startup applications are dispatched to incorrect monitors or workspaces, especially in dynamic multi-monitor environments (e.g., a laptop that gets docked/undocked). The original dispatch rules sometimes fail due to race conditions or child process spawning out of focus. This script re-applies correct dispatching logic after startup, reducing manual corrections. Also: - Updated UserKeybinds.conf to run the per-window layout script at startup. - All changes are additive. No existing configs or behavior were overridden or broken. These changes don't introduce any core structural modifications — just small utilities to improve the overall experience when using Hyprland in daily workflows. --- config/hypr/UserConfigs/UserKeybinds.conf | 3 +- config/hypr/scripts/Tak0-Autodispatch.sh | 90 +++++++++++++++++++ config/hypr/scripts/Tak0-Per-Window-Switch.sh | 123 ++++++++++++++++++++++++++ 3 files changed, 215 insertions(+), 1 deletion(-) create mode 100755 config/hypr/scripts/Tak0-Autodispatch.sh create mode 100755 config/hypr/scripts/Tak0-Per-Window-Switch.sh diff --git a/config/hypr/UserConfigs/UserKeybinds.conf b/config/hypr/UserConfigs/UserKeybinds.conf index 70202ba4..dd18b971 100644 --- a/config/hypr/UserConfigs/UserKeybinds.conf +++ b/config/hypr/UserConfigs/UserKeybinds.conf @@ -64,7 +64,8 @@ bind = $mainMod CTRL, O, exec, hyprctl setprop active opaque toggle # disable op bind = $mainMod SHIFT, K, exec, $scriptsDir/KeyBinds.sh # search keybinds via rofi bind = $mainMod SHIFT, A, exec, $scriptsDir/Animations.sh #hyprland animations menu bind = $mainMod SHIFT, O, exec, $UserScripts/ZshChangeTheme.sh # Change oh-my-zsh theme -bindln = ALT_L, SHIFT_L, exec, $scriptsDir/SwitchKeyboardLayout.sh # Change keyboard layout +bindln = ALT_L, SHIFT_L, exec, $scriptsDir/SwitchKeyboardLayout.sh # Change keyboard layout globally +bindln = SHIFT_L, ALT_L, exec, $scriptsDir/Tak0-Per-Window-Switch.sh # Change keyboard layout locally for each window bind = $mainMod ALT, C, exec, $UserScripts/RofiCalc.sh # calculator (qalculate) diff --git a/config/hypr/scripts/Tak0-Autodispatch.sh b/config/hypr/scripts/Tak0-Autodispatch.sh new file mode 100755 index 00000000..a1f72129 --- /dev/null +++ b/config/hypr/scripts/Tak0-Autodispatch.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# USAGE / ІНСТРУКЦІЯ: +# 1) Run from terminal: +# ./dispatch.sh +# Example: +# ./dispatch.sh discord 2 +# +# 2) Call from Hyprland config (in hyprland.conf file): +# exec-once = /path/to/dispatch.sh +# +# Logs are saved in dispatch.log file next to the script. +# If the window doesn't appear or is dispatched incorrectly — info will be there. +# +# Notes: +# - Script waits about ~9 seconds (30 iterations of 0.3 sec) for window to appear. +# - Uses hyprctl and jq, so these tools must be installed. +# +# USAGE / ІНСТРУКЦІЯ: +# 1) Запуск з терміналу: +# ./dispatch.sh +# Наприклад: +# ./dispatch.sh discord 2 +# +# 2) Виклик з конфігурації Hyprland (у файлі hyprland.conf): +# exec-once = /path/to/dispatch.sh +# +# Логи зберігаються у файлі dispatch.log поруч зі скриптом. +# Якщо вікно не з'явилось або неправильно диспатчилось — інформація там. +# +# Примітки: +# - Скрипт чекає до ~9 секунд (30 ітерацій по 0.3 сек) поки вікно з'явиться. +# - Використовує hyprctl і jq, тому ці інструменти мають бути встановлені. + +LOGFILE="$(dirname "$0")/dispatch.log" +# Log file path located next to the script. +# Файл логів розташований поруч зі скриптом. + +APP=$1 +# The application command or window class to launch or match. +# Команда для запуску аплікації або клас вікна для пошуку. + +TARGET_WORKSPACE=$2 +# The target workspace number where the window should be moved. +# Цільовий номер воркспейсу, куди потрібно перемістити вікно. + +# Check if required arguments are provided. +# Перевірка наявності необхідних параметрів. +if [[ -z "$APP" || -z "$TARGET_WORKSPACE" ]]; then + echo "Usage: $0 " >> "$LOGFILE" 2>&1 + exit 1 +fi + +echo "Starting dispatch of '$APP' to workspace $TARGET_WORKSPACE at $(date)" >> "$LOGFILE" +# Starting the dispatch process and logging the event. +# Початок процесу диспатчу, запис у лог. + +# Avoid early workspace focus issues by switching workspace first. +# Уникаємо проблем з раннім фокусом, спочатку переключаємо воркспейс. +hyprctl dispatch workspace "$TARGET_WORKSPACE" >> "$LOGFILE" 2>&1 +sleep 0.4 + +# Launch the application in the background and disown it. +# Запускаємо аплікацію у фоновому режимі та відв’язуємо від терміналу. +$APP & disown +pid=$! + +echo "Launched '$APP' with PID $pid" >> "$LOGFILE" +# Log the launched process ID. +# Лог процесу запуску з PID. + +# Wait for the application window to appear (matching window class). +# Чекаємо появи вікна аплікації (за класом вікна). +for i in {1..30}; do + win=$(hyprctl clients -j | jq -r --arg APP "$APP" ' + .[] | select(.class | test($APP;"i")) | .address' 2>>"$LOGFILE") + + if [[ -n "$win" ]]; then + echo "Found window $win for app '$APP', moving to workspace $TARGET_WORKSPACE" >> "$LOGFILE" + # Move the window to the target workspace. + # Переміщаємо вікно на цільовий воркспейс. + hyprctl dispatch movetoworkspace "$TARGET_WORKSPACE,address:$win" >> "$LOGFILE" 2>&1 + exit 0 + fi + sleep 0.3 +done + +echo "ERROR: Window for '$APP' was NOT found or dispatched properly to workspace $TARGET_WORKSPACE at $(date)" >> "$LOGFILE" +# Log error if window was not found or dispatched correctly. +# Запис помилки, якщо вікно не знайдено або неправильно диспатчено. +exit 1 diff --git a/config/hypr/scripts/Tak0-Per-Window-Switch.sh b/config/hypr/scripts/Tak0-Per-Window-Switch.sh new file mode 100755 index 00000000..76b6ad2d --- /dev/null +++ b/config/hypr/scripts/Tak0-Per-Window-Switch.sh @@ -0,0 +1,123 @@ +################################################################## +# # +# # +# TAK_0'S Per-Window-Switch # +# # +# # +# # +# Just a little script that I made to switch keyboard layouts # +# per-window instead of global switching for the more # +# smooth and comfortable workflow. # +# # +################################################################## + + + + + + + + +# This is for changing kb_layouts. Set kb_layouts in + +MAP_FILE="$HOME/.cache/kb_layout_per_window" +CFG_FILE="$HOME/.config/hypr/UserConfigs/UserSettings.conf" +ICON="$HOME/.config/swaync/images/ja.png" +SCRIPT_NAME="$(basename "$0")" + +# Ensure map file exists +touch "$MAP_FILE" + +# Read layouts from config +if ! grep -q 'kb_layout' "$CFG_FILE"; then + echo "Error: cannot find kb_layout in $CFG_FILE" >&2 + exit 1 +fi +kb_layouts=($(grep 'kb_layout' "$CFG_FILE" | cut -d '=' -f2 | tr -d '[:space:]' | tr ',' ' ')) +count=${#kb_layouts[@]} + +# Get current active window ID +get_win() { + hyprctl activewindow -j | jq -r '.address // .id' +} + +# Get available keyboards +get_keyboards() { + hyprctl devices -j | jq -r '.keyboards[].name' +} + +# Save window-specific layout +save_map() { + local W=$1 L=$2 + grep -v "^${W}:" "$MAP_FILE" > "$MAP_FILE.tmp" + echo "${W}:${L}" >> "$MAP_FILE.tmp" + mv "$MAP_FILE.tmp" "$MAP_FILE" +} + +# Load layout for window (fallback to default) +load_map() { + local W=$1 + local E + E=$(grep "^${W}:" "$MAP_FILE") + [[ -n "$E" ]] && echo "${E#*:}" || echo "${kb_layouts[0]}" +} + +# Switch layout for all keyboards to layout index +do_switch() { + local IDX=$1 + for kb in $(get_keyboards); do + hyprctl switchxkblayout "$kb" "$IDX" 2>/dev/null + done +} + +# Toggle layout for current window only +cmd_toggle() { + local W=$(get_win) + [[ -z "$W" ]] && return + local CUR=$(load_map "$W") + local i NEXT + for idx in "${!kb_layouts[@]}"; do + if [[ "${kb_layouts[idx]}" == "$CUR" ]]; then + i=$idx + break + fi + done + NEXT=$(( (i+1) % count )) + do_switch "$NEXT" + save_map "$W" "${kb_layouts[NEXT]}" + notify-send -u low -i "$ICON" "kb_layout: ${kb_layouts[NEXT]}" +} + +# Restore layout on focus +cmd_restore() { + local W=$(get_win) + [[ -z "$W" ]] && return + local LAY=$(load_map "$W") + for idx in "${!kb_layouts[@]}"; do + if [[ "${kb_layouts[idx]}" == "$LAY" ]]; then + do_switch "$idx" + break + fi + done +} + +# Listen to focus events and restore window-specific layouts +subscribe() { + local SOCKET2="$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" + [[ -S "$SOCKET2" ]] || { echo "Error: Hyprland socket not found." >&2; exit 1; } + + socat -u UNIX-CONNECT:"$SOCKET2" - | while read -r line; do + [[ "$line" =~ ^activewindow ]] && cmd_restore + done +} + +# Ensure only one listener +if ! pgrep -f "$SCRIPT_NAME.*--listener" >/dev/null; then + subscribe --listener & +fi + +# CLI +case "$1" in + toggle|"") cmd_toggle ;; + *) echo "Usage: $SCRIPT_NAME [toggle]" >&2; exit 1 ;; +esac -- cgit v1.2.3 From d5eaaf7b63420f99ef7054623263f141cbbf8cf0 Mon Sep 17 00:00:00 2001 From: tak0dan Date: Sat, 26 Jul 2025 18:24:56 +0200 Subject: Moved Autodispatch script to the UserScripts directory; --- config/hypr/UserScripts/Tak0-Autodispatch.sh | 90 ++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100755 config/hypr/UserScripts/Tak0-Autodispatch.sh diff --git a/config/hypr/UserScripts/Tak0-Autodispatch.sh b/config/hypr/UserScripts/Tak0-Autodispatch.sh new file mode 100755 index 00000000..a1f72129 --- /dev/null +++ b/config/hypr/UserScripts/Tak0-Autodispatch.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# USAGE / ІНСТРУКЦІЯ: +# 1) Run from terminal: +# ./dispatch.sh +# Example: +# ./dispatch.sh discord 2 +# +# 2) Call from Hyprland config (in hyprland.conf file): +# exec-once = /path/to/dispatch.sh +# +# Logs are saved in dispatch.log file next to the script. +# If the window doesn't appear or is dispatched incorrectly — info will be there. +# +# Notes: +# - Script waits about ~9 seconds (30 iterations of 0.3 sec) for window to appear. +# - Uses hyprctl and jq, so these tools must be installed. +# +# USAGE / ІНСТРУКЦІЯ: +# 1) Запуск з терміналу: +# ./dispatch.sh +# Наприклад: +# ./dispatch.sh discord 2 +# +# 2) Виклик з конфігурації Hyprland (у файлі hyprland.conf): +# exec-once = /path/to/dispatch.sh +# +# Логи зберігаються у файлі dispatch.log поруч зі скриптом. +# Якщо вікно не з'явилось або неправильно диспатчилось — інформація там. +# +# Примітки: +# - Скрипт чекає до ~9 секунд (30 ітерацій по 0.3 сек) поки вікно з'явиться. +# - Використовує hyprctl і jq, тому ці інструменти мають бути встановлені. + +LOGFILE="$(dirname "$0")/dispatch.log" +# Log file path located next to the script. +# Файл логів розташований поруч зі скриптом. + +APP=$1 +# The application command or window class to launch or match. +# Команда для запуску аплікації або клас вікна для пошуку. + +TARGET_WORKSPACE=$2 +# The target workspace number where the window should be moved. +# Цільовий номер воркспейсу, куди потрібно перемістити вікно. + +# Check if required arguments are provided. +# Перевірка наявності необхідних параметрів. +if [[ -z "$APP" || -z "$TARGET_WORKSPACE" ]]; then + echo "Usage: $0 " >> "$LOGFILE" 2>&1 + exit 1 +fi + +echo "Starting dispatch of '$APP' to workspace $TARGET_WORKSPACE at $(date)" >> "$LOGFILE" +# Starting the dispatch process and logging the event. +# Початок процесу диспатчу, запис у лог. + +# Avoid early workspace focus issues by switching workspace first. +# Уникаємо проблем з раннім фокусом, спочатку переключаємо воркспейс. +hyprctl dispatch workspace "$TARGET_WORKSPACE" >> "$LOGFILE" 2>&1 +sleep 0.4 + +# Launch the application in the background and disown it. +# Запускаємо аплікацію у фоновому режимі та відв’язуємо від терміналу. +$APP & disown +pid=$! + +echo "Launched '$APP' with PID $pid" >> "$LOGFILE" +# Log the launched process ID. +# Лог процесу запуску з PID. + +# Wait for the application window to appear (matching window class). +# Чекаємо появи вікна аплікації (за класом вікна). +for i in {1..30}; do + win=$(hyprctl clients -j | jq -r --arg APP "$APP" ' + .[] | select(.class | test($APP;"i")) | .address' 2>>"$LOGFILE") + + if [[ -n "$win" ]]; then + echo "Found window $win for app '$APP', moving to workspace $TARGET_WORKSPACE" >> "$LOGFILE" + # Move the window to the target workspace. + # Переміщаємо вікно на цільовий воркспейс. + hyprctl dispatch movetoworkspace "$TARGET_WORKSPACE,address:$win" >> "$LOGFILE" 2>&1 + exit 0 + fi + sleep 0.3 +done + +echo "ERROR: Window for '$APP' was NOT found or dispatched properly to workspace $TARGET_WORKSPACE at $(date)" >> "$LOGFILE" +# Log error if window was not found or dispatched correctly. +# Запис помилки, якщо вікно не знайдено або неправильно диспатчено. +exit 1 -- cgit v1.2.3 From e6d61ca717edce83aaefaceca9e76e30677e88ee Mon Sep 17 00:00:00 2001 From: Mewlkor Date: Sat, 26 Jul 2025 21:03:52 +0200 Subject: fix: fix qs overview window alignment --- config/quickshell/modules/overview/OverviewWidget.qml | 4 ++-- config/quickshell/modules/overview/OverviewWindow.qml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/quickshell/modules/overview/OverviewWidget.qml b/config/quickshell/modules/overview/OverviewWidget.qml index 2ea8d58a..22cf929e 100644 --- a/config/quickshell/modules/overview/OverviewWidget.qml +++ b/config/quickshell/modules/overview/OverviewWidget.qml @@ -258,8 +258,8 @@ Item { repeat: false running: false onTriggered: { - window.x = Math.max((windowData?.at[0] - monitorData?.reserved[0]) * root.scale, 0) + xOffset - window.y = Math.max((windowData?.at[1] - monitorData?.reserved[1]) * root.scale, 0) + yOffset + window.x = Math.max((windowData?.at[0] - monitorData?.reserved[0] - monitorData?.x) * root.scale, 0) + xOffset + window.y = Math.max((windowData?.at[1] - monitorData?.reserved[1] - monitorData?.y) * root.scale, 0) + yOffset } } diff --git a/config/quickshell/modules/overview/OverviewWindow.qml b/config/quickshell/modules/overview/OverviewWindow.qml index 449a98c4..93ea06f9 100644 --- a/config/quickshell/modules/overview/OverviewWindow.qml +++ b/config/quickshell/modules/overview/OverviewWindow.qml @@ -18,8 +18,8 @@ Rectangle { // Window property var availableWorkspaceWidth property var availableWorkspaceHeight property bool restrictToWorkspace: true - property real initX: Math.max((windowData?.at[0] - monitorData?.reserved[0]) * root.scale, 0) + xOffset - property real initY: Math.max((windowData?.at[1] - monitorData?.reserved[1]) * root.scale, 0) + yOffset + property real initX: Math.max((windowData?.at[0] - monitorData?.reserved[0] - monitorData?.x) * root.scale, 0) + xOffset + property real initY: Math.max((windowData?.at[1] - monitorData?.reserved[1] - monitorData?.y) * root.scale, 0) + yOffset property real xOffset: 0 property real yOffset: 0 -- cgit v1.2.3 From 1fbd9753ca36d1aae4a265284073a892703193bb Mon Sep 17 00:00:00 2001 From: Mewlkor Date: Sun, 27 Jul 2025 23:34:50 +0200 Subject: fix: fix window position not using correct monitor, fix scaling of windows on monitors with non 1.0 scale --- config/quickshell/modules/overview/OverviewWidget.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/quickshell/modules/overview/OverviewWidget.qml b/config/quickshell/modules/overview/OverviewWidget.qml index 22cf929e..93e90967 100644 --- a/config/quickshell/modules/overview/OverviewWidget.qml +++ b/config/quickshell/modules/overview/OverviewWidget.qml @@ -239,8 +239,8 @@ Item { delegate: OverviewWindow { id: window windowData: windowByAddress[modelData] - monitorData: root.monitorData - scale: root.scale + monitorData: HyprlandData.monitors.find(m => m.id === windowData?.monitor) // use monitorData of the monitor the window is on + scale: root.scale * (monitorData?.scale / root.monitor?.scale) // adjust window scale to the monitor where the overview is displayed availableWorkspaceWidth: root.workspaceImplicitWidth availableWorkspaceHeight: root.workspaceImplicitHeight -- cgit v1.2.3