Skip to content

Commit 3cd28a0

Browse files
authored
Merge pull request #424 from JaKooLit/development
Development to main
2 parents 9fefbe7 + fe28d8d commit 3cd28a0

File tree

8 files changed

+63
-44
lines changed

8 files changed

+63
-44
lines changed

config/hypr/UserConfigs/WindowRules.conf

+3
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ windowrulev2 = size 60% 70%, title:^(ROG Control)$
122122
windowrulev2 = pin,title:^(Picture-in-Picture)$
123123
#windowrulev2 = pin,title:^(Firefox)$
124124

125+
# windowrule v2 - extras
126+
windowrulev2 = keepaspectratio, title:^(Picture-in-Picture)$
127+
125128
#windowrulev2 = bordercolor rgb(EE4B55) rgb(880808), fullscreen:1
126129
#windowrulev2 = bordercolor rgb(282737) rgb(1E1D2D), floating:1
127130
#windowrulev2 = opacity 0.8 0.8, pinned:1

config/hypr/scripts/SwitchKeyboardLayout.sh

+54-41
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,37 @@
22
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
33
# This is for changing kb_layouts. Set kb_layouts in $settings_file
44

5-
layout_f="$HOME/.cache/kb_layout"
5+
layout_file="$HOME/.cache/kb_layout"
66
settings_file="$HOME/.config/hypr/UserConfigs/UserSettings.conf"
7-
notif="$HOME/.config/swaync/images/bell.png"
8-
9-
echo "Starting script..."
10-
11-
# Check if ~/.cache/kb_layout exists and create it with a default layout from Settings.conf if not found
12-
if [ ! -f "$layout_f" ]; then
13-
echo "Creating layout file as it does not exist..."
14-
default_layout=$(grep 'kb_layout = ' "$settings_file" | cut -d '=' -f 2 | cut -d ',' -f 1 2>/dev/null)
15-
if [ -z "$default_layout" ]; then
16-
default_layout="us" # Default to 'us' layout if Settings.conf or 'kb_layout' is not found
17-
fi
18-
echo "$default_layout" > "$layout_f"
7+
notif_icon="$HOME/.config/swaync/images/bell.png"
8+
9+
# Refined ignore list with patterns or specific device names
10+
ignore_patterns=(
11+
"--(avrcp)"
12+
"Bluetooth Speaker"
13+
"Other Device
14+
Name"
15+
)
16+
17+
18+
# Create layout file with default layout if it does not exist
19+
if [ ! -f "$layout_file" ]; then
20+
echo "Creating layout file..."
21+
default_layout=$(grep 'kb_layout = ' "$settings_file" | cut -d '=' -f 2 | tr -d '[:space:]' | cut -d ',' -f 1 2>/dev/null)
22+
default_layout=${default_layout:-"us"} # Default to 'us' layout
23+
echo "$default_layout" > "$layout_file"
1924
echo "Default layout set to $default_layout"
2025
fi
2126

22-
current_layout=$(cat "$layout_f")
27+
current_layout=$(cat "$layout_file")
2328
echo "Current layout: $current_layout"
2429

