Tutoriels/Utiliser d'autres gestionnaires de fenêtres avec Plasma

From KDE UserBase Wiki
This page is a translated version of the page Tutorials/Using Other Window Managers with Plasma and the translation is 54% complete.
Outdated translations are marked like this.

Introduction

KWin est le gestionnaire de fenêtres (WM) dans Plasma et à de nombreuses fonctionnalité, mais ne supporte uniquement des fenêtres flottantes. Plasma vous laisse utiliser un autre gestionnaire de fenêtres par exemple i3, bspwm ou n'importe quelle autre gestionnaire de fenêtre par pavage.

Plasma utilisant i3 comme gestionnaire de fenêtres

Attention

D'autre gestionnaire de fenêtre sont uniquement disponible en utilisant X.org. Ces changements ne peuvent pas encore être réalisés pour les sessions Wayland. Avec un Wayland plus mature et les extensions Wayland qui commencent à se normaliser, cette fonctionalité pourrait être implémentée dans Wayland [1]


Beaucoup de gestionnaire de fenêtre nécessite peu, voire aucune, modifications de leurs fichiers de configuration.

Quelques considérations à prendre en compte lorsque vous utilisez un autre gestionnaire de fenêtres :

  • Empiler les gestionnaires de fenêtres peut générer des problèmes avec les composants tels que les panneaux. Pour certaines configurations, certaines options aideront à surmonter les problèmes
  • La plupart des gestionnaires de fenêtres ne possèdent pas leur propre compositeur, c'est pourquoi certaines fonctionalités leur sont absentes comme les animations ou a transparence. Si de tels effets sont souhaités, un compositeur tel que compton est nécessaire.
    • Compositors can also help with screen tearing, however check first if you can resolve it with your video drivers, as this will be a more performant solution in most cases.

Utiliser un autre gestionnaire de fenêtre avec Plasma

To use a different window manager with Plasma, replace the systemd service for KWin with a new user unit for your preferred WM. A tutorial can be found in the ArchWiki.

Configuration de I3

To make a non-standard WM work well with Plasma, some additional configuration may be required.

i3

Installation

Avant de commencer la configuration, vous devez vous assurer que i3 ou i3-gaps sont installés sur votre système. S'ils ne le sont pas, utilisez votre gestionnaire de paquets ou Discover pour installer l'un de ces deux paquets.

Configurer i3

Lorsque vous exécutez i3 pour la première fois, sa configuration globale par défaut (dans /etc/i3/config) va lancer i3-config-wizard, qui fournit un dialogue pour la sélection de clé Mod et génère la configuration locale de l'utilisateur dans ~/.i3/config.

Si vous voulez conserver la même configuration pour tous les utilisateurs (ils pourront encore le réécraser avec leur propre configuration locale), supprimez l'appel de l'assistant du fichier de configuration global et utilisez le directement.


The following i3 window rules will help you with notifications and some other plasma windows:

for_window [title="Desktop — Plasma"] kill, floating enable, border none
for_window [class="plasmashell"] floating enable
for_window [class="Plasma"] floating enable, border none
for_window [title="plasma-desktop"] floating enable, border none
for_window [title="win7"] floating enable, border none
for_window [class="krunner"] floating enable, border none
for_window [class="Kmix"] floating enable, border none
for_window [class="Klipper"] floating enable, border none
for_window [class="Plasmoidviewer"] floating enable, border none
for_window [class="(?i)*nextcloud*"] floating disable
for_window [class="plasmashell" window_type="notification"] floating enable, border none, move right 700px, move down 450px
no_focus [class="plasmashell" window_type="notification"] 

Si vous utilisez une installation de Plasma qui n'est pas en langue anglaise, vous devez trouver quel est le titre exact de la fenêtre du bureau. Une manière de faire cela est d'utiliser wmctrl -l.

Au lieu d'ajouter

for_window [title="Desktop — Plasma"] kill; floating enable; border none

ajoutez le nom de la fenêtre à la configuration i3. Cet exemple utilise l'installation Plasma en allemand.

for_window [title="Arbeitsfläche — Plasma"] kill; floating enable; border none

Notification positioning can be tricky, since not all notifications have the same size depending on their content. You can also use coordinates positioning, knowing your screen resolution. For example, for a 1920x1080 screen and notifications in the top-right corner we can use:

