Squashed 'i3/' changes from 1903b20..68180b2

68180b2 Add workspace handling to auto_monitor.sh
f48098c Merge branch 'master' of vcs.murgi.de:dotfiles_fabian/i3config
4c9bf8f VGA config
bda0687 Add Xresources

git-subtree-dir: i3
git-subtree-split: 68180b2a45b48b3da2b09629a90113963ccb4cca
This commit is contained in:
Fabian Ising
2018-05-04 13:46:14 +02:00
parent 630f9e8a6d
commit d1e8697ba6
5 changed files with 227 additions and 16 deletions

104
.Xresources Normal file
View File

@@ -0,0 +1,104 @@
#if __has_include(".extend.Xresources")
#include ".extend.Xresources"
#endif
! ^ The above lines are no comments!
! Leave them as they are if a file ~/.extend.Xresources is being used on your system.
! config can be added there or also here below.
! For comments use "!"
Xft.dpi: 96
Xft.antialias: true
Xft.hinting: true
Xft.rgba: rgb
Xft.autohint: false
Xft.hintstyle: hintslight
Xft.lcdfilter: lcddefault
XTerm*background: #2b2b2b
XTerm*foreground: #e7e7e7
XTerm*pointerColor: #16A085
XTerm*faceName: Input Mono:size=9:antialias=false
XTerm*font: 7x13
#define base00 #282936
#define base01 #3a3c4e
#define base02 #4d4f68
#define base03 #626483
#define base04 #62d6e8
#define base05 #e9e9f4
#define base06 #f1f2f8
#define base07 #f7f7fb
#define base08 #ea51b2
#define base09 #b45bcf
#define base0A #00f769
#define base0B #ebff87
#define base0C #a1efe4
#define base0D #62d6e8
#define base0E #b45bcf
#define base0F #00f769
! URxvt settings
URxvt*font: xft:Input\ Mono:pixelsize=11
URxvt*boldFont: xft:Input\ Mono:pixelsize=11
URxvt*loginShell: true
URxvt*cursorUnderline: false
URxvt*scrollBar: false
URxvt*letterSpace: 1
URxvt*imLocale: en_US.UTF-8
!URxvt*scrollstyle: plain
!URxvt*scrollBar_right: true
URxvt*termName: rxvt
URxvt.buffered: true
URxvt.perl-ext: default,matcher
URxvt.urlLauncher: /bin/firefox
URxvt.matcher.button: 1
URxvt.transparent: False
URxvt.shading: 5
URxvt*foreground: #1abc9c
URxvt*background: #1F2D3A
URxvt*cursorColor: #1abc9c
URxvt*color0: #2c3e50
URxvt*color1: #c0392b
URxvt*color2: #27ae60
URxvt*color3: #f39c12
URxvt*color4: #2980b9
URxvt*color5: #8e44ad
URxvt*color6: #16a085
URxvt*color7: #bdc3c7
URxvt*color8: #34495e
URxvt*color9: #e74c3c
URxvt*color10: #2ecc71
URxvt*color11: #f1c40f
URxvt*color12: #3498db
URxvt*color13: #9b59b6
URxvt*color14: #2AA198
URxvt*color15: #ecf0f1
! Note: colors beyond 15 might not be loaded (e.g., xterm, urxvt),
! use 'shell' template to set these if necessary
URxvt*color16: base09
URxvt*color17: base0F
URxvt*color18: base01
URxvt*color19: base02
URxvt*color20: base04
URxvt*color21: base06
URxvt*keysym.Shift-Control-V: perl:clipboard:paste
URxvt*iso14755: False
URxvt*perl-ext-common: default,clipboard
! ------------------------------------------------------------------------------
! ROFI Color theme
! ------------------------------------------------------------------------------
rofi.color-enabled: true
rofi.color-window: #273238, #273238, #1e2529
rofi.color-normal: #273238, #c1c1c1, #273238, #394249, #ffffff
rofi.color-active: #273238, #80cbc4, #273238, #394249, #80cbc4
rofi.color-urgent: #273238, #ff1844, #273238, #394249, #ff1844

View File

