• Stars
    star
    467
  • Rank 93,935 (Top 2 %)
  • Language
    JavaScript
  • License
    GNU General Publi...
  • Created over 3 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Application/browser chooser

Junction

Junction lets you choose the application to open files and links.

screenshot

Download on Flathub

Usage

Set Junction as the default application for a resource and let it do the rest. Junction will pop up and offer multiple options to handle it.

Set Junction as default browser xdg-settings set default-web-browser re.sonny.Junction.desktop
Set Junction as default for all files xdg-mime default re.sonny.Junction.desktop x-scheme-handler/file

Please note that this may not be respected by all applications but the command xdg-open will.

Set Junction as default for png xdg-mime default re.sonny.Junction.desktop image/png
Set Junction as default email composer xdg-settings set default-url-scheme-handler mailto re.sonny.Junction.desktop
Set Junction as default folder opener xdg-mime default re.sonny.Junction.desktop inode/directory
API

Junction has a very simple API that doesn't require any programming. To open any resource with Junction, even if it's not configured as the default application, simply use the following URI format x-junction://$RESOURCE. For examples

  • x-junction://https://github.com
  • x-junction://~
  • x-junction://file:///etc/os-release
  • x-junction:///etc/os-release

You can use this in web pages, the terminal, native applications and anything that is able to open URIs.

If Junction is installed - you can test this in the terminal with xdg-open "x-junction://file:///etc/os-release" and in the browser with <a href="x-junction://file:///etc/os-release">Test Junction URI</a>.

Tips and tricks

Keyboard navigation

Use the menu or <Ctrl>? to learn about Keyboard usage. You can navigate the UI with the arrow keys too.

Open with multiple applications

Use Middle-click, Ctrl+Click, Ctrl+Enter or Ctrl+Space to keep Junction open - allowing you to open the resource in multiple applications.

Make Junction appear in the center of the screen

On GNOME you can make all new windows open in the center using

gsettings set org.gnome.mutter center-new-windows true

See https://gitlab.gnome.org/GNOME/mutter/-/issues/246

Use Junction from the terminal

Create a permant alias, for example alias open="flatpak run re.sonny.Junction".

Then you can use open my-file.

See How To Create Permanent Aliases In Linux?

Add custom scripts to Junction

You can add your own script to Junction by creating a .desktop file for it in ~/.local/share/applications.

See https://wiki.archlinux.org/title/desktop_entries (distro agnostic).

Browser integration

Create a bookmark with the following URL

javascript:window.location='x-junction://'+window.location
Multiple Firefox profiles

See Profile Manager - Create, remove or switch Firefox profiles

If you want to be able to choose the Firefox profile to open the resource with, you can make desktop files for your Firefox profiles in ~/.local/share/applications.

Here is an example ~/.local/share/applications/firefox-work.desktop

[Desktop Entry]
Version=1.0
Name=Firefox work
Exec=firefox -P work --class=firefox-work %u
Icon=firefox
Terminal=false
Type=Application
StartupWMClass=firefox-work
MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true

Save, run update-desktop-database ~/.local/share/applications, enjoy.

Reference

Environment variables in desktop files
# Before
Exec=firefox %u
# After
Exec=env MOZ_USE_XINPUT2=1 firefox %u

Troubleshooting

I can't distinguish between options with the same icon

Within Junction, you can toggle Show names in the menu or hover the application with the mouse to display a tooltip.

Otherwise, you can edit the desktop files to use distinctive icons, here are a some tools

My app doesn't show up

If the application was installed via Flatpak, the package manager or an other conventional way, feel free to open an issue.

Make sure the application desktop file has a MimeType key that matches the type of resource you want it to handle. For example if you want the application ~/.local/share/applications/my-custom-browser.desktop to handle web content; add the following MimeType=text/html;text/xml;application/xhtml+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;.

The desktop filename should be unique. Junction can't display both /usr/share/applicatins/firefox.desktop and ~/.local/share/applications/firefox.desktop. The second overrides the first.

Finally - make sure to run update-desktop-database ~/.local/share/applications after installing a desktop file.

Where are desktop files located ?
  • System /usr/share/applications/
  • User ~/.local/share/applications/
  • Flatpak system /var/lib/flatpak/exports/share/applications/
  • Flatpak user ~/.local/share/flatpak/exports/share/applications/
  • Snap /var/lib/snapd/desktop/applications/

In the media

softpedia.com - Nifty and useful app switcher called Junction - 05/2022

itsfoss.com - 03/2022

youtube.com - Junction 1.4 | Choose the application to open files and links - 12/2021

linuxunplugged.com - Episode 433 The Lessons of Jellyfin - 11/2021

Translation

If you'd like to help translating Junction into your language, please head over to Weblate.

Translation status

Thank you for your help!

Development

git clone --recursive https://github.com/sonnyp/Junction.git
cd Junction
npm install
make dev

