Como usar o i3 como gerenciador de janelas no KDE plasma

Publicado por Ryuk Shinigami em 17/04/2019

[ Hits: 5.639 ]

 


Como usar o i3 como gerenciador de janelas no KDE plasma



O primeiro passo é criar uma "Sessão de Login" com o Plasma+i3:

sudo nano /usr/bin/i3-kde-session

Adicione o conteúdo abaixo:

#!/bin/sh

if test -n "$1"; then
    echo "Syntax: i3-kde-session"
  exit
fi

# Set the prefix for the menu layout to use
export XDG_MENU_PREFIX="kde-4-"

# Clean up after SDDM
xprop -root -remove _NET_NUMBER_OF_DESKTOPS \
      -remove _NET_DESKTOP_NAMES \
      -remove _NET_CURRENT_DESKTOP 2> /dev/null

# Run KDE with i3 as its window manager
export KDEWM="/usr/bin/i3"
exec startkde "$@"

Agora, crie um Launcher para a Sessão KDE/i3 no Xsessions:

sudo nano /usr/share/xsessions/i3-kde.desktop

Adicione o seguinte conteúdo:

[Desktop Entry]
Name=KDE/i3
Comment=Use the i3 window manager inside of the K Desktop Environment
Exec=/usr/bin/i3-kde-session
TryExec=startkde
Icon=
Type=Application

Por fim, faça alguns ajustes no arquivo de configuração do i3 para deixá-lo melhor integrado ao KDE plasma:

nano ~/.config/i3/config

Adicione os códigos abaixo em complementação ao i3-config:

## Esconder barra do i3 (opcional)
bar {
    #status_command i3status
    tray_output none
    mode invisible
}

## Atalho para Hide/unhide a barra do i3
bindsym $mod+m bar mode toggle

## KDE plasma integration
for_window [title="Desktop Plasma"] kill
for_window [title="Área de Trabalho Plasma"] kill
for_window [title="plasma-desktop"] floating enable, border none
for_window [title="win7"] floating enable, border none
for_window [class="plasmashell"] floating enable
for_window [class="Klipper"] floating enable, border none
for_window [class="Kmix"] floating enable, border none
for_window [class="Plasmoidviewer"] floating enable, border none
for_window [class="bovo"] floating enable
for_window [class="kcalc"] floating enable
for_window [class="kcolorchooser"] floating enable
for_window [class="klines"] floating enable
for_window [class="Knights"] floating enable
for_window [class="kruler"] floating enable
for_window [class="krunner"] floating enable, border none
for_window [class="ksysguard"] floating enable
for_window [class="yakuake"] floating enable
#
for_window [window_role="About"] floating enable
for_window [window_role="Preferences"] floating enable
for_window [window_role="bubble"] floating enable
for_window [window_role="pop-up"] floating enable
for_window [window_role="task_dialog"] floating enable
for_window [window_type="dialog"] floating enable
for_window [window_type="menu"] floating enable
#
no_focus [class=plasmashell”]
no_focus [window_role="pop-up"]
no_focus [window_type="notification"]

## Logout/Desligar
bindsym $mod+Shift+e exec qdbus org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout -1 -1 -1

## krunner
bindsym $mod+d exec qdbus org.kde.kglobalaccel /component/krunner org.kde.kglobalaccel.Component.invokeShortcut 'run command'

## Compositor (Compton)
exec --no-startup-id compton --backend glx --vsync opengl-swc

Dica extra

Com a substituição do kwin pelo i3, perde-se o atalho de abrir o menu com a tecla Super (Windows). Para ter de volta essa funcionalidade, instale o aplicativo ksuperkey:

sudo apt-get install git gcc make libx11-dev libxtst-dev pkg-config
git clone https://github.com/hanschen/ksuperkey.git
cd ksuperkey
make
sudo make

E adicione "exec --no-startup-id ksuperkey" ao arquivo de configuração do i3.

Pronto, agora basta iniciar sua nova Sessão "KDE/i3" pelo SDDM e se divertir com o i3, sem ter que abrir mão de usar todos os recursos de um Ambiente Gráfico (DE) completo.

