From d1e8697ba619ce14cbc0580da0d607e5ccff8c72 Mon Sep 17 00:00:00 2001 From: Fabian Ising Date: Fri, 4 May 2018 13:46:14 +0200 Subject: [PATCH] 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 --- .Xresources | 104 +++++++++++++++++++++++++++++++++++++++++++++ auto_monitor.sh | 46 ++++++++++++++++++-- i3config | 31 +++++++++++++- link_config.sh | 13 +++--- switch_monitors.sh | 49 ++++++++++++++++++--- 5 files changed, 227 insertions(+), 16 deletions(-) create mode 100644 .Xresources diff --git a/.Xresources b/.Xresources new file mode 100644 index 0000000..8d04cfe --- /dev/null +++ b/.Xresources @@ -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 diff --git a/auto_monitor.sh b/auto_monitor.sh index 398a42f..e138d57 100755 --- a/auto_monitor.sh +++ b/auto_monitor.sh @@ -10,13 +10,53 @@ set -e HDMI_STATUS=$(> /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 diff --git a/i3config b/i3config index 0b7e8cd..2b5af76 100644 --- a/i3config +++ b/i3config @@ -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 diff --git a/link_config.sh b/link_config.sh index 4e22ac7..bc0eebd 100755 --- a/link_config.sh +++ b/link_config.sh @@ -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 diff --git a/switch_monitors.sh b/switch_monitors.sh index 15be527..01a5a94 100755 --- a/switch_monitors.sh +++ b/switch_monitors.sh @@ -11,6 +11,9 @@ HDMI_STATUS=$( /tmp/monitor