diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf index 5393331..bcca92c 100644 --- a/.config/hypr/hyprland.conf +++ b/.config/hypr/hyprland.conf @@ -7,9 +7,8 @@ ### MONITORS ### ################ -# See https://wiki.hyprland.org/Configuring/Monitors/ -monitor=,preferred,auto,auto - +source = ./monitors.conf +source = ./workspaces.conf ################### ### MY PROGRAMS ### diff --git a/.config/hypr/hyprlock.conf b/.config/hypr/hyprlock.conf index e626e80..1ed284b 100644 --- a/.config/hypr/hyprlock.conf +++ b/.config/hypr/hyprlock.conf @@ -82,3 +82,17 @@ label { # halign = center # valign = center # } +# selected layout +label { + monitor = + text = cmd[update:1000] ~/.config/scripts/get_layout.sh + color = rgba(200, 200, 200, 1.0) + font_size = 20 + font_family = Fira Semibold + position = -20, 20 + halign = right + valign = bottom + shadow_passes = 5 + shadow_size = 10 +} + diff --git a/.config/scripts/get_layout.sh b/.config/scripts/get_layout.sh new file mode 100755 index 0000000..a651977 --- /dev/null +++ b/.config/scripts/get_layout.sh @@ -0,0 +1,30 @@ +getFlagEmoji() { + local countryCode=$1 + local flag="" + + # Convert country code to uppercase + countryCode=$(echo "$countryCode" | tr '[:lower:]' '[:upper:]') + + # Iterate over each character in the country code + for (( i=0; i<${#countryCode}; i++ )); do + char="${countryCode:$i:1}" + # Calculate the code point for the flag emoji + codePoint=$((127397 + $(printf "%d" "'$char"))) + # Convert code point to the corresponding Unicode character + flag+=$(printf "\\U$(printf '%08x' $codePoint)") + done + + echo "$flag" +} +# TODO: get keyboard name dynamically +countryCode=$(hyprctl devices -j | + jq -r '.keyboards[] | select(.name == "at-translated-set-2-keyboard") | .active_keymap' | + cut -c1-2 | + tr 'a-z' 'A-Z') + +if [ "$countryCode" = "EN" ]; then + flagEmoji="🇺🇸" +else + flagEmoji=$(getFlagEmoji "$countryCode") +fi +echo "$flagEmoji"