Fix monitor problems

Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
Severin Kaderli 2019-06-06 21:31:12 +02:00
parent 92c15e04d0
commit be92d7f1b3
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
12 changed files with 149 additions and 128 deletions

View file

@ -11,16 +11,16 @@
# This file is loaded on boot by crontab.
# Synchronize Google Drive every 15 minutes
*/15 * * * * grive -d -p $HOME/documents/ >> $HOME/.local/log/cron.log
*/15 * * * * grive -d -p $HOME/documents/ >> $HOME/.local/log/cron.log 2>&1
# Sync pacman databases every 15 minutes
*/15 * * * * sudo $HOME/.local/bin/sync-packages >> $HOME/.local/log/cron.log
*/15 * * * * sudo $HOME/.local/bin/sync-packages >> $HOME/.local/log/cron.log 2>&1
# Synchronize notes every 15 minutes
*/15 * * * * $HOME/.local/bin/sync-notes >> $HOME/.local/log/cron.log
*/15 * * * * $HOME/.local/bin/sync-notes >> $HOME/.local/log/cron.log 2>&1
# Synchronize tasks every 10 minutes
*/10 * * * * $HOME/.local/bin/sync-tasks >> $HOME/.local/log/cron.log
*/10 * * * * $HOME/.local/bin/sync-tasks >> $HOME/.local/log/cron.log 2>&1
# Synchronize rss feeds every 15 minutes
*/15 * * * * $HOME/.local/bin/rss-sync >> $HOME/.local/log/cron.log
*/15 * * * * $HOME/.local/bin/rss-sync >> $HOME/.local/log/cron.log 2>&1

View file

@ -16,6 +16,10 @@ if [ -f "${XDG_BIN_HOME}/utils" ]; then
. "${XDG_BIN_HOME}/utils"
fi
if [ -z "${HOME}" ]; then
export HOME="/home/severin"
fi
export XDG_CONFIG_HOME="${HOME}/.config"
export XDG_CACHE_HOME="${HOME}/.cache"
export XDG_DATA_HOME="${HOME}/.local/share"

View file

@ -22,17 +22,11 @@ exec --no-startup-id "i3-msg 'workspace 1: '"
# Start compton
exec --no-startup-id compton -b
# Start polybar
exec_always --no-startup-id $XDG_CONFIG_HOME/polybar/launch
# Start dunst
exec --no-startup-id dunst
# Set resolution
exec_always --no-startup-id resolution
# Set wallpaper
exec_always --no-startup-id wallpaper
# Setup monitor
exec_always --no-startup-id monitor-setup
# Other applications
exec autokey-gtk

View file

@ -16,17 +16,11 @@ exec --no-startup-id "i3-msg 'workspace 1: '"
# Start compton
exec --no-startup-id compton -b
# Start polybar
exec_always --no-startup-id $XDG_CONFIG_HOME/polybar/launch
# Start dunst
exec --no-startup-id dunst
# Set resolution
exec_always --no-startup-id resolution
# Set wallpaper
exec_always --no-startup-id wallpaper
# Setup monitor
exec_always --no-startup-id monitor-setup
# Other applications
exec autokey-gtk

View file

@ -23,7 +23,7 @@ bar-height = 35
# Top bar
#######################################
[bar/top]
monitor = HDMI1
monitor = ${env:POLYBAR_MONITOR}
width = 100%
height = ${settings.bar-height}
@ -50,26 +50,6 @@ separator = |
scroll-up = i3wm-desknext
scroll-down = i3wm-deskprev
[bar/top2]
inherit = bar/top
monitor = eDP1
[bar/top3]
inherit = bar/top
monitor = DVI-I-1-1
[bar/top-nvidia]
inherit = bar/top
monitor = HDMI-1-1
[bar/top2-nvidia]
inherit = bar/top
monitor = eDP-1-1
[bar/top3-nvidia]
inherit = bar/top
monitor = DVI-I-2-1
#######################################
# Bottom bar
@ -80,31 +60,6 @@ bottom = true
modules-left =
modules-center =
modules-right = music
tray-position = none
[bar/bottom2]
inherit = bar/bottom
monitor = eDP1
tray-position = left
[bar/bottom3]
inherit = bar/bottom
monitor = DVI-I-1-1
tray-position = left
[bar/bottom-nvidia]
inherit = bar/bottom
monitor = HDMI-1-1
tray-position = none
[bar/bottom2-nvidia]
inherit = bar/bottom
monitor = eDP-1-1
tray-position = left
[bar/bottom3-nvidia]
inherit = bar/bottom
monitor = DVI-I-2-1
tray-position = left

