Merge commit '1d94a73b6f9a1613cf82406159f17c38aca87ac6'

This commit is contained in:
murgi
2017-05-24 17:39:04 +02:00
6 changed files with 154 additions and 46 deletions

View File

@@ -0,0 +1 @@
KERNEL=="card0", SUBSYSTEM=="drm", ACTION=="change", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/fabian/.Xauthority", RUN+="/bin/bash /usr/local/bin/auto_monitor.sh"

22
i3/auto_monitor.sh Executable file
View File

@@ -0,0 +1,22 @@
#! /bin/sh
#
# monitors.sh
# Copyright (C) 2017 Fabian Ising <fabian@murgi.de>
#
# Distributed under terms of the Apache v2.0 license.
#
# Get out of town if something errors
set -e
HDMI_STATUS=$(</sys/class/drm/card0/card0-HDMI-A-1/status )
if [ "connected" == "$HDMI_STATUS" ]; then
/usr/bin/xrandr --output eDP-1 --auto --left-of HDMI-1
/usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "HDMI plugged in"
else
/usr/bin/xrandr --output HDMI-1 --off
/usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "External monitor disconnected"
exit
fi

View File

@@ -117,7 +117,8 @@ bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10 bindsym $mod+Shift+0 move container to workspace 10
# reload the configuration file # reload the configuration file
bindsym $mod+Shift+c reload bindsym $mod+Shift+c exec "i3-msg reload && /usr/bin/notify-send -t 5000 --urgency=low 'Reload' 'Reloaded i3 config'"
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) # restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session) # exit i3 (logs you out of your X session)
@@ -150,9 +151,9 @@ mode "resize" {
bindsym $mod+r mode "resize" bindsym $mod+r mode "resize"
# Sound # Sound
bindsym XF86AudioRaiseVolume exec amixer set Master 5%+ unmute bindsym XF86AudioRaiseVolume exec --no-startup-id amixer set Master 5%+ unmute
bindsym XF86AudioLowerVolume exec amixer set Master 5%- unmute bindsym XF86AudioLowerVolume exec --no-startup-id amixer set Master 5%- unmute
bindsym XF86AudioMute exec amixer set Master 1+ toggle bindsym XF86AudioMute exec "amixer set Master 1+ toggle && amixer -c 0 set IEC958 1+ toggle"
#Rofi #Rofi
bindsym $mod+d exec --no-startup-id "rofi -show drun" bindsym $mod+d exec --no-startup-id "rofi -show drun"
@@ -162,7 +163,7 @@ bindsym Mod1+Tab exec --no-startup-id "rofi -show window"
bindsym Mod1+F2 exec --no-startup-id "rofi -show run" bindsym Mod1+F2 exec --no-startup-id "rofi -show run"
#Lock #Lock
bindsym $mod+Escape exec --no-startup-id "i3lock -c 000000 -f" bindsym $mod+Escape exec --no-startup-id "i3lock -d -c 000000 -f"
# Start i3bar to display a workspace bar (plus the system information i3status # Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available) # finds out, if available)
@@ -179,7 +180,7 @@ exec --no-startup-id "polybar bottom"
exec --no-startup-id "xfsettingsd" exec --no-startup-id "xfsettingsd"
exec --no-startup-id "xfce4-power-manager" exec --no-startup-id "xfce4-power-manager"
exec --no-startup-id "owncloud" exec --no-startup-id "owncloud"
exec --no-startup-id "caffeine" #exec --no-startup-id "caffeine"
#Colors #Colors
# class border backgr. text indicator child_border # class border backgr. text indicator child_border
@@ -191,3 +192,14 @@ client.focused_inactive #222222 #222222 #a9a9a9 #222222
client.urgent #4A4A4A #4A4A4A #f7f7f7 #4A4A4A client.urgent #4A4A4A #4A4A4A #f7f7f7 #4A4A4A
hide_edge_borders both hide_edge_borders both
# Change monitor mirroring
bindsym XF86Display exec --no-startup-id "/usr/local/bin/switch_monitors.sh"
# 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

View File

@@ -1,10 +1,13 @@
#! /bin/sh #! /bin/sh
# #
# link_config.sh # link_config.sh
# Copyright (C) 2016 fabian <fabian@testvm> # Copyright (C) 2016 fabian <fabian@tmurgi.de>
# #
# Distributed under terms of the MIT license. # Distributed under terms of the MIT license.
# #
ln -s $PWD/i3config ~/.config/i3/config ln -s $PWD/i3config ~/.config/i3/config
ln -s $PWD/polybarconfig ~/.config/polybar/config ln -s $PWD/polybarconfig ~/.config/polybar/config
ln -s $PWD/.xinitrc ~/.xinitrc ln -s $PWD/.xinitrc ~/.xinitrc
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

View File

@@ -8,29 +8,8 @@
;===================================================== ;=====================================================
[colors] [colors]
color15_i3wmthemer = ${xrdb:color15}
color14_i3wmthemer = ${xrdb:color14}
color13_i3wmthemer = ${xrdb:color13}
color12_i3wmthemer = ${xrdb:color12}
color11_i3wmthemer = ${xrdb:color11}
color10_i3wmthemer = ${xrdb:color10}
color09_i3wmthemer = ${xrdb:color9}
color08_i3wmthemer = ${xrdb:color8}
color07_i3wmthemer = ${xrdb:color7}
color06_i3wmthemer = ${xrdb:color6}
color05_i3wmthemer = ${xrdb:color5}
color04_i3wmthemer = ${xrdb:color4}
color03_i3wmthemer = ${xrdb:color3}
color02_i3wmthemer = ${xrdb:color2}
color01_i3wmthemer = ${xrdb:color1}
color00_i3wmthemer = ${xrdb:color0}
foreground_i3wmthemer = ${xrdb:foreground}
background_i3wmthemer = ${xrdb:background}
;background = ${xrdb:color0:#222}
background = #222 background = #222
background-alt = #444 background-alt = #444
;foreground = ${xrdb:color7:#222}
foreground = #dfdfdf foreground = #dfdfdf
foreground-alt = #555 foreground-alt = #555
primary = #ffb52a primary = #ffb52a
@@ -38,7 +17,8 @@ secondary = #e60053
alert = #bd2c40 alert = #bd2c40
[bar/top] [bar/top]
;monitor = ${env:MONITOR:HDMI-1} monitor = eDP-1
monitor-fallback = HDMI-1
width = 100% width = 100%
height = 27 height = 27
;offset-x = 1% ;offset-x = 1%
@@ -67,10 +47,13 @@ module-margin-right = 2
font-0 = fixed:pixelsize=10;1 font-0 = fixed:pixelsize=10;1
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0 font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = MaterialIcons:antialias=false;pixelsize=10;1 font-2 = MaterialIcons:antialias=false;pixelsize=10;1
font-3 = PowerlineSymbols:size=10;1
font-4 = FontAwesome:pixelsize=12
modules-left = i3 modules-left = i3
modules-center = date modules-center = date
modules-right = filesystem xkeyboard volume temperature powermenu modules-right = filesystem xkeyboard volume powermenu
;tray-position = ;tray-position =
;tray-padding = 2 ;tray-padding = 2
@@ -107,6 +90,8 @@ modules-right = filesystem xkeyboard volume temperature powermenu
;time-alt = %H:%M:%S ;time-alt = %H:%M:%S
[bar/bottom] [bar/bottom]
monitor = eDP-1
monitor-fallback = HDMI-1
width = 100% width = 100%
height = 27 height = 27
fixed-center = true fixed-center = true
@@ -121,7 +106,7 @@ line-color = #f00
border-size = 4 border-size = 4
border-color = #00000000 border-color = #00000000
padding-left = 0 padding-left = 2
padding-right = 2 padding-right = 2
module-margin-left = 1 module-margin-left = 1
@@ -130,11 +115,14 @@ module-margin-right = 2
font-0 = fixed:pixelsize=10;1 font-0 = fixed:pixelsize=10;1
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0 font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = MaterialIcons:pixelsize=10;1 font-2 = MaterialIcons:pixelsize=10;1
font-3 = PowerlineSymbols:pixelsize=12
font-4 = FontAwesome:pixelsize=12
;modules-left = bspwm i3 ;modules-left = bspwm i3
;modules-right = i3 ;modules-right = i3
modules-center = memory cpu modules-center = memory cpu
modules-left = battery modules-right = temperature
modules-left = battery backlight-acpi
tray-position = right tray-position = right
tray-padding = 2 tray-padding = 2
@@ -248,7 +236,7 @@ type = internal/xbacklight
format = <label> <bar> format = <label> <bar>
label = BL label = BL
bar-width = 10 bar-width = 20
bar-indicator = | bar-indicator = |
bar-indicator-foreground = #ff bar-indicator-foreground = #ff
bar-indicator-font = 2 bar-indicator-font = 2
@@ -267,7 +255,7 @@ card = intel_backlight
[module/cpu] [module/cpu]
type = internal/cpu type = internal/cpu
interval = 2 interval = 2
format-prefix = "cpu " format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt} format-prefix-foreground = ${colors.foreground-alt}
format-underline = #f90000 format-underline = #f90000
label = %percentage%% label = %percentage%%
@@ -358,11 +346,12 @@ date-alt = " %Y-%m-%d"
time = %H:%M:%S time = %H:%M:%S
time-alt = %H:%M:%S time-alt = %H:%M:%S
format-prefix = format-prefix =
format-prefix-foreground = ${colors.foreground-alt} format-prefix-foreground = ${colors.foreground-alt}
format-underline = #0a6cf5 format-underline = #0a6cf5
label = %date% %time% label = %date% %time%
[module/volume] [module/volume]
type = internal/volume type = internal/volume
@@ -370,7 +359,7 @@ format-volume = <label-volume> <bar-volume>
label-volume = VOL label-volume = VOL
label-volume-foreground = ${root.foreground} label-volume-foreground = ${root.foreground}
format-muted-prefix = "" format-muted-prefix = ""
format-muted-foreground = ${colors.foreground} format-muted-foreground = ${colors.foreground}
label-muted = " sound muted" label-muted = " sound muted"
@@ -403,18 +392,21 @@ format-charging-underline = #ffb52a
format-discharging = <ramp-capacity> <label-discharging> format-discharging = <ramp-capacity> <label-discharging>
format-discharging-underline = ${self.format-charging-underline} format-discharging-underline = ${self.format-charging-underline}
format-full-prefix = " " format-full-prefix =""
format-full-prefix-foreground = ${colors.foreground-alt} format-full-prefix-foreground = ${colors.foreground-alt}
format-full-underline = ${self.format-charging-underline} format-full-underline = ${self.format-charging-underline}
ramp-capacity-0 = ramp-capacity-0 =
ramp-capacity-1 =  ramp-capacity-0-foreground = ${colors.alert}
ramp-capacity-2 = ramp-capacity-1 =
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-foreground = ${colors.foreground-alt} ramp-capacity-foreground = ${colors.foreground-alt}
animation-charging-0 = animation-charging-0 =
animation-charging-1 = animation-charging-1 =
animation-charging-2 = animation-charging-2 =
animation-charging-3 = 
animation-charging-foreground = ${colors.foreground-alt} animation-charging-foreground = ${colors.foreground-alt}
animation-charging-framerate = 750 animation-charging-framerate = 750
@@ -432,10 +424,12 @@ label = %temperature%
label-warn = %temperature% label-warn = %temperature%
label-warn-foreground = ${colors.secondary} label-warn-foreground = ${colors.secondary}
ramp-0 = ramp-0 =
ramp-1 = ramp-1 =
ramp-2 = ramp-2 =
ramp-3 = 
ramp-foreground = ${colors.foreground-alt} ramp-foreground = ${colors.foreground-alt}
ramp-3-foreground = ${colors.alert}
[module/powermenu] [module/powermenu]
type = custom/menu type = custom/menu

76
i3/switch_monitors.sh Executable file
View File

@@ -0,0 +1,76 @@
#! /bin/sh
#
# switch_monitors.sh
# Copyright (C) 2017 Fabian Ising <fabian@murgi.de>
#
# Distributed under terms of the Apache v2.0 license.
#
# Get info on the monitors
HDMI_STATUS=$(</sys/class/drm/card0/card0-HDMI-A-1/status )
HDMI_ENABLED=$(</sys/class/drm/card0/card0-HDMI-A-1/enabled)
# Check to see if our state log exists
if [ ! -f /tmp/monitor ]; then
touch /tmp/monitor
STATE=5
else
STATE=$(</tmp/monitor)
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
fi
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"
;;
2)
# eDP-1 is on, projectors are connected but inactive
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --off
TYPE="eDP-1"
STATE=3
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Switched to $TYPE"
;;
3)
# eDP-1 is off, projectors are on
if [ "connected" == "$HDMI_STATUS" ]; then
/usr/bin/xrandr --output eDP-1 --off --output HDMI-1 --auto
TYPE="HDMI"
fi
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Switched to $TYPE"
STATE=4
;;
4)
# eDP-1 is on, projectors are mirroring
if [ "connected" == "$HDMI_STATUS" ]; then
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --auto
TYPE="HDMI"
fi
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Switched to $TYPE mirroring"
STATE=5
;;
5)
# 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"
fi
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Switched to $TYPE extending"
STATE=2
;;
*)
# Unknown state, assume we're in 1
STATE=1
esac
echo $STATE > /tmp/monitor