[i3king] unable to get rules working #214

Closed
opened 2025-03-21 20:06:59 +00:00 by TimRegeant · 10 comments
TimRegeant commented 2025-03-21 20:06:59 +00:00 (Migrated from github.com)

Hi, thanks for the amazing i3 toolset. They are all working great for me except i3king which I am having some issue with. Probably user error, but hoping I can get some guidance.

I am on void linux/runit. i3king --version reports version: 0.4.3 updated: 2023-08-04

I am starting i3king in my i3 startup script as 'i3king &'. After boot I see two PIDs running as i3king and the pid file at /run/user/1000/i3ass/i3king.pid so all is well there.

I edited the default ~/.config/i3king/rules file to just contain:

GLOBAL
exec --no-startup-id notify-send a-new-window-was-created

So I expect every new window to pop up a notification as a test, but this is not happening. If I just run 'notify-send hello' at the terminal the mesage pops up ok so I see my notify-send is working.

If I run i3king at the terminal like this: 'i3king --dryrun' I get a warning with the rules file above.
[WARNING] 'GLOBAL'
Expected criteria, got ('') A missplaced command? maybe.

Could you suggest something I could try or change to get this working? Thank you.

Hi, thanks for the amazing i3 toolset. They are all working great for me except i3king which I am having some issue with. Probably user error, but hoping I can get some guidance. I am on void linux/runit. i3king --version reports version: 0.4.3 updated: 2023-08-04 I am starting i3king in my i3 startup script as 'i3king &'. After boot I see two PIDs running as i3king and the pid file at /run/user/1000/i3ass/i3king.pid so all is well there. I edited the default ~/.config/i3king/rules file to just contain: GLOBAL exec --no-startup-id notify-send a-new-window-was-created So I expect every new window to pop up a notification as a test, but this is not happening. If I just run 'notify-send hello' at the terminal the mesage pops up ok so I see my notify-send is working. If I run i3king at the terminal like this: 'i3king --dryrun' I get a warning with the rules file above. [WARNING] 'GLOBAL' Expected criteria, got ('') A missplaced command? maybe. Could you suggest something I could try or change to get this working? Thank you.
TimRegeant commented 2025-03-21 20:45:23 +00:00 (Migrated from github.com)

Some follow-up...Using the default rules file that i3king creates on first start and running 'i3king --verbose --dryrun' results in this output:

% i3king --verbose --dryrun
i3king start
class:.:instance:firefox:title:a:space:window:space:title|tab:window_type:.:window_role:.:
[WARNING] 'GLOBAL'
Expected criteria, got ('') A missplaced command? maybe.
[WARNING] 'DEFAULT'
Expected criteria, got ('') A missplaced command? maybe.
class:URxvt:instance:.
:title:.:window_type:.:window_role:.:
class:URxvt:instance:.
:title:.:window_type:.:window_role:.:
class:.
:instance:firefox:title:.:window_type:.:window_role:.:
class:URxvt:instance:.
:title:.:window_type:.:window_role:.:
class:.
:instance:firefox:title:.:window_type:.:window_role:.:
class:URxvt:instance:.
:title:.:window_type:.:window_role:.:
class:.
:instance:firefox:title:.:window_type:.:window_role:.:
class:.
:instance:firefox:title:.:window_type:.:window_role:.:
class:URxvt:instance:.
:title:.:window_type:.:window_role:.*:

So it looks like the GLOBAL and DEFAULT lines with no blacklist criteria are throwing warnings and not getting parsed even with the default rules file. Maybe something related to the regex changes from the last update?

