How to run KDE's font picker as stand alone program?

I’m a graphic designer that for ages have been looking without success for an ultrafast, dumb, and featureless font viewer for Linux, to help me find the right font for my works. A simple application that would allow me to input some custom text and cycle it through my font collection.

Until I found the KDE font chooser in System Settings > Font types > “pencil icon”.

This little dialog does everything I need, but is kinda unintuitive to open System Settings to view my fonts, so I would like to spawn it from a .desktop file if possible.

I prooflessly believe that this is the thing I require, and I’ve been trying to call it using kdialog, but it has been way beyond me. Help, please!

Thank you! =)

1 Like

Open krunner (alt+space) type font and start from there. Works? Then open krunner again type again, drag with mouse to Desktop, do shortcut and ‘voila’.

You’re quite right - and I would personally like to see separate launchers for all of these items, because some of them take up a lot of EXTRA screen estate when launched inside settings.

Start by opening Dolphin, navigate to ~/.local/share/applications/

Here you see launchers. You can easily create your own.

I made a new folder /Settings

kcmshell6 is our command of interest, and you can run in a terminal (F4 in Dolphin):

kcmshell6 --list > ~/Desktop/kcmshell.txt
Summary

The following modules are available:
kcm_energyinfo - Energy Consumption Statistics
kcm_about-distro - Information About This System
kcm_powerdevilprofilesconfig - Power Management
kcm_kwin_virtualdesktops - Configure navigation, number and layout of virtual desktops
kcm_sddm - Configure Login Manager
kcm_gamecontroller - Test and Configure Game Controllers
kcm_touchpad - Touchpad settings
kcm_kwindecoration - Configure window title-bars and borders
kcm_pulseaudio - Configure audio devices and volume
kcm_plymouth - Choose Plymouth boot splash screen
kcm_splashscreen - Choose splash screen theme
kcm_kwinxwayland - Select which keys will be globally available to legacy X11 apps
kcm_fonts - Configure user interface fonts
kcm_soundtheme - Select a Sound Theme for Notifications
kcm_printer_manager - Configure your printers
kcm_screenlocker - Configure screen locking
kcm_cron - Configure and schedule tasks
kcm_regionandlang - Language Setting, Numeric, Currency and Time Formats
kcm_componentchooser - Choose default Applications
kcm_lookandfeel - Choose global look and feel
kcm_keyboard - Keyboard Hardware and Layout
kcm_tablet - No description available
kcm_notifications - Event Notifications and Actions
kcm_touchscreen - No description available
kcm_colors - Choose colour scheme
kcm_updates - Configure software update behaviour
kcm_flatpak - Configure Flatpak Permissions
kcm_style - Configure application style and behaviour
kcm_autostart - Automatically Started Applications
kcm_feedback - Configure user feedback settings
kcm_workspace - Configure general workspace behaviour
kcm_icons - Choose icon theme
kcm_cursortheme - Choose mouse cursor theme
kcm_virtualkeyboard - Select which virtual keyboard to use
kcm_smserver - Desktop Session Login and Logout
kcm_access - Configure Accessibility Options
kcm_nightlight - Adjust screen colour temperature based on time
kcm_kwinrules - Individual Window Behaviour
kcm_bluetooth - Manage Bluetooth devices
kcm_mouse - Mouse Controls
kcm_kscreen - Manage and configure monitors and displays
kcm_users - Manage user accounts
kcm_keys - Configure Keyboard Shortcuts
kcm_activities - Activities help you to focus on a specific task
kcm_kded - Configure background services
kcm_landingpage - Landing page with some basic settings
kcm_wallpaper - Configure the wallpaper
kcm_kwin_effects - Configure compositor settings for desktop effects
kcm_baloofile - Configure File Search
kcm_plasmasearch - Configure search settings
kcm_kaccounts - Configure your internet accounts such as Google, Live, Owncloud
kcm_kwin_scripts - Manage KWin scripts
kcm_desktoptheme - Choose Plasma style
kcm_desktoppaths - Location for Personal Files
kcm_firewall - Control your network rules
kcm_kamera - Configure Kamera
kcm_kup - Configure backup plans
kcm_kdeconnect - Configure device synchronisation
kcm_kwinscreenedges - Configure active screen corners and edges
kcm_qtquicksettings - No description available
kcm_kgamma - A monitor calibration tool
kcm_networkmanagement - Edit network connections
kcm_solid_actions - Manage actions available to the user when connecting new devices
kcm_kwinoptions - Configure window actions and behaviour
kcm_netpref - Configure generic network preferences, like timeout values
kcm_recentFiles - Manage your file activity history preferences
kcmspellchecking - Spell Checker Dictionaries and Options
kcm_filetypes - Configure file associations
kcm_webshortcuts - Configure Web search keywords
kcm_device_automounter - Configure automatic mounting of disks and volumes
kcm_fontinst - Install, manage and preview fonts
kcm_kwintabbox - Navigation Through Windows
kcm_clock - Date and Time
kwincompositing - Compositor Settings for Desktop Effects
kcm_kwallet5 - KDE Wallet Configuration
kcm_kwintouchscreen - Configure touch screen swipe gestures
kcm_proxy - Configure the proxy servers used
kcm_block_devices - Block Devices
kcm_glx - GLX information
kcm_interrupts - Interrupt information
kcm_opencl - OpenCL API information
kcm_egl - EGL information
kcm_audio_information - Audio Device Information
kcm_edid - Extended Display Identification Data
kcm_firmware_security - Firmware Security Information
kcm_vulkan - Vulkan graphics API information
kcm_kwinsupportinfo - KWin Support information
kcm_xserver - X-Server information
kcm_network - Network interface information
kcm_memory - Memory Information
kcm_usb - USB devices attached to this computer
kcm_wayland - Information about the Wayland Compositor
kcm_cpu - Advanced CPU Information
kcm_pci - PCI information
kcm_samba - Samba status monitor

