Giter VIP home page Giter VIP logo

Comments (16)

blueyed avatar blueyed commented on July 18, 2024

👍

from awesome.

blueyed avatar blueyed commented on July 18, 2024

awful.key might get changed to accept an optional table of arguments, where desc would be part of (to make it more flexible for future changes). But then, adding desc as a new arg by itself would make it easier to use by default (no table/key needed).

from awesome.

actionless avatar actionless commented on July 18, 2024

mb it can be like:

function key.new(mod, _key, press, release, ...)
    allkeys[mod][_key]['keydata'] = ...
    desc = foo.keydata[1]

or even add some workaround do omit release by default, but use it from keydata and shift keydata by one if first member is function:

function key.new(mod, _key, press, ...)
    local keydata = ...
    local release
    if type(keydata[1]) == 'function' then
       release = keydata[1]
       keydata = h_table.range(keydata, 2)
    end     
    allkeys[mod][_key]['keydata'] = keydata

from awesome.

Elv13 avatar Elv13 commented on July 18, 2024

Just as a side note, I also would like to have categories. I made a module for that, but after implementing it, the syntax isn't as nice looking as I thought it would be:

https://github.com/Elv13/awesome-configs/blob/master/shortcuts.lua#L136

The reason for this is to implement this as the welcome page:
![http://upload.wikimedia.org/wikipedia/commons/9/93/Ubuntu_Unity_Keyboard_shortcuts_-_En.png]

Here is how it look:
snapshot3

Many complains about tiled WM is that they are hard to learn (meh...) because they lack WYSIWYG hints. This kind of welcome screen help with that. Actionless edition with the visual keyboard layout is very useful too, maybe an hybrid of both could be used. The Shorter module used here have many issues, so I don't think it is the way forward versus upgrading awful.key. However, maybe we could break things a little more to make this use case better covered. What do you think?

from awesome.

actionless avatar actionless commented on July 18, 2024

so the solution with ... should help with categories, ie it can be like

awful.key({modkey}, 'a', do_action, 'Do some action', 'Misc stuff')


category = foo.keydata[2]

from awesome.

Elv13 avatar Elv13 commented on July 18, 2024

maybe more like

awful.key({modkey}, 'a', do_action, {desc='Do some action', category='Misc stuff'})

?

from awesome.

actionless avatar actionless commented on July 18, 2024

it's more straight-forward, i am agree.
but a tricky thing to remember here what it will be repeated about 100 times in a row, so imho specifiying table key names (desc, category) every time will be too verbose

from awesome.

Elv13 avatar Elv13 commented on July 18, 2024

At the same time, if we want to add another parameter at some point, the function will have 6 arguments, this start to be problematic. It also allow shortcuts helper implementations like yours and mine to have different metadata fields (color, icons?)

Edit:
Actionless version

from awesome.

actionless avatar actionless commented on July 18, 2024

yup, if starting to think about more additional parameters using table keys will make sense and will be less complicated, but i still would like to make it like:

function key.new(mod, _key, press, release, keydata)
    if type(release) == 'table' and not keydata then
       keydata = release
       release = nil
    end  

btw, in my thing only description and category are defined.
colors for categories are set in widget itself, in depend on category.

from awesome.

actionless avatar actionless commented on July 18, 2024

is example in a message above seems ok to you, guys?

also there is a second topic to discuss is how to store bindings?
i was thinking about storing it like:

{
  "joined_modifiers_repr": {
    "key": { keydata },
    "key2": { keydata },
  },
  "Control_Mod4": {
    "r": { keydata },
    "q": { keydata }
  }
}

what do you think about it?

currently to get representation of modifiers for key i am also sorting it for clarity: https://github.com/actionless/awesome_config/blob/devel/actionless/hotkeys.lua#L76-L84

after some agreement on both cases i will start implementing it

from awesome.

actionless avatar actionless commented on July 18, 2024

also just noticed GNOME plans on that topic:
https://wiki.gnome.org/Design/OS/HelpOverlay

from awesome.

actionless avatar actionless commented on July 18, 2024

@blueyed @Elv13 any comments on code examples above?

from awesome.

actionless avatar actionless commented on July 18, 2024

bump

from awesome.

blueyed avatar blueyed commented on July 18, 2024

@actionless
I think your code examples are fine.

from awesome.

Elv13 avatar Elv13 commented on July 18, 2024

Yes, I like the storage example. awful.util.table.join "format" is unusable.

from awesome.

psychon avatar psychon commented on July 18, 2024

If I understand correctly, the merge of #421 fixed this

from awesome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.