Sway: Implement bindsym --locked

Created on 22 Apr 2016  路  11Comments  路  Source: swaywm/sway

add an option so media control keys like XF86AudioRaiseVolume etc. can control music/volume in locked state

Most helpful comment

It would be nice if you could just specify a whitelist of keys that should get through. Or maybe bindsym --locked?

All 11 comments

It would be nice if you could just specify a whitelist of keys that should get through. Or maybe bindsym --locked?

I like the idea of bindsym --locked. It would allow different actions for the same combinations in the locked state and it is more explicit, so you don't allow wrong key combinations resulting in harmful actions by accident.

You could specifically let multimedia keys through or you could add a flag to pass a given key through but it seems like it would be simultaneously much easier and more useful to have a locked mode that is applied when you lock the screen.

This is useful because

  • Its simpler and easier to implement as you just engage a mode upon locking the screen
  • it keeps all your lock screen bindings together
  • it allows you to reuse bindings that may be bound otherwise for your locksceen where useful example

jkhl volume up down track previous next (for those without multimedia keys)
space toggle playback

I'm sure there are a multitude of permutations that others may find useful which is why its much more useful to have a lockscreen mode than passing specific keys and simpler than a flag for every possible binding.

You could have both. Write up your own locked mode, then make your "lock screen" keybinding switch to that mode before invoking swaylock. And in that mode section add a bunch of keybindings with --locked.

@SirCmpwn I have several questions.

Do normal keybindings work while locked? That would seem to be a security issue so I presume that only the bindings with --locked would be effective. Is that correct?

How would you ensure that it left the locked mode upon unlocking or would you just have to manually escape every time you unlocked your computer?

Does sway have anything like hooks or events so you could say run this script upon lock unlock etc etc?

Wouldn't a locked mode as opposed to a locked modifier be easier to implement?

Do normal keybindings work while locked? That would seem to be a security issue so I presume that only the bindings with --locked would be effective. Is that correct?

Yes.

How would you ensure that it left the locked mode upon unlocking or would you just have to manually escape every time you unlocked your computer?

Just write a script like this:

swaymsg mode locked
swaylock
swaymsg mode default

Invoke this script instead of swaylock.

Wouldn't a locked mode as opposed to a locked modifier be easier to implement?

No.

I suppose I should just configure a vm to test sway. One last question if I have a hotkey to open a terminal but swaylock is engaged what happens?

It doesn't open a terminal, unless of course you've bound a key with --locked that opens your terminal.

What happened to his issue?

Hasn't been prioritized. Send a patch if you think it's important.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ddevault picture ddevault  路  4Comments

marcoms picture marcoms  路  3Comments

Olie440 picture Olie440  路  4Comments

dnkl picture dnkl  路  4Comments

J0nnyMak0 picture J0nnyMak0  路  3Comments