From 33298f4ea9cfda50689d669b534defe63d56c370 Mon Sep 17 00:00:00 2001 From: Ryan Chan Date: Tue, 23 Aug 2022 10:42:01 +0100 Subject: [PATCH] Fix lemonbar when resizing monitor for VNC --- bin/start-barrier | 2 +- bin/start-lemonbar | 15 +++++++++++++++ bin/start-vncserver | 5 ++++- bspwm/bspwmrc | 20 +++++++------------- 4 files changed, 27 insertions(+), 15 deletions(-) create mode 100755 bin/start-lemonbar diff --git a/bin/start-barrier b/bin/start-barrier index bba80c9..02f9985 100755 --- a/bin/start-barrier +++ b/bin/start-barrier @@ -1,5 +1,5 @@ #!/usr/bin/env sh # Stop the process with: -# killall barrierc +# pkill -x barrierc barrierc --no-tray "$@" & setxkbmap -device "$(xinput list --id-only "Virtual core XTEST keyboard")" "gb" diff --git a/bin/start-lemonbar b/bin/start-lemonbar new file mode 100755 index 0000000..e9a967b --- /dev/null +++ b/bin/start-lemonbar @@ -0,0 +1,15 @@ +#!/usr/bin/env sh +pkill -f lemons + +readonly lemons_log="/tmp/lemons_""$XDG_SESSION_ID"".txt" + +LEMONBAR_PIPE="/tmp/lemonbar_pipe_""$XDG_SESSION_ID" +export LEMONBAR_PIPE + +# setsid necessary so pkill-ing lemonbar doesn't bring down the parent +# process with it. +setsid /usr/bin/lemons \ + -g "x26" \ + -f "Roboto Mono:style=Medium:antialias=true:autohint=true:pixelsize=13" \ + -f "Roboto Mono:style=Bold:antialias=true:autohint=true:pixelsize=13" \ + > "$lemons_log" 2>&1 & diff --git a/bin/start-vncserver b/bin/start-vncserver index f113c0f..1d89e87 100755 --- a/bin/start-vncserver +++ b/bin/start-vncserver @@ -1,4 +1,7 @@ #!/usr/bin/env sh -exec /usr/bin/systemd-inhibit \ +# autorandr postswitch hook is responsible for restarting lemonbar +trap "autorandr --load default" EXIT INT TERM QUIT +autorandr --load vnc +systemd-inhibit \ --what="sleep:handle-lid-switch" --why="Keep VNC alive" \ x0vncserver -rfbauth "$HOME""/.vnc/passwd" diff --git a/bspwm/bspwmrc b/bspwm/bspwmrc index 148f575..082c8dc 100755 --- a/bspwm/bspwmrc +++ b/bspwm/bspwmrc @@ -1,20 +1,10 @@ #!/usr/bin/env sh - readonly gray="#c8c8c8" readonly white="#dadada" sxhkd & -LEMONBAR_PIPE="/tmp/lemonbar_pipe_""$XDG_SESSION_ID" -export LEMONBAR_PIPE - -readonly lemons_log_file="/tmp/lemons_""$XDG_SESSION_ID"".txt" - -lemons \ - -g "x26" \ - -f "Roboto Mono:style=Medium:antialias=true:autohint=true:pixelsize=13" \ - -f "Roboto Mono:style=Bold:antialias=true:autohint=true:pixelsize=13" \ - > "$lemons_log_file" 2>&1 & +start-lemonbar # TODO(rycwo): xrandr --listmonitors might be more reliable IFS='\n' read -ra monitors <<< "$(bspc query -M)" @@ -28,8 +18,12 @@ bspc config focused_border_color "$gray" bspc config split_ratio 0.5 bspc config border_width 1 -bspc config window_gap 24 +bspc config window_gap 2 -# Monocle layout settings. +# Monocle layout settings bspc config borderless_monocle true bspc config gapless_monocle true +bspc config single_monocle true + +# Temporary rules +bspc rule -a Borann state=floating -- 2.38.5