Fix monitor utility not working in debian

This commit is contained in:
JEEVITHA KANNAN K S 2024-08-16 12:16:31 +05:30
parent 4119804683
commit eb5028e085
No known key found for this signature in database
GPG Key ID: 5904C34A2F7CE333
9 changed files with 23 additions and 24 deletions

View File

@ -5,7 +5,7 @@
# Function to change monitor orientation
change_orientation() {
monitor_list=$(detect_connected_monitors)
IFS=$'\n' read -r -d '' -a monitor_array <<<"$monitor_list"
IFS=$'\n' read -r -a monitor_array <<<"$monitor_list"
clear
echo -e "${BLUE}=========================================${RESET}"

View File

@ -13,7 +13,7 @@ CYAN='\033[36m'
# Function to disable a monitor
disable_monitor() {
monitor_list=$(detect_connected_monitors)
IFS=$'\n' read -r -d '' -a monitor_array <<<"$monitor_list"
IFS=$'\n' read -r -a monitor_array <<<"$monitor_list"
clear
echo -e "${BLUE}=========================================${RESET}"

View File

@ -13,7 +13,7 @@ CYAN='\033[36m'
# Function to enable a monitor
enable_monitor() {
monitor_list=$(detect_connected_monitors)
IFS=$'\n' read -r -d '' -a monitor_array <<<"$monitor_list"
IFS=$'\n' read -r -a monitor_array <<<"$monitor_list"
clear
echo -e "${BLUE}=========================================${RESET}"

View File

@ -5,7 +5,7 @@
# Function to manage monitor arrangement
manage_arrangement() {
monitor_list=$(detect_connected_monitors)
IFS=$'\n' read -r -d '' -a monitor_array <<<"$monitor_list"
IFS=$'\n' read -r -a monitor_array <<<"$monitor_list"
clear
echo -e "${BLUE}=========================================${RESET}"

View File

@ -9,7 +9,7 @@ reset_scaling() {
echo -e "${BLUE}=========================================${RESET}"
monitor_list=$(detect_connected_monitors)
IFS=$'\n' read -r -d '' -a monitor_array <<<"$monitor_list"
IFS=$'\n' read -r -a monitor_array <<<"$monitor_list"
for monitor in "${monitor_array[@]}"; do
echo -e "${CYAN}Resetting scaling for $monitor to 1x1 (native resolution)${RESET}"

View File

@ -9,7 +9,7 @@ scale_monitors() {
echo -e "${BLUE}=========================================${RESET}"
monitor_list=$(detect_connected_monitors)
IFS=$'\n' read -r -d '' -a monitor_array <<<"$monitor_list"
IFS=$'\n' read -r -a monitor_array <<<"$monitor_list"
# Get the highest resolution among all monitors
max_width=0

View File

@ -5,7 +5,7 @@
# Function to set a monitor as primary
set_primary_monitor() {
monitor_list=$(detect_connected_monitors)
IFS=$'\n' read -r -d '' -a monitor_array <<<"$monitor_list"
IFS=$'\n' read -r -a monitor_array <<<"$monitor_list"
clear
echo -e "${BLUE}=========================================${RESET}"

View File

@ -13,7 +13,7 @@ CYAN='\033[36m'
# Function to set resolutions
set_resolutions() {
monitor_list=$(detect_connected_monitors)
IFS=$'\n' read -r -d '' -a monitor_array <<<"$monitor_list"
IFS=$'\n' read -r -a monitor_array <<<"$monitor_list"
while true; do
clear

View File

@ -7,15 +7,15 @@ setup_xrandr() {
echo "Install xrandr if not already installed..."
if ! command_exists xrandr; then
case ${PACKAGER} in
pacman)
sudo "${PACKAGER}" -S --noconfirm xorg-xrandr
;;
apt-get)
sudo "${PACKAGER}" install -y x11-xserver-utils
;;
*)
sudo "${PACKAGER}" install -y xorg-x11-server-utils
;;
pacman)
sudo "${PACKAGER}" -S --noconfirm xorg-xrandr
;;
apt-get)
sudo "${PACKAGER}" install -y x11-xserver-utils
;;
*)
sudo "${PACKAGER}" install -y xorg-x11-server-utils
;;
esac
else
echo "xrandr is already installed."
@ -27,11 +27,11 @@ colored_echo() {
local color=$1
local text=$2
case $color in
red) echo -e "\033[31m$text\033[0m" ;;
green) echo -e "\033[32m$text\033[0m" ;;
yellow) echo -e "\033[33m$text\033[0m" ;;
blue) echo -e "\033[34m$text\033[0m" ;;
*) echo "$text" ;;
red) echo -e "\033[31m$text\033[0m" ;;
green) echo -e "\033[32m$text\033[0m" ;;
yellow) echo -e "\033[33m$text\033[0m" ;;
blue) echo -e "\033[34m$text\033[0m" ;;
*) echo "$text" ;;
esac
}
@ -40,9 +40,8 @@ check_display_server() {
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
colored_echo "red" "You are using Wayland."
colored_echo "red" "This script is designed for X11. It may not work correctly on Wayland."
read -p "Do you want to continue anyway? (y/n): " response
if [[ ! "$response" =~ ^[Yy]$ ]]; then
if ! confirm_action "Do you want to continue anyway?"; then
echo "Exiting script."
exit 1
fi