Obs.: esta dica foi testada no Kubuntu e Solus, funciona tanto para o i3-WM como o i3-Gaps. Não se esqueça de configurar os atalhos de teclado do i3, de modo a não conflitar com os atalhos do KDE plasma.

Outras dicas deste autor

Como alterar o nome do seu $USER e o do diretório $HOME

Consertando erros do pacman no Manjaro

Como redimensionar o menu de aplicativos do KDE plasma 5.21

Como Renomear o Diretório "Área de Trabalho" para "Desktop"

Solus OS não inicializa após atualização [RESOLVIDO]

Leitura recomendada

Corrigindo incompatibilidade do kdemod após o "nascimento" do KDE 4.1 no Arch

Ajustando resolução de tela no Ubuntu Linux 8.04

Impressora Canon iP1300 (e outras) no Ubuntu 13.04

Mudar a imagem de background do GDM 3 no Debian Wheezy

Facilite a navegação pelo Konsole

  

Comentários
[1] Comentário enviado por Podsz em 18/04/2019 - 17:56h

Não esta funcionando, ele inicia mas fica em uma tela preta e depois volta pro sddm.

[2] Comentário enviado por Ryuk em 18/04/2019 - 19:38h


[1] Comentário enviado por Podsz em 18/04/2019 - 17:56h

Não esta funcionando, ele inicia mas fica em uma tela preta e depois volta pro sddm.


Bem, estou usando aqui sem qualquer problema! Para tentar descobrir qual o seu problema e como resolvê-lo, abra um tópico no fórum, com mais detalhes do sistema, mostrando logs do Xsession e as configurações tanto do plasma como do i3. Talvez alguma coisa aí esteja conflitando :\

[3] Comentário enviado por cadr em 29/04/2019 - 12:48h

Pra quem não tá funcionando; vê se não tem um espaço como primeiro caractere em i3-kde.desktop, depois checa se /usr/bin/i3-kde-session existe e não tá com o mesmo problema de espaço como primeiro caractere. Dava um erro do Xsessions então dei sudo chmod +x /usr/bin/i3-kde-session e resolveu as coisas.

O Plasma aqui tem outro nome como janela então adicionei as seguintes regras na minha config do i3:

for_window [title="Área de Trabalho — Plasma"] kill
for window [class="plasmashell plasmashell"] kill

Se não funcionar pra alguém e o plasma ainda ocupar a tela inteira, inicia uma sessão com o kde normal, vai em gerenciamento de janelas e cria uma regra aleatória no KWin, só para identificar a classe e o nome do plasma. Tem que mirar no papel de parede quando for fazer isso.

Tirando essas coisas, funcionou muito tranquilo pra mim, tinha seguido outros tutoriais mas esse aqui é o melhor. Nenhum script do KWin substitui um wm como i3.

Quando eu inicio a sessão o i3 da uns erros e eu não faço ideia do porque:

ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set ', 'set ', 'set_from_resource', 'bindsym', 'bindcode', 'bind', 'bar', 'font', 'mode', 'gaps', 'smart_borders', 'smart_gaps', 'floating_minimum_size', 'floating_maximum_size', 'floating_modifier', 'default_orientation', 'workspace_layout', 'default_border', 'new_window', 'default_floating_border', 'new_float', 'hide_edge_borders', 'for_window', 'assign', 'no_focus', 'focus_follows_mouse', 'mouse_warping', 'focus_wrapping', 'force_focus_wrapping', 'force_xinerama', 'force-xinerama', 'disable_randr15', 'disable-randr15', 'workspace_auto_back_and_forth', 'fake_outputs', 'fake-outputs', 'force_display_urgency_hint', 'focus_on_window_activation', 'title_align', 'show_marks', 'workspace', 'ipc_socket', 'ipc-socket', 'ipc_kill_timeout', 'restart_state', 'popup_during_fullscreen', 'exec_always', 'exec', 'client.background', 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent', 'client.placeholder'
ERROR: CONFIG: (in file /home/cadr/.config/i3/config)
ERROR: CONFIG: Line 11: #
ERROR: CONFIG: Line 12: for_window [title="Área de Trabalho — Plasma"] kill
ERROR: CONFIG: Line 13: for window [class="plasmashell plasmashell"] kill
ERROR: CONFIG: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ERROR: CONFIG: Line 14: for_window [title="Desktop Plasma"] kill
ERROR: CONFIG: Line 15: for_window [title="Área de Trabalho Plasma"] kill
ERROR: FYI: You are using i3 version 4.16.1-169-g60a6d149 (2019-04-11, branch "gaps-next")

