Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify sway commands match i3 commands #2336

Closed
ddevault opened this issue Jul 23, 2018 · 31 comments
Closed

Verify sway commands match i3 commands #2336

ddevault opened this issue Jul 23, 2018 · 31 comments

Comments

@ddevault
Copy link
Contributor

ddevault commented Jul 23, 2018

Find a list of i3 commands and make sure we have all of them in sway (at least all the ones we want to have). Double check that each sway implementation supports the same arguments as the i3 equivalents.

Criteria:

  • class
    • __focused__
  • instance
    • __focused__
  • window_role
    • __focused__
  • window_type
    • normal, dialog, utility, toolbar, splash, menu, dropdown_menu, popup_menu, tooltip, notification
  • id
  • title
    • __focused__
  • urgent
    • latest/newest/last/recent (sway: only latest)
    • oldest/first (sway: only oldest)
  • workspace
    • __focused__
  • con_mark
  • con_id
    • __focused__
  • floating
  • tiling

Commands:

  • exec [--no-startup-id]
    • command chaining
    • exec quoting
  • split
    • split vertical|horizontal|toggle
    • splith
    • splitv
    • splitt
  • layout
    • layout default|tabbed|stacking|splitv|splith (sway: default possible but not documented)
    • layout toggle [split|all] (sway: all is ignored)
    • layout toggle [split|tabbed|stacking|splitv|splith] [split|tabbed|stacking|splitv|splith] (sway: anything except split is ignored)
  • focus
    • <criteria> focus (undocumented)
    • focus left|right|down|up
    • focus parent|child|floating|tiling|mode_toggle
    • focus output left|right|up|down|primary|<output> (sway: no primary)
    • focus mode_toggle
  • move
    • move <left|right|down|up> [<px> px] (sway: documentation does not specify px can be included)
    • move [absolute] position <pos_x> [px] <pos_y> [px] (sway: absolute ignored)
    • move [absolute] position center (sway: absolute ignored)
    • move position mouse (sway: allows "absolute")
    • move window|container to mark <mark>
    • move container|workspace to output left|right|down|up|current|primary|<output> (sway: no primary; allows "window")
  • swap container with id|con_id|mark <arg>
  • sticky enable|disable|toggle
  • workspace
    • workspace next|prev|next_on_output|prev_on_output
    • workspace back_and_forth
    • workspace [--no-auto-back-and-forth] <name> (sway: no --no-auto-back-and-forth)
    • workspace [--no-auto-back-and-forth] number <name> (sway: no --no-auto-back-and-forth)
    • move [--no-auto-back-and-forth] [window|container] [to] workspace <name> (sway: no --no-auto-back-and-forth; "to" has to be included)
    • move [--no-auto-back-and-forth] [window|container] [to] workspace number <name> (sway: no --no-auto-back-and-forth; "to" has to be included; undocumented)
    • move [window|container] [to] workspace prev|next|current (sway: current undocumented)
      • move container to workspace back_and_forth
    • Also can be identified with both: "number <number>: <name>"
    • rename workspace [<old_name>] to <new_name>
  • resize
  • mark
    • mark [--add|--replace] [--toggle] <identifier>
    • unmark <identifier>
  • title_format <format>
    • Pango placeholders: %title, %class, %instance
  • border
    • border normal|pixel [<n>]
    • border none|toggle
  • shmlog
    • shmlog <size_in_bytes>
    • shmlog on|off|toggle
  • debuglog on|off|toggle
  • restart
  • reload
  • exit
  • scratchpad
    • move scratchpad (sway: also allows "to")
    • scratchpad show
  • nop [<comment>]
  • bar
    • bar hidden_state hide|show|toggle [<bar_id>]
    • bar mode dock|hide|invisible|toggle [<bar_id>]
  • mode
  • floating enable|disable|toggle
  • fullscreen
  • kill

