apache-apply() {
for file; do
+ if [[ ! -e $file ]]; then
+ echo '#!/bin/bash' >$file
+ chmod +x $file
+ fi
if head -n1 "$file"| grep -E '^#!/' &>/dev/null; then
{
head -n1 "$file"
3 mountpoints: fsf-sysops (default, public), fsf (all staff), fsf-tech (tech team)
-d debug.
--f Stream full screen even high resolution.
--t Stream tall half screen
+-r RESOLUTION_TYPE
+ full: full screen even high resolution.
+ tall (default): half screen.
+ quarter: self evident
-u Undelayed. Removes 5 second video delay, and about 4 second audio delay.
-w do not launch watch of stream
loglevel=fatal
watch=true
fullscreen=false
-tall=false
-temp=$(getopt -l help hdftuw "$@") || usage 1
+tall=true
+temp=$(getopt -l help hdr:uw "$@") || usage 1
eval set -- "$temp"
while true; do
case $1 in
loglevel=info
ffp_args+=(-d)
;;
- -f)
- fullscreen=true
- tall=false
- ;;
- -t)
- fullscreen=false
- tall=true
+ -r)
+ case $2 in
+ tall)
+ fullscreen=false
+ tall=true
+ ;;
+ quarter)
+ fullscreen=false
+ tall=false
+ ;;
+ full)
+ fullscreen=true
+ tall=false
+ ;;
+ esac
+ shift
;;
-w)
watch=false
[vol0][vol1] amerge=inputs=2;
[2]zmq='b=tcp\://127.0.0.1\:5557',drawbox=color=0x262626,drawtext=fontsize=90: fontcolor=beige: x=40: y=40: text=''${delay_arg}[out]"
-# [vol0][vol1] amerge=inputs=2,adelay=6000:all=1;
-
-
# An online source says to match a 5 second vid delay, we can do an
# audio delay filter: "adelay=5000|5000". However, we already get
# a stream delay of about 2 seconds, and having the audio be about
rm -f /tmp/iank-ffmpeg-interlude-toggle
-# start muted
-pactl set-source-mute @DEFAULT_SOURCE@ true
+# system mute. disabled, just using application level mute atm.
+#
+# pactl set-source-mute @DEFAULT_SOURCE@ true
if pkill -f ^ffmpeg.\*icecast://source.\*/fsf; then
sleep 1
# limitations under the License.
+if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi
+shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" exit status: $?, PIPESTATUS: ${PIPESTATUS[*]}" >&2' ERR
+
+
# https://stackoverflow.com/a/2108540
tmp=:$PATH:
del=/usr/local/bin
# new tab
-tmpf=$(mktemp)
-i3-msg -t get_tree | jq -e '.nodes[].nodes[].nodes[].nodes | [.[]] + ( [.[].nodes[]]) | .[] | select(.window_properties.class=="abrowser") | .id' | sort >$tmpf
# prefer abrowser
if type -P abrowser &>/dev/null; then
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
-#printf "%s\n" "$*" >> /tmp/a
-if (( $# == 0 )) && ! i3-msg -t get_tree | jq --stream -r 'select(.[1]|scalars!=null) | "\(.[0]|join(".")): \(.[1]|tojson)"' | grep 'marks.0: "abrowser"$' &>/dev/null; then
- # explaining this jq nonsense. when the abrowser window starts, it
- # might be in a vertical split container, and then it is nested down
- # another level. the best way I could find to look in both levels was
- # to get both, then combine them with + (and you have to turn them
- # 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=="'$b'") | .id' | comm -23 - $tmpf | head -n1)
- rm -f $tmpf
- if [[ $id ]]; then
- i3-msg "[con_id=$id] mark abrowser"
- fi
-fi
-
-wait
+$b "$@"
# See the License for the specific language governing permissions and
# limitations under the License.
-exec emacs -f znc-all "$@"
+exec emacs -f my-znc-all "$@"
--- /dev/null
+#!/bin/bash
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to change
+# to a recommended GPL license.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi
+shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" exit status: $?, PIPESTATUS: ${PIPESTATUS[*]}" >&2' ERR
+
+
+# prefer abrowser
+if type -P abrowser &>/dev/null; then
+ b=abrowser
+else
+ b=firefox
+fi
+
+# mark if we dont have a mark already
+if i3-msg -t get_tree | jq --stream -r 'select(.[1]|scalars!=null) | "\(.[0]|join(".")): \(.[1]|tojson)"' | grep 'marks.0: "abrowser"$' &>/dev/null; then
+ h=$(i3-msg -t get_tree | jq -r ".. | select(.focused? == true) | .rect.height")
+ cur_workspace=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused? == true) | .name')
+
+ # h tests if we have a current focus, but that is just a random guess.
+ if [[ $cur_workspace == 2 && $h ]]; then
+ i3-msg "swap container with mark abrowser; [con_mark=\"abrowser\"] focus"
+ else
+ i3-msg '[con_mark="abrowser"] move workspace current'
+ fi
+
+else
+ i3-split-maybe
+ abrowser &
+ # on a fast computer, .5 is too fast, 1 is ok. on x200, 1 is too fast, 2 is ok.
+ sleep 2
+ i3-msg "[workspace=__focused__ class=\"$b\"] mark abrowser"
+ wait
+fi
--- /dev/null
+#!/bin/bash
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to change
+# to a recommended GPL license.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+id=$(i3-msg -t get_tree | jq -e '.. | select(.name?) | select(.name | test("^e-iak")).id ')
+
+if [[ $id ]]; then
+ h=$(i3-msg -t get_tree | jq -r ".. | select(.focused? == true) | .rect.height")
+
+ cur_workspace=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused? == true) | .name')
+
+ # h tests if we have a current focus, but that is just a random guess.
+ if [[ $cur_workspace == 2 && $h ]]; then
+ i3-msg "swap container with con_id $id; [con_id=\"$id\"] focus"
+ else
+ i3-msg '[con_id="'$id'"] move workspace current'
+ fi
+else
+
+ i3-split-maybe
+ emacsclient -c
+fi
--- /dev/null
+#!/bin/bash
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to change
+# to a recommended GPL license.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi
+shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" exit status: $?, PIPESTATUS: ${PIPESTATUS[*]}" >&2' ERR
+
+
+if i3-msg -t get_tree | jq --stream -r 'select(.[1]|scalars!=null) | "\(.[0]|join(".")): \(.[1]|tojson)"' | grep 'marks.0: "term"$' &>/dev/null; then
+ h=$(i3-msg -t get_tree | jq -r ".. | select(.focused? == true) | .rect.height")
+
+ cur_workspace=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused? == true) | .name')
+
+ # h tests if we have a current focus, but that is just a random guess.
+ if [[ $cur_workspace == 2 && $h ]]; then
+ i3-msg "swap container with mark term; [con_mark=\"term\"] focus"
+ else
+ i3-msg '[con_mark="term"] move workspace current'
+ fi
+else
+ i3-split-maybe
+ konsole
+ sleep 1
+ i3-msg "[workspace=__focused__ class=\"konsole\"] mark term"
+fi
cur_workspace=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused? == true) | .name')
-
# 1080 = half the 4k height
#if [[ $cur_workspace == 1 && $h ]] && (( h <= 1080 )); then
if [[ $cur_workspace == 1 && $h ]]; then
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,'))')
+ '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,
if (len(parent.nodes) > 1
and ( ph > h + 10 or pw > w )
and ( screen_w < screen_h or w <= half_w )
- and h <= half_h )):
+ and h <= half_h ):
i3.command('split vertical, layout tabbed')
# print('d1: tabbed')
bindsym $mod+2 $ex "i3-split-maybe"; exec "pavucontrol"
# calling without -no-remote makes this to be the instance that links
# will open in from other applications.
-bindsym $mod+3 $ex "i3-split-maybe"; exec "abrowser"
+# unused. todo: consider binding this to some key on the right side of keyboard.
+#bindsym $mod+3 $ex "i3-split-maybe"; exec "abrowser"
# calling just abrowser mysteriously stopped working,
# so I figured out this is how to get output, but then
# it suddenly started working again.
# get class with xprop, example output
# WM_CLASS(STRING) = "irssi", "URxvt"
# xprop |& grep WM_CLASS
-bindsym $mod+w $ex i3-pull abrowser
+bindsym $mod+w $ex "/a/exe/i3-abrowser"
bindsym $mod+shift+w fullscreen toggle
-bindsym $mod+e $ex i3-pull emacs
-bindsym $mod+shift+e unmark emacs; mark emacs
+bindsym $mod+e $ex "/a/exe/i3-emacs"
+# unused
+#bindsym $mod+shift+e
bindsym $mod+r $ex "/a/bin/ds/xl"
bindsym $mod+t $ex "i3-set-layout splitv"
#bindsym $mod+shift+5 $ex "/a/a.sh"
-bindsym $mod+b $ex i3-pull term
+bindsym $mod+b $ex "/a/exe/i3-konsole"
bindsym $mod+shift+b unmark term; mark term
+
+
# for use to cleanup extra emacs windows
# https://faq.i3wm.org/question/7662/reverse-perl-matches-in-criteria-in-i3-config.1.html
# I found their regex slightly wrong. This is a hacky way to
bindsym $mod+c kill
-
bindsym $mod+Home split horizontal
bindsym $mod+Shift+End move container to workspace 7
bindsym $mod+End workspace 7