hypr conf update

language label added to hyprlock
monitors and workspaces configs added to hyprland conf
This commit is contained in:
parent e6a09fc17e
commit c7855a8c34
3 changed files with 46 additions and 3 deletions

View File

@ -7,9 +7,8 @@
### MONITORS ###
################
# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=,preferred,auto,auto
source = ./monitors.conf
source = ./workspaces.conf
###################
### MY PROGRAMS ###

View File

@ -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
}

30
.config/scripts/get_layout.sh Executable file
View File

@ -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"