mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-05 21:28:48 +00:00
Fix monitor utility not working in debian
This commit is contained in:
parent
4119804683
commit
eb5028e085
|
@ -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}"
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user