switch to autorandr, leave warning on display

This commit is contained in:
Nemo 2019-05-07 14:53:23 +05:30
parent bcfa21830a
commit 1fcb64c6a2
2 changed files with 44 additions and 34 deletions

View File

@ -452,39 +452,44 @@ man() {
# Overrides the display provided by imagemagick
function display() {
layout="$1"
if [[ "$1" == "toggle" ]]; then
# exchange it
CURRENT=$(cat ~/.screenlayout/current)
echo "current=$CURRENT"
case "$CURRENT" in
"office")
layout="single"
;;
"single")
layout="office"
;;
esac
fi
echo "layout=$layout"
if [[ "$layout" == "home" ]]; then
xrandr --newmode "2560x1080_60.00" \
230.00 2560 2720 2992 3424 \
1080 1083 1093 1120 -hsync +vsync
xrandr --addmode HDMI1 "2560x1080_60.00"
fi
if [[ -a ~/.screenlayout/$layout.sh ]]; then
`cd ~/.screenlayout && sh $layout.sh`
# Write the current layout
echo $layout > ~/.screenlayout/current
if [[ -e "~/Pictures/$layout.jpg" ]]; then
(cd ~/Pictures && cp "$layout.jpg" "./xin_1.jpg")
fi
sleep 3
nitrogen --restore
i3-msg reload
# dunst doesn't like screensize changes
killall dunst;notify-send "Display Switched"
if [[ `which autorandr` ]]; then
autorandr
else
echo "[warn] Reminder to switch to autorandr"
layout="$1"
if [[ "$1" == "toggle" ]]; then
# exchange it
CURRENT=$(cat ~/.screenlayout/current)
echo "current=$CURRENT"
case "$CURRENT" in
"office")
layout="single"
;;
"single")
layout="office"
;;
esac
fi
echo "layout=$layout"
if [[ "$layout" == "home" ]]; then
xrandr --newmode "2560x1080_60.00" \
230.00 2560 2720 2992 3424 \
1080 1083 1093 1120 -hsync +vsync
xrandr --addmode HDMI1 "2560x1080_60.00"
fi
if [[ -a ~/.screenlayout/$layout.sh ]]; then
`cd ~/.screenlayout && sh $layout.sh`
# Write the current layout
echo $layout > ~/.screenlayout/current
if [[ -e "~/Pictures/$layout.jpg" ]]; then
(cd ~/Pictures && cp "$layout.jpg" "./xin_1.jpg")
fi
sleep 3
nitrogen --restore
i3-msg reload
# dunst doesn't like screensize changes
killall dunst;notify-send "Display Switched"
fi
fi
}

View File

@ -33,6 +33,9 @@ exec i3-msg "workspace $WS1; exec cwdterm.sh"
# Web workspace
exec i3-msg "workspace $WS2; exec firefox-beta"
# Startup figure out monitors
exec autorandr
# Quick switching between workspace is disabled
# Just leads to confusion
workspace_auto_back_and_forth no
@ -258,6 +261,7 @@ bindsym F2 scratchpad show
# Only for Nasc
bindsym $mod+F3 [class="Com.github.parnold-x.nasc"] scratchpad show
# Scratchpad
bindsym $mod+shift+z move scratchpad
@ -274,7 +278,8 @@ bindsym $mod+shift+s move workspace to output right
bindsym $mod+shift+w move workspace to output up
bindsym $mod+shift+x move workspace to output down
bindsym XF86Display exec arandr
bindsym XF86Display exec autorandr
bindsym $mod+F9 exec autorandr
client.focused #4E9C00 #4E9C00 #FFFFFF #FFFFFF
client.focused_inactive #1B3600 #1B3600 #888888 #FFFFFF