Skip to content

Commit

Permalink
update monitor scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
klpod221 committed Nov 2, 2023
1 parent b0b2413 commit 2a95c3e
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 21 deletions.
6 changes: 6 additions & 0 deletions configs/.config/hypr/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"monitor": {
"primary_position": "right",
"scale": [1, 1]
}
}
1 change: 1 addition & 0 deletions configs/.config/hypr/hyprland.conf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ exec-once = wl-paste --type text --watch cliphist store # clipboard store text d
exec-once = wl-paste --type image --watch cliphist store # clipboard store image data
exec-once = ~/.config/hypr/scripts/swwwallpaper.sh # start wallpaper daemon
exec-once = ~/.config/hypr/scripts/batterynotify.sh # battery notification
exec-once = ~/.config/hypr/scripts/autodetectmonitors.sh # auto detect monitor
exec-once = fcitx5 # start fcitx5


Expand Down
20 changes: 0 additions & 20 deletions configs/.config/hypr/monitors.conf
Original file line number Diff line number Diff line change
@@ -1,22 +1,2 @@

# █▀▄▀█ █▀█ █▄░█ █ ▀█▀ █▀█ █▀█ █▀
# █░▀░█ █▄█ █░▀█ █ ░█░ █▄█ █▀▄ ▄█


# See https://wiki.hyprland.org/Configuring/Monitors/

# monitor = ,preferred,auto,auto
monitor = HDMI-A-1, 1920x1080, 0x0, 1
monitor = eDP-1, 1920x1080, 1920x0, 1


# █▀▄▀█ █ █▀ █▀▀
# █░▀░█ █ ▄█ █▄▄


# See https://wiki.hyprland.org/Configuring/Variables/ for more

misc {
vrr = 0
}

Empty file modified configs/.config/hypr/scripts/amdgpu.py
100644 → 100755
Empty file.
58 changes: 58 additions & 0 deletions configs/.config/hypr/scripts/autodetectmonitors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

list=$(xrandr --query | sed '1d' | awk -F'connected' '{print $1}')
monitor_name=$(xrandr --query | grep " connected" | awk '{print $1}')

monitor=()

for i in ${list}; do
# if i is monitor name
for j in ${monitor_name}; do
if [[ "${i}" == "${j}" ]]; then
monitor+=("${i}")
break
fi
done

# if i is resolution
if [[ "${i}" =~ ^[0-9]+x[0-9]+$ ]]; then
monitor[-1]+=" ${i}"
continue
fi

i=$(echo "${i}" | sed 's/*//g' | sed 's/+//g' | awk '{printf "%.0f", $1}')
# if i is number and != 0
if [[ "${i}" =~ ^[0-9]+$ ]] && [[ "${i}" != "0" ]]; then
monitor[-1]+="@${i}"
fi
done

hyprland_monitor=()
primary_pos="right"

for i in "${monitor[@]}"; do
hyprland_monitor+=("monitor = ")
hyprland_monitor[-1]+=$(echo "${i}" | awk -F' ' '{print $1}')
hyprland_monitor[-1]+=", "
hyprland_monitor[-1]+=$(echo "${i}" | awk -F' ' '{print $2}')
hyprland_monitor[-1]+=", "
# if monitor is eDP-* (laptop monitor) and primary_pos is "left" or "right"
if [[ "${i}" =~ ^(eDP-).*$ ]]; then
if [[ "${primary_pos}" == "left" ]]; then
hyprland_monitor[-1]+="0x0, "
elif [[ "${primary_pos}" == "right" ]]; then
hyprland_monitor[-1]+="1920x0, "
fi
else
hyprland_monitor[-1]+="0x0, "
fi

hyprland_monitor[-1]+="1"
done

monitor_config_file="${HOME}/.config/hypr/monitors.conf"
echo "" > "${monitor_config_file}"

for i in "${hyprland_monitor[@]}"; do
echo "${i}" >> "${monitor_config_file}"
done
Empty file modified configs/.config/hypr/scripts/batterynotify.sh
100644 → 100755
Empty file.
Empty file modified configs/.config/hypr/scripts/sddmwall.sh
100644 → 100755
Empty file.
Empty file modified configs/.config/hypr/scripts/wallbashdunst.sh
100644 → 100755
Empty file.
Empty file modified configs/.config/hypr/scripts/wallbashkvm.sh
100644 → 100755
Empty file.
Empty file modified configs/.config/hypr/scripts/wallbashspotify.sh
100644 → 100755
Empty file.
1 change: 0 additions & 1 deletion configs/.config/hypr/userprefs.conf
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,3 @@ bind = CTRL Alt_L, V, submap, passthrough
submap = passthrough
bind = CTRL Alt_L, V, submap, reset
submap = reset

0 comments on commit 2a95c3e

Please sign in to comment.