Se alguém conseguir ajudar ai :P

[4] Comentário enviado por Ryuk em 29/04/2019 - 13:23h

Poxa! Esqueci dizer para tornar os arquivos executáveis:

$ sudo chmod +x /usr/share/xsessions/i3-kde.desktop
$ sudo chmod +x /usr/bin/i3-kde-session

Quanto ao "~/.config/i3/config", as linhas sugeridas na DICA são apenas complemento ao config original do i3.
Não sei porque saiu um errinho nas seguintes linhas (faltou um traço), o correto é assim:

for_window [title="Desktop - Plasma"] kill
for_window [title="Área de Trabalho - Plasma"] kill

[5] Comentário enviado por Ryuk em 29/04/2019 - 13:26h


[3] Comentário enviado por cadr em 29/04/2019 - 12:48h

Pra quem não tá funcionando; vê se não tem um espaço como primeiro caractere em i3-kde.desktop, depois checa se /usr/bin/i3-kde-session existe e não tá com o mesmo problema de espaço como primeiro caractere. Dava um erro do Xsessions então dei sudo chmod +x /usr/bin/i3-kde-session e resolveu as coisas.

O Plasma aqui tem outro nome como janela então adicionei as seguintes regras na minha config do i3:

for_window [title="Área de Trabalho — Plasma"] kill
for window [class="plasmashell plasmashell"] kill

Se não funcionar pra alguém e o plasma ainda ocupar a tela inteira, inicia uma sessão com o kde normal, vai em gerenciamento de janelas e cria uma regra aleatória no KWin, só para identificar a classe e o nome do plasma. Tem que mirar no papel de parede quando for fazer isso.

Tirando essas coisas, funcionou muito tranquilo pra mim, tinha seguido outros tutoriais mas esse aqui é o melhor. Nenhum script do KWin substitui um wm como i3.

Quando eu inicio a sessão o i3 da uns erros e eu não faço ideia do porque:

ERROR: CONFIG: Expected one of these tokens: &lt;end&gt;, '#', 'set ', 'set ', 'set_from_resource', 'bindsym', 'bindcode', 'bind', 'bar', 'font', 'mode', 'gaps', 'smart_borders', 'smart_gaps', 'floating_minimum_size', 'floating_maximum_size', 'floating_modifier', 'default_orientation', 'workspace_layout', 'default_border', 'new_window', 'default_floating_border', 'new_float', 'hide_edge_borders', 'for_window', 'assign', 'no_focus', 'focus_follows_mouse', 'mouse_warping', 'focus_wrapping', 'force_focus_wrapping', 'force_xinerama', 'force-xinerama', 'disable_randr15', 'disable-randr15', 'workspace_auto_back_and_forth', 'fake_outputs', 'fake-outputs', 'force_display_urgency_hint', 'focus_on_window_activation', 'title_align', 'show_marks', 'workspace', 'ipc_socket', 'ipc-socket', 'ipc_kill_timeout', 'restart_state', 'popup_during_fullscreen', 'exec_always', 'exec', 'client.background', 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent', 'client.placeholder'
ERROR: CONFIG: (in file /home/cadr/.config/i3/config)
ERROR: CONFIG: Line 11: #
ERROR: CONFIG: Line 12: for_window [title="Área de Trabalho — Plasma"] kill
ERROR: CONFIG: Line 13: for window [class="plasmashell plasmashell"] kill
ERROR: CONFIG: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ERROR: CONFIG: Line 14: for_window [title="Desktop Plasma"] kill
ERROR: CONFIG: Line 15: for_window [title="Área de Trabalho Plasma"] kill
ERROR: FYI: You are using i3 version 4.16.1-169-g60a6d149 (2019-04-11, branch "gaps-next")

