Auto detect terminal
This commit is contained in:
parent
611e382ff9
commit
a8a865b3fa
|
@ -35,7 +35,6 @@ local app_launcher = bling.widget.app_launcher(args)
|
|||
|
||||
```lua
|
||||
local args = {
|
||||
terminal = "alacritty" -- Set default terminal
|
||||
favorites = { "firefox", "wezterm" } -- Favorites are given priority and are bubbled to top of the list
|
||||
search_commands = true -- Search by app name AND commandline command
|
||||
skip_names = { "Discord" } -- List of apps to omit from launcher
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
# Based on i3-sensible-terminal
|
||||
|
||||
#
|
||||
# This code is released in public domain by Han Boetes <han@mijncomputer.nl>
|
||||
#
|
||||
# This script tries to exec a terminal emulator by trying some known terminal
|
||||
# emulators.
|
||||
#
|
||||
# We welcome patches that add distribution-specific mechanisms to find the
|
||||
# preferred terminal emulator. On Debian, there is the x-terminal-emulator
|
||||
# symlink for example.
|
||||
#
|
||||
# Invariants:
|
||||
# 1. $TERMINAL must come first
|
||||
# 2. Distribution-specific mechanisms come next, e.g. x-terminal-emulator
|
||||
# 3. The terminal emulator with best accessibility comes first.
|
||||
# 4. No order is guaranteed/desired for the remaining terminal emulators.
|
||||
for terminal in "$TERMINAL" termite hyper wezterm alacritty kitty x-terminal-emulator mate-terminal gnome-terminal terminator xfce4-terminal urxvt rxvt termit Eterm aterm uxterm xterm roxterm lxterminal terminology st qterminal lilyterm tilix terminix konsole guake tilda; do
|
||||
if command -v "$terminal" > /dev/null 2>&1; then
|
||||
exec "$terminal" "$@"
|
||||
fi
|
||||
done
|
||||
|
||||
awesome-client 'local naughty = require("naughty"); naughty.notification { message = "awesome-sensible-terminal could not find a terminal emulator. Please install one." }'
|
|
@ -19,13 +19,8 @@ local path = ...
|
|||
|
||||
local app_launcher = { mt = {} }
|
||||
|
||||
local terminal_commands_lookup =
|
||||
{
|
||||
alacritty = "alacritty -e",
|
||||
termite = "termite -e",
|
||||
rxvt = "rxvt -e",
|
||||
terminator = "terminator -e"
|
||||
}
|
||||
local AWESOME_SENSIBLE_TERMINAL_PATH = debug.getinfo(1).source:match("@?(.*/)") ..
|
||||
"awesome-sensible-terminal"
|
||||
|
||||
local function string_levenshtein(str1, str2)
|
||||
local len1 = string.len(str1)
|
||||
|
@ -191,16 +186,7 @@ local function create_app_widget(self, entry)
|
|||
|
||||
function app.spawn()
|
||||
if entry.terminal == true then
|
||||
if self.terminal ~= nil then
|
||||
local terminal_command = terminal_commands_lookup[self.terminal] or self.terminal
|
||||
awful.spawn(terminal_command .. " " .. entry.executable)
|
||||
else
|
||||
awful.spawn.easy_async("gtk-launch " .. entry.executable, function(stdout, stderr)
|
||||
if stderr then
|
||||
awful.spawn(entry.executable)
|
||||
end
|
||||
end)
|
||||
end
|
||||
awful.spawn.with_shell(AWESOME_SENSIBLE_TERMINAL_PATH .. " -e " .. entry.executable)
|
||||
else
|
||||
awful.spawn(entry.executable)
|
||||
end
|
||||
|
@ -741,7 +727,6 @@ end
|
|||
local function new(args)
|
||||
args = args or {}
|
||||
|
||||
args.terminal = args.terminal or nil
|
||||
args.favorites = args.favorites or {}
|
||||
args.search_commands = args.search_commands == nil and true or args.search_commands
|
||||
args.skip_names = args.skip_names or {}
|
||||
|
|
Loading…
Reference in New Issue