aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2021-09-20 13:22:40 +0200
committerKarel Kočí <cynerd@email.cz>2021-09-20 13:35:00 +0200
commitb122ba5087d466c7b2fb41b71f8dee708bec67ec (patch)
tree9b65a59eb9a01ebdd7ba52abe0ad27c809f93883
parenta1ddc8f09f822c991ec93a05bd738f9be2319dfc (diff)
downloadmyconfigs-b122ba5087d466c7b2fb41b71f8dee708bec67ec.tar.gz
myconfigs-b122ba5087d466c7b2fb41b71f8dee708bec67ec.tar.bz2
myconfigs-b122ba5087d466c7b2fb41b71f8dee708bec67ec.zip
Stop using mxrandr and use autorandr
-rw-r--r--config/i3/config15
-rwxr-xr-xinstall1
-rwxr-xr-xlocal/bin/mxrandr119
-rw-r--r--xinitrc2
4 files changed, 4 insertions, 133 deletions
diff --git a/config/i3/config b/config/i3/config
index 71f3bad..7e0144f 100644
--- a/config/i3/config
+++ b/config/i3/config
@@ -97,6 +97,9 @@ bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
+# Detect graphics output
+bindsym $mod+Shift+o exec --no-startup-id autorander --change
+
set $mode_system System (l) lock, (e) logout, (s) suspend, (r) reboot, (Shift+s) shutdown
mode "$mode_system" {
bindsym l exec --no-startup-id loginctl lock-session $XDG_SESSION_ID, mode "default"
@@ -110,18 +113,6 @@ mode "$mode_system" {
}
bindsym $mod+Shift+q mode "$mode_system"
-set $displays (d)efault, toggle: 1:eDP 2:HDMI 3:VGA
-mode "$displays" {
- bindsym d exec --no-startup-id mxrandr, mode "default"
- bindsym 1 exec --no-startup-id mxrandr toggle eDP1, mode "default"
- bindsym 2 exec --no-startup-id mxrandr toggle HDMI1, mode "default"
- bindsym 3 exec --no-startup-id mxrandr toggle VGA1, mode "default"
-
- bindsym Return mode "default"
- bindsym Escape mode "default"
-}
-bindsym $mod+o mode "$displays"
-
set $xshot Xshot: (w)indow or (d)desktop
mode "$xshot" {
# Note: xshot window is for some reason broken.
diff --git a/install b/install
index 6b0ba06..04c96ec 100755
--- a/install
+++ b/install
@@ -91,7 +91,6 @@ if ask "xorg" "Install XOrg (i3)"; then
inst xinitrc ~/.xinitrc
inst Xresources ~/.Xresources
inst config/i3/ ~/.config/i3
- inst local/bin/mxrandr ~/.local/bin/
fi
if ask "wayland" "Install Wayland (sway)"; then
diff --git a/local/bin/mxrandr b/local/bin/mxrandr
deleted file mode 100755
index 81ae511..0000000
--- a/local/bin/mxrandr
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/bin/bash
-
-# get info from xrandr
-connectedOutputs=$(xrandr | grep " connected" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/")
-activeOutput=$(xrandr | grep -E " connected (primary )?[1-9]+" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/")
-disconnectedOutputs=$(xrandr | grep -E " disconnected (primary )?[1-9]+" | awk '{print $1}')
-
-cmd="xrandr "
-cmd_def=$cmd
-
-INTERNAL=eDP-1
-HDMI=HDMI-1
-VGA=VGA-1
-
-for device in "$disconnectedOutputs"; do
- if [ -n "$defice" ]; then
- if [[ "$activeOutput" == *"$device"* ]]; then
- cmd=$cmd" --output $device --off"
- fi
- fi
-done
-
-function only_internal {
- cmd=$cmd" --output $INTERNAL --auto --primary"
- cmd=$cmd" --output $HDMI --off"
- cmd=$cmd" --output $VGA --off"
-}
-
-function internal_vga {
- cmd=$cmd" --output $INTERNAL --auto --primary"
- cmd=$cmd" --output $HDMI --off"
- cmd=$cmd" --output $VGA --auto --right-of $INTERNAL"
-}
-
-function internal_hdmi {
- cmd=$cmd" --output $INTERNAL --auto --right-of $HDMI"
- cmd=$cmd" --output $HDMI --auto --primary"
- cmd=$cmd" --output $VGA --off"
-}
-
-function internal_hdmi_vga {
- cmd=$cmd" --output $INTERNAL --auto --right-of $HDMI"
- cmd=$cmd" --output $HDMI --auto --primary"
- cmd=$cmd" --output $VGA --auto --left-of $HDMI"
-}
-
-function cmd_exec {
- if [ "$cmd" != "$cmd_def" ]; then
- echo $cmd
- `$cmd`
- fi
-}
-
-
-if [ $# -le 1 ]; then
- if [[ "$connectedOutputs" == *"$HDMI"* ]]; then
- if [[ "$connectedOutputs" == *"$VGA"* ]]; then
- internal_hdmi_vga
- else
- internal_hdmi
- fi
- else
- if [[ "$connectedOutputs" == *"$VGA"* ]]; then
- internal_vga
- else
- only_internal
- fi
- fi
- cmd_exec
- exit
-fi
-
-if [ "$2" != "mode" ]; then
- if [[ "$connectedOutputs" != *"$2"* ]]; then
- echo No $2 display known
- exit
- fi
-fi
-
-case "$1" in
- toggle)
- case "$2" in
- $INTERNAL)
- if [[ "$activeOutput" == *"$INTERNAL"* ]]; then
- cmd=$cmd" --output $INTERNAL --off"
- else
- if [[ "$activeOutput" == *"$HDMI"* ]]; then
- cmd=$cmd" --output $INTERNAL --auto --right-of $HDMI"
- else
- cmd=$cmd" --output $INTERNAL --auto --primary"
- fi
- fi
- ;;
- $HDMI)
- if [[ "$activeOutput" == *"$HDMI"* ]]; then
- cmd=$cmd" --output $HDMI --off"
- else
- if [[ "$activeOutput" == *"$VGA"* ]]; then
- cmd=$cmd" --output $HDMI --auto --primary"
- else
- cmd=$cmd" --output $HDMI --auto --right-of $INTERNAL"
- fi
- fi
- ;;
- $VGA)
- if [[ "$activeOutput" == *"$VGA"* ]]; then
- cmd=$cmd" --output $VGA --off"
- else
- if [[ "$activeOutput" == *"$HDMI"* ]]; then
- cmd=$cmd" --output $VGA --auto --left-of $HDMI"
- else
- cmd=$cmd" --output $VGA --auto --right-of $INTERNAL"
- fi
- fi
- ;;
- esac
- ;;
-esac
-cmd_exec
diff --git a/xinitrc b/xinitrc
index 8945c82..6cbf2e0 100644
--- a/xinitrc
+++ b/xinitrc
@@ -26,6 +26,6 @@ if [ -d /etc/X11/xinit/xinitrc.d ] ; then
fi
-mxrandr
+autorandr --change
exec i3