1
0
Fork 0
mirror of https://github.com/lcpz/awesome-copycats.git synced 2024-12-22 19:22:32 +00:00

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"}), {description = "show weather", group = "widgets"}),
-- Brightness -- 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"}), {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"}), {description = "-10%", group = "hotkeys"}),
-- ALSA volume control -- ALSA volume control
@ -438,25 +438,25 @@ globalkeys = my_table.join(
-- MPD control -- MPD control
awful.key({ altkey, "Control" }, "Up", awful.key({ altkey, "Control" }, "Up",
function () function ()
awful.spawn.with_shell("mpc toggle") os.execute("mpc toggle")
beautiful.mpd.update() beautiful.mpd.update()
end, end,
{description = "mpc toggle", group = "widgets"}), {description = "mpc toggle", group = "widgets"}),
awful.key({ altkey, "Control" }, "Down", awful.key({ altkey, "Control" }, "Down",
function () function ()
awful.spawn.with_shell("mpc stop") os.execute("mpc stop")
beautiful.mpd.update() beautiful.mpd.update()
end, end,
{description = "mpc stop", group = "widgets"}), {description = "mpc stop", group = "widgets"}),
awful.key({ altkey, "Control" }, "Left", awful.key({ altkey, "Control" }, "Left",
function () function ()
awful.spawn.with_shell("mpc prev") os.execute("mpc prev")
beautiful.mpd.update() beautiful.mpd.update()
end, end,
{description = "mpc prev", group = "widgets"}), {description = "mpc prev", group = "widgets"}),
awful.key({ altkey, "Control" }, "Right", awful.key({ altkey, "Control" }, "Right",
function () function ()
awful.spawn.with_shell("mpc next") os.execute("mpc next")
beautiful.mpd.update() beautiful.mpd.update()
end, end,
{description = "mpc next", group = "widgets"}), {description = "mpc next", group = "widgets"}),
@ -475,10 +475,10 @@ globalkeys = my_table.join(
{description = "mpc on/off", group = "widgets"}), {description = "mpc on/off", group = "widgets"}),
-- Copy primary to clipboard (terminals to gtk) -- 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"}), {description = "copy terminal to gtk", group = "hotkeys"}),
-- Copy clipboard to primary (gtk to terminals) -- 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"}), {description = "copy gtk to terminal", group = "hotkeys"}),
-- User programs -- User programs
@ -494,9 +494,9 @@ globalkeys = my_table.join(
--]] --]]
--[[ dmenu --[[ dmenu
awful.key({ modkey }, "x", function () 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)) beautiful.bg_normal, beautiful.fg_normal, beautiful.bg_focus, beautiful.fg_focus))
end, end,
{description = "show dmenu", group = "launcher"}) {description = "show dmenu", group = "launcher"})
--]] --]]
-- Prompt -- Prompt

View file

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

View file

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

View file

@ -136,15 +136,15 @@ local mpdicon = wibox.widget.imagebox(theme.widget_music)
mpdicon:buttons(my_table.join( mpdicon:buttons(my_table.join(
awful.button({ modkey }, 1, function () awful.spawn.with_shell(musicplr) end), awful.button({ modkey }, 1, function () awful.spawn.with_shell(musicplr) end),
awful.button({ }, 1, function () awful.button({ }, 1, function ()
awful.spawn.with_shell("mpc prev") os.execute("mpc prev")
theme.mpd.update() theme.mpd.update()
end), end),
awful.button({ }, 2, function () awful.button({ }, 2, function ()
awful.spawn.with_shell("mpc toggle") os.execute("mpc toggle")
theme.mpd.update() theme.mpd.update()
end), end),
awful.button({ }, 3, function () awful.button({ }, 3, function ()
awful.spawn.with_shell("mpc next") os.execute("mpc next")
theme.mpd.update() theme.mpd.update()
end))) end)))
theme.mpd = lain.widget.mpd({ 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) -- Scissors (xsel copy and paste)
local scissors = wibox.widget.imagebox(theme.widget_scissors) 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 -- Mail IMAP check
local mailicon = wibox.widget.imagebox(theme.widget_mail) 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( mpdicon:buttons(my_table.join(
awful.button({ modkey }, 1, function () awful.spawn.with_shell(musicplr) end), awful.button({ modkey }, 1, function () awful.spawn.with_shell(musicplr) end),
awful.button({ }, 1, function () awful.button({ }, 1, function ()
awful.spawn.with_shell("mpc prev") os.execute("mpc prev")
theme.mpd.update() theme.mpd.update()
end), end),
awful.button({ }, 2, function () awful.button({ }, 2, function ()
awful.spawn.with_shell("mpc toggle") os.execute("mpc toggle")
theme.mpd.update() theme.mpd.update()
end), end),
awful.button({ }, 3, function () awful.button({ }, 3, function ()
awful.spawn.with_shell("mpc next") os.execute("mpc next")
theme.mpd.update() theme.mpd.update()
end))) end)))
theme.mpd = lain.widget.mpd({ 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.tooltip.wibox.font = theme.font
theme.volume.bar:buttons(my_table.join ( theme.volume.bar:buttons(my_table.join (
awful.button({}, 1, function() awful.button({}, 1, function()
awful.spawn.with_shell(string.format("%s -e alsamixer", terminal)) awful.spawn(string.format("%s -e alsamixer", terminal))
end), end),
awful.button({}, 2, function() 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() theme.volume.update()
end), end),
awful.button({}, 3, function() 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() theme.volume.update()
end), end),
awful.button({}, 4, function() 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() theme.volume.update()
end), end),
awful.button({}, 5, function() 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() theme.volume.update()
end) end)
)) ))

View file

@ -209,22 +209,22 @@ theme.volume = lain.widget.alsabar({
}) })
volicon:buttons(my_table.join ( volicon:buttons(my_table.join (
awful.button({}, 1, function() 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), end),
awful.button({}, 2, function() 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() theme.volume.notify()
end), end),
awful.button({}, 3, function() 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() theme.volume.notify()
end), end),
awful.button({}, 4, function() 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() theme.volume.notify()
end), end),
awful.button({}, 5, function() 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() theme.volume.notify()
end) end)
)) ))