patch prefered terminal into glib/gio apps like firefox
now i can type mailto:foo@bar.com into firefox urlbar and it opens in aerc in a new terminal
This commit is contained in:
@@ -150,6 +150,7 @@ let
|
||||
# tageditor # music tagging
|
||||
unar
|
||||
wireguard-tools
|
||||
xdg-terminal-exec
|
||||
xdg-utils # for xdg-open
|
||||
# yarn
|
||||
zsh
|
||||
|
2
pkgs/additional/xdg-terminal-exec/default.nix
Normal file
2
pkgs/additional/xdg-terminal-exec/default.nix
Normal file
@@ -0,0 +1,2 @@
|
||||
{ writeShellScriptBin }:
|
||||
writeShellScriptBin "xdg-terminal-exec" (builtins.readFile ./xdg-terminal-exec)
|
39
pkgs/additional/xdg-terminal-exec/xdg-terminal-exec
Executable file
39
pkgs/additional/xdg-terminal-exec/xdg-terminal-exec
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
# xdg-terminal-exec is a proposed XDG extension, with example implementation:
|
||||
# - <https://github.com/Vladimir-csp/xdg-terminal-exec>
|
||||
#
|
||||
# its purpose is to allow any program which needs to launch a terminal to do so
|
||||
# in a manner which respects user preferences.
|
||||
# it aims to be `xdg-open`, but for opening a terminal.
|
||||
#
|
||||
# a notable user is glib/gio: <repo:gnome/glib:gio/gdesktopappinfo.c>
|
||||
# and by extension, Firefox
|
||||
#
|
||||
# it's not actually packaged for NixOS, nor Alpine, as of 2023/06/29.
|
||||
# this script is just a hackier version. it lets me insert my preferences
|
||||
|
||||
termargs="$@"
|
||||
|
||||
try_term() {
|
||||
if command -v "$1" > /dev/null
|
||||
then
|
||||
exec "$1" $termargs
|
||||
fi
|
||||
}
|
||||
|
||||
# user preference
|
||||
if [ -n "$TERMINAL" ]
|
||||
then
|
||||
exec "$TERMINAL" $termargs
|
||||
fi
|
||||
|
||||
# hardcoded checks, imprecise order
|
||||
try_term kitty
|
||||
try_term alacritty
|
||||
try_term foot
|
||||
try_term st
|
||||
try_term gnome-terminal
|
||||
try_term konsole
|
||||
|
||||
# fallback to default
|
||||
exec xterm "$termargs"
|
@@ -47,6 +47,7 @@ let
|
||||
sxmo-utils = callPackage ./additional/sxmo-utils { };
|
||||
tow-boot-pinephone = callPackage ./additional/tow-boot-pinephone { };
|
||||
unftp = callPackage ./additional/unftp { };
|
||||
xdg-terminal-exec = callPackage ./additional/xdg-terminal-exec { };
|
||||
zecwallet-light-cli = callPackage ./additional/zecwallet-light-cli { };
|
||||
|
||||
# packages i haven't used for a while, may or may not still work
|
||||
|
Reference in New Issue
Block a user