Launch new terminal in same directory as old one

This commit is contained in:
Thomas Avé 2022-07-28 17:32:37 +02:00
parent 0f8550b990
commit 580077e498
4 changed files with 19 additions and 4 deletions

View File

@ -130,7 +130,7 @@ top_panel.create = function(s)
client.connect_signal("focus", change_panel_visibility)
updates_indicator:connect_signal("button::press", function(c, _, _, button)
awful.spawn('alacritty -e bash -c "yay ; echo \'\nDone, press any key to exit...\' ; read"')
awful.spawn.with_shell('WINIT_X11_SCALE_FACTOR=1 alacritty -e bash -c "yay ; echo \'\nDone, press any key to exit...\' ; read"')
end)
end

View File

@ -143,7 +143,12 @@ keys.globalkeys = gears.table.join(
-- Spawn terminal
awful.key({modkey}, "Return",
function()
awful.spawn(apps.terminal)
local c = client.focus
if c and c.class == "Alacritty" then
awful.spawn(string.format("/home/user/.config/awesome/scripts/launch_alacritty.sh %d", c.pid))
else
awful.spawn(apps.terminal)
end
end,
{description = "open a terminal", group = "launcher"}
),
@ -178,7 +183,7 @@ keys.globalkeys = gears.table.join(
-- launch clipman
awful.key({modkey}, "c",
function()
awful.spawn('bash -c "CM_LAUNCHER=rofi clipmenu"')
awful.spawn.with_shell('CM_LAUNCHER=rofi-script rofi -modi "clipmenu:/usr/bin/clipmenu" -show clipmenu')
end,
{description = "Clipboard manager", group = "launcher"}
),

View File

@ -0,0 +1,10 @@
#!/bin/bash
CHILD_PID=$(pgrep -P $1)
pushd "/proc/$CHILD_PID/cwd"
SHELL_CWD=$(pwd -P)
popd
# Start alacritty with the working directory
alacritty --working-directory $SHELL_CWD

View File

@ -3,5 +3,5 @@ then
echo "Already running"
else
export TERMINAL=alacritty
rofi -show combi -combi-modi drun,calc:~/.config/rofi/show-calculator.sh -sort -levenshtein-sort
rofi -show combi -combi-modi drun,calc:~/.config/rofi/show-calculator.sh -sort -levenshtein-sort -matching fuzzy
fi