Tokyo,Japan
i use arch btw
Comment by ~tkna on ~tsdh/swayr
Sorry the screencast is not clear. I wrote a shell script to check how it works this time. (You don't have to check it)
The
-L
is working as expected "unconditionally alternating between target and ORIGIN".swayr-test.sh
#!/bin/bash #set -x LOG=swayrd_$(date --utc +%Y%m%d-%H%M%S).log swayrd-start() { systemctl --user stop swayrd.service pkill swayrd swayrd >> $LOG 2>&1 & #RUST_BACKTRACE=1 RUST_LOG=swayr::cmds=debug swayrd >> $LOG 2>&1 & #RUST_BACKTRACE=1 RUST_LOG=swayr=debug swayrd >> $LOG 2>&1 & } swayrd-end() { sleep 1 pkill swayrd swaymsg [con_mark="swayr-test"] focus cat $LOG } window-open() { swaymsg for_window [app_id="MARK"] mark "MARK" swaymsg mark "swayr-test" foot --app-id=ORIGIN --title=ORIGIN > /dev/null & foot --app-id=LRU --title=LRU > /dev/null & foot --app-id=MARK --title=MARK > /dev/null & } before_the_switch() { sleep 5 echo >> $LOG } between_the_switch() { sleep 5 echo >> $LOG } origin-start() { sleep 1 swaymsg [app_id=LRU] focus sleep 1 swaymsg [app_id=ORIGIN] focus before_the_switch } mark-start() { sleep 1 swaymsg [app_id=LRU] focus sleep 1 swaymsg [app_id=ORIGIN] focus sleep 1 swaymsg [app_id=MARK] focus before_the_switch } pacman -Q swayr-git >> $LOG echo "* cat ~/.config/swayr/config.toml *" >> $LOG cat ~/.config/swayr/config.toml >> $LOG swayrd-start window-open cmd="swayr switch-to-mark-or-urgent-or-lru-window -L MARK" # event1-1 origin-start echo "* event1-1: origin-start - $cmd *" >> $LOG $cmd >> $LOG between_the_switch # event1-2 echo "* event1-2: *" >> $LOG $cmd >> $LOG between_the_switch # event1-3 echo "* event1-3: *" >> $LOG $cmd >> $LOG between_the_switch # event1-4 echo "* event1-4: *" >> $LOG $cmd >> $LOG between_the_switch # event2-1 mark-start echo "* event2-1: mark-start - $cmd *" >> $LOG $cmd >> $LOG between_the_switch # event2-2 echo "* event2-2: *" >> $LOG $cmd >> $LOG between_the_switch # event2-3 echo "* event2-3: *" >> $LOG $cmd >> $LOG between_the_switch # event2-4 echo "* event2-4: *" >> $LOG $cmd >> $LOG between_the_switch cmd="swayr switch-to-mark-or-urgent-or-lru-window MARK" # event3-1 origin-start echo "* event3-1: origin-start - $cmd *" >> $LOG $cmd >> $LOG between_the_switch # event3-2 echo "* event3-2: *" >> $LOG $cmd >> $LOG between_the_switch # event3-3 echo "* event3-3: *" >> $LOG $cmd >> $LOG between_the_switch # event3-4 echo "* event3-4: *" >> $LOG $cmd >> $LOG between_the_switch # event4-1 mark-start echo "* event4-1: mark-start - $cmd *" >> $LOG $cmd >> $LOG between_the_switch # event4-2 echo "* event4-2: *" >> $LOG $cmd >> $LOG between_the_switch # event4-3 echo "* event4-3: *" >> $LOG $cmd >> $LOG between_the_switch # event4-4 echo "* event4-4: *" >> $LOG $cmd >> $LOG between_the_switch swayrd-endresult:
swayr-git r432.0f5c887-1 * cat ~/.config/swayr/config.toml * [focus] lockin_delay = 750 [misc] seq_inhibit = false #auto_nop_delay = 200 * event1-1: origin-start - swayr switch-to-mark-or-urgent-or-lru-window -L MARK * Executed sway command '[con_id=554] focus' (It's a matching window.) * event1-2: * Executed sway command '[con_id=553] focus' (It's the origin window.) * event1-3: * Executed sway command '[con_id=554] focus' (It's a matching window.) * event1-4: * Executed sway command '[con_id=553] focus' (It's the origin window.) * event2-1: mark-start - swayr switch-to-mark-or-urgent-or-lru-window -L MARK * Executed sway command '[con_id=553] focus' (It's the LRU window.) * event2-2: * Executed sway command '[con_id=554] focus' (It's the origin window.) * event2-3: * Executed sway command '[con_id=553] focus' (It's the LRU window.) * event2-4: * Executed sway command '[con_id=554] focus' (It's the origin window.) * event3-1: origin-start - swayr switch-to-mark-or-urgent-or-lru-window MARK * Executed sway command '[con_id=554] focus' (It's a matching window.) * event3-2: * Executed sway command '[con_id=555] focus' (It's the LRU window.) * event3-3: * Executed sway command '[con_id=553] focus' (It's the origin window.) * event3-4: * Executed sway command '[con_id=554] focus' (It's a matching window.) * event4-1: mark-start - swayr switch-to-mark-or-urgent-or-lru-window MARK * Executed sway command '[con_id=555] focus' (It's the LRU window.) * event4-2: * Executed sway command '[con_id=553] focus' (It's the origin window.) * event4-3: * Executed sway command '[con_id=554] focus' (It's a matching window.) * event4-4: * Executed sway command '[con_id=555] focus' (It's the LRU window.)
As I was working on this shell script, I noticed that they all had the expected "unconditionally alternate between target and ORIGIN" behavior this time when
auto_nop_delay = 200
was enabled.result:
auto_nop_delay = 200
swayr-git r432.0f5c887-1 * cat ~/.config/swayr/config.toml * [focus] lockin_delay = 750 [misc] seq_inhibit = false auto_nop_delay = 200 * event1-1: origin-start - swayr switch-to-mark-or-urgent-or-lru-window -L MARK * Executed sway command '[con_id=558] focus' (It's a matching window.) * event1-2: * Executed sway command '[con_id=556] focus' (It's the LRU window.) * event1-3: * Executed sway command '[con_id=558] focus' (It's a matching window.) * event1-4: * Executed sway command '[con_id=556] focus' (It's the LRU window.) * event2-1: mark-start - swayr switch-to-mark-or-urgent-or-lru-window -L MARK * Executed sway command '[con_id=556] focus' (It's the LRU window.) * event2-2: * Executed sway command '[con_id=558] focus' (It's a matching window.) * event2-3: * Executed sway command '[con_id=556] focus' (It's the LRU window.) * event2-4: * Executed sway command '[con_id=558] focus' (It's a matching window.) * event3-1: origin-start - swayr switch-to-mark-or-urgent-or-lru-window MARK * Executed sway command '[con_id=558] focus' (It's a matching window.) * event3-2: * Executed sway command '[con_id=556] focus' (It's the LRU window.) * event3-3: * Executed sway command '[con_id=558] focus' (It's a matching window.) * event3-4: * Executed sway command '[con_id=556] focus' (It's the LRU window.) * event4-1: mark-start - swayr switch-to-mark-or-urgent-or-lru-window MARK * Executed sway command '[con_id=556] focus' (It's the LRU window.) * event4-2: * Executed sway command '[con_id=558] focus' (It's a matching window.) * event4-3: * Executed sway command '[con_id=556] focus' (It's the LRU window.) * event4-4: * Executed sway command '[con_id=558] focus' (It's a matching window.)
However, when I use
-L
, I don't have to consider whether the switching interval is less thanauto_nop_delay
or not, and the result is always the same, which is more convenient for me.I will continue to check these behaviors as I use it.
Thanks for your kind implementation.
Comment by ~tkna on ~tsdh/swayr
In the following, LRU seems to be included in the switch destination. How can I switch only between MARK and ORIGIN?
swayr switch-to-mark-or-urgent-or-lru-window --skip-lru-if-current-doesnt-match MARK || foot --app-id='APP' swayr switch-to-mark-or-urgent-or-lru-window --skip-lru-if-current-doesnt-match --skip-origin MARK || foot --app-id='APP'
screencast: https://streamable.com/u9k39a
Comment by ~tkna on ~tsdh/swayr
Thanks. I tested the following.
$ pacman -Q swayr-git swayr-git r431.ec73a59-1 $
test.conf
for_window [app_id="APP"] mark "MARK" set $mode_test "Test6[*]?" mode $mode_test { bindsym a exec swayr switch-to-mark-or-urgent-or-lru-window --skip-lru-if-current-doesnt-match --skip-lru MARK || foot --app-id='APP' bindsym b exec swayr switch-to-mark-or-urgent-or-lru-window -L --skip-lru MARK || foot --app-id='APP' bindsym c exec swayr switch-to-app-or-urgent-or-lru-window --skip-lru-if-current-doesnt-match --skip-lru APP || foot --app-id='APP' bindsym d exec swayr switch-to-app-or-urgent-or-lru-window -L --skip-lru APP || foot --app-id='APP' bindsym e exec swayr switch-to-matching-or-urgent-or-lru-window --skip-lru-if-current-doesnt-match --skip-lru '[con_mark="MARK"]' || foot --app-id='APP' bindsym f exec swayr switch-to-matching-or-urgent-or-lru-window -L --skip-lru '[app_name="APP"]' || foot --app-id='APP' bindsym g exec swayr switch-to-matching-or-urgent-or-lru-window -L --skip-lru '[app_id="APP"]' || foot --app-id='APP' bindsym z exec foot --app-id='APP' # back to normal: Escape bindsym Escape mode "default" } bindsym $mod+t mode $mode_test
It seems that if I do
a,b,e
whenMARK
has focus, I can't switch.screencast: https://streamable.com/ppvyeg
[2022-12-12T11:39:29Z DEBUG swayr::daemon] Received command: SwitchToMarkOrUrgentOrLRUWindow { con_mark: "MARK", skip_urgent: false, skip_lru: true, skip_lru_if_current_doesnt_match: true, skip_origin: false } [2022-12-12T11:39:29Z INFO swayr::cmds] Running SwayrCommand SwitchToMarkOrUrgentOrLRUWindow { con_mark: "MARK", skip_urgent: false, skip_lru: true, skip_lru_if_current_doesnt_match: true, skip_origin: false } [2022-12-12T11:39:29Z DEBUG swayr::cmds] Initialized SwitchToMatchingData: SwitchToMatchingData { visited: [], lru: Some(12), origin: Some(138), skip_urgent: false, skip_lru: true, skip_lru_if_current_doesnt_match: true, skip_origin: false } [2022-12-12T11:39:29Z DEBUG swayr::cmds] Switching back to origin [2022-12-12T11:39:29Z DEBUG swayr::cmds] Origin is already focused; resetting. [2022-12-12T11:39:29Z DEBUG swayr::daemon] Executed command, returning result Ok("Origin is already focused.")
Sorry if I misunderstood something.
Comment by ~tkna on ~tsdh/swayr
I think the current behavior is correct for swayr's specification, but when I want to switch unconditionally and alternately between a target for which the user has specified app_id and mark, and the window that has the previous focus, I have to make the script do the following conditional branching.
e.g. If the target is focused,
swayr switch-to-urgent-or-lru-window
is executed. Otherwise, executeswayr switch-to-app-or-urgent-or-lru-window $app_id_or_class --skip-lru --skip-origin
.That may not be a problem, but it seems a bit frustrating not to be able to use that usage by default.
Comment by ~tkna on ~tsdh/swayr
What is the
lockin_delay
,auto_nop_delay
,seq_inhibit
in your config? My~/.config/swayr/config.toml
is below in default state.[focus] lockin_delay = 750 [misc] seq_inhibit = false
Comment by ~tkna on ~tsdh/swayr
I think so.
$ pacman -Q swayr-git swayr-git r427.6c56b3f-1 $
When there are three different windows - mark, current, and one previous focus - I want only mark and current to switch repeatedly.
Comment by ~tkna on ~tsdh/swayr
Sorry if I didn't communicate it well. I would like something that satisfies the following
- When the current window is MARK-foot, I want to switch alternately between only a single LRU (one previously focused window) and only MARK-foot.
- When the current window is not MARK-foot, I want to switch alternately between only MARK-foot and the only current window.
Comment by ~tkna on ~tsdh/swayr
Thanks, I have run Test1-4.
$ pacman -Q swayr-git swayr-git r427.6c56b3f-1 $
It may be a problem with my usage, but I was curious about something.
Here is what I want to do: "I want to be able to switch alternately between the window to be marked at any time and the window that is currently or one focus ago."
With the following settings,
a,b
will cause the LRU to intervene between origin and the mark target. It seems thatc
cannot switch anywhere because the mark target is origin.screencast: https://streamable.com/0hm3tb
for_window [app_id="MARK"] mark "MARK" set $mode_test "Test5[*]?" mode $mode_test { bindsym a exec swayr switch-to-mark-or-urgent-or-lru-window --skip-origin MARK || foot --app-id='MARK' bindsym b exec swayr switch-to-mark-or-urgent-or-lru-window MARK || foot --app-id='MARK' bindsym c exec swayr switch-to-mark-or-urgent-or-lru-window --skip-lru MARK || foot --app-id='MARK' # back to normal: Escape bindsym Escape mode "default" } bindsym $mod+t mode $mode_test
Is there any way to fix this?
Comment by ~tkna on ~tsdh/swayr
I probably found a case where there is a target but non-zero exit. I think this should be a 0 exit because the target exists.
$ pacman -Q swayr-git swayr-git r426.82e1005-1 $
screencast: https://streamable.com/32gu7m
- run one alacritty
- run two foots
- Execute the following command without locking-in focus on the foot before the foot to be executed.
command:
swayr switch-to-app-or-urgent-or-lru-window Alacritty ; echo $? swayr switch-to-app-or-urgent-or-lru-window Alacritty ; echo $? swayr switch-to-app-or-urgent-or-lru-window Alacritty ; echo $? swayr switch-to-app-or-urgent-or-lru-window Alacritty --skip-lru ; echo $?
result:
Executed sway command '[con_id=24] focus' (It's a matching window.) 0 Executed sway command '[con_id=33] focus' (It's the origin window.) 0 Executed sway command '[con_id=24] focus' (It's a matching window.) 0 Error: "Nothing to be switched to." 1
swayrd log(
RUST_BACKTRACE=full RUST_LOG=swayr=debug swayrd
):[2022-12-03T00:31:55Z INFO swayr::cmds] Running SwayrCommand SwitchToAppOrUrgentOrLRUWindow { name: "Alacritty", skip_urgent: false, skip_lru: true, skip_origin: false } [2022-12-03T00:31:55Z DEBUG swayr::cmds] Initialized SwitchToMatchingData: SwitchToMatchingData { visited: [], lru: Some(33), origin: Some(24), skip_urgent: false, skip_lru: true, skip_origin: false } [2022-12-03T00:31:55Z DEBUG swayr::cmds] Switching back to origin [2022-12-03T00:31:55Z DEBUG swayr::cmds] Origin is already focused or is gone; resetting. [2022-12-03T00:31:55Z DEBUG swayr::daemon] Executed command, returning result Err("Nothing to be switched to.")
Comment by ~tkna on ~tsdh/swayr
Both below and Test4 were fine.
$ pacman -Q swayr-git swayr-git r425.727195f-1 $ swayr switch-to-app-or-urgent-or-lru-window NONE --skip-urgent --skip-lru --skip-origin ; echo $? Error: "No window matches." 1 $ swayr switch-to-mark-or-urgent-or-lru-window N --skip-urgent ; echo $? Error: "No window matches." 1 $ swayr switch-to-matching-or-urgent-or-lru-window '[app_id="NONE"]' ; echo $? Error: "No window matches." 1 $
A little more time than this and I will check Test2,3.