Try these:

kcmshell6 kcm_fonts
kcmshell6 kcm_fontinst

The benefit of this approach will be apparent if you like to change settings. Perhaps you want to adjust colours: kcmshell6 kcm_colors whilst also messing with the application style kcmshell6 kcm_style.

You can create launchers for whichever ones you wish to launch as stand-alone applications in your ‘applications’ folder.

Fonts.Desktop
[Desktop Entry]
Exec=kcmshell6 fonts
Comment=Launch fonts settings module
Icon=preferences-desktop-font
StartupNotify=true
Terminal=false
Type=Application
Categories=Settings;DesktopSettings;
X-KDE-AliasFor=systemsettings

Now, when I go to krunner or my menu, if I type ‘fonts’ I see that launcher in addition to the ‘settings’ module.

This is for the Font Manager:

Summary
[Desktop Entry]
Categories=Settings;DesktopSettings;
Comment[en_GB]=Launch kcmshell6 settings module
Comment=Launch kcmshell6 settings module
Exec=kcmshell6 kcm_fontinst
GenericName[en_GB]=
GenericName=
Icon=preferences-desktop-font-installer
MimeType=
Name[en_GB]=
Name=
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=
1 Like

Thanks for the responses @Radek and @ben2talk , but it seems I failed at explaining clearly what I needed, apologies. I’ll try to be more precise.

I don’t want the kcm, as my intention isn’t to change a setting. What I want is only the font selector because what I need is a font viewer. Here is an image of the panel I want to launch standalone:

Reading (but not underestanding) the previously linked API documentation I found that the item in my screenshot appears to be called KFontChooser and that is a widget that “can be used standalone”, although I’m not even sure if that means what I wish.

It has no context if launched alone. That will be launched if you choose to change a font in an application.

To launch font selector to choose a font for kwrite makes sense.

Just to launch font selector alone makes no sense to me - why would you want to do that??? :person_facepalming:

The Font Manager is the correct application to use if you want to look through and see previews of your fonts… not the ‘font picker’.

Ah, I don’t need it to change the fonts of other applications. I just need it to show me a custom text using the fonts I have installed.

Like what Gwenview does for your vacation photos, it allows you to watch your custom pictures easily and fast. You don’t need Krita for that.

The font manager doesn’t allow me to enter a custom text, which is vital when you are picking a font for a project.

Let’s imagine that I’m working on a project and I’m in need of a font where the “A” and “N” letters look similar. Using the font picker makes this trivial, see: https://imgur.com/qo3mkli This feature here is the basic thing I need in a font viewer, but I haven’t found one good enough, most don’t do this and focus on downloading fonts from the internet. Some do it, but are cumbersome or slow with big collections; the font picker does it and is hella fast, that’s why I want to launch it stand alone.

Try to install and use Xdialog. There is option for display system fonts:
Xdialog --fontsel "" 30 120
I did not find this option in kdialog so instead can be use Xdialog.

Radek

1 Like

You can also create a simple Qt “program” which only shows the font picker dialog, like this one written in Python:

from PyQt6.QtWidgets import *
app = QApplication([])
font = QFontDialog()
font.show()
app.exec()

If you have PyQt installed, just save this as a .py file and run it with python3 name.py.

3 Likes

That’s smart. However if the OP does not have PyQT installed, here’s another option: create a tiny QML program to do it!

import QtQuick
import Qt.labs.platform as Platform

Platform.FontDialog {
    Component.onCompleted: {
        open();
    }
}

Copy all of that and save it into a file named OpenFontDialog.qml and put it somewhere.

To execute it, use a terminal to run qmlscene-qt6 [full path to OpenFontDialog.qml]

(on some distros, qmlscene-qt6 may need to be replaced with just qmlscene)

To make a nice graphical launcher for it, create a file named OpenFontDialog.desktop and put it in ~/.local/share/applications:

[Desktop Entry]
Type=Application
Name=Open Font Dialog
Icon=preferences-desktop-font
Exec=qmlscene-qt6 [full path to OpenFontDialog.qml]

Then run kbuildsycoca6 in a terminal window to make the system notice it.

If you want to assign a global shortcut to it, you can do that too, from System Settings > Keyboard > Shortcuts > Add New > Application.

Find “Open File Dialog” in the app chooser dialog and then after that, click on it in the sidebar and assign it a shortcut.

3 Likes

It is also possible to add a shebang line to the QML file:

#!/usr/bin/qmlscene

import QtQuick
import Qt.labs.platform as Platform

Platform.FontDialog {
    Component.onCompleted: {
        open();
    }
}

Path and name of qmlscene could be different on your system.

And make it executable:

$> chmod u+x OpenFontDialog.qml
$> ./OpenFontDialog.qml
3 Likes

Thank you everyone for your responses! :two_hearts:

I did as ngraham and krake said, and it works great! :clap:

2 Likes