for_window [class="plasmashell" window_type="notification"] floating enable, border none, move position 1450px 20px

If you want to unlock KWallet automatically on login, configure PAM and then add the following line to your i3 configuration file:

exec --no-startup-id /usr/lib/pam_kwallet_init

Configurer Plasma

You may get into issues related with the "Activities" feature - activating it via keyboard shortcuts (some of which are also used by i3, like "Meta + Q") seems to make i3 unresponsive. Removing Activity related global shortcuts seems to resolve this.

To get the Plasma provided pager display desktops as i3bar, set Pager Settings > General > Text display to "Desktop name"

Configuration de bspwm

Dans la plupart des cas, bspwm demande quelques petites déclarations supplémentaires.

  • A single Plasma panel, in most cases, is detected properly and bspwm will not place windows in its space. If the panel ends up presenting a problem, or when using multiple panels, the following may be added to .bspwmrc
    bspc config top_padding size
    where size is the size of the panel in pixels. Also valid are bottom_padding, left_padding, and right_padding. As many of these directives may be used as necessary for multiple panels.

awesomewm

Following rules help Plasma to work as intended. Add these entries into awful.rules.rules table

{ -- General plasma rules
    rule_any = {
        class = {
            "plasmashell",
            "ksmserver-logout-greeter",
        },
    },
    properties = {
        floating = true,
        border_width = 0,
        titlebars = false, -- custom property to control titlebars
    },

},
{ -- KDE apps
    rule_any = {
        class = {
            "spectacle",
            "krunner"
        }
    },
    properties = {
        floating = true,
    }
},

Plasma widgets hide when they become unfocused. We do not want Desktop and Panel to be focusable, but want other plasmashell windows to remain focusable. A way to achieve this is with "manage" signal handler. An example handler:

client.connect_signal("manage", function(c)
--... your config

if c.type == "dock" -- Plasma Panel
    or c.type == "desktop" then -- Plasma Desktop
    c.focusable = false
    c:tags(c.screen.tags) -- show on all tags from this screen.
end

-- Show titlebars only if enabled.
if c.titlebars then 
    awful.titlebar.show(c)
else
    awful.titlebar.hide(c)
end

-- Place floating windows. Plasma widgets provide this info
 if c.floating then
    if c.size_hints.user_position then
        c.x = c.size_hints.user_position.x
        c.y = c.size_hints.user_position.y
    end
    if c.size_hints.user_size then
        c.width = c.size_hints.user_size.width
        c.height = c.size_hints.user_size.height
    end
end
..
end)

You may match Plasma Desktop using the following rule:

 rule_any = {
     name = {
       "Desktop.*Plasma",
     },
 },

Conseils et astuces

DBus

Vous pouvez ouvrir certains composants Plasma avec les commandes DBus. Ainsi vous pouvez créer des raccourcis clavier vers ces commandes DBus. Pour trouver une commande DBus spécifique, vous pouvez utiliser QDbusViewer.

You can open some Plasma components with DBus commands. You can use this to map corresponding keybindings to DBus commands. To find a specific DBus command, you can look at dbus-monitor or qdbusviewer while you invoke the component in a standard Plasma set-up.

D'autres informations sur la gestion des méta clés :


Quelques exemples :

  • Ouvrir Krunner
    qdbus org.kde.kglobalaccel /component/krunner org.kde.kglobalaccel.Component.invokeShortcut 'run command'
  • Ouvrir l'écran de confirmation de déconnexion
    qdbus org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout -1 -1 -1
  • Open Krunner
    qdbus org.kde.kglobalaccel /component/krunner org.kde.kglobalaccel.Component.invokeShortcut 'run command'
  • Open logout confirmation screen
    qdbus org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout -1 -1 -1

Pour i3, vous pouvez définir un raccourci clavier avec la commande bindsym. Exemple :

bindsym $mod+Shift+e exec <command>

Si vous voulez faire correspondre la clé du modificateur lui-même, utilisez la commande bindcode - vous devez préciser le code de clé généré par la clé, que vous pouvez obtenir via l'utilitaire xev.

Exemple pour la Meta key:

bindcode 133 --release exec --no-startup-id <command>

Pour Bspwn, vous devez utiliser le programme bspc . Voir le wiki de l'archive linux pour plus d'informations.

Davantage d'informations

Références