From 90ebbd7e23e70472cd9bbb1770c09259e9f2a224 Mon Sep 17 00:00:00 2001 From: Louis Vallat Date: Wed, 22 Jun 2022 13:05:22 +0200 Subject: [PATCH] Added autorandr config to dotfiles and rewrote bspwm Signed-off-by: Louis Vallat --- .config/autorandr/laptop-only/config | 19 +++++++++++++ .config/autorandr/laptop-only/setup | 1 + .config/autorandr/postswitch | 4 +++ .config/autorandr/work/config | 29 +++++++++++++++++++ .config/autorandr/work/setup | 2 ++ .config/bspwm/bspwmrc | 42 +++++++++++++--------------- 6 files changed, 75 insertions(+), 22 deletions(-) create mode 100644 .config/autorandr/laptop-only/config create mode 100644 .config/autorandr/laptop-only/setup create mode 100755 .config/autorandr/postswitch create mode 100644 .config/autorandr/work/config create mode 100644 .config/autorandr/work/setup diff --git a/.config/autorandr/laptop-only/config b/.config/autorandr/laptop-only/config new file mode 100644 index 0000000..37b9aae --- /dev/null +++ b/.config/autorandr/laptop-only/config @@ -0,0 +1,19 @@ +output HDMI-A-0 +off +output DisplayPort-0 +off +output DisplayPort-1 +off +output eDP +crtc 0 +mode 1920x1080 +pos 0x0 +primary +rate 60.03 +x-prop-max_bpc 16 +x-prop-non_desktop 0 +x-prop-scaling_mode None +x-prop-tearfree auto +x-prop-underscan off +x-prop-underscan_hborder 0 +x-prop-underscan_vborder 0 diff --git a/.config/autorandr/laptop-only/setup b/.config/autorandr/laptop-only/setup new file mode 100644 index 0000000..ff6927c --- /dev/null +++ b/.config/autorandr/laptop-only/setup @@ -0,0 +1 @@ +eDP 00ffffffffffff0006af3d5700000000001c0104a51f1178022285a5544d9a270e505400000001010101010101010101010101010101b43780a070383e401010350035ae100000180000000f0000000000000000000000000020000000fe0041554f0a202020202020202020000000fe004231343048414e30352e37200a0070 diff --git a/.config/autorandr/postswitch b/.config/autorandr/postswitch new file mode 100755 index 0000000..8515209 --- /dev/null +++ b/.config/autorandr/postswitch @@ -0,0 +1,4 @@ +#!/bin/bash + +dunstify "Autorandr" "Changed configuration to $AUTORANDR_CURRENT_PROFILE." +"${HOME}"/.config/bspwm/bspwmrc diff --git a/.config/autorandr/work/config b/.config/autorandr/work/config new file mode 100644 index 0000000..4553dc6 --- /dev/null +++ b/.config/autorandr/work/config @@ -0,0 +1,29 @@ +output DisplayPort-0 +off +output DisplayPort-1 +off +output HDMI-A-0 +crtc 0 +mode 1920x1080 +pos 0x0 +primary +rate 60.00 +x-prop-max_bpc 8 +x-prop-non_desktop 0 +x-prop-scaling_mode None +x-prop-tearfree auto +x-prop-underscan off +x-prop-underscan_hborder 0 +x-prop-underscan_vborder 0 +output eDP +crtc 1 +mode 1920x1080 +pos 1920x0 +rate 60.03 +x-prop-max_bpc 16 +x-prop-non_desktop 0 +x-prop-scaling_mode None +x-prop-tearfree auto +x-prop-underscan off +x-prop-underscan_hborder 0 +x-prop-underscan_vborder 0 diff --git a/.config/autorandr/work/setup b/.config/autorandr/work/setup new file mode 100644 index 0000000..ae557d4 --- /dev/null +++ b/.config/autorandr/work/setup @@ -0,0 +1,2 @@ +HDMI-A-0 00ffffffffffff0004721103ae3140342c17010380301b782a2795a55550a2270b5054b30c00714f81c0810081809500b300d1c00101023a801871382d40582c4500dd0c1100001e000000fd00384b1e5311000a202020202020000000fc0041636572204732323648514c0a000000ff004c57554545303035343334310a01ef020316324b010203040590111213149f65030c001000023a801871382d40582c4500dd0c1100001e011d8018711c1620582c2500dd0c1100009e011d80d0721c1620102c2580dd0c1100009e023a80d072382d40102c4580dd0c1100001e00000000000000000000000000000000000000000000000000000000000000000070 +eDP 00ffffffffffff0006af3d5700000000001c0104a51f1178022285a5544d9a270e505400000001010101010101010101010101010101b43780a070383e401010350035ae100000180000000f0000000000000000000000000020000000fe0041554f0a202020202020202020000000fe004231343048414e30352e37200a0070 diff --git a/.config/bspwm/bspwmrc b/.config/bspwm/bspwmrc index 8419da1..c5dee4f 100755 --- a/.config/bspwm/bspwmrc +++ b/.config/bspwm/bspwmrc @@ -1,5 +1,8 @@ #! /bin/bash +# Enable debug +set -x + # Autostart pgrep -x sxhkd > /dev/null || sxhkd & disown xrdb -load $HOME/.config/.Xresources & @@ -7,37 +10,32 @@ dunst -conf $HOME/.config/dunst/dunstrc & picom --experimental-backends & $HOME/.fehbg & /usr/lib/kdeconnectd & disown -nextcloud & disown +pgrep 'nextcloud' || nextcloud & disown xset -b -DISPLAYS=$(xrandr -q | grep -w 'connected' | cut -d ' ' -f 1) -EXT_PRIMARY="" -INTEGRATED_DISPLAY=$(xrandr -q | grep -w 'connected primary' | cut -d ' ' -f 1) +DISPLAYS=$(xrandr -q | grep -w 'connected' | grep -v 'primary' | cut -d ' ' -f 1) +PRIMARY_DISPLAY=$(xrandr -q | grep -w 'connected primary' | cut -d ' ' -f 1) -for DISP in ${DISPLAYS}; do - if [ ${DISP} != ${INTEGRATED_DISPLAY} ]; then - EXT_PRIMARY=${DISP} - fi -done - - -killall -q polybar -if [ "${EXT_PRIMARY}" != "" ]; then - xrandr --output ${EXT_PRIMARY} --primary --output ${INTEGRATED_DISPLAY} --right-of ${EXT_PRIMARY} - bspc monitor ${EXT_PRIMARY} -d 1 2 3 4 5 - bspc monitor ${INTEGRATED_DISPLAY} -d 6 7 8 9 0 - MONITOR=${EXT_PRIMARY} polybar main 2>&1 | tee -a /tmp/polybar.log & disown -else - bspc monitor ${INTEGRATED_DISPLAY} -d 1 2 3 4 5 6 7 8 9 0 -fi - -MONITOR=${INTEGRATED_DISPLAY} polybar main 2>&1 | tee -a /tmp/polybar.log & disown +echo "Displays '${DISPLAYS}' have been detected. '${PRIMARY_DISPLAY}' is primary." bspc config border_width 0 bspc config window_gap 8 bspc config top_padding 20 bspc config split_ratio 0.6 +EXT_DISPLAY=${DISPLAYS%% *} + +killall -q polybar +if [ "${EXT_DISPLAY}" != "" ]; then + bspc monitor ${PRIMARY_DISPLAY} -d 1 2 3 4 5 + bspc monitor ${EXT_DISPLAY} -d 6 7 8 9 0 + MONITOR=${EXT_DISPLAY} polybar main 2>&1 | tee -a /tmp/polybar.log & disown +else + bspc monitor ${PRIMARY_DISPLAY} -d 1 2 3 4 5 6 7 8 9 0 +fi + +MONITOR=${PRIMARY_DISPLAY} polybar main 2>&1 | tee -a /tmp/polybar.log & disown + # Fix for Java applications wmname LG3D