DvdGiessen / kwin-toggleterminal

KWin script for toggling your terminal (or any other program) with a global hotkey
GNU General Public License v3.0
10 stars 3 forks source link

kwin-toggleterminal

KWin script for toggling your terminal with a global hotkey.

Note: This is the README for version 2.x.x, which works on KDE Plasma 6. If you're using KDE Plasma 5, see version 1.x.x on the branch plasma5.

Installation

This script depends on a helper program to actually launch the terminal app via D-Bus when it's not already running, because there is no API for KWin scripts to start programs directly (bug). Without it this script can toggle your terminal when its already running but not start a new instance of it.

Install dbus-app-launcher to enable starting new instances of your terminal app.

To install this script:

kpackagetool6 -t KWin/Script -i .

To upgrade if already installed:

kpackagetool6 -t KWin/Script -u .

Configuration

Via the System Settings GUI

After installation the script can be found in System Settings > Window Management > KWin Scripts.

Enable it, and optionally change the configuration to your own terminal. By default this script starts foot. Also see the usage recommendations below for how you could set this up further.

You can configure the hotkey by going to System Settings > Keyboard > Shortcuts and searching for the "Toggle Terminal" action in the KWin category. Configure any custom shortcut you like.

(Note: KWin doesn't always correctly detect changes to the configuration. If your changes are not applied, run qdbus org.kde.KWin /KWin reconfigure or log out and in again to restart KWin.)

Via the command line

Enable the script:

kwriteconfig6 --file kwinrc --group Plugins --key toggleterminalEnabled true
qdbus org.kde.KWin /KWin reconfigure

Configure a hotkey for the KWin "Toggle Terminal" action:

kwriteconfig6 --file kglobalshortcutsrc --group kwin --key ToggleTerminal 'Meta+`,none,Toggle Terminal'
qdbus org.kde.KWin /KWin reconfigure

To configure a different terminal:

kwriteconfig6 --file kwinrc --group Script-toggleterminal --key windowNamePrefix foot
kwriteconfig6 --file kwinrc --group Script-toggleterminal --key windowNameSuffix ''
kwriteconfig6 --file kwinrc --group Script-toggleterminal --key launchCommand /usr/bin/foot
qdbus org.kde.KWin /KWin reconfigure

Usage

Press the configured hotkey to summon or hide your terminal.

A few recommendations to make it more seamless:

Troubleshooting

License and contributing

kwin-toggleterminal is free software licensed under the GPLv3.

If you have fixed a bug or want to contribute a feature, feel free to open a pull request on GitHub.