kbd notif in awesome

This commit is contained in:
Simonas Narbutas
2018-07-30 14:57:54 +02:00
parent 2e41d7601d
commit fd56f2ca1c
4 changed files with 46 additions and 10 deletions

View File

@@ -120,16 +120,15 @@ mykeyboardlayout = awful.widget.keyboardlayout()
-- Create a textclock widget
mytextclock = wibox.widget.textclock()
local cal_notification
-- {{{ Calendar
mytextclock:connect_signal("button::release",
function()
if cal_notification == nil then
awful.spawn.easy_async([[zsh -c "cal -3 -m --color=always |sed 's#\x1B\[7m\([0-9]\+\)\x1B\[27m#<span foreground=\"red\"><b>\1</b></span>#'"]],
function(stdout, stderr, reason, exit_code)
cal_notification = naughty.notify{
text = stdout,
-- text = string.gsub(string.gsub(stdout,
-- "+", "<span foreground='red'><b>"),
-- "-", "</b></span>"),
text = stdout,
font = "Source Code Pro",
timeout = 0,
width = auto,
@@ -141,7 +140,24 @@ mytextclock:connect_signal("button::release",
naughty.destroy(cal_notification)
end
end)
-- }}}
-- {{{ change keyboard layout
mykeyboardlayout:connect_signal("button::release",
function()
if kbd_notification == nil then
awful.spawn.easy_async([[sh -c "~/.bin/kbdswitch"]], function(stdout, stderr, reason, exit_code)
kbd_notification = naughty.notify{
title = "Keyboard",
text = stdout,
timeout = 0.5,
destroy = function() kbd_notification = nil end}
end)
else
naughty.destroy(kbd_notification)
end
end)
-- }}}
-- Create a wibox for each screen and add it
local taglist_buttons = gears.table.join(
awful.button({ }, 1, function(t) t:view_only() end),
@@ -382,6 +398,10 @@ globalkeys = gears.table.join(
function ()
awful.util.spawn("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next", naughty.notify {title = "Next", timeout = 0.5, bg = "#ad11c7"})
end),
awful.key({ "Control", "Mod4" }, "s",
function ()
awful.util.spawn_with_shell("sleep .1 && scrot -s '%d-%m-%y_%H:%M:%s_scrot.png' -e 'mv $f ~/Pictures/scrots/'", naughty.notify {text = "scrot complete", timeout = 0.5, bg = "#ad11c7"})
end),
awful.key({ modkey, "Control" }, "n",
function ()