fixed awful.spawn/os.execute calls

This commit is contained in:
Luca CPZ 2018-08-03 11:29:32 +02:00
parent 2b3317217f
commit c53da4c7f0
7 changed files with 42 additions and 42 deletions

View File

@ -398,9 +398,9 @@ globalkeys = my_table.join(
{description = "show weather", group = "widgets"}),
-- Brightness
awful.key({ }, "XF86MonBrightnessUp", function () awful.util.spawn("xbacklight -inc 10") end,
awful.key({ }, "XF86MonBrightnessUp", function () os.execute("xbacklight -inc 10") end,
{description = "+10%", group = "hotkeys"}),
awful.key({ }, "XF86MonBrightnessDown", function () awful.util.spawn("xbacklight -dec 10") end,
awful.key({ }, "XF86MonBrightnessDown", function () os.execute("xbacklight -dec 10") end,
{description = "-10%", group = "hotkeys"}),
-- ALSA volume control
@ -438,25 +438,25 @@ globalkeys = my_table.join(
-- MPD control
awful.key({ altkey, "Control" }, "Up",
function ()
awful.spawn.with_shell("mpc toggle")
os.execute("mpc toggle")
beautiful.mpd.update()
end,
{description = "mpc toggle", group = "widgets"}),
awful.key({ altkey, "Control" }, "Down",
function ()
awful.spawn.with_shell("mpc stop")
os.execute("mpc stop")
beautiful.mpd.update()
end,
{description = "mpc stop", group = "widgets"}),
awful.key({ altkey, "Control" }, "Left",
function ()
awful.spawn.with_shell("mpc prev")
os.execute("mpc prev")
beautiful.mpd.update()
end,
{description = "mpc prev", group = "widgets"}),
awful.key({ altkey, "Control" }, "Right",
function ()
awful.spawn.with_shell("mpc next")
os.execute("mpc next")
beautiful.mpd.update()
end,
{description = "mpc next", group = "widgets"}),
@ -475,10 +475,10 @@ globalkeys = my_table.join(
{description = "mpc on/off", group = "widgets"}),
-- Copy primary to clipboard (terminals to gtk)
awful.key({ modkey }, "c", function () awful.spawn("xsel | xsel -i -b") end,
awful.key({ modkey }, "c", function () awful.spawn.with_shell("xsel | xsel -i -b") end,
{description = "copy terminal to gtk", group = "hotkeys"}),
-- Copy clipboard to primary (gtk to terminals)
awful.key({ modkey }, "v", function () awful.spawn("xsel -b | xsel") end,
awful.key({ modkey }, "v", function () awful.spawn.with_shell("xsel -b | xsel") end,
{description = "copy gtk to terminal", group = "hotkeys"}),
-- User programs
@ -494,7 +494,7 @@ globalkeys = my_table.join(
--]]
--[[ dmenu
awful.key({ modkey }, "x", function ()
awful.spawn(string.format("dmenu_run -i -fn 'Monospace' -nb '%s' -nf '%s' -sb '%s' -sf '%s'",
os.execute(string.format("dmenu_run -i -fn 'Monospace' -nb '%s' -nf '%s' -sb '%s' -sf '%s'",
beautiful.bg_normal, beautiful.fg_normal, beautiful.bg_focus, beautiful.fg_focus))
end,
{description = "show dmenu", group = "launcher"})

View File

@ -10,7 +10,7 @@ local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
local os = { getenv = os.getenv, setlocale = os.setlocale }
local os = { execute = os.execute, getenv = os.getenv, setlocale = os.setlocale }
local awesome, client = awesome, client
local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
@ -214,7 +214,7 @@ local fsbar = wibox.widget {
ticks_size = 6,
widget = wibox.widget.progressbar,
}
theme.fs = lain.widget.fs({
theme.fs = lain.widget.fs {
notification_preset = { fg = theme.fg_normal, bg = theme.bg_normal, font = "Tamzen 10.5" },
settings = function()
if fs_now["/home"].percentage < 90 then
@ -224,13 +224,13 @@ theme.fs = lain.widget.fs({
end
fsbar:set_value(fs_now["/home"].percentage / 100)
end
})
}
local fsbg = wibox.container.background(fsbar, "#474747", gears.shape.rectangle)
local fswidget = wibox.container.margin(fsbg, 2, 7, 4, 4)
-- ALSA volume bar
local volicon = wibox.widget.imagebox(theme.vol)
theme.volume = lain.widget.alsabar({
theme.volume = lain.widget.alsabar {
width = 59, border_width = 0, ticks = true, ticks_size = 6,
notification_preset = { font = theme.font },
--togglechannel = "IEC958,3",
@ -250,26 +250,26 @@ theme.volume = lain.widget.alsabar({
mute = red,
unmute = theme.fg_normal
}
})
}
theme.volume.tooltip.wibox.fg = theme.fg_focus
theme.volume.bar:buttons(my_table.join (
awful.button({}, 1, function()
awful.spawn.with_shell(string.format("%s -e alsamixer", awful.util.terminal))
awful.spawn(string.format("%s -e alsamixer", awful.util.terminal))
end),
awful.button({}, 2, function()
awful.spawn(string.format("%s set %s 100%%", theme.volume.cmd, theme.volume.channel))
os.execute(string.format("%s set %s 100%%", theme.volume.cmd, theme.volume.channel))
theme.volume.update()
end),
awful.button({}, 3, function()
awful.spawn(string.format("%s set %s toggle", theme.volume.cmd, theme.volume.togglechannel or theme.volume.channel))
os.execute(string.format("%s set %s toggle", theme.volume.cmd, theme.volume.togglechannel or theme.volume.channel))
theme.volume.update()
end),
awful.button({}, 4, function()
awful.spawn(string.format("%s set %s 1%%+", theme.volume.cmd, theme.volume.channel))
os.execute(string.format("%s set %s 1%%+", theme.volume.cmd, theme.volume.channel))
theme.volume.update()
end),
awful.button({}, 5, function()
awful.spawn(string.format("%s set %s 1%%-", theme.volume.cmd, theme.volume.channel))
os.execute(string.format("%s set %s 1%%-", theme.volume.cmd, theme.volume.channel))
theme.volume.update()
end)
))

View File

@ -180,23 +180,23 @@ musicwidget:buttons(my_table.join(awful.button({ }, 1,
function () awful.spawn(theme.musicplr) end)))
prev_icon:buttons(my_table.join(awful.button({}, 1,
function ()
awful.spawn.with_shell("mpc prev")
os.execute("mpc prev")
theme.mpd.update()
end)))
next_icon:buttons(my_table.join(awful.button({}, 1,
function ()
awful.spawn.with_shell("mpc next")
os.execute("mpc next")
theme.mpd.update()
end)))
stop_icon:buttons(my_table.join(awful.button({}, 1,
function ()
play_pause_icon:set_image(theme.play)
awful.spawn.with_shell("mpc stop")
os.execute("mpc stop")
theme.mpd.update()
end)))
play_pause_icon:buttons(my_table.join(awful.button({}, 1,
function ()
awful.spawn.with_shell("mpc toggle")
os.execute("mpc toggle")
theme.mpd.update()
end)))

View File

@ -136,15 +136,15 @@ local mpdicon = wibox.widget.imagebox(theme.widget_music)
mpdicon:buttons(my_table.join(
awful.button({ modkey }, 1, function () awful.spawn.with_shell(musicplr) end),
awful.button({ }, 1, function ()
awful.spawn.with_shell("mpc prev")
os.execute("mpc prev")
theme.mpd.update()
end),
awful.button({ }, 2, function ()
awful.spawn.with_shell("mpc toggle")
os.execute("mpc toggle")
theme.mpd.update()
end),
awful.button({ }, 3, function ()
awful.spawn.with_shell("mpc next")
os.execute("mpc next")
theme.mpd.update()
end)))
theme.mpd = lain.widget.mpd({

View File

@ -128,7 +128,7 @@ task:buttons(my_table.join(awful.button({}, 1, lain.widget.contrib.task.prompt))
-- Scissors (xsel copy and paste)
local scissors = wibox.widget.imagebox(theme.widget_scissors)
scissors:buttons(my_table.join(awful.button({}, 1, function() awful.spawn("xsel | xsel -i -b") end)))
scissors:buttons(my_table.join(awful.button({}, 1, function() awful.spawn.with_shell("xsel | xsel -i -b") end)))
-- Mail IMAP check
local mailicon = wibox.widget.imagebox(theme.widget_mail)
@ -163,15 +163,15 @@ local mpdicon = wibox.widget.imagebox(theme.widget_music)
mpdicon:buttons(my_table.join(
awful.button({ modkey }, 1, function () awful.spawn.with_shell(musicplr) end),
awful.button({ }, 1, function ()
awful.spawn.with_shell("mpc prev")
os.execute("mpc prev")
theme.mpd.update()
end),
awful.button({ }, 2, function ()
awful.spawn.with_shell("mpc toggle")
os.execute("mpc toggle")
theme.mpd.update()
end),
awful.button({ }, 3, function ()
awful.spawn.with_shell("mpc next")
os.execute("mpc next")
theme.mpd.update()
end)))
theme.mpd = lain.widget.mpd({

View File

@ -168,22 +168,22 @@ theme.volume.tooltip.wibox.fg = theme.fg_focus
theme.volume.tooltip.wibox.font = theme.font
theme.volume.bar:buttons(my_table.join (
awful.button({}, 1, function()
awful.spawn.with_shell(string.format("%s -e alsamixer", terminal))
awful.spawn(string.format("%s -e alsamixer", terminal))
end),
awful.button({}, 2, function()
awful.spawn(string.format("%s set %s 100%%", theme.volume.cmd, theme.volume.channel))
os.execute(string.format("%s set %s 100%%", theme.volume.cmd, theme.volume.channel))
theme.volume.update()
end),
awful.button({}, 3, function()
awful.spawn(string.format("%s set %s toggle", theme.volume.cmd, theme.volume.togglechannel or theme.volume.channel))
os.execute(string.format("%s set %s toggle", theme.volume.cmd, theme.volume.togglechannel or theme.volume.channel))
theme.volume.update()
end),
awful.button({}, 4, function()
awful.spawn(string.format("%s set %s 1%%+", theme.volume.cmd, theme.volume.channel))
os.execute(string.format("%s set %s 1%%+", theme.volume.cmd, theme.volume.channel))
theme.volume.update()
end),
awful.button({}, 5, function()
awful.spawn(string.format("%s set %s 1%%-", theme.volume.cmd, theme.volume.channel))
os.execute(string.format("%s set %s 1%%-", theme.volume.cmd, theme.volume.channel))
theme.volume.update()
end)
))

View File

@ -209,22 +209,22 @@ theme.volume = lain.widget.alsabar({
})
volicon:buttons(my_table.join (
awful.button({}, 1, function()
awful.spawn.with_shell(string.format("%s -e alsamixer", awful.util.terminal))
awful.spawn(string.format("%s -e alsamixer", awful.util.terminal))
end),
awful.button({}, 2, function()
awful.spawn(string.format("%s set %s 100%%", theme.volume.cmd, theme.volume.channel))
os.execute(string.format("%s set %s 100%%", theme.volume.cmd, theme.volume.channel))
theme.volume.notify()
end),
awful.button({}, 3, function()
awful.spawn(string.format("%s set %s toggle", theme.volume.cmd, theme.volume.togglechannel or theme.volume.channel))
os.execute(string.format("%s set %s toggle", theme.volume.cmd, theme.volume.togglechannel or theme.volume.channel))
theme.volume.notify()
end),
awful.button({}, 4, function()
awful.spawn(string.format("%s set %s 1%%+", theme.volume.cmd, theme.volume.channel))
os.execute(string.format("%s set %s 1%%+", theme.volume.cmd, theme.volume.channel))
theme.volume.notify()
end),
awful.button({}, 5, function()
awful.spawn(string.format("%s set %s 1%%-", theme.volume.cmd, theme.volume.channel))
os.execute(string.format("%s set %s 1%%-", theme.volume.cmd, theme.volume.channel))
theme.volume.notify()
end)
))