Some follow-up...Using the default rules file that i3king creates on first start and running 'i3king --verbose --dryrun' results in this output: % i3king --verbose --dryrun i3king start class:.*:instance:firefox:title:a[[:space:]]window[[:space:]]title|tab:window_type:.*:window_role:.*: [WARNING] 'GLOBAL' Expected criteria, got ('') A missplaced command? maybe. [WARNING] 'DEFAULT' Expected criteria, got ('') A missplaced command? maybe. class:URxvt:instance:.*:title:.*:window_type:.*:window_role:.*: class:URxvt:instance:.*:title:.*:window_type:.*:window_role:.*: class:.*:instance:firefox:title:.*:window_type:.*:window_role:.*: class:URxvt:instance:.*:title:.*:window_type:.*:window_role:.*: class:.*:instance:firefox:title:.*:window_type:.*:window_role:.*: class:URxvt:instance:.*:title:.*:window_type:.*:window_role:.*: class:.*:instance:firefox:title:.*:window_type:.*:window_role:.*: class:.*:instance:firefox:title:.*:window_type:.*:window_role:.*: class:URxvt:instance:.*:title:.*:window_type:.*:window_role:.*: So it looks like the GLOBAL and DEFAULT lines with no blacklist criteria are throwing warnings and not getting parsed even with the default rules file. Maybe something related to the regex changes from the last update?
TimRegeant commented 2025-03-21 20:58:11 +00:00 (Migrated from github.com)

Yes, there appears to be a bug with GLOBAL and DEFAULT rules without blacklist criteria.

I modified my simplified example rules file from this:

GLOBAL
exec --no-startup-id notify-send a-new-window-was-created

to this:

GLOBAL class=foobar
exec --no-startup-id notify-send a-new-window-was-created

and now running 'i3king --verbose --dryrun' doesn't produce any warnings:

i3king start
class:foobar:instance:.:title:.:window_type:.:window_role:.:

So now, the rule is triggered when a new window is opened. However, with the GLOBAL rule above, opening a new window produces an entire screen full of notification chicklets, then they expire, then a another full screen of notifications is drawn, and this goes on until I kill the i3king process. Might be something to do with not having systemd?

If I change the rule to use 'wall' instead of 'notify-send' then all works good and the terminals get the message:

GLOBAL class=foobar
exec --no-startup-id wall a-new-window-was-created

Yes, there appears to be a bug with GLOBAL and DEFAULT rules without blacklist criteria. I modified my simplified example rules file from this: GLOBAL exec --no-startup-id notify-send a-new-window-was-created to this: GLOBAL class=foobar exec --no-startup-id notify-send a-new-window-was-created and now running 'i3king --verbose --dryrun' doesn't produce any warnings: i3king start class:foobar:instance:.*:title:.*:window_type:.*:window_role:.*: So now, the rule is triggered when a new window is opened. However, with the GLOBAL rule above, opening a new window produces an entire screen full of notification chicklets, then they expire, then a another full screen of notifications is drawn, and this goes on until I kill the i3king process. Might be something to do with not having systemd? If I change the rule to use 'wall' instead of 'notify-send' then all works good and the terminals get the message: GLOBAL class=foobar exec --no-startup-id wall a-new-window-was-created
1ntronaut commented 2025-03-25 19:57:21 +00:00 (Migrated from github.com)

i3kings config file is (among other things) depending on some of the i3 config syntax, make sure you get the indentation right and escape \n newlines in the right places. Indent the second line with two spaces:

GLOBAL class=foobar
  exec --no-startup-id wall a-new-window-was-created

The difference in between notify-send and wall, does imply another probable cause though..
Maybe they differ in how they eventually assign winid's to the processes spawning a single winid to the notifications, or a new winid for every single notification pop-up.

Can't help you with that, systemd, notify-send and definitely wall are out of my league to understand thoroughly.

I can't help you on anything more specific, but I've made a write-up in my i3king rules file, which is a compilation of info from the manpages of i3king+i3run with defaults and notes/examples I made myself, to try understand it myself. Also can't guarantee it's 100% correct or that it'll work on your setup, though.