@@ -10,13 +10,53 @@
set -e
HDMI_STATUS=$(</sys/class/drm/card0/card0-HDMI-A-1/status )
HDMI2_STATUS=$(</sys/class/drm/card0/card0-HDMI-A-2/status )
DP_STATUS=$(</sys/class/drm/card0/card0-DP-1/status )
I3CONFIG=/home/fabian/i3/i3config
echo "Rule run" >> /tmp/udev_test
OUT2="eDP-1"
if [ "connected" == "$HDMI_STATUS" ]; then
xrandr >> /tmp/udev_test
/usr/bin/xrandr --output eDP-1 --auto --left-of HDMI-1
/usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "HDMI plugged in"
/usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "HDMI-1 plugged in"
echo "HDMI connected" >> /tmp/udev_test
xrandr >> /tmp/udev_test
OUT2="HDMI-1"
else
/usr/bin/xrandr --output HDMI-1 --off
/usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "External monitor disconnected"
exit
/usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "External monitor (HDMI-1) disconnected"
echo "HDMI disconnected" >> /tmp/udev_test
fi
if [ "connected" == "$HDMI2_STATUS" ]; then
xrandr >> /tmp/udev_test
/usr/bin/xrandr --output eDP-1 --auto --left-of HDMI-2
/usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "HDMI-2 plugged in"
echo "HDMI-2 connected" >> /tmp/udev_test
xrandr >> /tmp/udev_test
OUT2="HDMI-2"
else
/usr/bin/xrandr --output HDMI-2 --off
/usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "External monitor (HDMI-2) disconnected"
echo "HDMI disconnected" >> /tmp/udev_test
fi
if [ "connected" == "$DP_STATUS" ]; then
xrandr >> /tmp/udev_test
/usr/bin/xrandr --output eDP-1 --auto --right-of DP-1
/usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "DP-1 plugged in"
echo "DP connected" >> /tmp/udev_test
xrandr >> /tmp/udev_test
OUT2="DP-1"
else
/usr/bin/xrandr --output DP-1 --off
/usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "External monitor (DP-1) disconnected"
echo "DP disconnected" >> /tmp/udev_test
fi
sed 's/^set\s\s*$OUTPUT_EVEN\s.*/set $OUTPUT_EVEN '$OUT2'/' -i "$I3CONFIG"
i3-msg [workspace=2] move workspace to output $OUT2
i3-msg [workspace=4] move workspace to output $OUT2
i3-msg [workspace=6] move workspace to output $OUT2
i3-msg reload

View File

@@ -8,6 +8,8 @@
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
set $OUTPUT_ODD eDP-1
set $OUTPUT_EVEN eDP-1
set $mod Mod4
@@ -106,15 +108,25 @@ bindsym $mod+0 workspace 10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+ctrl+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+ctrl+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+ctrl+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+ctrl+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+ctrl+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+ctrl+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+ctrl+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+ctrl+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+ctrl+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
bindsym $mod+ctrl+0 move container to workspace 10
# reload the configuration file
bindsym $mod+Shift+c exec "i3-msg reload && /usr/bin/notify-send -t 5000 --urgency=low 'Reload' 'Reloaded i3 config'"
@@ -150,6 +162,16 @@ mode "resize" {
bindsym $mod+r mode "resize"
mode "moveit" {
bindsym Up move up 20px
bindsym Left move left 20px
bindsym Down move down 20px
bindsym Right move right 20px
bindsym $mod+m mode "default"
bindsym Escape mode "default"
}
bindsym $mod+m focus floating; mode "moveit"
# Sound
bindsym XF86AudioRaiseVolume exec --no-startup-id amixer set Master 5%+ unmute
bindsym XF86AudioLowerVolume exec --no-startup-id amixer set Master 5%- unmute
@@ -195,11 +217,16 @@ hide_edge_borders both
# Change monitor mirroring
bindsym XF86Display exec --no-startup-id "/usr/local/bin/switch_monitors.sh"
bindsym Shift+XF86Display exec --no-startup-id "/usr/local/bin/switch_monitors.sh mirror"
# pdfpc
assign [class="Pdfpc" window_role="presenter"] 1
assign [class="Pdfpc" window_role="presentation"] 2
# multi monitor
workspace 1 output eDP-1
workspace 2 output HDMI-1
workspace 1 output $OUTPUT_ODD
workspace 2 output $OUTPUT_EVEN
workspace 3 output $OUTPUT_ODD
workspace 4 output $OUTPUT_EVEN
workspace 5 output $OUTPUT_ODD
workspace 6 output $OUTPUT_EVEN

View File

@@ -8,9 +8,10 @@
mkdir -p $HOME/.config/i3
mkdir -p $HOME/.config/polybar
ln -s $PWD/i3config ~/.config/i3/config
ln -s $PWD/polybarconfig ~/.config/polybar/config
ln -s $PWD/.xinitrc ~/.xinitrc
ln -Ts $PWD/i3config ~/.config/i3/config
ln -Ts $PWD/polybarconfig ~/.config/polybar/config
ln -Ts $PWD/.xinitrc ~/.xinitrc
ln -Ts $PWD/.Xresources ~/.Xresources
while true; do
read -p "Is this your laptop? [y/n]" yn
case $yn in
@@ -19,6 +20,6 @@ while true; do
* ) echo "Please answer yes or no.";;
esac
done
sudo ln -s $PWD/auto_monitor.sh /usr/local/bin/auto_monitor.sh
sudo ln -s $PWD/switch_monitors.sh /usr/local/bin/switch_monitors.sh
sudo ln -s $PWD/98-monitor-hotplug.rules /etc/udev/rules.d/98-monitor-hotplug.rules
sudo ln -Ts $PWD/auto_monitor.sh /usr/local/bin/auto_monitor.sh
sudo ln -Ts $PWD/switch_monitors.sh /usr/local/bin/switch_monitors.sh
sudo ln -Ts $PWD/98-monitor-hotplug.rules /etc/udev/rules.d/98-monitor-hotplug.rules

