显示 HN:用于管理 XDG 默认应用程序的 TUI
Show HN: TUI for managing XDG default applications

原始链接: https://github.com/mitjafelicijan/xdgctl

## xdgctl:一个用于XDG默认应用程序的TUI `xdgctl` 是一个基于终端的用户界面 (TUI),使用 C (GLib/GIO & termbox2) 构建,用于轻松管理 XDG 默认应用程序。它提供了一种便捷的方式来查看和设置各种文件类别的默认程序(如浏览器、文本编辑器),而无需直接使用命令行 `xdg-mime`。 导航使用箭头键 – 上/下用于类别/应用程序,右/Tab 切换到应用程序列表,左返回。按下 Enter 将选定的应用程序设置为当前类别的默认应用程序。 要安装,克隆 GitHub 仓库 ([https://github.com/mitjafelician/xdgctl](https://github.com/mitjafelician/xdgctl)),然后 `make` 和 `make install`。确保已安装开发库,如 `glib-2.0` 和 `gio-2.0`。 请记住,在添加新的 `.desktop` 文件后运行 `update-desktop-database`,默认值存储在 `~/.config/mimeapps.list` 中。`xdgctl` 简化了对桌面环境应用程序关联的管理。

Hacker News 新闻 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 展示 HN:用于管理 XDG 默认应用程序的 TUI (github.com/mitjafelicijan) 6 分,作者 mitjafelicijan 1 小时前 | 隐藏 | 过去 | 收藏 | 3 条评论 作者在此。我制作了这个小 TUI 程序,用于管理 Linux 桌面上的默认应用程序。也许对你们中的一些人有用。 很高兴回答任何问题。 cda2100 10 分钟前 | 下一个 [–] 你用感觉编写了一个 TUI 来设置一些环境变量? 现在每个展示 HN 都是这样吗? 回复 JonAtkinson 2 分钟前 | 父评论 | 下一个 [–] 你有什么资格告诉别人为什麽感到自豪,以及想要分享什麽? 回复 untech 10 分钟前 | 上一个 [–] 看起来不错! 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

xdgctl is a TUI for managing XDG default applications. View and set defaults for file categories without using xdg-mime directly.

Built with C using GLib/GIO and termbox2.

xdgctl.mp4
  • Browse by category (Browsers, Text Editors, etc.)
  • Current default marked with *
Key Action
Arrow Up/Down Navigate through categories or applications
Arrow Right/Tab Switch from category list to application list
Arrow Left Switch back to category list
Enter Set selected application as default for current category
Esc / q Quit the application

To build xdgctl, you need the following development libraries:

  • glib-2.0
  • gio-2.0
  • gio-unix-2.0
  • clang or gcc
# On Void Linux
sudo xbps-install glibc-devel
git clone https://github.com/mitjafelician/xdgctl.git
cd xdgctl

# Build
make
sudo make install

# Using prefix
sudo make PREFIX=/usr/local install
make PREFIX=~/.local install

If you manually add new applications to your ~/.local/share/applications directory, you might need to run update-desktop-database again.

ls /usr/share/applications
ls ~/.local/share/applications
xdg-mime query default text/plain
xdg-mime query default text/html
xdg-mime query default x-scheme-handler/http
xdg-mime query default x-scheme-handler/https
xdg-mime query default inode/directory

Setting defaults manually

xdg-mime default brave.desktop x-scheme-handler/http
xdg-mime default brave.desktop x-scheme-handler/https
# ~/.local/share/applications/brave.desktop
[Desktop Entry]
Exec=/home/m/Applications/brave
Type=Application
Categories=Applications
Name=Brave Browser
MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;

Other useful commands/files

update-desktop-database ~/.local/share/applications
less ~/.config/mimeapps.list
less /usr/share/applications/mimeapps.list
联系我们 contact @ memedata.com