Configuration:

  • comments
  • font (sway: can be command)
  • Bindings
    • Keyboard: bindsym|bindcode [--release] [<Group>+][<Modifiers>+]<keysym|keycode> command
    • Mouse: bindsym [--release] [--border] [--whole-window] [--exclude-titlebar] [<Modifiers>+]button<n> command
  • mode [--pango_markup] <name>
  • floating_modifier <Modifier> (sway: also includes normal|inverse)
  • floating_m<in|ax>imum_size <width> x <height>
  • default_orientation horizontal|vertical|auto (default follows on monitor size)
  • workspace_layout default|stacking|tabbed (sway: can be command; allows auto)
  • Default border (default: normal)
    • default_[floating_]border normal|none|pixel
    • default_[floating_]border normal|pixel <px>
  • hide_edge_borders none|vertical|horizontal|both|smart (default: none)
  • for_window <criteria> <command>
  • no_focus <criteria>
  • set $&lt;name&gt; &lt;value&gt; (sway: can be command, despite documentation; if &lt;name&gt; is given without $, the $ is silently added instead of error)
  • set_from_resource $<name> <resource_name> <fallback>
  • Assign (sway: can be command)
    • assign <criteria> [→] [workspace] [number] <workspace> (sway: no number)
    • assign <criteria> [→] output left|right|up|down|primary|<output> (sway: undocumented)
  • exec[_always] [--no-startup-id] <command>
  • workspace <workspace> output <output> (sway: can be command)
  • Colors:
    • <colorclass> <border> <background> <text> <indicator> <child_border>
    • colorclass: client.focused client.focused_inactive client.unfocused client.urgent client.placeholder client.background
  • ipc-socket <path> (default: /tmp/i3-%u.XXXXXX/ipc-socket.%p)
  • focus_follows_mouse yes|no (default: yes) (sway: does not document that the default is yes)
  • mouse_warping output|none (default: output)
  • popup_during_fullscreen smart|ignore|leave_fullscreen (default: smart)
  • focus_wrapping yes|no|force (default: yes)
  • force_focus_wrapping yes|no (deprecated)
  • force_xinerama yes|no (default: no)
  • workspace_auto_back_and_forth yes|no (default: no) (sway: can be command)
  • force_display_urgency_hint <timeout> ms (default: 500)
  • focus_on_window_activation smart|urgent|focus|none (default: smart)
  • show_marks yes|no (default: yes) (marks starting with _ will never be drawn) (sway: can be command)
  • line continuation \
  • bar
    • i3bar_command <command> (passed to "sh -c") (default: i3bar) (sway: uses swaybar instead of i3bar)
    • status_command <command> (passed to "sh -c")
    • mode dock|hide|invisibile (default: dock)
    • hidden_state hide|show (default: hide)
    • modifier <Modifier>|none (default: Mod4)
    • bindsym [--release] button<n> <command>
    • id <bar_id> (default: bar-x) (sway: default is not documented)
    • position top|bottom
    • output primary|<output>
    • tray_output none|primary|<output>
    • tray_padding <px> [px] (default: 2)
    • font <font>
    • separator_symbol <symbol> (default: vertical)
    • workspace_buttons yes|no (default: yes)
    • strip_workspace_buttons yes|no (default: no)
    • binding_mode_indicator yes|no (default: yes)
    • Colors:
      • background, statusline, separator, focused_background (fallback: background), focused_statusline (fallback: statusline), focused_separator (fallback: separator), focused_workspace, active_workspace, inactive_workspace, urgent_workspace, binding_mode (fallback: urgent_workspace)

Sway-exclusive:

  • clipboard <content>
  • layout auto <next|prev>
  • layout auto [master|ncol] [inc|set] <n>
  • move <next|prev|first>
  • floating_scroll
  • gaps (TODO: check against i3-gaps)
  • output
  • seamless_mouse
  • include
  • swaybg_command
  • swaybar_command
  • input
  • seat
  • opacity
  • urgent enable|disable|allow|deny
@ddevault ddevault added this to the sway 1.0-beta.1 milestone Jul 23, 2018
@progandy
Copy link
Contributor

progandy commented Jul 23, 2018

There are at least some commands that don't support the same boolean representations, for example focus_wrapping. sway only allows yes, no and force. i3 allows anything.
force is matched the same,
yes can be anything that eval_boolstr recognizes (1, yes, on, true, enable, active)
no is everything else

@ddevault
Copy link
Contributor Author

We should probably use something similar to eval_boolstr ourselves.

@ianyfan
Copy link
Contributor

ianyfan commented Jul 28, 2018

Made a start. Most seems to be there, mainly issues of documentation.

@SirCmpwn moved this list into the top-level description so that GitHub can track the progress of this issue

@ddevault
Copy link
Contributor Author

Thanks for putting that list together, much appreciated! I went through and crossed out some things that don't make sense for sway to implement.

  • font (sway: can be command)
  • workspace_layout default|stacking|tabbed (sway: can be command; allows auto)
  • set $ (sway: can be command, despite documentation; if is given without $, the $ is silently added instead of error)
  • workspace output (sway: can be command)
  • workspace_auto_back_and_forth yes|no (default: no) (sway: can be command)
  • show_marks yes|no (default: yes) (marks starting with _ will never be drawn) (sway: can be command)

Can you elaborate on these? Are these just differences with i3 rather than things sway is missing (save for better set docs)?

  • clipboard
  • seamless_mouse

These aren't present on master, was this list prepared against 0.15?

@ianyfan
Copy link
Contributor

ianyfan commented Jul 28, 2018

was this list prepared against 0.15?

I accidentally started on the 0.15 docs and when I switched to the 1.0 docs I forgot to check ones that were removed.

The ones that I put "can be command" means that in i3, they're only supposed to be used in the config file but in sway they can also be executed at runtime. I don't know if you want to change it. Otherwise, it works as well as in i3.
(I was going to put a note about that in the original comment but forgot)

I also noticed a few markdown escapes I missed, I'll fix that.

@ddevault
Copy link
Contributor Author

Gotcha, thanks

@ianyfan
Copy link
Contributor

ianyfan commented Jul 28, 2018

Actually, if primary outputs aren't being supported you can mark them off.

@ddevault
Copy link
Contributor Author

Good call, updated.

@ianyfan
Copy link
Contributor

ianyfan commented Aug 27, 2018