25-
# Read keyboard layout settings from Settings.conf
30+
# Read available layouts from settings file
2631
if [ -f "$settings_file" ]; then
27-
echo "Reading keyboard layout settings from $settings_file..."
2832
kb_layout_line=$(grep 'kb_layout = ' "$settings_file" | cut -d '=' -f 2)
29-
IFS=',' read -ra layout_mapping <<< "$kb_layout_line"
30-
echo "Available layouts: ${layout_mapping[@]}"
33+
# Remove leading and trailing spaces around each layout
34+
kb_layout_line=$(echo "$kb_layout_line" | tr -d '[:space:]')
35+
IFS=',' read -r -a layout_mapping <<< "$kb_layout_line"
3136
else
3237
echo "Settings file not found!"
3338
exit 1
@@ -36,56 +41,64 @@ fi
3641
layout_count=${#layout_mapping[@]}
3742
echo "Number of layouts: $layout_count"
3843

39-
# Find the index of the current layout in the mapping
44+
# Find current layout index and calculate next layout
4045
for ((i = 0; i < layout_count; i++)); do
4146
if [ "$current_layout" == "${layout_mapping[i]}" ]; then
4247
current_index=$i
43-
echo "Current layout index: $current_index"
4448
break
4549
fi
4650
done
4751

48-
# Calculate the index of the next layout
4952
next_index=$(( (current_index + 1) % layout_count ))
5053
new_layout="${layout_mapping[next_index]}"
5154
echo "Next layout: $new_layout"
5255

53-
# Created by T-Crypt
54-
56+
# Function to get keyboard names
5557
get_keyboard_names() {
5658
hyprctl devices -j | jq -r '.keyboards[].name'
5759
}
5860

61+
# Function to check if a device matches any ignore pattern
62+
is_ignored() {
63+
local device_name=$1
64+
for pattern in "${ignore_patterns[@]}"; do
65+
if [[ "$device_name" == *"$pattern"* ]]; then
66+
return 0 # Device matches ignore pattern
67+
fi
68+
done
69+
return 1 # Device does not match any ignore pattern
70+
}
71+
72+
# Function to change keyboard layout
5973
change_layout() {
60-
local got_error=false
74+
local error_found=false
6175

6276
while read -r name; do
77+
if is_ignored "$name"; then
78+
echo "Skipping ignored device: $name"
79+
continue
80+
fi
81+
6382
echo "Switching layout for $name to $new_layout..."
64-
hyprctl switchxkblayout "$name" "$new_layout"
65-
if [[ $? -eq 0 ]]; then
66-
echo "Switched the layout for $name."
67-
else
68-
>&2 echo "Error while switching the layout for $name."
69-
got_error=true
83+
hyprctl switchxkblayout "$name" next
84+
if [ $? -ne 0 ]; then
85+
echo "Error while switching layout for $name." >&2
86+
error_found=true
7087
fi
7188
done <<< "$(get_keyboard_names)"
7289

73-
if [ "$got_error" = true ]; then
74-
>&2 echo "Some errors were found during the process..."
75-
return 1
76-
fi
77-
78-
return 0 # All layouts had been cycled successfully
90+
$error_found && return 1
91+
return 0
7992
}
8093

94+
# Execute layout change and notify
8195
if ! change_layout; then
82-
notify-send -u low -t 2000 'Keyboard layout' 'Error: Layout change failed'
83-
>&2 echo "Layout change failed."
96+
notify-send -u low -t 2000 'kb_layout' 'Error: Layout change failed'
97+
echo "Layout change failed." >&2
8498
exit 1
8599
else
86-
# Notification for the new keyboard layout
87-
notify-send -u low -i "$notif" "new KB_Layout: $new_layout"
100+
notify-send -u low -i "$notif_icon" "New kb_layout: $new_layout"
88101
echo "Layout change notification sent."
89102
fi
90103

91-
echo "$new_layout" > "$layout_f"
104+
echo "$new_layout" > "$layout_file"
File renamed without changes.

config/waybar/configs/[TOP] Everforest

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
// "mpris",
2525
"custom/swaync",
2626
"tray",
27+
"mpris",
2728
],
2829
"modules-center": [
2930
"clock#forest",

config/waybar/configs/[TOP] Minimal - Long

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"idle_inhibitor",
3131
],
3232
"modules-right": [
33-
"group/motherboard",
33+
"group/mobo_drawer",
3434
"custom/separator#blank_2",
3535
"group/laptop",
3636
"custom/separator#blank_2",

config/waybar/modules

+2
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@
194194
"title<.*reddit.*>": " ",
195195
"title<.*Picture-in-Picture.*>": " ",
196196
"class<firefox>": " ",
197+
"class<org.mozilla.firefox>": " ",
197198
"class<kitty>": " ",
198199
"class<kitty-dropterm>": " ",
199200
"class<konsole>": " ",
@@ -202,6 +203,7 @@
202203
"class<[Ss]potify>": "<span font='12'> </span>",
203204
"class<VSCode|code-url-handler>": "<span font='12'>󰨞</span>",
204205
"class<thunar>": "󰝰 ",
206+
"class<[Tt]hunderbird>": " ",
205207
"class<discord>": " ",
206208
"class<WebCord>": " ",
207209
"class<subl>": "󰅳 ",

config/wlogout/style.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* ----------- 💫 https://github.com/JaKooLit 💫 -------- */
22
/* wallust-wlogout */
33

4-
/* Importing pywal colors */
4+
/* Importing wallust colors */
55

66
@import '../../.config/waybar/wallust/colors-waybar.css';
77

copy.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ printf "\n%.0s" {1..2}
2525
OK="$(tput setaf 2)[OK]$(tput sgr0)"
2626
ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)"
2727
NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)"
28-
WARN="$(tput setaf 166)[WARN]$(tput sgr0)"
28+
WARN="$(tput setaf 5)[WARN]$(tput sgr0)"
2929
CAT="$(tput setaf 6)[ACTION]$(tput sgr0)"
3030
ORANGE=$(tput setaf 166)
3131
YELLOW=$(tput setaf 3)

0 commit comments

Comments
 (0)