View File

@@ -11,6 +11,9 @@ HDMI_STATUS=$(</sys/class/drm/card0/card0-HDMI-A-1/status )
HDMI_ENABLED=$(</sys/class/drm/card0/card0-HDMI-A-1/enabled)
DP_STATUS=$(</sys/class/drm/card0/card0-DP-1/status )
DP_ENABLED=$(</sys/class/drm/card0/card0-DP-1/enabled )
# Check to see if our state log exists
if [ ! -f /tmp/monitor ]; then
touch /tmp/monitor
@@ -22,15 +25,41 @@ fi
# The state log has the NEXT state to go to in it
# If monitors are disconnected, stay in state 1
if [ "disconnected" == "$HDMI_STATUS" -a "disconnected" == "$VGA_STATUS" ]; then
STATE=1
if [ "disconnected" == "$HDMI_STATUS" -a "disconnected" == "$DP_STATUS" ]; then
STATE=5
fi
if [ $1 == "mirror" ]; then
if [ $STATE == 4 ]; then
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Mirror Stuff from $STATE to 5"
# eDP-1 is on, projectors are mirroring
if [ "connected" == "$HDMI_STATUS" ]; then
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --auto --same-as eDP-1
TYPE="HDMI"
elif [ "connected" == "$DP_STATUS" ]; then
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --off --output DP-1 --auto --same-as eDP-1
TYPE="DP-1"
fi
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Switched to $TYPE mirroring"
STATE=5
else
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Mirror Stuff from $STATE to 4"
# eDP-1 is on, projectors are extending
if [ "connected" == "$HDMI_STATUS" ]; then
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --auto --right-of eDP-1
TYPE="HDMI"
elif [ "connected" == "$DP_STATUS" ]; then
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --off --output DP-1 --auto --left-of eDP-1
TYPE="DP-1"
fi
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Switched to $TYPE extending"
STATE=4
fi
else
TYPE="eDP-1"
case $STATE in
1)
# eDP-1 is on, projectors not connected
/usr/bin/xrandr --output eDP-1 --auto
TYPE="eDP-1"
STATE=2
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Switched to $TYPE"
;;
@@ -46,6 +75,9 @@ case $STATE in
if [ "connected" == "$HDMI_STATUS" ]; then
/usr/bin/xrandr --output eDP-1 --off --output HDMI-1 --auto
TYPE="HDMI"
elif [ "connected" == "$DP_STATUS" ]; then
/usr/bin/xrandr --output eDP-1 --off --output HDMI-1 --off --output DP-1 --auto
TYPE="DP-1"
fi
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Switched to $TYPE"
STATE=4
@@ -53,8 +85,11 @@ case $STATE in
4)
# eDP-1 is on, projectors are mirroring
if [ "connected" == "$HDMI_STATUS" ]; then
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --auto
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --auto --same-as eDP-1
TYPE="HDMI"
elif [ "connected" == "$DP_STATUS" ]; then
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --off --output DP-1 --auto --same-as eDP-1
TYPE="DP-1"
fi
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Switched to $TYPE mirroring"
STATE=5
@@ -64,6 +99,9 @@ case $STATE in
if [ "connected" == "$HDMI_STATUS" ]; then
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --auto --right-of eDP-1
TYPE="HDMI"
elif [ "connected" == "$DP_STATUS" ]; then
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --off --output DP-1 --auto --left-of eDP-1
TYPE="DP-1"
fi
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Switched to $TYPE extending"
STATE=2
@@ -72,5 +110,6 @@ case $STATE in
# Unknown state, assume we're in 1
STATE=1
esac
fi
echo $STATE > /tmp/monitor