~tkna


#25 Add OR/NOT designation expression to CRITERIA: switch-to-matching-or-urgent-or-lru-window 14 days ago

Comment by ~tkna on ~tsdh/swayr

Maybe the title should have been "composition of criteria queries using OR/NOT". Feel free to change it.

#22 Multiple Window Switching: switch-to-matching-or-urgent-or-lru-window 14 days ago

Comment by ~tkna on ~tsdh/swayr

I wrote that ticket #25

#25 Add OR/NOT designation expression to CRITERIA: switch-to-matching-or-urgent-or-lru-window 14 days ago

Ticket created by ~tkna on ~tsdh/swayr

(Continued from #22)

If swayr could specify multiple CRETERIA by AND/OR/NOT to specify where to switch focus, I think it could handle most cases imaginable.

#22 Multiple Window Switching: switch-to-matching-or-urgent-or-lru-window 14 days ago

Comment by ~tkna on ~tsdh/swayr

Understood. Thanks for the great design and implementation!

#22 Multiple Window Switching: switch-to-matching-or-urgent-or-lru-window 29 days ago

Comment by ~tkna on ~tsdh/swayr

Understood. I would be happy to be informed of any progress.

#22 Multiple Window Switching: switch-to-matching-or-urgent-or-lru-window 29 days ago

Comment by ~tkna on ~tsdh/swayr

I don't know yet if there are any specific use cases for me, but in the direction of extending the functionality, I feel that the ability to make CRITERIA OR conditional would cover most cases I can imagine right now.

If you don't mind, I will write an issue on sway's github. May I quote this ticket for explanation? Is that a bit hasty?

#22 Multiple Window Switching: switch-to-matching-or-urgent-or-lru-window 29 days ago

Comment by ~tkna on ~tsdh/swayr

Sorry, I must have written the command wrong and misunderstood something. I wrote the following u,v and it worked as expected.

$ pgrep -a sunvox
1178894 sunvox_opengl
$
    bindsym u exec swayr switch-to-matching-or-urgent-or-lru-window '[title="SunVox v"]'
    bindsym v exec swayr switch-to-matching-or-urgent-or-lru-window '[pid=1178894]' --skip-lru
    bindsym w exec swayr switch-to-matching-or-urgent-or-lru-window '[title="(SunVox v|\.sunvox)"]' --skip-lru
    bindsym x exec swayr switch-to-matching-or-urgent-or-lru-window '[app_name="foot|Alacritty"]' --skip-lru

By writing w,x I was also able to match OR conditions on the same CRITERIA type. screencast: https://streamable.com/mcmgh4

This is just a curiosity question, but is there a way to write an OR condition to connect different CRITERIA types?

#22 Multiple Window Switching: switch-to-matching-or-urgent-or-lru-window 30 days ago

Comment by ~tkna on ~tsdh/swayr

Thanks. I have tested the following.

$ foot --title foot#1 & foot --title foot#2 &
$ alacritty
$ paru -S sunvox qutebrowser
$ sunvox_opengl &
$ pgrep -a sunvox_opengl
816200 sunvox_opengl
$ qutebrowser &
$ pgrep -a qutebrowser
608129 /usr/bin/python3 /usr/bin/qutebrowser --untrusted-args
$ 
    bindsym d exec swayr switch-to-matching-or-urgent-or-lru-window '[app_name="foot"]'
    bindsym e exec swayr switch-to-matching-or-urgent-or-lru-window '[app_name="Alacritty"]'
    bindsym f exec swayr switch-to-matching-or-urgent-or-lru-window '[app_name="foot" title="foot#1"]'
    bindsym g exec swayr switch-to-matching-or-urgent-or-lru-window '[app_name="foot" title="foot#1"]' --skip-urgent
    bindsym h exec swayr switch-to-matching-or-urgent-or-lru-window '[app_name="foot" title="foot#1"]' --skip-urgent --skip-lru
    bindsym i exec swayr switch-to-matching-or-urgent-or-lru-window '[app_name="foot" title="foot#1"]' --skip-urgent --skip-lru --skip-origin
    bindsym j exec swayr switch-to-matching-or-urgent-or-lru-window '[app_name="foot" title="foot#1"]' --skip-urgent --skip-origin
    bindsym k exec swayr switch-to-matching-or-urgent-or-lru-window '[app_name="foot" title="foot#1"]' --skip-lru
    bindsym l exec swayr switch-to-matching-or-urgent-or-lru-window '[app_name="foot" title="foot#1"]' --skip-lru --skip-origin
    bindsym m exec swayr switch-to-matching-or-urgent-or-lru-window '[app_name="foot" title="foot#1"]' --skip-origin
    bindsym n exec swayr switch-to-matching-or-urgent-or-lru-window '[app_name="foot" title="foot#"]'
    bindsym o exec swayr switch-to-matching-or-urgent-or-lru-window '[app_name="foot" title="foot#"]' --skip-urgent --skip-lru --skip-origin
    bindsym p exec swayr switch-to-matching-or-urgent-or-lru-window '[app_name="foo[t]" title="foot[#.*]"]' --skip-urgent --skip-lru
    bindsym q exec swayr switch-to-matching-or-urgent-or-lru-window '[title="foot.*"]'
    bindsym r exec swayr switch-to-matching-or-urgent-or-lru-window '[pid=608129]'
    bindsym s exec swayr switch-to-matching-or-urgent-or-lru-window '[title="SunVox v]'
    bindsym t exec swayr switch-to-matching-or-urgent-or-lru-window '[pid=816200]'
  • d-r: appears to be OK
  • s,t: can't switch

As for s,t, I think it is difficult to switch because the application does not have app_id or class. As for me, I don't currently use it regularly, so there is little need for it.

#22 Multiple Window Switching: switch-to-matching-or-urgent-or-lru-window a month ago

Comment by ~tkna on ~tsdh/swayr

The following does not appear to work. Am I doing something wrong?

swayr switch-to-matching-or-urgent-or-lru-window '[name="foot"]'
$ paru -Q swayr-git
swayr-git r363.1cff0d2-1
$ which app_id_class
app_id_class () {
        echo "* APP_ID *"
        swaymsg -t get_tree | grep "app_id" | sed -e "s@^ *.*: @@g" -e "s@[\",]@@g" -e "s@ \+@\n@g" | sort -u
        echo -e "\n* CLASS *"
        swaymsg -t get_tree | jq -r "..|try .window_properties .class" | sort -u
}
$ app_id_class | grep "\*\|foot" 
* APP_ID *
foot
* CLASS *
$ alias swayrd_dbg='pkill swayrd ; RUST_BACKTRACE=1 RUST_LOG=swayr::cmds=debug swayrd 2>&1 | tee /tmp/swayrd_cmds=debug_$(date --utc +%Y%m%d-%H%M%S).log'
$ alias swayrd_dbg_v='pkill swayrd ; RUST_BACKTRACE=1 RUST_LOG=swayr=debug swayrd 2>&1 | tee /tmp/swayrd_$(date --utc +%Y%m%d-%H%M%S).log'
$ swayrd_dbg_v

Having run out of alphabets to make identifiers and key bindings I start Test2.

set $mode_test "Test2 key[*]?"
mode $mode_test {
    bindsym a exec swayr switch-to-matching-or-urgent-or-lru-window '[name="foot"]'
    bindsym b exec swayr switch-to-matching-or-urgent-or-lru-window '[name=foot]'
    bindsym c exec swayr switch-to-matching-or-urgent-or-lru-window [name=foot]
    # back to normal: Escape
    bindsym Escape mode "default"
}
bindsym $mod+t mode $mode_test
  • a-c: do not switch. The debug log is below
[a@gb1 ~]$ swayrd_dbg_v
[2022-07-08T08:30:28Z DEBUG swayr::shared::cfg] Loading config from /home/a/.config/swayr/config.toml.
[2022-07-08T08:30:28Z DEBUG swayr::daemon] Connecting to sway for subscribing to events...
[2022-07-08T08:30:28Z DEBUG swayr::daemon] Deleted stale socket from previous run.
[2022-07-08T08:30:29Z DEBUG swayr::daemon] Handled window event type Focus
[2022-07-08T08:30:30Z DEBUG swayr::daemon] Locking-in focus on 11
[2022-07-08T08:30:33Z DEBUG swayr::daemon] Executing auto-nop.
[2022-07-08T08:30:33Z INFO  swayr::cmds] Running SwayrCommand Nop
[2022-07-08T08:30:36Z INFO  swayr::cmds] Running SwayrCommand SwitchToMatchingOrUrgentOrLRUWindow { criteria: "[name=\"foot\"]", skip_urgent: false, skip_lru: false, skip_origin: false }
[2022-07-08T08:30:36Z ERROR swayr::criteria] Could not parse criteria query [name="foot"]: error at 1:2: expected one of "]", "app_id", "app_name", "class", "con_id", "con_mark", "floating", "instance", "pid", "tiling", "title", [' ' | '\t']
[2022-07-08T08:30:41Z DEBUG swayr::daemon] Executing auto-nop.
[2022-07-08T08:30:41Z INFO  swayr::cmds] Running SwayrCommand Nop
[2022-07-08T08:30:42Z DEBUG swayr::daemon] Handled window event type Focus
^C
[a@gb1 ~]$

#22 Multiple Window Switching: switch-to-matching-or-urgent-or-lru-window a month ago

Comment by ~tkna on ~tsdh/swayr

I see, you mean matching on the AND condition, not the OR condition. I didn't realize that, sorry. I redid it with the following for now.

$ paru -Q swayr-git
swayr-git r363.1cff0d2-1
$ foot --title foot#1 & foot --title foot#2 &
set $mode_test "Test key[*]?"
mode $mode_test {
    bindsym p exec swayr switch-to-matching-or-urgent-or-lru-window '[app_id="foot" title="foot#1"]'
    bindsym q exec swayr switch-to-matching-or-urgent-or-lru-window '[app_id="foot" title="foot#1"]' --skip-urgent
    bindsym r exec swayr switch-to-matching-or-urgent-or-lru-window '[app_id="foot" title="foot#1"]' --skip-urgent --skip-lru
    bindsym s exec swayr switch-to-matching-or-urgent-or-lru-window '[app_id="foot" title="foot#1"]' --skip-urgent --skip-lru --skip-origin
    bindsym t exec swayr switch-to-matching-or-urgent-or-lru-window '[app_id="foot" title="foot#1"]' --skip-urgent --skip-origin
    bindsym u exec swayr switch-to-matching-or-urgent-or-lru-window '[app_id="foot" title="foot#1"]' --skip-lru
    bindsym v exec swayr switch-to-matching-or-urgent-or-lru-window '[app_id="foot" title="foot#1"]' --skip-lru --skip-origin
    bindsym w exec swayr switch-to-matching-or-urgent-or-lru-window '[app_id="foot" title="foot#1"]' --skip-origin
    bindsym x exec swayr switch-to-matching-or-urgent-or-lru-window '[app_id="foot" title="foot#"]'
    bindsym z exec swayr switch-to-matching-or-urgent-or-lru-window '[app_id="foot" title="foot#"]' --skip-urgent --skip-lru --skip-origin
    # back to normal: Escape
    bindsym Escape mode "default"
}
bindsym $mod+t mode $mode_test
  • p-z: no problems as far as I can see

Thank you very much. I will do some more testing with PID.