Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
linux-config
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Walmes Marques Zeviani
linux-config
Commits
16af9add
Commit
16af9add
authored
1 year ago
by
Walmes Marques Zeviani
Browse files
Options
Downloads
Patches
Plain Diff
Adiciona script para rotacionar os monitores.
parent
7f807fcb
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
rotate_monitors.sh
+77
-0
77 additions, 0 deletions
rotate_monitors.sh
with
77 additions
and
0 deletions
rotate_monitors.sh
0 → 100644
+
77
−
0
View file @
16af9add
#!/bin/bash
#---- Feito com ChatGPT ------------------------------------------------
#
# Crie instruções em bash para o terminal do Linux para eu fazer a
# rotação dos monitores. Eu quero 4 configurações.
#
# 1. Normal: os dois monitores então na orientação normal.
# 2. HDMI-1 rotacionado para direita.
# 3. HDMI-2 rotacionado para a esquerda.
# 4. HDMI-1 rotacionado para direita e HDMI-2 rotacionado para a
# esquerda.
#
# No começo do script faça com que usuário forneça o número para a
# configuração desejada e aplique conforme informado.
#
# Quando o usuário chamar o script com -h ou --help, retorne a
# documentação para que ele possa compreender como usar.
#
#-----------------------------------------------------------------------
# echo "Monitores disponíveis."
# xrandr --listactivemonitors
# Função para exibir a ajuda
show_help
()
{
cat
<<
EOF
Usage:
${
0
##*/
}
[-h|--help] [OPTION]
Rotate dual monitors to the desired orientation.
Options:
1 Set both monitors to normal orientation.
2 Rotate HDMI-1 to the right.
3 Rotate HDMI-2 to the left.
4 Rotate HDMI-1 to the right and HDMI-2 to the left.
-h, --help Display this help and exit.
EOF
}
# Função para aplicar a configuração
apply_config
()
{
case
$1
in
1
)
xrandr
--output
HDMI-1
--rotate
normal
--output
HDMI-2
--rotate
normal
;;
2
)
xrandr
--output
HDMI-1
--rotate
right
--output
HDMI-2
--rotate
normal
;;
3
)
xrandr
--output
HDMI-1
--rotate
normal
--output
HDMI-2
--rotate
left
;;
4
)
xrandr
--output
HDMI-1
--rotate
right
--output
HDMI-2
--rotate
left
;;
*
)
echo
"Option not recognized."
show_help
;;
esac
}
# Verifique se foi passado o argumento -h ou --help
if
[[
$1
==
"-h"
||
$1
==
"--help"
]]
;
then
show_help
exit
0
fi
# Verifica se foi passado algum argumento
if
[
$#
-eq
0
]
;
then
echo
"No options were passed. Use -h or --help for usage information."
exit
1
fi
# Chama a função para aplicar a configuração com o argumento passado
apply_config
"
$1
"
#-----------------------------------------------------------------------
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment