material-shell / material-awesome

Material and Mouse driven config for AwesomeWM 4.3
MIT License
686 stars 243 forks source link

make notification via awful #55

Open kleinpetr opened 4 years ago

kleinpetr commented 4 years ago

Hey,

is there some chance to generate custom notification via awful?

I am creating my own sh script for toggling keyboard layouts like this

#!/bin/bash

actual_layout=$(setxkbmap -query | grep layout)

if [[ $actual_layout == *"us"* ]]; then
        setxkbmap -layout "cz(qwerty)"
else
        setxkbmap -layout "us"
fi

xmodmap $HOME/.Xmodmap

and rebind the keys/global.lua shortcut mod+space, like this

awful.key(
    {modkey},
    'space',
    function()
      -- _G.screen.primary.left_panel:toggle(true)
      awful.spawn('nextkblayout.sh')
      -- HERE I WANT SHOW NOTIFICATION WITH CUSTOM MESSAGE
    end,
    {description = 'show main menu', group = 'awesome'}
  ),

is it possible?

kleinpetr commented 4 years ago

Ok I am found the naught solution like this

awful.spawn.easy_async_with_shell('nextkblayout', function(out)
        naughty.notify({
          title = 'Keyboard layout switched',
          text = out
        })
      end)

but the notify appears after few seconds, not at the same moment