Вход на сайт

Просмотр новости

Найдите то, что Вас интересует

Open PHP files in the right editor, automatically.

Дата публикации: 30-05-2026 17:22:25

This is one of those cases when, viewing a file in your window manager, you see a .php file you want to quickly inspect. You double click on it, and… It quickly opens Geany, or your default quick file editor, but PHPStorm is already running right there… Or the opposite: you just want a quick peak for a single little…

Основное содержимое страницы с новостью.

This is one of those cases when, viewing a file in your window manager, you see a .php file you want to quickly inspect. You double click on it, and…

  • It quickly opens Geany, or your default quick file editor, but PHPStorm is already running right there…
  • Or the opposite: you just want a quick peak for a single little file, but it slowly cold starts your 4 GB IDE :x

What if your file manager just knew? That's the idea of the following bash script that acts as the default handler for .php files:

  • PhpStorm is running? Open the file there, in the existing instance.
  • PhpStorm is not running? Open in Geany – fast, lightweight, no wait for a quick glance.
The script

Drop this in ~/.local/bin/open-php:

#!/bin/bash
# Open .php files: use PhpStorm if running, otherwise Geany

if pgrep -x "phpstorm" > /dev/null || pgrep -f "phpstorm" > /dev/null; then
    # PhpStorm is running - open file in existing instance
    phpstorm "$@"
else
    geany "$@"
fi

Then chmod it +x. Also make sure obviously that your IDE and light editor binaries are in the path. To find the exact name of your IDE process, you can use pgrep -a -f [Pp]hp[Ss]torm for example.

The setup

Set open-php as the default application for .php files. Right-click any .php in your file manager, pick "Open With Other Application", point to ~/.local/bin/open-php, and set it as default.

Alternatively, at least if using Nemo (Linux Mint for instance), you can create ~/.local/share/applications/open-php.desktop with the following:

[Desktop Entry]
Name=Open PHP File
Exec=/home/YOUR_USERNAME/.local/bin/open-php %F
Type=Application
NoDisplay=true
MimeType=application/x-php;text/x-php;

Replace YOUR_USERNAME with your own user name, then register it as the new handler:

update-desktop-database ~/.local/share/applications

xdg-mime default open-php.desktop application/x-php
xdg-mime default open-php.desktop text/x-php

From now on, double-clicking a PHP file does the right thing automatically. Heavy tooling when it's already warm, or the lightweight editor when it's not. Best of both worlds!

Схожие новости

#Наименование новостиТональностьИнформативностьДата публикации
1Standardize listing of Markdown Flavors used in the MD document: GLFM, GFM, QMD, etc05.0403-10-2026
2GitHub Copilot vs. OpenClaw: A Hands-On Tutorial for the Two AI Tools Everyone’s Searching For010.7109-08-2026
3AI Makes "Open-Source, Clean Room" Implementations Of Adobe Photoshop & Premier In Rust09.0208-10-2026
4Part 6: An operating system for coding agents: the disciplined build07.4407-10-2026
5Markdific - A better tool to open, read, edit and export Markdown files07.2305-10-2026
6Audacity schneller machen: Diese Tipps und Hacks helfen Ihnen07.4802-10-2026
7X-post: A Note on Figma access011.4318-09-2026
8New features for RFC-Editor.org014.2630-09-2026
9Ability to assign custom global hotkeys to open specific URLs / bookmarks05.430-09-2026

Классификация: . Схожих патентов: 0. Схожих новостей: 9. Тональность: 0. Информативность: 7.06. Источник: planetozh.com.