From: Ian Kelling Date: Sat, 22 Jun 2024 13:07:44 +0000 (-0400) Subject: mostly misc fixes X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=7380af320b256cc90dc832df96e24cb15f376905;p=distro-setup mostly misc fixes --- diff --git a/brc b/brc index 222e0f8..293953d 100644 --- a/brc +++ b/brc @@ -2491,7 +2491,7 @@ sk() { # see https://savannah.gnu.org/maintenance/fsf/bash-style-guide/ for justifications local quotes others ret quotes=2048,2068,2086,2206,2254 - others=2029,2032,2033,2054,2164 + others=2029,2032,2033,2054,2164,2317 shellcheck -x -W 999 -e $quotes,$others "$@" || ret=$? if (( ret >= 1 )); then echo "A template comment to disable is now in clipboard. eg: # shellcheck disable=SC2206 # reason" diff --git a/brc2 b/brc2 index b22918a..b9d35c0 100644 --- a/brc2 +++ b/brc2 @@ -4266,7 +4266,7 @@ nap() { sink=$(pactl get-default-sink) card="${sink%.*}" card="${card/output/card}" - m pacmd set-card-profile "$card" off + m pactl set-card-profile "$card" off # clicking on a link in a browser can cause unmute. # I don't want that. So, use a stronger form of mute diff --git a/i3-sway/gen b/i3-sway/gen index 532af0b..055f8a5 100755 --- a/i3-sway/gen +++ b/i3-sway/gen @@ -26,76 +26,19 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR x="$(readlink -f -- "${BASH_SOURCE[0]}")"; cd ${x%/*} # directory of this file +## do sway config. untested and probably broken at this point dir=/a/bin/distro-setup/subdir_files/.config/sway mkdir -p $dir cat common.conf sway.conf > $dir/config + +## do i3 config dir=/a/bin/distro-setup/subdir_files/.config/i3 mkdir -p $dir cat common.conf i3.conf > $dir/config - -monitor_count=$(xrandr|grep -c ' connected') -if [[ $1 == bar ]] || (( monitor_count >= 2 )); then - cat bar.conf >> $dir/config +if [[ -s ~/i3-myx.conf ]]; then + cat ~/i3-myx.conf >>$dir/config fi -move_arg=right -if xrandr --listmonitors | awk '$2 == "MON-BOTTOM-LEFT"' |grep . >/dev/null; then - cat >>$dir/config <<'EOF' -# by default, new workspaces are created on whatever screen doesn't have -# one active or else the current one. That is annoying, I have one -# primary monitor, I don't want a new workspace created on secondary -# monitor just because I happen be focused on it. This fixes that. -workspace 1 output primary -workspace 2 output MON-LEFT -workspace 3 output MON-BOTTOM-LEFT -workspace 4 output MON-RIGHT -workspace 5 output MON-RIGHT -workspace 6 output MON-RIGHT -workspace 7 output MON-RIGHT -workspace 8 output MON-RIGHT -workspace 9 output MON-RIGHT -workspace 10 output MON-RIGHT -EOF - move_arg="MON-BOTTOM-LEFT MON-RIGHT primary" -elif xrandr --listmonitors | awk '$2 == "MON-LEFT"' |grep . >/dev/null; then - cat >>$dir/config <<'EOF' -# by default, new workspaces are created on whatever screen doesn't have -# one active or else the current one. That is annoying, I have one -# primary monitor, I don't want a new workspace created on secondary -# monitor just because I happen be focused on it. This fixes that. -workspace 1 output primary -workspace 2 output MON-LEFT -workspace 3 output MON-RIGHT -workspace 4 output MON-RIGHT -workspace 5 output MON-RIGHT -workspace 6 output MON-RIGHT -workspace 7 output MON-RIGHT -workspace 8 output MON-RIGHT -workspace 9 output MON-RIGHT -workspace 10 output MON-RIGHT -EOF - move_arg="MON-RIGHT primary" -else - mon2=$(xrandr | awk '$2 == "connected" && $3 != "primary" {print $1}') - if [[ $mon2 ]]; then - cat >>$dir/config <>$dir/config - if [[ $I3SOCK ]]; then echo $0: i3-msg reload i3-msg reload diff --git a/myx b/myx index 85b857a..2eefc91 100755 --- a/myx +++ b/myx @@ -232,39 +232,94 @@ if [[ $secondary_out || $primary_res != "$target_res" ]]; then m xrandr --output $target_out $left_right_arg --mode $target_res fi - -m /a/bin/ds/i3-sway/gen - - if $tall; then - # 298 & 336 are millimeters. I took them from a monitor I was using. I # don't know if they are important, I assume not important enough to # change for different monitors. m xrandr --setmonitor MON-LEFT $half_x/298x$target_y/336+$x_offset+0 $target_out m xrandr --setmonitor MON-RIGHT $half_x/298x$target_y/336+$(( x_offset + half_x ))+0 none - move-ws MON-LEFT 2 - move-ws MON-RIGHT 3 4 5 6 7 8 9 10 - elif $quarter; then - m xrandr --setmonitor MON-LEFT $half_x/298x$half_y/336+$x_offset+0 $target_out m xrandr --setmonitor MON-BOTTOM-LEFT $half_x/298x$half_y/336+$x_offset+$half_y none m xrandr --setmonitor MON-RIGHT $half_x/298x$target_y/336+$(( x_offset + half_x ))+0 none - - move-ws MON-LEFT 2 - move-ws MON-BOTTOM-LEFT 3 - move-ws MON-RIGHT 4 5 6 7 8 9 10 -else # fullscreen - move-ws $target_out 2 3 5 6 7 8 9 10 fi + + +## begin i3 config ## if [[ $secondary_out ]]; then ws1_output=$primary_out + move_outputs=($primary_out) else + move_outputs=() ws1_output=MON-RIGHT fi -move-ws $ws1_output 1 + +ws_outputs=( + $ws1_output +) + +if $tall; then + ws_outputs+=( + MON-LEFT + MON-RIGHT + ) + move_outputs+=(MON-RIGHT) +elif $quarter; then + ws_outputs+=( + MON-LEFT + MON-BOTTOM-LEFT + MON-RIGHT + ) + move_outputs+=(MON-BOTTOM-LEFT MON-RIGHT) +fi + +echo d1 ${ws_outputs[@]} + +if (( ${#move_outputs[@]} == 0 )); then + move_outputs=(right) +fi + +rm -f ~/i3-myx.conf +total_ws_count=10 +for (( i=0; i>~/i3-myx.conf +done +echo "bindsym \$mod+Shift+t move workspace to output ${move_outputs[*]}" >>~/i3-myx.conf +m /a/bin/ds/i3-sway/gen + +# this bit is so that we only move workspaces that need to be moved +# and we don't have to ignore errors. A waste of time, but +# it was fun. +declare -A ws_to_out +tmps=$(i3 -t get_workspaces) +tmps=$(jq -r '.[] | .num, .output' <<<"$tmps") +while read -r ws; do + read -r output || break + ws_to_out["$ws"]=$output +done <<<"$tmps" + +for (( i=0; i