i3-gaps:

  • gaps (though setting for workspace syntax is slightly different)
  • smart_gaps on|off
  • smart_borders on|no_gaps|off
  • hide_edge_borders smart_no_gaps

@ddevault ddevault mentioned this issue Sep 21, 2018
@martinsb
Copy link

martinsb commented Oct 3, 2018

I noticed that "tiling" and "floating" criteria do not work.
Ex. for_window [tiling] border none yields error that Token 'tiling' is not recognized. The same happens if using floating criterion.
EDIT: forgot to mention, using version 1.0 alpha 6.

@ddevault
Copy link
Contributor Author

ddevault commented Oct 3, 2018

Thanks @martinsb, @RyanDwyer fixed that in #2755.

@ddevault
Copy link
Contributor Author

All done! Special thanks to @ianyfan for their hard work on shoring this up.

@ndrewtl
Copy link

ndrewtl commented Oct 19, 2018

Hooray! Thank you so much @SirCmpwn and all contributors for making this happen. This project is so exciting, as is wl-roots. Huge shoutout to everyone volunteering hours of their lives to make this work, and many thanks!

@orestisfl
Copy link

New stuff in i3 4.16:

@ddevault
Copy link
Contributor Author

ddevault commented Nov 5, 2018

Can you open a new ticket for those things?

@orestisfl
Copy link

A new ticket for each or a single for all?

@ddevault
Copy link
Contributor Author

ddevault commented Nov 6, 2018

Up to you.

@orestisfl orestisfl mentioned this issue Nov 6, 2018
8 tasks
@Arnaudv6
Copy link
Contributor

disclaimer: never used i3 and really new to this all.
And I know this is hackish/defeating.
But those lines in config should work isn't it?
for_window [class="[.]*"] floating enable, focus;
I also tried this one:
for_window [id="[.]*"] floating enable, focus;
yet I get Token 'class' is not recognized
respectively Token 'id' is not recognized

@Arnaudv6
Copy link
Contributor

Should I open a new bug?

@ddevault
Copy link
Contributor Author

Yes. And send a patch

@Arnaudv6
Copy link
Contributor

#3653
@ddevault: I would take years to send a patch there really sorry, just hope this gets tackled before.

@ddevault
Copy link
Contributor Author

That's total horseshit.

@vipau
Copy link

vipau commented Mar 3, 2019

What about set_from_resource? It's strikethrough'd in the issue, but not sure if it's implemented, this breaks compatibility with i3 configs

@RedSoxFan
Copy link
Member

What about set_from_resource?

set_from_resource loads a value from the X resource database. Sway does not use the X resource database and there is not a Wayland equivalent.

@vipau
Copy link

vipau commented Mar 3, 2019

set_from_resource loads a value from the X resource database. Sway does not use the X resource database and there is not a Wayland equivalent.

You're right, appearently this is what the i3 guide says.
I was using set_from_resource $user echo "$USER" which actually work for getting your username into i3 config to write multi-user configs. It also works for reading any other env variable.
Is there another way to read env variables in sway config?

@RedSoxFan
Copy link
Member

I was using set_from_resource $user echo "$USER" which actually work for getting your username into i3 config to write multi-user configs. It also works for reading any other env variable.

You can just replace it with set $user $USER (or better yet, just replace all instances of $user with $USER). See https://www.reddit.com/r/i3wm/comments/4zq30r/is_there_a_way_to_use_bash_environmental/d6y50tt/

Is there another way to read env variables in sway config?

No, there is no way to read an environment variable's value into a sway variable

@emersion
Copy link
Member

emersion commented Mar 3, 2019

You can use command substitution in include directives, e.g. include `hostname`.conf.

@Patricol
Copy link

Couldn't find a more relevant issue for this:

set $<name> <value> doesn't work inside mode <name> {} blocks, which doesn't match i3's behavior.

Is that a bug, an intentional divergence, or an oversight?

Also, @RedSoxFan, i3's set_from_resource $<name> <resource_name> <fallback> does allow for the inclusion of a fallback. If drop-in compatibility with i3 configurations is desired, sway could just interpret set_from_resource commands including <fallback> args as set $<name> <value (fallback)>.

In interpreting my 450 line i3 config file, those are the only two stumbles sway had.

@RedSoxFan
Copy link
Member

RedSoxFan commented Mar 20, 2019

set $<name> <value> doesn't work inside mode <name> {} blocks, which doesn't match i3's behavior.
Is that a bug, an intentional divergence, or an oversight?

I think this is an oversight since they don't really have any relation to modes since they are not scoped. I'll submit a PR to allow it -- Submitted as #3940

sway could just interpret set_from_resource commands including <fallback> args as set $<name> <value (fallback)>

I have no problem submitting a PR to add this for i3 compatibility and just documenting that the fallback is always used and the command only exists for compatibility with i3 configs. @ddevault @emersion any objections?

@ddevault
Copy link
Contributor Author

I'd rather not implement set_from_resource, no.

@ghost
Copy link

ghost commented Nov 9, 2021

Why is ipc-socket struck-through? I don't use it, but sway seems to break compatibility with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests