mostly fixes, some improvements
authorIan Kelling <ian@iankelling.org>
Thu, 13 Jun 2024 14:15:07 +0000 (10:15 -0400)
committerIan Kelling <ian@iankelling.org>
Thu, 13 Jun 2024 14:15:07 +0000 (10:15 -0400)
brc2
distro-end
ffs
filesystem/usr/local/bin/abrowser
i3-split-maybe
i3-sway/bar.conf
i3-sway/common.conf
laptop-xrandr
mail-setup
pkgs

diff --git a/brc2 b/brc2
index c857670bc64f937d381c42e6123a79ba8f480bcf..bb33b7d768204ff7097f372c6bfbc6cb3f66b6bc 100644 (file)
--- a/brc2
+++ b/brc2
@@ -925,7 +925,7 @@ beetag()  {
   else
     pl_state_file=sorted
   fi
-  pl_state_dir=/i/info/pl-state
+  pl_state_dir=/b/data/pl-state
   if [[ $playlist ]]; then
     pl_state_dir=$pl_state_dir/$playlist
   else
index 232170fa8eee134968edcf1367d955383e1764b1..5378579e302561e7e00896fb13ded2c09fa979cc 100755 (executable)
@@ -1826,7 +1826,7 @@ EOF
       equivs-build tox
       sudo dpkg -i tox_1.0_all.deb
       rm -rf ./tox*
-      pi beets python3-discogs-client
+      pi beets
       cd
       rm -r "$tmpdir"
     fi
diff --git a/ffs b/ffs
index 0bb4ae7b94781a6c2792a078b91d58a0f227fc23..d6dc01ff07018546a282f57a782bd52aa6168ccb 100755 (executable)
--- a/ffs
+++ b/ffs
 # the top half for a 1080p stream, this is how:
 # https://superuser.com/questions/1106674/how-to-add-blank-lines-above-the-bottom-in-terminal
 #
-# potential improvement: sometimes I probably want to stream full height
-# window. I could add an option for that.
-
-# potential improvement: setup a function which automatically mutes after some time, or
-# after some time of no audio input.
-
-
-### begin background/development docs ###
-
-# zmq vs stdin commands:
-#
-# * zmq allows targeting a specific filter when there are duplicates.
-#
-# * if you type stdin command too slow, ffmpeg will die because it stops
-#   doing normal work while it is waiting.
-#
-# * zmq returns a result to the calling process, rather than printing to
-#   stdout.
-#
-# * the only simple zmq tool I found, zmqsend, requires compiling. I
-#   used the latest ffmpeg 7.0.1. Build like so:
-#
-# p build-dep ffmpeg/aramo
-# ./configure --enable-libzmq # i already had libzmq3-dev installed
-# make alltools
-# cp tools/zmqsend /a/opt/bin
-#
-# * ffmpeg debug output was useful in testing zmq commands.
-#
-# * Important documentation for stdin commands is only found by typing
-#   "c" into the stdin of ffmpeg and reading the output.
-#
-#
-#
-# stdin command docs, before I abandoned it for zmq:
-#  mkfifo -m 0600 /tmp/iank-ffmpeg
-# # ffmpeg sits and waits until we do this. dunno why.
-#  echo >/tmp/iank-ffmpeg &
-#  ffmpeg ... </tmp/iank-ffmpeg |& while read -r line; do : check results; done
-#  # example of working commands:
-#  echo "cdrawbox -1 t 0" >/tmp/iank-ffmpeg
-#  echo "cdrawbox -1 t fill" >/tmp/iank-ffmpeg
-#  echo "cdrawtext -1 reinit text=''" >/tmp/iank-ffmpeg
-#  echo "cvolume -1 volume=1" >/tmp/iank-ffmpeg
-
-
-# For testing: to show the number of audio channels in a resulting file
-# https://stackoverflow.com/questions/47905083/how-to-check-number-of-channels-in-my-audio-wav-file-using-ffmpeg-command
-#
-# ffprobe -i /tmp/out.wav -show_entries stream=channels -select_streams a:0 -of compact=p=0:nk=1 -v 0
-
-# for a right/left speaker test:
-# https://askubuntu.com/questions/148363/which-linux-command-can-i-use-to-test-my-speakers-for-current-talk-radio-output
-# p install alsa-utils
-# speaker-test -t wav -c 2 -l 1
-
-# There are 2 other options for audio, so I wanted to do a little
-# performance measurement of this method.
-# 1 is to combine the 2 audio sources in pulse,
-# https://unix.stackexchange.com/questions/351764/create-combined-source-in-pulseaudio .
-# 1 is to record mumble and combine in post processing.
-
-### benchmark / perf tests: these are pretty inaccurate.
-# 29 seconds cpu use. video bitrate 1500k, 8 fps, 2x keyframe interval.
-# * 64k vorbis: 69.7%
-# * 128k vorbis: 70.1% (used in subsequent tests)
-# * 1 audio input: 64.3%
-# * 0 audio inputs: 59.2%
-
-# how I did perf testing: add -to 00:00:30 to ffmpeg opts to
-# conveniently exit after measurement. Then run:
-#
-# ffmpeg "${opts[@]}" &
-# pid=$!
-# sleep 29
-# ps -p $pid -o %cpu
-# kill %%
-
-# filter for only 1 audio input:
-#-filter_complex "[0]azmq,volume=precision=fixed;[1]zmq='b=tcp\://127.0.0.1\:5557',drawbox=color=0x262626,drawtext=fontsize=90: fontcolor=beige: x=40: y=40: text=''"
-# filter with 0 audio input:
-# -filter_complex "[0]zmq='b=tcp\://127.0.0.1\:5557',drawbox=color=0x262626,drawtext=fontsize=90: fontcolor=beige: x=40: y=40: text=''"
-
-
-# When things weren't working, I did some checking on newer ffmpeg to
-# see if that helped. It never did. I compiled the latest ffmpeg release
-# tarball, 7.0.1, and tried the version in debian bullseye by schrooting
-# before running ffmpeg. Building was just configure; make, but then I
-# found some flags that were needed. gpl flags r just because I noticed them.
-# ./configure --enable-libzmq --enable-libpulse --enable-libvorbis --enable-gpl --enable-version3
-#
-
-### end background/development docs ###
 
 
 if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi
@@ -427,3 +334,92 @@ if $watch; then
   kill %%
   rm -f $HOME/.iank-stream-on
 fi
+
+
+
+### begin background/development docs ###
+
+# zmq vs stdin commands:
+#
+# * zmq allows targeting a specific filter when there are duplicates.
+#
+# * if you type stdin command too slow, ffmpeg will die because it stops
+#   doing normal work while it is waiting.
+#
+# * zmq returns a result to the calling process, rather than printing to
+#   stdout.
+#
+# * the only simple zmq tool I found, zmqsend, requires compiling. I
+#   used the latest ffmpeg 7.0.1. Build like so:
+#
+# p build-dep ffmpeg/aramo
+# ./configure --enable-libzmq # i already had libzmq3-dev installed
+# make alltools
+# cp tools/zmqsend /a/opt/bin
+#
+# * ffmpeg debug output was useful in testing zmq commands.
+#
+# * Important documentation for stdin commands is only found by typing
+#   "c" into the stdin of ffmpeg and reading the output.
+#
+#
+#
+# stdin command docs, before I abandoned it for zmq:
+#  mkfifo -m 0600 /tmp/iank-ffmpeg
+# # ffmpeg sits and waits until we do this. dunno why.
+#  echo >/tmp/iank-ffmpeg &
+#  ffmpeg ... </tmp/iank-ffmpeg |& while read -r line; do : check results; done
+#  # example of working commands:
+#  echo "cdrawbox -1 t 0" >/tmp/iank-ffmpeg
+#  echo "cdrawbox -1 t fill" >/tmp/iank-ffmpeg
+#  echo "cdrawtext -1 reinit text=''" >/tmp/iank-ffmpeg
+#  echo "cvolume -1 volume=1" >/tmp/iank-ffmpeg
+
+
+# For testing: to show the number of audio channels in a resulting file
+# https://stackoverflow.com/questions/47905083/how-to-check-number-of-channels-in-my-audio-wav-file-using-ffmpeg-command
+#
+# ffprobe -i /tmp/out.wav -show_entries stream=channels -select_streams a:0 -of compact=p=0:nk=1 -v 0
+
+# for a right/left speaker test:
+# https://askubuntu.com/questions/148363/which-linux-command-can-i-use-to-test-my-speakers-for-current-talk-radio-output
+# p install alsa-utils
+# speaker-test -t wav -c 2 -l 1
+
+# There are 2 other options for audio, so I wanted to do a little
+# performance measurement of this method.
+# 1 is to combine the 2 audio sources in pulse,
+# https://unix.stackexchange.com/questions/351764/create-combined-source-in-pulseaudio .
+# 1 is to record mumble and combine in post processing.
+
+### benchmark / perf tests: these are pretty inaccurate.
+# 29 seconds cpu use. video bitrate 1500k, 8 fps, 2x keyframe interval.
+# * 64k vorbis: 69.7%
+# * 128k vorbis: 70.1% (used in subsequent tests)
+# * 1 audio input: 64.3%
+# * 0 audio inputs: 59.2%
+
+# how I did perf testing: add -to 00:00:30 to ffmpeg opts to
+# conveniently exit after measurement. Then run:
+#
+# ffmpeg "${opts[@]}" &
+# pid=$!
+# sleep 29
+# ps -p $pid -o %cpu
+# kill %%
+
+# filter for only 1 audio input:
+#-filter_complex "[0]azmq,volume=precision=fixed;[1]zmq='b=tcp\://127.0.0.1\:5557',drawbox=color=0x262626,drawtext=fontsize=90: fontcolor=beige: x=40: y=40: text=''"
+# filter with 0 audio input:
+# -filter_complex "[0]zmq='b=tcp\://127.0.0.1\:5557',drawbox=color=0x262626,drawtext=fontsize=90: fontcolor=beige: x=40: y=40: text=''"
+
+
+# When things weren't working, I did some checking on newer ffmpeg to
+# see if that helped. It never did. I compiled the latest ffmpeg release
+# tarball, 7.0.1, and tried the version in debian bullseye by schrooting
+# before running ffmpeg. Building was just configure; make, but then I
+# found some flags that were needed. gpl flags r just because I noticed them.
+# ./configure --enable-libzmq --enable-libpulse --enable-libvorbis --enable-gpl --enable-version3
+#
+
+### end background/development docs ###
index 7892cc7cafcc2838882dd39a62bae1f0084a842a..d3ce6431f1053ecc4d4ffcb7527bba948c78ac6c 100755 (executable)
@@ -43,11 +43,13 @@ i3-msg -t get_tree | jq -e '.nodes[].nodes[].nodes[].nodes | [.[]] + ( [.[].node
 
 # prefer abrowser
 if type -P abrowser &>/dev/null; then
-  abrowser "$@" &
+  b=abrowser
 else
-  firefox "$@" &
+  b=firefox
 fi
 
+$b "$@" &
+
 # on a fast computer, .5 is too fast, 1 is ok. on x200, 1 is too fast, 2 is ok.
 sleep 2
 # debug
@@ -60,7 +62,7 @@ if (( $# == 0 )) && ! i3-msg -t get_tree | jq --stream -r 'select(.[1]|scalars!=
   # into a single array instead of a list of arrays with [.[]], or else
   # it will add the arrays a bunch of times and give several results.
   # comm gives us just the new id.
-  id=$(i3-msg -t get_tree | jq -e '.nodes[].nodes[].nodes[].nodes | [.[]] + ( [.[].nodes[]]) + ( [.[].nodes[].nodes[]]) + ( [.[].nodes[].nodes[].nodes[]]) | .[] | select(.window_properties.class=="abrowser") | .id' | comm -23 - $tmpf | head -n1)
+  id=$(i3-msg -t get_tree | jq -e '.nodes[].nodes[].nodes[].nodes | [.[]] + ( [.[].nodes[]]) + ( [.[].nodes[].nodes[]]) + ( [.[].nodes[].nodes[].nodes[]]) | .[] | select(.window_properties.class=="'$b'") | .id' | comm -23 - $tmpf | head -n1)
   rm -f $tmpf
   if [[ $id ]]; then
     i3-msg "[con_id=$id] mark abrowser"
index 0a98c90b3927ed8a499b56f05441b3959bd4fc54..bb425ef913e96ac26d706c9dd8c33689b2f36161 100755 (executable)
 # limitations under the License.
 
 
-# This anticipates when we want to tab windows. There are 2 options of
-# when to do it: just after a window is created, or just before a window
-# is created.
+# This anticipates when we want to tab windows.
+#
+# There are 2 options of when to do it: just after a window is created,
+# or just before a window is created.
 #
 # * Doing it after a window is created allows you to move a window into
 # the split that only has 1 window, whereas the other way doesn't. For
@@ -45,7 +46,8 @@
 #   the window is closed, and I don't want single window splits hanging around,
 #   so I close them out in
 #
-# I have a keybind which disables both, it runs /b/ds/i3-auto-layout-toggle
+# I have a keybind which disables both, super+shift+u, it runs
+# /b/ds/i3-auto-layout-toggle
 #
 
 import sys
@@ -89,35 +91,42 @@ def set_layout(i3):
     workspace = win.workspace()
     #pprint(vars(workspace.rect))
 
-    screen_width = workspace.rect.width
-    screen_height = workspace.rect.height
-    half_w =  screen_width / 2 + 1
-    half_h = screen_height / 2 + 1
+    screen_w = workspace.rect.width
+    screen_h = workspace.rect.height
+    half_w =  screen_w / 2 + 1
+    half_h = screen_h / 2 + 1
 
     w = win.rect.width
     h = win.rect.height
     ph = parent.rect.height
     pw = parent.rect.width
 
-    # There is potential for future use with < 1920, but I'm
-    # not thinking about it yet.
-    if ( screen_width < 1920 or parent.layout == 'tabbed' or gp.layout == 'tabbed'):
+    if ( parent.layout == 'tabbed' or gp.layout == 'tabbed'):
         return
 
-    # print('d2: len(parent.nodes)', len(parent.nodes),' > 1',
-    #       'and ( ph ',ph,' > h + 10',h + 10,' or pw',pw,' > w',w,' )',
-    #       'and w <= half_w',half_w,'+ and h <= half_h',half_h)
+    # debug
+    print('d2: len(parent.nodes):', len(parent.nodes),' > 1',
+          'and ( ph:',ph,' > h + 10:',h + 10,' or pw:',pw,' > w:',w,' )',
+          'and (screen_w:',screen_w,' < screen_h:',screen_h,' or w <= half_w:',half_w,')',
+          'and h <= half_h:',half_h,'))')
 
     # h + 10 because a tabbed window loses high compared to its parent.
     # Note, it is redundant since we check above if the parent is tabbed,
     # but just being cautious.
+    #
+    # condition in english
+    #   the parent container is bigger
+    #   and we are on a vertical screen or our window is <= half the screen width
+    #       and we are <= half the screen height
     if (len(parent.nodes) > 1
         and ( ph > h + 10 or pw > w )
-        and w <= half_w and h <= half_h ):
+        and ( screen_w < screen_h or w <= half_w )
+        and h <= half_h )):
        i3.command('split vertical, layout tabbed')
 #       print('d1: tabbed')
 
 
+
 ### further potential use cases:
 
 # We could automatically do a vertical split when there are 2 or 3
index d1457bee48d81418b63a9c4fb6e61250e525e6ec..75e345bbf9ba470b4d4e3efe015dca904f2ddb72 100644 (file)
@@ -1,4 +1,21 @@
-# need this for kde connect
+# 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 BIG-LEFT
+workspace 3 output BIG-RIGHT
+workspace 4 output BIG-RIGHT
+workspace 5 output BIG-RIGHT
+workspace 6 output BIG-RIGHT
+workspace 7 output BIG-RIGHT
+workspace 8 output BIG-RIGHT
+workspace 9 output BIG-RIGHT
+workspace 10 output BIG-RIGHT
+
+default_orientation vertical
+
+# bar is needed for kde connect
 bar {
 
 # keep it only on secondary monitor to save space and make for less
index 40b1bb5d3aafdf4b90df48110b4b058f699290b8..79f26bb488783eea2063d690ebb4f72ba092c1a1 100644 (file)
@@ -63,7 +63,7 @@ bindsym $mod+r $ex "/a/bin/ds/xl"
 
 bindsym $mod+t $ex "i3-set-layout splitv"
 #bindsym $mod+Shift+t move workspace to output up
-bindsym $mod+Shift+t move workspace to output right
+bindsym $mod+Shift+t move workspace to output BIG-RIGHT eDP-1
 
 bindsym $mod+g $ex "i3-set-layout tabbed"
 
@@ -90,17 +90,18 @@ bindsym $mod+shift+Right move right
 bindsym $mod+shift+Up move up
 bindsym $mod+shift+Down move down
 
-bindsym $mod+Shift+a move container to workspace 4
-bindsym $mod+a workspace 4
+bindsym $mod+Shift+a move container to workspace 1
+bindsym $mod+a workspace 1
 
-bindsym $mod+Shift+s move container to workspace 3
-bindsym $mod+s workspace 3
 
-bindsym $mod+Shift+d move container to workspace 2
-bindsym $mod+d workspace 2
+bindsym $mod+Shift+s move container to workspace 4
+bindsym $mod+s workspace 4
 
-bindsym $mod+Shift+f move container to workspace 1
-bindsym $mod+f workspace 1
+bindsym $mod+Shift+d move container to workspace 3
+bindsym $mod+d workspace 3
+
+bindsym $mod+Shift+f move container to workspace 2
+bindsym $mod+f workspace 2
 
 bindsym $mod+Shift+z move container to workspace 5
 bindsym $mod+z workspace 5
@@ -109,7 +110,7 @@ bindsym $mod+Shift+x move container to workspace 6
 bindsym $mod+x workspace 6
 
 bindsym $mod+v split vertical
-bindsym $mod+Shift+v split horizontal
+bindsym $mod+Shift+v move workspace to output BIG-LEFT
 
 # 122 = XF86AudioLowerVolume, keyboardio function + t
 bindcode 122 $ex "toggle-mute unmute"; mode "ptt"
@@ -140,8 +141,9 @@ bindsym $mod+shift+6 [class="Emacs" title="^(?!#[a-zA-Z][a-zA-Z-]*$)"] move work
 bindsym $mod+c kill
 
 
-bindsym $mod+Shift+Home move container to workspace 7
-bindsym $mod+Home workspace 7
+bindsym $mod+Home split horizontal
+bindsym $mod+Shift+End move container to workspace 7
+bindsym $mod+End workspace 7
 bindsym $mod+Shift+q move container to workspace 8
 bindsym $mod+q workspace 8
 
@@ -195,10 +197,6 @@ hide_edge_borders vertical
 # Start clipster daemon
 #exec --no-startup-id /a/opt/clipster/clipster -d
 
-
-# shortcut to selection widget (primary)
-bindsym $mod+End $ex "/b/ds/toggle-mute"
-
 # title bars but no borders. i tried this out a bit
 #default_border normal 0
 
index 6701e74525d7c2203a4a03a5fc9c533596b04ec9..bed869d3594d7d293200c49b13c6b724e390bec5 100755 (executable)
 
 set -e; . /usr/local/lib/bash-bear; set +e
 
+xf=$(mktemp)
+xrandr >$xf
+
 # eg eDP-1 connected primary
-laptop_out=$(xrandr | awk '$3 == "primary" {print $1}')
-output=$(xrandr | grep -E "^(HDMI|DP)[^ ]* connected [0-9]" | awk '{print $1}' ||:)
+laptop_out=$(awk '$3 == "primary" {print $1}' $xf)
+output=$(grep -E "^(HDMI|DP)[^ ]* connected [0-9]" $xf| awk '{print $1}' ||:)
+
+edid() {
+  card=$1
+  sha256sum </sys/class/drm/$card/edid | grep -oE '^.{10}'
+  }
 
+restart=false
 left_right_arg=--right-of
 if [[ $output ]]; then
 
+  mode=$(grep -A1 -E "^$output" | tail -n1 | awk '{print $1}' $xf)
+
+  primary_res=$(awk '$2 == "connected" && $3 == "primary" { print $4 }' $xf | sed 's/+.*//')
+  primary_x=${primary_res%x*}
+
+  x=${mode%x*}
+  y=${mode#*x}
+
+  half_x=$(( x / 2 ))
+
+  x_offset=0
+
   # identify monitors that are always on the left.
-  if [[ $output == HDMI2 && $(sha256sum </sys/class/drm/card0-HDMI-A-2/edid | grep -oE '^.{10}') == 192efbdcef ]]; then
+  if [[ $output == HDMI2 && $(edid card0-HDMI-A-2) == 192efbdcef ]] || \
+       [[ $output == HDMI-1 && $(edid card1-HDMI-A-1 ) == 7c58f9ac1e ]]; then
     left_right_arg=--left-of
+    x_offset=$primary_x
   fi
-  if [[ $output == HDMI-1 && $(sha256sum </sys/class/drm/card1-HDMI-A-1/edid | grep -oE '^.{10}') == 7c58f9ac1e ]]; then
-    left_right_arg=--left-of
+
+  # some monitors need off then on to become active
+  if $restart; then
+    xrandr --output $output --off
+    sleep 2
   fi
 
-  xrandr --output $output --off
-  sleep 2
-  mode=$(xrandr | grep -A1 -E "^$output" | tail -n1 | awk '{print $1}')
+
   # eg: 3840x2160
   echo mode=$mode
   xrandr --output $output $left_right_arg $laptop_out --mode $mode
 
-  for i in 1 2 4 5 6 7 8 9 10; do
+
+  # This splits a monitor into 2 virtual screens, which makes it split
+  # into 2 workspaces in i3, which is a much more convenient setup for
+  # managing windows.
+  # todo: add an option to turn this off
+  # todo: do this on systems with just 1 monitor.
+  #
+  # /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.
+  xrandr --setmonitor BIG-LEFT $half_x/298x$y/336+0+$x_offset $output
+  xrandr --setmonitor BIG-RIGHT $half_x/298x$y/336+$(( x_offset + half_x ))+0 none
+
+
+  for i in 2 3 4 5 6 7 8 9 10; do
     # if the workspace is already there, this will fail.
     # if the workspace doesn't exist yet, it fails with:
     # ERROR: No output matched
index c6ce2a5d5266bb190a4920ba262ed29329099869..f5553d3e36a6f557d7d55b5a8ce9d85ca774f8fb 100755 (executable)
@@ -3276,6 +3276,10 @@ bounce_debbugs:
 EOF
 
     install -m=0775 -d -g Debian-exim -o iank /var/spool/exim4/gw
+    f=/var/spool/exim4/gw/.no-delay-eximids
+    if [[ ! -e $f ]]; then
+      install -g Debian-exim -o iank /dev/null $f
+    fi
     u /etc/exim4/conf.d/router/155_delay <<'EOF'
 # By default, delay sending email by 30-40 minutes in case I
 # change my mind.
diff --git a/pkgs b/pkgs
index b051773d48e73c7033b45a2afd2ff75aed473fa2..932ddff449feacddce98e2e7dfeb6ade35a27d46 100644 (file)
--- a/pkgs
+++ b/pkgs
@@ -99,6 +99,8 @@ p3=(
   barrier
   bash-doc
   bat
+  # options beets dep
+  python3-discogs-client
   # not using it currently and it has a dependency problem
 #  beets
 #  beets-doc