You are not logged in.
I wrote a small bash wrapper to be used in XFCE4 and Thunar to handle xdg-open requests for a terminal to be handled by creating a new tab in guake and in thunars case automatically change to the selected directory.
quake-open.sh
#!/bin/bash
IFS=$'\n'
DIR=$1
if [ -n "$DIR" ]; then
CMD_STRING="cd '"'"'$DIR'"'"'"
CMD="$(echo $CMD_STRING |sed 's/\"//g')" # Remove double quotes
guake --show --new-tab XDG-OPEN -e $CMD
else
guake --show --new-tab XDG-OPEN
fi
this just builds a string that is forwarded to quake to change to the selected directory in single quotes. The resulting command is:
guake --show --new-tab XDG-OPEN -e "cd '/path/to/working dir/selected'"
this works perfectly well but I kinda hate how I did it, its ugly and possibly explotiable. Can someone please take a look and help me make it better?
Thanks!
Last edited by Crunchbang (2024-05-14 14:46:04)
Offline
https://wiki.archlinux.org/title/Guake#Guake_scripting
… -n "$1"
?
Doesn't the -e syntax just switch the directory and then quit (instead of opening a shell) and what is "XDG-OPEN"?
Offline
Because you misspelled it twice, and also in the script's name: quake (a game) != guake (a terminal emulator)
Inofficial first vice president of the Rust Evangelism Strike Force
Offline
https://wiki.archlinux.org/title/Guake#Guake_scripting
… -n "$1"
?
Doesn't the -e syntax just switch the directory and then quit (instead of opening a shell) and what is "XDG-OPEN"?
WTF lol. I’m not at my PC but I could swear -n is for new tab and the next arg is supposed to be title. XDG-OPEN is just because you have to name the new tab or it fails lol. Tab name is then changed to pwd as per guake preferences for me.
-e definitely doesn’t just run then exit for me. The posted example works without flaws but I think that the "cd '"'"'$DIR'"'"'" is pretty nasty. Possibly injectable garbage
Last edited by Crunchbang (2024-05-13 13:39:03)
Offline
So the whole script could just be one command:
guake --show --new-tab "${1:-$HOME}"
Last edited by Trilby (2024-05-13 15:23:52)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
So the whole script could just be one command:
guake --show --new-tab "${1:-$HOME}"
Yep! Got home yesterday and confirmed that I’m an ID10T lol. Changed to something very near this example.
The way it’s written in the man pages appears like: guake -n NEW_TAB and I assumed that to mean name without fully reading the meaning I guess.
Anyways thanks all
Offline