mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
Compare commits
11 Commits
fix-omarch
...
gaming-imp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
616f8abae3 | ||
|
|
e336341ae1 | ||
|
|
65230ffd55 | ||
|
|
2a4c20df30 | ||
|
|
9b02c9f651 | ||
|
|
d3edcfc282 | ||
|
|
1a35c22de2 | ||
|
|
0a2c106a41 | ||
|
|
be6614b2b1 | ||
|
|
1124929173 | ||
|
|
3f738fd57e |
@@ -8,82 +8,31 @@ if [[ ! -d "$OUTPUT_DIR" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SCOPE=""
|
# Selects region or output
|
||||||
AUDIO="false"
|
SCOPE="$1"
|
||||||
WEBCAM="false"
|
|
||||||
|
|
||||||
for arg in "$@"; do
|
# Selects audio inclusion or not
|
||||||
case "$arg" in
|
AUDIO=$([[ $2 == "audio" ]] && echo "--audio")
|
||||||
--with-audio) AUDIO="true" ;;
|
|
||||||
--with-webcam) WEBCAM="true" ;;
|
|
||||||
output|region) SCOPE="$arg" ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
cleanup_webcam() {
|
|
||||||
pkill -f "WebcamOverlay" 2>/dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
start_webcam_overlay() {
|
|
||||||
cleanup_webcam
|
|
||||||
|
|
||||||
# Get monitor scale
|
|
||||||
local scale=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .scale')
|
|
||||||
|
|
||||||
# Target width (base 360px, scaled to monitor)
|
|
||||||
local target_width=$(awk "BEGIN {printf \"%.0f\", 360 * $scale}")
|
|
||||||
|
|
||||||
# Try preferred 16:9 resolutions in order, use first available
|
|
||||||
local preferred_resolutions=("640x360" "1280x720" "1920x1080")
|
|
||||||
local video_size_arg=""
|
|
||||||
local available_formats=$(v4l2-ctl --list-formats-ext -d /dev/video0 2>/dev/null)
|
|
||||||
|
|
||||||
for resolution in "${preferred_resolutions[@]}"; do
|
|
||||||
if echo "$available_formats" | grep -q "$resolution"; then
|
|
||||||
video_size_arg="-video_size $resolution"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
ffplay -f v4l2 $video_size_arg -framerate 30 /dev/video0 \
|
|
||||||
-vf "scale=${target_width}:-1" \
|
|
||||||
-window_title "WebcamOverlay" \
|
|
||||||
-noborder \
|
|
||||||
-fflags nobuffer -flags low_delay \
|
|
||||||
-probesize 32 -analyzeduration 0 \
|
|
||||||
-loglevel quiet &
|
|
||||||
sleep 1
|
|
||||||
}
|
|
||||||
|
|
||||||
start_screenrecording() {
|
start_screenrecording() {
|
||||||
local filename="$OUTPUT_DIR/screenrecording-$(date +'%Y-%m-%d_%H-%M-%S').mp4"
|
filename="$OUTPUT_DIR/screenrecording-$(date +'%Y-%m-%d_%H-%M-%S').mp4"
|
||||||
local audio_args=""
|
|
||||||
|
|
||||||
# Merge audio tracks into one - separate tracks only play one at a time in most players
|
if lspci | grep -qi 'nvidia'; then
|
||||||
[[ "$AUDIO" == "true" ]] && audio_args="-a default_output|default_input"
|
wf-recorder $AUDIO -f "$filename" -c libx264 -p crf=23 -p preset=medium -p movflags=+faststart "$@" &
|
||||||
|
else
|
||||||
|
wl-screenrec $AUDIO -f "$filename" --ffmpeg-encoder-options="-c:v libx264 -crf 23 -preset medium -movflags +faststart" "$@" &
|
||||||
|
fi
|
||||||
|
|
||||||
gpu-screen-recorder -w "$@" -f 60 -c mp4 -o "$filename" $audio_args &
|
|
||||||
toggle_screenrecording_indicator
|
toggle_screenrecording_indicator
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_screenrecording() {
|
stop_screenrecording() {
|
||||||
pkill -SIGINT -f "gpu-screen-recorder" # SIGINT required to save video properly
|
pkill -x wl-screenrec
|
||||||
|
pkill -x wf-recorder
|
||||||
|
|
||||||
# Wait a maximum of 5 seconds to finish before hard killing
|
notify-send "Screen recording saved to $OUTPUT_DIR" -t 2000
|
||||||
local count=0
|
|
||||||
while pgrep -f "gpu-screen-recorder" >/dev/null && [ $count -lt 50 ]; do
|
|
||||||
sleep 0.1
|
|
||||||
count=$((count + 1))
|
|
||||||
done
|
|
||||||
|
|
||||||
if pgrep -f "gpu-screen-recorder" >/dev/null; then
|
sleep 0.2 # ensures the process is actually dead before we check
|
||||||
pkill -9 -f "gpu-screen-recorder"
|
|
||||||
cleanup_webcam
|
|
||||||
notify-send "Screen recording error" "Recording process had to be force-killed. Video may be corrupted." -u critical -t 5000
|
|
||||||
else
|
|
||||||
cleanup_webcam
|
|
||||||
notify-send "Screen recording saved to $OUTPUT_DIR" -t 2000
|
|
||||||
fi
|
|
||||||
toggle_screenrecording_indicator
|
toggle_screenrecording_indicator
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,51 +41,14 @@ toggle_screenrecording_indicator() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
screenrecording_active() {
|
screenrecording_active() {
|
||||||
pgrep -f "gpu-screen-recorder" >/dev/null || pgrep -x slurp >/dev/null || pgrep -f "WebcamOverlay" >/dev/null
|
pgrep -x wl-screenrec >/dev/null || pgrep -x wf-recorder >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
if screenrecording_active; then
|
if screenrecording_active; then
|
||||||
if pgrep -x slurp >/dev/null; then
|
stop_screenrecording
|
||||||
pkill -x slurp 2>/dev/null
|
|
||||||
elif pgrep -f "WebcamOverlay" >/dev/null && ! pgrep -f "gpu-screen-recorder" >/dev/null; then
|
|
||||||
cleanup_webcam
|
|
||||||
else
|
|
||||||
stop_screenrecording
|
|
||||||
fi
|
|
||||||
elif [[ "$SCOPE" == "output" ]]; then
|
elif [[ "$SCOPE" == "output" ]]; then
|
||||||
[[ "$WEBCAM" == "true" ]] && start_webcam_overlay
|
start_screenrecording
|
||||||
|
|
||||||
if ! output=$(slurp -o -f "%o"); then
|
|
||||||
[[ "$WEBCAM" == "true" ]] && cleanup_webcam
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "$output" ]]; then
|
|
||||||
notify-send "Error" "Could not detect monitor" -u critical
|
|
||||||
[[ "$WEBCAM" == "true" ]] && cleanup_webcam
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
start_screenrecording "$output"
|
|
||||||
else
|
else
|
||||||
[[ "$WEBCAM" == "true" ]] && start_webcam_overlay
|
region=$(slurp) || exit 1
|
||||||
|
start_screenrecording -g "$region"
|
||||||
scale=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .scale')
|
|
||||||
|
|
||||||
if ! region=$(slurp -f "%wx%h+%x+%y"); then
|
|
||||||
[[ "$WEBCAM" == "true" ]] && cleanup_webcam
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$region" =~ ^([0-9]+)x([0-9]+)\+([0-9]+)\+([0-9]+)$ ]]; then
|
|
||||||
w=$(awk "BEGIN {printf \"%.0f\", ${BASH_REMATCH[1]} * $scale}")
|
|
||||||
h=$(awk "BEGIN {printf \"%.0f\", ${BASH_REMATCH[2]} * $scale}")
|
|
||||||
x=$(awk "BEGIN {printf \"%.0f\", ${BASH_REMATCH[3]} * $scale}")
|
|
||||||
y=$(awk "BEGIN {printf \"%.0f\", ${BASH_REMATCH[4]} * $scale}")
|
|
||||||
scaled_region="${w}x${h}+${x}+${y}"
|
|
||||||
else
|
|
||||||
scaled_region="$region"
|
|
||||||
fi
|
|
||||||
|
|
||||||
start_screenrecording region -region "$scaled_region"
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
browser=$(xdg-settings get default-web-browser)
|
browser=$(xdg-settings get default-web-browser)
|
||||||
|
|
||||||
case $browser in
|
case $browser in
|
||||||
google-chrome* | brave-browser* | microsoft-edge* | opera* | vivaldi* | helium-browser*) ;;
|
google-chrome* | brave-browser* | microsoft-edge* | opera* | vivaldi*) ;;
|
||||||
*) browser="chromium.desktop" ;;
|
*) browser="chromium.desktop" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
@@ -299,10 +299,13 @@ show_install_ai_menu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
show_install_gaming_menu() {
|
show_install_gaming_menu() {
|
||||||
case $(menu "Install" " Steam\n RetroArch [AUR]\n Minecraft") in
|
case $(menu "Install" "Omarchy Gaming Helper\n Steam\n RetroArch [AUR]\n Minecraft\n Heroic Launcher\n Lutris") in
|
||||||
|
*Omarchy*) present_terminal omarchy-setup-gaming ;;
|
||||||
*Steam*) present_terminal omarchy-install-steam ;;
|
*Steam*) present_terminal omarchy-install-steam ;;
|
||||||
*RetroArch*) aur_install_and_launch "RetroArch" "retroarch retroarch-assets libretro libretro-fbneo" "com.libretro.RetroArch.desktop" ;;
|
*RetroArch*) aur_install_and_launch "RetroArch" "retroarch retroarch-assets libretro libretro-fbneo" "com.libretro.RetroArch.desktop" ;;
|
||||||
*Minecraft*) aur_install_and_launch "Minecraft [AUR]" "minecraft-launcher" "minecraft-launcher" ;;
|
*Minecraft*) aur_install_and_launch "Minecraft [AUR]" "minecraft-launcher" "minecraft-launcher" ;;
|
||||||
|
*Heroic*) aur_install_and_launch "Heroic Launcher" "heroic-games-launcher-bin" "heroic" ;;
|
||||||
|
*Lutris*) aur_install_and_launch "Lutris" "lutris" "lutris" ;;
|
||||||
*) show_install_menu ;;
|
*) show_install_menu ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo -e "Restarting pipewire audio service...\n"
|
echo -e "Restarting pirewire audio service...\n"
|
||||||
systemctl --user restart pipewire.service
|
systemctl --user restart pipewire.service
|
||||||
|
|||||||
27
bin/omarchy-setup-gaming
Executable file
27
bin/omarchy-setup-gaming
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
yay -S --noconfirm gamescope proton-ge-custom-bin
|
||||||
|
|
||||||
|
mkdir -p ~/.config/systemd/user/
|
||||||
|
|
||||||
|
cat > ~/.config/systemd/user/omarchy-gaming-helper.service << EOF
|
||||||
|
[Unit]
|
||||||
|
Description=Omarchy Gaming Helper
|
||||||
|
After=graphical-session.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=$OMARCHY_PATH/default/hypr/scripts/omarchy-gaming-helper.sh
|
||||||
|
Restart=always
|
||||||
|
RestartSec=5
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
systemctl --user daemon-reload
|
||||||
|
|
||||||
|
systemctl --user enable omarchy-gaming-helper.service
|
||||||
|
systemctl --user start omarchy-gaming-helper.service
|
||||||
|
|
||||||
|
echo "Omarchy Gaming Helper service has been installed and started."
|
||||||
@@ -43,7 +43,7 @@ cat >"$DESKTOP_FILE" <<EOF
|
|||||||
Version=1.0
|
Version=1.0
|
||||||
Name=$APP_NAME
|
Name=$APP_NAME
|
||||||
Comment=$APP_NAME
|
Comment=$APP_NAME
|
||||||
Exec=\$TERMINAL --class=$APP_CLASS -e $APP_EXEC
|
Exec=$TERMINAL --class $APP_CLASS -e $APP_EXEC
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
Icon=$ICON_PATH
|
Icon=$ICON_PATH
|
||||||
|
|||||||
@@ -15,9 +15,3 @@ decoration {
|
|||||||
# Use round window corners
|
# Use round window corners
|
||||||
# rounding = 8
|
# rounding = 8
|
||||||
}
|
}
|
||||||
|
|
||||||
# https://wiki.hypr.land/Configuring/Dwindle-Layout/
|
|
||||||
dwindle {
|
|
||||||
# Avoid overly wide single-window layouts on wide screens
|
|
||||||
# single_window_aspect_ratio = 1 1
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ source = ~/.local/share/omarchy/default/hypr/apps/jetbrains.conf
|
|||||||
source = ~/.local/share/omarchy/default/hypr/apps/localsend.conf
|
source = ~/.local/share/omarchy/default/hypr/apps/localsend.conf
|
||||||
source = ~/.local/share/omarchy/default/hypr/apps/pip.conf
|
source = ~/.local/share/omarchy/default/hypr/apps/pip.conf
|
||||||
source = ~/.local/share/omarchy/default/hypr/apps/qemu.conf
|
source = ~/.local/share/omarchy/default/hypr/apps/qemu.conf
|
||||||
source = ~/.local/share/omarchy/default/hypr/apps/retroarch.conf
|
|
||||||
source = ~/.local/share/omarchy/default/hypr/apps/steam.conf
|
|
||||||
source = ~/.local/share/omarchy/default/hypr/apps/system.conf
|
source = ~/.local/share/omarchy/default/hypr/apps/system.conf
|
||||||
source = ~/.local/share/omarchy/default/hypr/apps/terminals.conf
|
source = ~/.local/share/omarchy/default/hypr/apps/terminals.conf
|
||||||
source = ~/.local/share/omarchy/default/hypr/apps/walker.conf
|
source = ~/.local/share/omarchy/default/hypr/apps/walker.conf
|
||||||
source = ~/.local/share/omarchy/default/hypr/apps/webcam-overlay.conf
|
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
# Webcam overlay for screen recording
|
|
||||||
windowrule = float, title:WebcamOverlay
|
|
||||||
windowrule = pin, title:WebcamOverlay
|
|
||||||
windowrule = noinitialfocus, title:WebcamOverlay
|
|
||||||
windowrule = nodim, title:WebcamOverlay
|
|
||||||
windowrule = move 100%-w-40 100%-w-40, title:WebcamOverlay # There's a typo in the hyprland rule so 100%-w on the height param is actually correct here
|
|
||||||
@@ -36,9 +36,9 @@ bindd = CTRL, PRINT, Screenshot of display, exec, omarchy-cmd-screenshot output
|
|||||||
|
|
||||||
# Screen recordings
|
# Screen recordings
|
||||||
bindd = ALT, PRINT, Screen record a region, exec, omarchy-cmd-screenrecord region
|
bindd = ALT, PRINT, Screen record a region, exec, omarchy-cmd-screenrecord region
|
||||||
bindd = ALT SHIFT, PRINT, Screen record a region with audio, exec, omarchy-cmd-screenrecord region --with-audio
|
bindd = ALT SHIFT, PRINT, Screen record a region with audio, exec, omarchy-cmd-screenrecord region audio
|
||||||
bindd = CTRL ALT, PRINT, Screen record display, exec, omarchy-cmd-screenrecord output
|
bindd = CTRL ALT, PRINT, Screen record display, exec, omarchy-cmd-screenrecord output
|
||||||
bindd = CTRL ALT SHIFT, PRINT, Screen record display with audio, exec, omarchy-cmd-screenrecord output --with-audio
|
bindd = CTRL ALT SHIFT, PRINT, Screen record display with audio, exec, omarchy-cmd-screenrecord output audio
|
||||||
|
|
||||||
# Color picker
|
# Color picker
|
||||||
bindd = SUPER, PRINT, Color picker, exec, pkill hyprpicker || hyprpicker -a
|
bindd = SUPER, PRINT, Color picker, exec, pkill hyprpicker || hyprpicker -a
|
||||||
|
|||||||
5
default/hypr/gaming.conf
Normal file
5
default/hypr/gaming.conf
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Gaming-specific tweaks
|
||||||
|
source = ~/.local/share/omarchy/default/hypr/gaming/general-gaming.conf
|
||||||
|
source = ~/.local/share/omarchy/default/hypr/gaming/blizzard.conf
|
||||||
|
source = ~/.local/share/omarchy/default/hypr/gaming/retroarch.conf
|
||||||
|
source = ~/.local/share/omarchy/default/hypr/gaming/steam.conf
|
||||||
6
default/hypr/gaming/blizzard.conf
Normal file
6
default/hypr/gaming/blizzard.conf
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
windowrule = tag +game, title:Hearthstone
|
||||||
|
windowrule = tag +game, title:Overwatch
|
||||||
|
windowrule = tag +game, title:.*Warcraft.*
|
||||||
|
|
||||||
|
windowrule = tag -game, title:Battle.net.*
|
||||||
|
windowrule = tag +game-launcher, title:Battle.net.*
|
||||||
20
default/hypr/gaming/general-gaming.conf
Normal file
20
default/hypr/gaming/general-gaming.conf
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
windowrule = float, tag:game-launcher
|
||||||
|
windowrule = center, tag:game-launcher
|
||||||
|
windowrule = size 60% 60%, tag:game-launcher
|
||||||
|
|
||||||
|
windowrule = immediate, tag:game
|
||||||
|
windowrule = idleinhibit fullscreen, tag:game
|
||||||
|
windowrule = opacity 1 1, tag:game
|
||||||
|
windowrule = noshadow, tag:game
|
||||||
|
windowrule = noborder, tag:game
|
||||||
|
windowrule = noblur, tag:game
|
||||||
|
|
||||||
|
windowrule = noborder, class:Xdg-desktop-portal-gtk
|
||||||
|
windowrule = noblur, class:Xdg-desktop-portal-gtk
|
||||||
|
windowrule = noshadow, class:Xdg-desktop-portal-gtk
|
||||||
|
|
||||||
|
windowrule = tag +game, class:(steam_app.*|lutris|heroic|gamescope)
|
||||||
|
|
||||||
|
# Fix positioning for steam games
|
||||||
|
# windowrule = center, class:steam_app.*
|
||||||
|
# windowrule = stayfocused, class:steam_app.*
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Float Steam
|
# Float Steam, fullscreen RetroArch
|
||||||
windowrule = float, class:steam
|
# windowrule = float, class:steam
|
||||||
windowrule = center, class:steam, title:Steam
|
# windowrule = center, class:steam, title:Steam
|
||||||
windowrule = opacity 1 1, class:steam
|
windowrule = opacity 1 1, class:steam
|
||||||
windowrule = size 1100 700, class:steam, title:Steam
|
windowrule = size 1100 700, class:steam, title:Steam
|
||||||
windowrule = size 460 800, class:steam, title:Friends List
|
windowrule = size 460 800, class:steam, title:Friends List
|
||||||
143
default/hypr/scripts/omarchy-gaming-helper.sh
Executable file
143
default/hypr/scripts/omarchy-gaming-helper.sh
Executable file
@@ -0,0 +1,143 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Gaming Helper for Hyprland
|
||||||
|
# Runs as a service in the background to perform tasks that can't be accomplished with only
|
||||||
|
# hyprland rules
|
||||||
|
# Usage: omarchy-gaming-helper.sh [--debug]
|
||||||
|
|
||||||
|
DEBUG_MODE=0
|
||||||
|
[[ "$1" == "--debug" ]] && DEBUG_MODE=1
|
||||||
|
|
||||||
|
# Track if we have active games
|
||||||
|
GAMES_ACTIVE=0
|
||||||
|
|
||||||
|
log_debug() {
|
||||||
|
[[ $DEBUG_MODE -eq 1 ]] && gum log --level debug "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
log_info() {
|
||||||
|
gum log --level info "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Monitor Management
|
||||||
|
apply_gaming_scale() {
|
||||||
|
log_info "Applying integer scaling for gaming"
|
||||||
|
|
||||||
|
# Get all monitors and apply integer scaling
|
||||||
|
hyprctl monitors -j | jq -r '.[] | "\(.name) \(.width) \(.height) \(.refreshRate) \(.x) \(.y) \(.scale)"' | \
|
||||||
|
while read -r name width height refresh x y scale; do
|
||||||
|
# Round scale to nearest integer
|
||||||
|
integer_scale=$(awk "BEGIN {printf \"%.0f\", $scale}")
|
||||||
|
|
||||||
|
log_info "Setting $name from scale $scale to $integer_scale"
|
||||||
|
hyprctl keyword monitor "$name,${width}x${height}@${refresh},${x}x${y},$integer_scale"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
restore_monitor_settings() {
|
||||||
|
log_info "Restoring monitor settings"
|
||||||
|
hyprctl reload
|
||||||
|
}
|
||||||
|
|
||||||
|
# Game Detection
|
||||||
|
is_steam_game() {
|
||||||
|
local class="$1"
|
||||||
|
[[ "$class" == steam_app_* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
count_active_games() {
|
||||||
|
hyprctl clients -j | jq -r '[.[] | select(.class | startswith("steam_app_"))] | length'
|
||||||
|
}
|
||||||
|
|
||||||
|
# Event Handlers
|
||||||
|
handle_window_open() {
|
||||||
|
local event="$1"
|
||||||
|
|
||||||
|
# Parse: openwindow>>address,workspace,class,title
|
||||||
|
IFS=',' read -r address workspace class title <<< "${event#openwindow>>}"
|
||||||
|
|
||||||
|
if is_steam_game "$class"; then
|
||||||
|
log_info "Steam game opened: $title ($class)"
|
||||||
|
|
||||||
|
# Apply scaling on first game
|
||||||
|
if [[ $GAMES_ACTIVE -eq 0 ]]; then
|
||||||
|
apply_gaming_scale
|
||||||
|
fi
|
||||||
|
GAMES_ACTIVE=$((GAMES_ACTIVE + 1))
|
||||||
|
|
||||||
|
# Apply fullscreen
|
||||||
|
hyprctl dispatch fullscreenstate 2 2 "address:$address"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
handle_title_change() {
|
||||||
|
local event="$1"
|
||||||
|
|
||||||
|
# Parse: windowtitlev2>>address,title
|
||||||
|
IFS=',' read -r address title <<< "${event#windowtitlev2>>}"
|
||||||
|
address="${address#0x}"
|
||||||
|
|
||||||
|
# Get window class and tags
|
||||||
|
local window_info=$(hyprctl clients -j | jq -r --arg addr "0x$address" \
|
||||||
|
'.[] | select(.address == $addr) | "\(.class) \(.tags)"')
|
||||||
|
|
||||||
|
if [[ -z "$window_info" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -r class tags <<< "$window_info"
|
||||||
|
|
||||||
|
# Handle gamescope windows (Battle.net, etc)
|
||||||
|
if [[ "$class" == "gamescope" ]]; then
|
||||||
|
if [[ "$tags" == *"game"* ]] && [[ "$tags" != *"game-launcher"* ]]; then
|
||||||
|
log_info "Gamescope game detected: $title"
|
||||||
|
hyprctl dispatch fullscreenstate 2 2 "address:0x$address"
|
||||||
|
elif [[ "$tags" == *"game-launcher"* ]]; then
|
||||||
|
log_info "Gamescope launcher detected: $title"
|
||||||
|
hyprctl dispatch fullscreenstate 0 0 "address:0x$address"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
handle_window_close() {
|
||||||
|
local event="$1"
|
||||||
|
local address="${event#closewindow>>}"
|
||||||
|
|
||||||
|
# Count remaining games
|
||||||
|
local remaining_games=$(count_active_games)
|
||||||
|
log_debug "Window closed, remaining games: $remaining_games"
|
||||||
|
|
||||||
|
# Restore settings when last game closes
|
||||||
|
if [[ "$remaining_games" -eq 0 ]] && [[ $GAMES_ACTIVE -gt 0 ]]; then
|
||||||
|
log_info "No games remain, restoring settings"
|
||||||
|
restore_monitor_settings
|
||||||
|
GAMES_ACTIVE=0
|
||||||
|
else
|
||||||
|
GAMES_ACTIVE="$remaining_games"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main Event Loop
|
||||||
|
main() {
|
||||||
|
log_info "Gaming helper started (debug=$DEBUG_MODE)"
|
||||||
|
|
||||||
|
socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | \
|
||||||
|
while read -r event; do
|
||||||
|
log_debug "Event: ${event:0:80}..."
|
||||||
|
|
||||||
|
case "$event" in
|
||||||
|
openwindow*)
|
||||||
|
handle_window_open "$event"
|
||||||
|
;;
|
||||||
|
windowtitlev2*)
|
||||||
|
handle_title_change "$event"
|
||||||
|
;;
|
||||||
|
closewindow*)
|
||||||
|
handle_window_close "$event"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Start
|
||||||
|
main
|
||||||
@@ -9,3 +9,4 @@ windowrule = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned
|
|||||||
|
|
||||||
# App-specific tweaks
|
# App-specific tweaks
|
||||||
source = ~/.local/share/omarchy/default/hypr/apps.conf
|
source = ~/.local/share/omarchy/default/hypr/apps.conf
|
||||||
|
source = ~/.local/share/omarchy/default/hypr/gaming.conf
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if pgrep -f "gpu-screen-recorder" >/dev/null; then
|
if pgrep -x wl-screenrec >/dev/null || pgrep -x wf-recorder >/dev/null; then
|
||||||
echo '{"text": "", "tooltip": "Stop recording", "class": "active"}'
|
echo '{"text": "", "tooltip": "Stop recording", "class": "active"}'
|
||||||
else
|
else
|
||||||
echo '{"text": ""}'
|
echo '{"text": ""}'
|
||||||
|
|||||||
@@ -24,6 +24,6 @@ run_logged $OMARCHY_INSTALL/config/hardware/usb-autosuspend.sh
|
|||||||
run_logged $OMARCHY_INSTALL/config/hardware/ignore-power-button.sh
|
run_logged $OMARCHY_INSTALL/config/hardware/ignore-power-button.sh
|
||||||
run_logged $OMARCHY_INSTALL/config/hardware/nvidia.sh
|
run_logged $OMARCHY_INSTALL/config/hardware/nvidia.sh
|
||||||
run_logged $OMARCHY_INSTALL/config/hardware/fix-f13-amd-audio-input.sh
|
run_logged $OMARCHY_INSTALL/config/hardware/fix-f13-amd-audio-input.sh
|
||||||
run_logged $OMARCHY_INSTALL/config/hardware/fix-apple-bcm43xx.sh
|
run_logged $OMARCHY_INSTALL/config/hardware/fix-apple-bcm4360.sh
|
||||||
run_logged $OMARCHY_INSTALL/config/hardware/fix-apple-spi-keyboard.sh
|
run_logged $OMARCHY_INSTALL/config/hardware/fix-apple-spi-keyboard.sh
|
||||||
run_logged $OMARCHY_INSTALL/config/hardware/fix-apple-t2.sh
|
run_logged $OMARCHY_INSTALL/config/hardware/fix-apple-t2.sh
|
||||||
|
|||||||
5
install/config/hardware/fix-apple-bcm4360.sh
Normal file
5
install/config/hardware/fix-apple-bcm4360.sh
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Install wifi drivers for 2013-2015 MacBooks using the BCM4360 chip
|
||||||
|
if lspci -nnv | grep -A2 "14e4:43a0" | grep -q "106b:"; then
|
||||||
|
echo "Apple BCM4360 detected"
|
||||||
|
sudo pacman -S --noconfirm --needed broadcom-wl dkms linux-headers
|
||||||
|
fi
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
# Install Wi-Fi drivers for Broadcom chips on MacBooks:
|
|
||||||
# - BCM4360 (2013–2015)
|
|
||||||
# - BCM4331 (2012, early 2013)
|
|
||||||
|
|
||||||
pci_info=$(lspci -nnv)
|
|
||||||
|
|
||||||
if echo "$pci_info" | grep -q "106b:" &&
|
|
||||||
(echo "$pci_info" | grep -q "14e4:43a0" || echo "$pci_info" | grep -q "14e4:4331"); then
|
|
||||||
echo "Apple BCM4360 / BCM4331 detected"
|
|
||||||
sudo pacman -S --noconfirm --needed broadcom-wl dkms linux-headers
|
|
||||||
fi
|
|
||||||
@@ -1,12 +1,7 @@
|
|||||||
# Detect MacBook models that need SPI keyboard modules
|
# Detect MacBook models that need SPI keyboard modules
|
||||||
product_name="$(cat /sys/class/dmi/id/product_name 2>/dev/null)"
|
if [[ "$(cat /sys/class/dmi/id/product_name 2>/dev/null)" =~ MacBook12,1|MacBookPro13,[123]|MacBookPro14,[123] ]]; then
|
||||||
if [[ "$product_name" =~ MacBook[89],1|MacBook1[02],1|MacBookPro13,[123]|MacBookPro14,[123] ]]; then
|
|
||||||
echo "Detected MacBook with SPI keyboard"
|
echo "Detected MacBook with SPI keyboard"
|
||||||
|
|
||||||
sudo pacman -S --noconfirm --needed macbook12-spi-driver-dkms
|
sudo pacman -S --noconfirm --needed macbook12-spi-driver-dkms
|
||||||
if [[ "$product_name" == "MacBook8,1" ]]; then
|
echo "MODULES=(applespi intel_lpss_pci spi_pxa2xx_platform)" | sudo tee /etc/mkinitcpio.conf.d/macbook_spi_modules.conf >/dev/null
|
||||||
echo "MODULES=(applespi spi_pxa2xx_platform spi_pxa2xx_pci)" | sudo tee /etc/mkinitcpio.conf.d/macbook_spi_modules.conf >/dev/null
|
|
||||||
else
|
|
||||||
echo "MODULES=(applespi intel_lpss_pci spi_pxa2xx_platform)" | sudo tee /etc/mkinitcpio.conf.d/macbook_spi_modules.conf >/dev/null
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ github-cli
|
|||||||
gnome-calculator
|
gnome-calculator
|
||||||
gnome-keyring
|
gnome-keyring
|
||||||
gnome-themes-extra
|
gnome-themes-extra
|
||||||
gpu-screen-recorder
|
|
||||||
gum
|
gum
|
||||||
gvfs-mtp
|
gvfs-mtp
|
||||||
gvfs-smb
|
gvfs-smb
|
||||||
@@ -114,12 +113,14 @@ unzip
|
|||||||
uwsm
|
uwsm
|
||||||
walker-bin
|
walker-bin
|
||||||
waybar
|
waybar
|
||||||
|
wf-recorder
|
||||||
whois
|
whois
|
||||||
wireless-regdb
|
wireless-regdb
|
||||||
wiremix
|
wiremix
|
||||||
wireplumber
|
wireplumber
|
||||||
wl-clip-persist
|
wl-clip-persist
|
||||||
wl-clipboard
|
wl-clipboard
|
||||||
|
wl-screenrec
|
||||||
woff2-font-awesome
|
woff2-font-awesome
|
||||||
xdg-desktop-portal-gtk
|
xdg-desktop-portal-gtk
|
||||||
xdg-desktop-portal-hyprland
|
xdg-desktop-portal-hyprland
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
echo "Fix Disk Usage and Docker TUIs"
|
|
||||||
|
|
||||||
APP_DIR="$HOME/.local/share/applications"
|
|
||||||
ICON_DIR="$APP_DIR/icons"
|
|
||||||
|
|
||||||
# Don't use omarchy-tui-remove to preserve icons
|
|
||||||
|
|
||||||
if [[ -f "$APP_DIR/Docker.desktop" ]]; then
|
|
||||||
rm "$APP_DIR/Docker.desktop"
|
|
||||||
omarchy-tui-install "Docker" "lazydocker" tile "$ICON_DIR/Docker.png"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f "$APP_DIR/Disk Usage.desktop" ]]; then
|
|
||||||
rm "$APP_DIR/Disk Usage.desktop"
|
|
||||||
omarchy-tui-install "Disk Usage" "bash -c 'dust -r; read -n 1 -s'" float "$ICON_DIR/Disk Usage.png"
|
|
||||||
fi
|
|
||||||
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
echo "Change omarchy-screenrecord to use gpu-screen-recorder"
|
|
||||||
omarchy-pkg-drop wf-recorder wl-screenrec
|
|
||||||
omarchy-pkg-add gpu-screen-recorder
|
|
||||||
Reference in New Issue
Block a user