Se alguém conseguir ajudar ai :P


Mostra aí o "config" completo para eu possa ver onde está o problema.

[6] Comentário enviado por cadr em 29/04/2019 - 13:45h

# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#

# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
#
for_window [title="Área de Trabalho — Plasma"] kill
for window [class="plasmashell plasmashell"] kill
for_window [title="Desktop Plasma"] kill
for_window [title="Área de Trabalho Plasma"] kill
for_window [title="plasma-desktop"] floating enable, border none
for_window [title="win7"] floating enable, border none
for_window [class="plasmashell"] floating enable
for_window [class="Klipper"] floating enable, border none
for_window [class="Kmix"] floating enable, border none
for_window [class="Plasmoidviewer"] floating enable, border none
for_window [class="bovo"] floating enable
for_window [class="kcalc"] floating enable
for_window [class="kcolorchooser"] floating enable
for_window [class="klines"] floating enable
for_window [class="Knights"] floating enable
for_window [class="kruler"] floating enable
for_window [class="krunner"] floating enable, border none
for_window [class="ksysguard"] floating enable
for_window [class="yakuake"] floating enable
#
for_window [window_role="About"] floating enable
for_window [window_role="Preferences"] floating enable
for_window [window_role="bubble"] floating enable
for_window [window_role="pop-up"] floating enable
for_window [window_role="task_dialog"] floating enable
for_window [window_type="dialog"] floating enable
for_window [window_type="menu"] floating enable
#
no_focus [class=plasmashell”]
no_focus [window_role="pop-up"]
no_focus [window_type="notification"]

## Logout/Desligar
# bindsym $mod+Shift+e exec qdbus org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout -1 -1 -1

## krunner
# bindsym $mod+d exec qdbus org.kde.kglobalaccel /component/krunner org.kde.kglobalaccel.Component.invokeShortcut 'run command'

####
set $mod Mod4

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 8


bindsym $mod+p exec xtrlock

# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8

# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesn’t scale on retina/hidpi displays.

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# start a terminal
bindsym $mod+Return exec i3-sensible-terminal

# kill focused window
bindsym $mod+Shift+q kill

# start dmenu (a program launcher)
bindsym $mod+d exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop

# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+ccedilla focus right

# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+ccedilla move right

# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

# split in horizontal orientation
bindsym $mod+h split h

# split in vertical orientation
bindsym $mod+v split v

# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle

# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

# toggle tiling / floating
bindsym $mod+Shift+space floating toggle

# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle

# focus the parent container
bindsym $mod+a focus parent

# focus the child container
#bindsym $mod+d focus child

# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10

# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"

# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode

# Pressing left will shrink the window’s width.
# Pressing right will grow the window’s width.
# Pressing up will shrink the window’s height.
# Pressing down will grow the window’s height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym ccedilla resize grow width 10 px or 10 ppt

# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt

# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}

bindsym $mod+r mode "resize"



[7] Comentário enviado por Ryuk em 29/04/2019 - 16:27h


[6] Comentário enviado por cadr em 29/04/2019 - 13:45h

# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#

# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
#
for_window [title="Área de Trabalho — Plasma"] kill
for window [class="plasmashell plasmashell"] kill <<<<------
(linha 13, mude para "for_window ...")



Aparentemente só tem a linha 13 com erro: tá "for window ..." em vez de "for_window ..."
No mais sugiro deletar as primeiras linhas (1-7). O config padrão deve começar com "i3 config file (v4)".

Não sei se faz diferença, mas estou usando aqui o i3-wm original (funcionando de boa). Fiz apenas alguns testes com o i3-gaps no Solus e o único problema era o plasmashell que reiniciava de vez em quando, talvez porque o KDE-plasma ainda esteja em fase de testes nessa distro. Sugiro, usar o i3-wm oficial e atualizado!



Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts