-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support files with spaces in alias mode
- Loading branch information
salman-abedin
committed
Jul 23, 2020
1 parent
c40a732
commit 75341fd
Showing
1 changed file
with
9 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
#!/bin/sh | ||
# | ||
# Hides your terminal window before launching an external program and unhides it after quitting. | ||
# Dependencies: sed, xdo | ||
# Usage: devour CMD/ALIAS... | ||
# devour CMD/ALIAS... -- [FILE with spaces] | ||
|
||
WID=$(xdo id) | ||
|
||
ARGS=$* | ||
CMD="${ARGS%% --*}" | ||
FILE="${ARGS##*-- }" | ||
SAFEFILE=$(echo "$FILE" | sed 's/ /\\ /g') | ||
|
||
$SHELL -i -c "xdo hide | ||
echo $* >> ~/Downloads/d | ||
echo ($*) >> ~/Downloads/d | ||
$* > /dev/null 2>&1 | ||
$CMD $SAFEFILE > /dev/null 2>&1 | ||
xdo show $WID | ||
exit" |