From 2299826babc6d5f4328c7eceb00b501e25695689 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Thu, 20 Jun 2024 20:05:59 -0400 Subject: [PATCH] minor improvements --- btrbk-run | 2 +- i3-abrowser | 35 ++++++++++++++++++++--------------- i3-sway/bar.conf | 18 +++++++++--------- i3-sway/common.conf | 2 +- i3-sway/gen | 44 ++++++++++++++++++++++---------------------- myx | 24 ++++++++++++------------ 6 files changed, 65 insertions(+), 60 deletions(-) diff --git a/btrbk-run b/btrbk-run index 0cdc625..95503a5 100644 --- a/btrbk-run +++ b/btrbk-run @@ -57,7 +57,7 @@ script_name="${script_name##*/}" log-setup() { if [[ ! $log_path ]]; then mkdir -p /var/log/btrbk - log_path=/var/log/btrbk/$(date +%F_%T%:::z).log + log_path=/var/log/btrbk/$(date +%F_%H_%M_%S%:::z).log fi } d() { diff --git a/i3-abrowser b/i3-abrowser index a43c21d..101468a 100755 --- a/i3-abrowser +++ b/i3-abrowser @@ -47,24 +47,29 @@ if ! /a/c/i3-focus-maybe abrowser; then i3-msg "workspace 2" i3-split-maybe $b "$@" & - # 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\" instance=\"Navigator\" window_role=\"browser\"] mark abrowser" + # on a fast computer, .5 is too fast, 1 is ok. on x200, 2 is ok if the computer isn't busy. + + for (( i=0; i < 15; i++ )); do + sleep 1 + if i3-msg "[workspace=__focused__ class=\"$b\" instance=\"Navigator\" window_role=\"browser\"] mark abrowser"; then + break + fi + done wait -# else - # # If we were streaming 1/4 of the screen without separate workspaces, we might - # # want something like this. But as is, it is better to just focus. same deal in - # # my other programs like this one, but I removed the code there. - # - # cur_workspace=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused? == true) | .name') - # i3-msg "[con_mark=\"abrowser\"] focus" + # else + # # If we were streaming 1/4 of the screen without separate workspaces, we might + # # want something like this. But as is, it is better to just focus. same deal in + # # my other programs like this one, but I removed the code there. + # + # cur_workspace=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused? == true) | .name') + # i3-msg "[con_mark=\"abrowser\"] focus" - # if [[ $cur_workspace == 2 ]]; then - # i3-msg "swap container with mark abrowser; [con_mark=\"abrowser\"] focus" - # else - # i3-msg "[con_mark=\"abrowser\"] focus" - # fi + # if [[ $cur_workspace == 2 ]]; then + # i3-msg "swap container with mark abrowser; [con_mark=\"abrowser\"] focus" + # else + # i3-msg "[con_mark=\"abrowser\"] focus" + # fi fi diff --git a/i3-sway/bar.conf b/i3-sway/bar.conf index 75e345b..918385b 100644 --- a/i3-sway/bar.conf +++ b/i3-sway/bar.conf @@ -3,15 +3,15 @@ # 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 +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 default_orientation vertical diff --git a/i3-sway/common.conf b/i3-sway/common.conf index 8d0d5d9..dbc5931 100644 --- a/i3-sway/common.conf +++ b/i3-sway/common.conf @@ -110,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 move workspace to output BIG-LEFT +bindsym $mod+Shift+v move workspace to output MON-LEFT # 122 = XF86AudioLowerVolume, keyboardio function + t bindcode 122 $ex "toggle-mute unmute"; mode "ptt" diff --git a/i3-sway/gen b/i3-sway/gen index 9d2e691..532af0b 100755 --- a/i3-sway/gen +++ b/i3-sway/gen @@ -39,42 +39,42 @@ if [[ $1 == bar ]] || (( monitor_count >= 2 )); then fi move_arg=right -if xrandr --listmonitors | awk '$2 == "BIG-BOTTOM-LEFT"' |grep . >/dev/null; then +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 BIG-LEFT -workspace 3 output BIG-BOTTOM-LEFT -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 +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="BIG-BOTTOM-LEFT BIG-RIGHT primary" -elif xrandr --listmonitors | awk '$2 == "BIG-LEFT"' |grep . >/dev/null; then + 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 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 +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="BIG-RIGHT primary" + move_arg="MON-RIGHT primary" else mon2=$(xrandr | awk '$2 == "connected" && $3 != "primary" {print $1}') if [[ $mon2 ]]; then diff --git a/myx b/myx index b22e9be..99d889f 100755 --- a/myx +++ b/myx @@ -148,8 +148,8 @@ if $dry_run; then fi for mon_suffix in TOP-LEFT BOTTOM-LEFT LEFT RIGHT; do - if xrandr --listmonitors | awk '$2 == "BIG-'$mon_suffix\" |grep . >/dev/null; then - m xrandr --delmonitor BIG-$mon_suffix + if xrandr --listmonitors | awk '$2 == "MON-'$mon_suffix\" |grep . >/dev/null; then + m xrandr --delmonitor MON-$mon_suffix fi done @@ -223,20 +223,20 @@ 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 BIG-LEFT $half_x/298x$target_y/336+$x_offset+0 $target_out - m xrandr --setmonitor BIG-RIGHT $half_x/298x$target_y/336+$(( x_offset + half_x ))+0 none + 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 BIG-LEFT 2 - move-ws BIG-RIGHT 3 4 5 6 7 8 9 10 + move-ws MON-LEFT 2 + move-ws MON-RIGHT 3 4 5 6 7 8 9 10 elif $quarter; then - m xrandr --setmonitor BIG-LEFT $half_x/298x$half_y/336+$x_offset+0 $target_out - m xrandr --setmonitor BIG-BOTTOM-LEFT $half_x/298x$half_y/336+$x_offset+$half_y none - m xrandr --setmonitor BIG-RIGHT $half_x/298x$target_y/336+$(( x_offset + half_x ))+0 none + 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 BIG-LEFT 2 - move-ws BIG-BOTTOM-LEFT 3 - move-ws BIG-RIGHT 4 5 6 7 8 9 10 + 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 -- 2.30.2