24
system/.local/bin/is-connected Executable file
View file

@ -0,0 +1,24 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# is-connected
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Checks if the output is connected
#
# USAGE:
# ./is-connected OUTPUT
if [ -z "${1}" ]; then
echo "No output given"
exit 1
fi
if [ -z "$(xrandr --query | grep "${1} connected")" ]; then
exit 1
else
exit 0
fi

16
system/.local/bin/monitor-setup Executable file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# monitor-setup
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Setups the resolution, wallpaper and polybar
#
# USAGE:
# ./monitor-setup
resolution
polybar-launch
wallpaper

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# .config/polybar/launch
# polybar-launch
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
@ -10,10 +10,10 @@
# This script kills existing polybar processes and then launches the bars.
#
# USAGE:
# ./launch
# ./polybar-launch
# Terminate already running bar instances
pkill polybar
killall -q polybar
# Wait until the processes have been shut down
while pgrep -x polybar >/dev/null; do sleep 1; done
@ -28,17 +28,17 @@ else
export POLYBAR_NETWORK="enp0s31f6"
fi
# Launch bar1 and bar2
polybar top &
polybar top2 &
polybar top3 &
polybar bottom &
polybar bottom2 &
polybar bottom3 &
MONITORS=(
"eDP1"
"eDP-1-1"
"HDMI1"
"HDMI-1-1"
"DVI-I-1-1"
"DVI-I-2-1"
)
polybar top-nvidia &
polybar top2-nvidia &
polybar top3-nvidia &
polybar bottom-nvidia &
polybar bottom2-nvidia &
polybar bottom3-nvidia &
for monitor in "${MONITORS[@]}"; do
export POLYBAR_MONITOR="${monitor}"
polybar top &
polybar bottom &
done

View file

@ -16,9 +16,30 @@
xrandr --listproviders | grep -q "modesetting" && xrandr --setprovideroutputsource 1 0
xrandr --dpi 96
xrandr --output HDMI1 --mode 1280x1024 --pos 0x56 --rotate normal
xrandr --output HDMI-1-1 --mode 1280x1024 --pos 0x56 --rotate normal
if is-connected "HDMI1"; then
xrandr --output HDMI1 --mode 1280x1024 --left-of eDP1
else
xrandr --output HDMI1 --off
fi
if is-connected "HDMI-1-1"; then
xrandr --output HDMI-1-1 --mode 1280x1024 --left-of eDP-1-1
else
xrandr --output HDMI-1-1 --off
fi
xrandr --output eDP1 --primary --mode 1920x1080 --pos 1280x0 --rotate normal
xrandr --output eDP-1-1 --primary --mode 1920x1080 --pos 1280x0 --rotate normal
xrandr --output DVI-I-1-1 --mode 1920x1080 --pos -640x0 --rotate normal
xrandr --output DVI-I-2-1 --mode 1920x1080 --pos -640x0 --rotate normal
if is-connected "DVI-I-1-1"; then
xrandr --output DVI-I-1-1 --off
else
xrandr --output DVI-I-1-1 --mode 1920x1080 --left-of eDP1
fi
if is-connected "DVI-I-2-1"; then
xrandr --output DVI-I-2-1 --off
else
xrandr --output DVI-I-2-1 --mode 1920x1080 --left-of eDP-1-1
fi

View file

@ -0,0 +1,6 @@
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "ch"
Option "XkbModel" "pc105"
EndSection

View file

@ -0,0 +1,2 @@
resolv_conf=/etc/resolv.conf
name_servers=127.0.0.1