material-shell/material-awesome

make notification via awful

Opened this issue · 1 comments

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?

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