i3kings config file is (among other things) depending on some of the i3 config syntax, make sure you get the indentation right and escape \n newlines in the right places. Indent the second line with two spaces: ``` GLOBAL class=foobar exec --no-startup-id wall a-new-window-was-created ``` The difference in between notify-send and wall, does imply another probable cause though.. Maybe they differ in how they eventually assign winid's to the processes spawning a single winid to the notifications, or a new winid for every single notification pop-up. Can't help you with that, systemd, notify-send and definitely wall are out of my league to understand thoroughly. > I can't help you on anything more specific, but I've made a [write-up in my i3king rules file](https://bin.disroot.org/?260a0d5ff8096bc6#8mWXsR9mapCoswvCMosoEmnsPTf7sVmvT2WD4qs6s5U), which is a compilation of info from the manpages of i3king+i3run with defaults and notes/examples I made myself, to try understand it myself. Also can't guarantee it's 100% correct or that it'll work on your setup, though.
TimRegeant commented 2025-03-25 22:33:22 +00:00 (Migrated from github.com)

Hi, yes I have the spacing and format correct. As I mentioned, this error occurs on the default config file example from i3ass itself, not just my specific config file.

Hi, yes I have the spacing and format correct. As I mentioned, this error occurs on the default config file example from i3ass itself, not just my specific config file.
1ntronaut commented 2025-03-28 12:10:56 +00:00 (Migrated from github.com)

@TimRegeant I noticed you edited your comment.. I saw you looked into my write-up..

if I use:

DEFAULT
  class=(URxvt|XTerm|st-256color|St) instance=auto, \
  class=Xfce4-terminal role=auto
    floating enable

i3king throws this error

/usr/bin/i3king: line 383: execute: bad array subscript
[WARNING] 'DEFAULT' 
 Expected criteria, got ('') A missplaced command? maybe.
[{"success":true}]
[{"success":true},{"success":true},{"success":true},{"success":true}]

Using the previous setting below, makes i3king initialize and run perfectly, w/o throuing any errors.

DEFAULT \
  class=(URxvt|XTerm|st-256color|St) instance=auto, \
  class=Xfce4-terminal role=auto
    floating enable

... I am not saying you are wrong, perhaps there are issues/errors in the bash scripting and/or the manpage/--help pages are incorrect. Unfortunately, I cannot just help you with that

@TimRegeant I noticed you edited your comment.. I saw you looked into my write-up.. if I use: ``` DEFAULT class=(URxvt|XTerm|st-256color|St) instance=auto, \ class=Xfce4-terminal role=auto floating enable ``` i3king throws this error ``` /usr/bin/i3king: line 383: execute: bad array subscript [WARNING] 'DEFAULT' Expected criteria, got ('') A missplaced command? maybe. [{"success":true}] [{"success":true},{"success":true},{"success":true},{"success":true}] ``` Using the previous setting below, makes i3king initialize and run perfectly, w/o throuing any errors. ``` DEFAULT \ class=(URxvt|XTerm|st-256color|St) instance=auto, \ class=Xfce4-terminal role=auto floating enable ``` ... I am not saying you are wrong, perhaps there are issues/errors in the bash scripting and/or the manpage/--help pages are incorrect. Unfortunately, I cannot just help you with that
TimRegeant commented 2025-03-28 12:37:27 +00:00 (Migrated from github.com)

I edited my comment because I was wrong about what I said :).

I edited my comment because I was wrong about what I said :).
1ntronaut commented 2025-03-28 15:45:58 +00:00 (Migrated from github.com)

@TimRegeant ok, no problem!\

@TimRegeant ok, no problem!\
budRich commented 2025-03-29 12:26:04 +00:00 (Migrated from github.com)

I will look into this. Without testing anything, it sounds like there is a bug when DEFAULT not having a blacklist . Is there a GLOBAL rule, i don't remember that.

@TimRegeant thanks for testing and good bug report!
@1ntronaut great support, means a lot, really, thanks :)

I will look into this. Without testing anything, it sounds like there is a bug when DEFAULT not having a blacklist . Is there a GLOBAL rule, i don't remember that. @TimRegeant thanks for testing and good bug report! @1ntronaut great support, means a lot, really, thanks :)
budRich commented 2025-03-29 14:50:00 +00:00 (Migrated from github.com)

I think i fixed it. @TimRegeant can you test it to confirm?

I think i fixed it. @TimRegeant can you test it to confirm?
TimRegeant commented 2025-03-30 01:49:11 +00:00 (Migrated from github.com)

Yes, seems fixed, no errors thrown on DEFAULT keyword with no blacklist. Thanks so much!

Yes, seems fixed, no errors thrown on DEFAULT keyword with no blacklist. Thanks so much!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bud/i3ass#214
No description provided.