Make changes and press <Primary><Shift>Q on the Junction window to restart it.

Use <Primary><Shift>I to open the inspector.

To pass the tests you have to install a few dependencies

# Install development dependencies
sudo dnf install --assumeyes npm flatpak make desktop-file-utils gjs gtk4-devel libadwaita-devel
cd Junction
npm install
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user --assumeyes --noninteractive flathub org.freedesktop.appstream-glib

# Run tests
make test

Maintainer

Bookmarks
i18n
# To update the pot file
# xgettext -f po/POTFILES -o po/re.sonny.Junction.pot --no-wrap -cTRANSLATORS --from-code=UTF-8
# sed -i "s/Project-Id-Version: PACKAGE VERSION/Project-Id-Version: re.sonny.Junction/" po/re.sonny.Junction.pot
meson compile re.sonny.Junction-pot -C build


# To create a translation
# msginit -i po/re.sonny.Junction.pot -o po/fr.po -l fr_FR.UTF-8
echo -n " fr" >> po/LINGUAS
meson compile re.sonny.Junction-update-po -C build

# To update translations
# msgmerge -U po/*.po po/re.sonny.Junction.pot
meson compile re.sonny.Junction-update-po -C build

See sonnyp/Commit#14 (comment)

Publish new version
  • update metainfo and screenshot
  • meson compile re.sonny.Junction-pot -C build
  • meson compile re.sonny.Junction-update-po -C build
  • Update version in meson.build
  • git tag
  • flathub

Building

host
cd Junction
meson --prefix $PWD/install build
ninja -C build install
Flatpak

Use GNOME Builder or

cd Junction
flatpak-builder --user --force-clean --repo=repo --install-deps-from=flathub flatpak re.sonny.Junction.json
flatpak --user remote-add --no-gpg-verify --if-not-exists Junction repo
flatpak --user install --reinstall --assumeyes Junction re.sonny.Junction

Install

user

~/.local/bin must be in $PATH

cd Junction
meson --prefix ~/.local build
ninja -C build install
system
cd Junction
meson build
ninja -C build install
uninstall
cd Junction
ninja -C build uninstall

Copyright

Β© 2021-2022 Sonny Piers

License

GPLv3. Please see COPYING file.

More Repositories

1

Tangram

Browser for your pinned tabs
JavaScript
905
star
2

aria2.js

JavaScript library for aria2, "The next generation download utility."
JavaScript
608
star
3

Workbench

Code playground for GNOME πŸ› οΈ
JavaScript
524
star
4

polygoat

Make JavaScript functions that support both promise and callback styles.
JavaScript
154
star
5

Playhouse

Playground for HTML/CSS/JavaScript
JavaScript
146
star
6

Commit

Commit message editor
JavaScript
133
star
7

JSON8

JSON toolkit for JavaScript.
JavaScript
104
star
8

OhMySVG

Reduce the size of SVGs
JavaScript
92
star
9

linux-minibook-x

Linux for the Chuwi MiniBook X 2023 / N100
46
star
10

troll

Libraries for GNOME JavaScript (GJS)
JavaScript
45
star
11

Retro

A customizable retro digital segment clock
JavaScript
17
star
12

lightstring

XMPP client library for browsers.
JavaScript
17
star
13

remoteStorage

Playing around with remoteStorage, eventually releasing a lightweight library
TypeScript
5
star
14

mermaid-webkitgtk

JavaScript
5
star
15

owi-535

Applications and libraries for OWI-535 aka. Robotic Arm Edge
JavaScript
4
star
16

Disappear

Free your desktop from cumbersome apps.
JavaScript
4
star
17

broadcaster.js

Server-less cross-tabs messaging
HTML
3
star
18

proctor

Node.js module to lookup CPU and memory usage of a process.
JavaScript
3
star
19

icns.js

Apple Icon Image format (icns) for JavaScript
JavaScript
3
star
20

pya

CLI application to manage and monitor devices
JavaScript
2
star
21

node-bosh

BOSH client implementation library for nodejs.
JavaScript
2
star
22

netflix-desktop-entry

A simple (Linux) desktop entry that will open Netflix with Google Chrome
Makefile
2
star
23

ubiquitous-pancake

JavaScript
2
star
24

readplist

Tiny Node.js module to read any plist file.
JavaScript
2
star
25

outofsoya

Out of soya
TypeScript
1
star
26

gjs-embed

C
1
star
27

HTMLIncludes

JavaScript
1
star
28

sliders

HTML WYSIWYG slides editor
JavaScript
1
star
29

server-stop

Closes all connections and stop the server. Node.js
JavaScript
1
star
30

HTTPClient.js

JavaScript HTTP client library for browsers and Node.js
JavaScript
1
star
31

media-loop

Firefox addon that adds a menu item to control HTML5 audio/video loop.
JavaScript
1
star
32

dezorse

Like dezalgo but let you choose your "asap" function.
JavaScript
1
star