fosKeyMan
Loading...
Searching...
No Matches
createlinuxlauncher.py
Go to the documentation of this file.
2r"""
3Create a Linux launcher file for fosKeyMan.
4It is assumed, that the current directory:
5- contains the binary (compiled program) called `fosKeyMan`,
6- contains the logo `foskeyman_logo_short.svg`.
7- will be the working directory for `fosKeyMan` (config and log files will be written here).
8
9The file `fosKeyMan.desktop` is created in the current directory.
10The file can be copied to the desktop.
11Copy the launcher to `~/.local/share/applications/` if you want the
12launcher to show up in the start menu of the desktop environment
13
14For the documentation on the format, see the
15[Desktop Entry Specification](https://specifications.freedesktop.org/desktop-entry-spec/latest/).
16
17\author Bertram Richter
18\date 2025
19"""
20
21import os
22
23filecontent = \
24r"""
25[Desktop Entry]
26Type = Application
27Name = fosKeyMan
28Comment = Fiber optic Sensor Key Manager
29Icon = {iconpath}
30Categories = Office;Utility;Settings
31Path = {directory}
32Terminal = false
33Exec = {binpath}
34"""
35
36def main():
37 r"""
38 """
39 directory = os.getcwd()
40 iconpath = os.path.join(directory, "foskeyman_logo_short.svg")
41 binpath = os.path.join(directory, "fosKeyMan")
42 filecontent_filled = filecontent.format(
43 iconpath=iconpath,
44 directory=directory,
45 binpath=binpath,
46 )
47 with open(os.path.join(directory, "fosKeyMan.desktop"), "w", encoding="utf-8") as launcher:
48 launcher.write(filecontent_filled)
49
50if __name__ == "__main__":
51 main()