dnkl/foot
41
2.0k
Fork
You've already forked foot
243

Add support for file:// URLs for initial working directory, and add a MIME type handler. #2387

Open
airkoala wants to merge 6 commits from airkoala/foot:master into master
pull from: airkoala/foot:master
merge into: dnkl:master
dnkl:master
dnkl:osc-5522
dnkl:sixel-heap-buffer-overflow
dnkl:releases/1.27
dnkl:releases/1.26
dnkl:releases/1.25
dnkl:releases/1.24
dnkl:multi-cursor
dnkl:releases/1.23
dnkl:pixman-16f-2
dnkl:releases/1.22
dnkl:releases/1.21
dnkl:releases/1.20
dnkl:releases/1.19
dnkl:releases/1.18
dnkl:releases/1.17
dnkl:releases/1.16
dnkl:releases/1.15
dnkl:releases/1.14
dnkl:releases/1.13
dnkl:releases/1.12
dnkl:releases/1.11
dnkl:releases/1.10
dnkl:releases/1.9
dnkl:releases/1.8
dnkl:releases/1.7
dnkl:releases/1.6
dnkl:releases/1.5
dnkl:releases/1.4
dnkl:releases/1.3
dnkl:releases/1.2
dnkl:releases/1.1
dnkl:releases/1.0
First-time contributor
Copy link

this will allow for foot to be registered as a MIME type handler for directories, allowing a "open with foot" action via xdg-open.

some applications pass a simple directory path (eg. qbittorrent) but others pass it as a "file://" URL (lutris), which is also sometimes percent-encoded (calibre) but sometimes not. this PR should be able to handle all 3 of these variants.

this will allow for foot to be registered as a MIME type handler for directories, allowing a "open with foot" action via xdg-open. some applications pass a simple directory path (eg. qbittorrent) but others pass it as a "file://" URL (lutris), which is also sometimes percent-encoded (calibre) but sometimes not. this PR should be able to handle all 3 of these variants.
Add support for file:// URLs for initial working directory, and add a MIME type handler.
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
d4b4e68c0c
client.c Outdated
@ -242,0 +243,4 @@
if (strncmp(optarg, "file://", 7) == 0) {
optarg += 7;
percent_decode_inplace(optarg);
}
Owner
Copy link

Use uri_parse() instead. You only need to pass scheme, host and path, the rest can be non-NULL. Then check scheme is "file", and that the host refers to the localhost (using hostname_is_localhost()).

Use `uri_parse()` instead. You only need to pass `scheme`, `host` and `path`, the rest can be non-NULL. Then check `scheme` is `"file"`, **and** that the host refers to the localhost (using `hostname_is_localhost()`).
@ -0,0 +9,4 @@
Name=FootURLLauncher
GenericName=Terminal
Comment=OpenfilesystemURLswithfoot
Owner
Copy link

I don't want to add yet another .desktop file that'll show up in application launchers and menus etc.

Can't we add an action entry to the existing foot/footclient desktop files?

I don't want to add yet another `.desktop` file that'll show up in application launchers and menus etc. Can't we add an action entry to the existing foot/footclient desktop files?
Author
First-time contributor
Copy link

if i understand the spec correctly, actions are mainly for alternate ways of launching an application and cant have a separate MimeType list or be set as a handler. for example, footclient.desktop and foot-server.desktop could potentially be merged into foot.desktop as actions but then that will be annoying for anyone wanting to set footclient as their default terminal.

anyway, im happy to drop this entry to keep things clean if you'd prefer.

if i understand the spec correctly, actions are mainly for alternate ways of launching an application and cant have a separate MimeType list or be set as a handler. for example, `footclient.desktop` and `foot-server.desktop` could potentially be merged into `foot.desktop` as actions but then that will be annoying for anyone wanting to set footclient as their default terminal. anyway, im happy to drop this entry to keep things clean if you'd prefer.
Owner
Copy link

I suppose we could change -D, and allow it to be used without an argument (meaning - use current CWD). Then we could update foot.desktop and footclient.desktop to always run foot -D %u?

I suppose we _could_ change `-D`, and allow it to be used without an argument (meaning - use current CWD). Then we could update `foot.desktop` and `footclient.desktop` to always run `foot -D %u`?
Author
First-time contributor
Copy link

for optional arguments using getopt, you cant have a space between the switch and the parameter. ie, if -D was changed to be optional then the directory would need to be specified as foot -D/foo/bar rather than foot -D /foo/bar. im not sure if theres a way to do this cleanly without breaking workflow

for optional arguments using `getopt`, you cant have a space between the switch and the parameter. ie, if `-D` was changed to be optional then the directory would need to be specified as `foot -D/foo/bar` rather than `foot -D /foo/bar`. im not sure if theres a way to do this cleanly without breaking workflow
fix crash on non-URL paths
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
5df0e460b2
main.c Outdated
@ -296,0 +308,4 @@
}
free(scheme);
free(host);
custom_cwd = path;
Owner
Copy link

path is leaked here. One option is to always xstrdup() I.e. both here, and in the else clause), and then `free()' it later.

`path` is leaked here. One option is to always `xstrdup()` I.e. both here, and in the `else` clause), and then `free()' it later.
Merge remote-tracking branch 'upstream/master'
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
33aa53221c
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u master:airkoala-master
git switch airkoala-master

Merge

Merge the changes and update on Forgejo.
git switch master
git merge --no-ff airkoala-master
git switch airkoala-master
git rebase master
git switch master
git merge --ff-only airkoala-master
git switch airkoala-master
git rebase master
git switch master
git merge --no-ff airkoala-master
git switch master
git merge --squash airkoala-master
git switch master
git merge --ff-only airkoala-master
git switch master
git merge airkoala-master
git push origin master
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dnkl/foot!2387
Reference in a new issue
dnkl/foot
No description provided.
Delete branch "airkoala/foot:master"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?