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
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
# 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
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 ###
# 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
# 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"
# 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
# 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
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
-# 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
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"
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
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"
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
# 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
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
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.
barrier
bash-doc
bat
+ # options beets dep
+ python3-discogs-client
# not using it currently and it has a dependency problem
# beets
# beets-doc