Home > Backend Development > Python Tutorial > Building a desktop launcher

Building a desktop launcher

DDD
Release: 2024-12-07 07:57:12
Original
512 people have browsed it

I still use QuickSilver on my mac, despite there are multiple efforts attempting to displace it. There used to be one made for Linux, called Gnome Do, however the development eventually stopped. I settled for the built-in launcher in Gnome Shell, and then briefly moved on to rofi with this configuration.

One thing I liked a lot about Quicksilver is that I can somewhat “pipe” the result of an action to another operation, for example:

Building a desktop launcher
“Piping” in Quicksilver in action

For example, I can start by looking for a file DSCF8200.jpg then select an action Open With followed by selecting an application Preview. This is a flexibility that I don’t get with rofi and Gnome Shell.

Plus, I couldn’t even get rofi to run in a wayland session.

Finding a job is still looking like a long process (yes, still #OpenToWork here), just to distract my attention, I decided to start working on a simple launcher I would eventually start using. I would also take the opportunity to learn how to build a GUI application for real this time.

Considering that I am most comfortable with Python, I start with tkinter. However, I would start small and start the experiment with a CLI command. The building of the command, will serve as a blueprint for the launcher.

This is how RapidCopper started (sorry for the unimaginative name).

And yes, I am aware of the fact that tkinter GUI applications do not work in Wayland for now.

It is still in a very early stage, I am still prototyping things, and still figuring out the spec for the launcher. However, for now it does the things I want it to do.

The application still expects a setup, with

rc rebuild-index
Copy after login

This sets up the configuration in $HOME/.config/rapidcopper, with a sqlite3 database as the index, and a folder for plugins.

The do subcommand is the part where it does its job. I can launch an application

rc do fire
Copy after login

And it spits out a list of options

0 app: /home/jeffrey04/.local/share/applications/userapp-Firefox Developer Edition-EPEGV2.desktop - Custom definition for Firefox Developer Edition
                Firefox Developer Edition
1 app: /home/jeffrey04/.local/share/applications/firefox-developer.desktop - Firefox Aurora with Developer tools
                Firefox Developer Edition
2 app: /home/jeffrey04/.local/share/applications/userapp-Firefox Developer Edition-8CCQV2.desktop - Custom definition for Firefox Developer Edition
                Firefox Developer Edition
Enter choice: :
Copy after login

Enter a number, press enter, and the corresponding application launches (via gtk-launcher, yes, this script is not portable).

I wanted to somewhat replicate the UX of quicksilver, so I made it aware of the pipe character |, though it looks ugly in practice.

rc do echo lorem ipsum dolor sit amet "|" clipboard
Copy after login

The specified text lorem ipsum dolor sit amet will then be copied to the clipboard. Unfortunately, I had to surround the pipe character with quotes so it will not be treated as a redirection in shell.

I am still figuring out the UX and specification, but for now it accomplished the main task where I want it to launch applications. After spending some time on it, and I reminded myself of Textual, where it offers an experience that resembles web front-end development. Currently, the TUI is still in development but seems to work similarly to the CLI counterpart.

It is hard to say what I expect out of it, as I am currently preparing to pick up some temporary part-time jobs while looking for the next project. This would greatly reduce the time and energy I have left for the project. The launcher does currently have a very basic support for plugins, but the API is subject to change.

The above is the detailed content of Building a desktop launcher. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template