summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachIR <zachir@librem.one>2022-07-22 12:41:08 -0500
committerZachIR <zachir@librem.one>2022-07-22 12:41:08 -0500
commitb044dcd913dc64deacef1b75924733d0a9c38f48 (patch)
tree90ef9732803398264db60da70fae24eac0f13f6c
parent5f300bc898765f17bdaedd9a83f0e67ddd01a41e (diff)
rc.lua: add command to make switching terms for sp easier
-rw-r--r--rc.lua35
1 files changed, 27 insertions, 8 deletions
diff --git a/rc.lua b/rc.lua
index 82661ae..f1622ae 100644
--- a/rc.lua
+++ b/rc.lua
@@ -76,6 +76,25 @@ local spawnatbottom = true
-- This is used later as the default terminal and editor to run.
terminal = "st"
+function terminal_sp_cmd (spc, cmd)
+ if terminal == "st" then
+ cflag = "-c"
+ gflag = "-g"
+ xflag = "-e"
+ geo = "100x30"
+ elseif terminal == "alacritty" then
+ cflag = "--class"
+ gflag = false
+ xflag = "-e"
+ end
+ if gflag then
+ return terminal .. " " .. cflag .. " " .. spc .. " " .. \
+ gflag .. " " .. geo .. " " .. xflag .. " " .. cmd
+ else
+ return terminal .. " " .. cflag .. " " .. spc .. " " .. \
+ " " .. xflag .. " " .. cmd
+ end
+end
editor = os.getenv("EDITOR") or "nvim"
editor_cmd = terminal .. " -e " .. editor
@@ -283,42 +302,42 @@ end)
globalkeys = gears.table.join(
-- scratchpads
awful.key({ modkey, "Control" }, "z", function ()
- scratch.toggle("st -c sphtop -g 100x30 -e htop", { class = "sphtop" })
+ scratch.toggle(terminal_sp_cmd("sphtop","htop"), { class = "sphtop" })
awful.placement.centered()
end,
{description = "Toggle htop scratchpad"}),
awful.key({ modkey, "Control" }, "x", function ()
- scratch.toggle("st -c spterm -g 100x30 -e zsh", { class = "spterm" })
+ scratch.toggle(terminal_sp_cmd("spterm","zsh"), { class = "spterm" })
awful.placement.centered()
end,
{description = "Toggle term scratchpad"}),
awful.key({ modkey, "Control" }, "c", function ()
- scratch.toggle("st -c sppmxr -g 100x30 -e pulsemixer", { class = "sppmxr" })
+ scratch.toggle(terminal_sp_cmd("sppmxr","pulsemixer"), { class = "sppmxr" })
awful.placement.centered()
end,
{description = "Toggle pulsemixer scratchpad"}),
awful.key({ modkey, "Control" }, "v", function ()
- scratch.toggle("st -c spblue -g 100x30 -e bluetoothctl", { class = "spblue" })
+ scratch.toggle(terminal_sp_cmd("spblue","bluetoothctl"), { class = "spblue" })
awful.placement.centered()
end,
{description = "Toggle bluetoothctl scratchpad"}),
awful.key({ modkey, "Control" }, "b", function ()
- scratch.toggle("st -c spncmp -g 100x30 -e ncmpcpp", { class = "spncmp" })
+ scratch.toggle(terminal_sp_cmd("spncmp","ncmpcpp"), { class = "spncmp" })
awful.placement.centered()
end,
{description = "Toggle ncmpcpp scratchpad"}),
awful.key({ modkey, "Control" }, "a", function ()
- scratch.toggle("st -c spmutt -g 100x30 -e zsh -c neomutt", { class = "spmutt" })
+ scratch.toggle(terminal_sp_cmd("spmutt","neomutt"), { class = "spmutt" })
awful.placement.centered()
end,
{description = "Toggle neomutt scratchpad"}),
awful.key({ modkey, "Control" }, "s", function ()
- scratch.toggle("st -c spprof -g 100x30 -e profanity", { class = "spprof" })
+ scratch.toggle(terminal_sp_cmd("spprof","profanity"), { class = "spprof" })
awful.placement.centered()
end,
{description = "Toggle profanity scratchpad"}),
awful.key({ modkey, "Control" }, "d", function ()
- scratch.toggle("st -c sptrem -g 100x30 -e tremc", { class = "sptrem" })
+ scratch.toggle(terminal_sp_cmd("sptrem","tremc"), { class = "sptrem" })
awful.placement.centered()
end,
{description = "Toggle tremc scratchpad"}),