Add manage ouput with Sway article
This commit is contained in:
parent
6837bd8ee1
commit
37cf1b50ec
5 changed files with 352 additions and 1 deletions
|
@ -0,0 +1,186 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
sodipodi:docname="positionnement_ecrans.svg"
|
||||
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
|
||||
id="svg8"
|
||||
version="1.1"
|
||||
viewBox="0 0 370.93994 138.96873"
|
||||
height="525.23615"
|
||||
width="1401.9778">
|
||||
<title
|
||||
id="title892">Scema de positionnement des écrans pour la configuration de Sway</title>
|
||||
<defs
|
||||
id="defs2" />
|
||||
<sodipodi:namedview
|
||||
units="px"
|
||||
fit-margin-bottom="3"
|
||||
fit-margin-right="3"
|
||||
fit-margin-left="3"
|
||||
lock-margins="true"
|
||||
fit-margin-top="3"
|
||||
showgrid="false"
|
||||
inkscape:document-rotation="0"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:cy="-37.350909"
|
||||
inkscape:cx="-15.068051"
|
||||
inkscape:zoom="0.33892648"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
borderopacity="1.0"
|
||||
bordercolor="#666666"
|
||||
pagecolor="#ffffff"
|
||||
id="base" />
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>Scema de positionnement des écrans pour la configuration de Sway</dc:title>
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>Yoric Barbanneau ^ ephase</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<dc:language>fr</dc:language>
|
||||
<dc:subject>
|
||||
<rdf:Bag>
|
||||
<rdf:li>Sway</rdf:li>
|
||||
<rdf:li>Wayland</rdf:li>
|
||||
<rdf:li>positionnement</rdf:li>
|
||||
<rdf:li>écran</rdf:li>
|
||||
</rdf:Bag>
|
||||
</dc:subject>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(382.02667,-64.36395)"
|
||||
id="layer1"
|
||||
inkscape:groupmode="layer"
|
||||
inkscape:label="Layer 1">
|
||||
<rect
|
||||
y="87.105789"
|
||||
x="-371.25827"
|
||||
height="90"
|
||||
width="160"
|
||||
id="rect10"
|
||||
style="fill:#cddcf4;fill-opacity:1;stroke:#000000;stroke-width:0.896;stroke-miterlimit:4;stroke-dasharray:none" />
|
||||
<rect
|
||||
style="fill:#cddcf4;fill-opacity:1;stroke:#000000;stroke-width:0.896;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
id="rect12"
|
||||
width="192"
|
||||
height="108"
|
||||
x="-211.25826"
|
||||
y="87.105789" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
style="fill:none;stroke:#f26a3d;stroke-width:1.665;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:3.33, 1.665;stroke-dashoffset:0;stroke-opacity:1"
|
||||
d="M -216.74144,199.27435 V 81.814122"
|
||||
id="path839" />
|
||||
<text
|
||||
id="text843"
|
||||
y="75.218742"
|
||||
x="-379.23267"
|
||||
style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#f26a3d;fill-opacity:1;stroke:none;stroke-width:0.264583"
|
||||
xml:space="preserve"><tspan
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:semi-condensed;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold Semi-Condensed';fill:#f26a3d;fill-opacity:1;stroke-width:0.264583"
|
||||
y="75.218742"
|
||||
x="-379.23267"
|
||||
id="tspan841"
|
||||
sodipodi:role="line">pos 0 0</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#f26a3d;fill-opacity:1;stroke:none;stroke-width:0.264583"
|
||||
x="-217.99149"
|
||||
y="75.546516"
|
||||
id="text847"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan845"
|
||||
x="-217.99149"
|
||||
y="75.546516"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:semi-condensed;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold Semi-Condensed';fill:#f26a3d;fill-opacity:1;stroke-width:0.264583">pos 1600 0</tspan></text>
|
||||
<path
|
||||
id="path849"
|
||||
d="m -371.25828,87.105788 -5.82083,-5.291667"
|
||||
style="fill:none;stroke:#800080;stroke-width:1.065;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.065, 1.065;stroke-dashoffset:0;stroke-opacity:1" />
|
||||
<path
|
||||
style="fill:none;stroke:#800080;stroke-width:1.065;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.065, 1.065;stroke-dashoffset:0;stroke-opacity:1"
|
||||
d="m -211.44984,87.105788 -5.82083,-5.291667"
|
||||
id="path851" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccc"
|
||||
id="path837"
|
||||
d="M -377.07911,200.33269 V 81.814122 h 362.992378"
|
||||
style="fill:none;stroke:#f26a3d;stroke-width:1.665;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:3.6;stroke-dasharray:3.33, 1.665;stroke-dashoffset:0;stroke-opacity:1" />
|
||||
<path
|
||||
id="path857"
|
||||
d="m -19.891428,87.105788 -5.820827,-5.291667"
|
||||
style="fill:#800080;stroke:#000000;stroke-width:1.065;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.065, 1.065;stroke-dashoffset:0;stroke-opacity:1" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.264583"
|
||||
x="-366.05252"
|
||||
y="171.86621"
|
||||
id="text843-3"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan841-2"
|
||||
x="-366.05252"
|
||||
y="171.86621"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:semi-condensed;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold Semi-Condensed';fill:#ffffff;fill-opacity:1;stroke-width:0.264583">eDP-1</tspan></text>
|
||||
<text
|
||||
id="text879"
|
||||
y="190.76503"
|
||||
x="-207.30267"
|
||||
style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.264583"
|
||||
xml:space="preserve"><tspan
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:semi-condensed;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold Semi-Condensed';fill:#ffffff;fill-opacity:1;stroke-width:0.264583"
|
||||
y="190.76503"
|
||||
x="-207.30267"
|
||||
id="tspan877"
|
||||
sodipodi:role="line">DP-1</tspan></text>
|
||||
<g
|
||||
style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
|
||||
id="text883"
|
||||
aria-label="-" />
|
||||
<circle
|
||||
r="1.9539149"
|
||||
cy="81.763107"
|
||||
cx="-377.07275"
|
||||
id="path888"
|
||||
style="fill:#f26a3d;fill-opacity:1;stroke:none;stroke-width:1.665;stroke-miterlimit:3.6;stroke-dasharray:3.32999, 1.665;stroke-dashoffset:2.66401;stroke-opacity:1" />
|
||||
<circle
|
||||
style="fill:#f26a3d;fill-opacity:1;stroke:none;stroke-width:1.665;stroke-miterlimit:3.6;stroke-dasharray:3.32999, 1.665;stroke-dashoffset:2.66401;stroke-opacity:1"
|
||||
id="circle890"
|
||||
cx="-216.73546"
|
||||
cy="81.763107"
|
||||
r="1.9539149" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 8.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 422 KiB |
165
content/articles/2020/sway-gerer-sortie-ecran/index.md
Normal file
165
content/articles/2020/sway-gerer-sortie-ecran/index.md
Normal file
|
@ -0,0 +1,165 @@
|
|||
Title: Gérer ses écrans à chaud avec Sway
|
||||
Category: linux
|
||||
Tags: bureau, Sway, pl-fr
|
||||
Date: 2020-08-01 1:34
|
||||
cover: assets/backgrounds/article_gerer-ses-ecrans-a-chaud-avec-sway.jpg
|
||||
|
||||
Depuis quelques temps, j'utilise [Sway][l_sway], gestionnaire de fenêtre du type
|
||||
*Tiling-Manager*, reprenant le principe du célèbre *[i3][l_i3]* et utilisant
|
||||
*Wayland* comme protocole de serveur d'affichage. C'est le gestionnaire de
|
||||
fenêtre par défaut sur mes trois machines (et même celle de "jeu").
|
||||
|
||||
Pour pouvoir configurer les sorties écran à chaud avec *Sway*, il est possible
|
||||
d'utiliser la commande `swaymsg`, voici quelques exemple.
|
||||
|
||||
## Trouver le nom des sorties.
|
||||
|
||||
Afin de pouvoir paramétrer comme il se doit ses différents écrans, il faut
|
||||
d'abord **trouver leurs noms**, la commande pour les trouver est :
|
||||
|
||||
```shell
|
||||
swaymsg -t get-outputs
|
||||
```
|
||||
Et sa sortie :
|
||||
|
||||
```shell
|
||||
Output eDP-1 'Sharp Corporation 0x144A 0x00000000' (focused)
|
||||
Current mode: 3200x1800 @ 59.981998 Hz
|
||||
Position: 1920,0
|
||||
Scale factor: 2.000000
|
||||
Scale filter: nearest
|
||||
Subpixel hinting: unknown
|
||||
Transform: normal
|
||||
Workspace: 1
|
||||
Max render time: off
|
||||
Adaptive sync: disabled
|
||||
Available modes:
|
||||
3200x1800 @ 47.985001 Hz
|
||||
3200x1800 @ 59.981998 Hz
|
||||
|
||||
Output DP-1 'Iiyama North America PL2482HS 1175301402148'
|
||||
Current mode: 1920x1080 @ 74.973000 Hz
|
||||
Position: 0,0
|
||||
Scale factor: 1.000000
|
||||
Scale filter: nearest
|
||||
Subpixel hinting: unknown
|
||||
Transform: normal
|
||||
Workspace: 5
|
||||
Max render time: off
|
||||
Adaptive sync: disabled
|
||||
Available modes:
|
||||
720x400 @ 70.082001 Hz
|
||||
[...]
|
||||
```
|
||||
|
||||
Cette commande (dont j'ai raccourci la sortie) donne tout un tas
|
||||
d'**informations utiles sur les écrans reliés à la machine**. Si vous avez déjà
|
||||
toutes celles nécessaires mais il vous manque les noms associés, il et possible
|
||||
de lancer la commande suivante :
|
||||
|
||||
```shell
|
||||
swaymsg -t get_outputs -p | grep Output | cut -d' ' -f2-
|
||||
|
||||
eDP-1 'Sharp Corporation 0x144A 0x00000000' (focused)
|
||||
DP-1 'Iiyama North America PL2482HS 1175301402148'
|
||||
```
|
||||
|
||||
On voit ainsi rapidement quel nom porte chaque écran (`eDP-1` mon écran interne
|
||||
et `DP-1` l'externe).
|
||||
|
||||
## Changer la disposition.
|
||||
|
||||
Lors du branchement de mon écran externe, il est positionné à gauche de celui
|
||||
du portable, or c'est l'inverse que je veux, il suffit alors de faire
|
||||
dans un terminal :
|
||||
|
||||
```shell
|
||||
swaymsg 'output eDP-1 pos 0 0; output DP-1 pos 1600 0'
|
||||
```
|
||||
|
||||
Je place ainsi l'écran interne en position `0 0` et l'écran HDMI en position
|
||||
`1600 0`. Comme l'écran interne est de type HiDPI (`3200x1800`) et qu'un facteur
|
||||
d'agrandissement de 2 est paramétré dans mon fichier de configuration, j'ai
|
||||
utilisé la taille *"virtuelle"* de l'écran (`1600 0`) pour positionner le
|
||||
suivant.
|
||||
|
||||

|
||||
|
||||
Vous notez qu'**il est possible de passer plusieurs commandes à `swaymsg` en les
|
||||
séparant par un point-virgule**.
|
||||
|
||||
## Changer le fond d'écran
|
||||
|
||||
Il est aussi possible de changer le fond d'écran, par exemple si je veux changer
|
||||
celui de l'écran HDMI :
|
||||
|
||||
```shell
|
||||
swaymsg 'output DP-1 background ~/documents/ressources/wallpapers/morty.jpg fill'
|
||||
```
|
||||
|
||||
Le chemin vers l'image doit être absolu sinon ça ne fonctionne pas. Le dernier
|
||||
paramètre spécifie le mode d'adaptation de l'image.
|
||||
|
||||
## Bouger un espace de travail déjà ouvert vers l'écran fraichement connecté.
|
||||
|
||||
Je viens donc de brancher un écran à chaud, j'aimerai que certains espaces de
|
||||
travail de *Sway* déjà utilisés "déménagent" sur ce dernier.
|
||||
|
||||
Petite précision, dans mon fichier de configuration de *Sway*, j'ai personnalisé
|
||||
le nom de mes espaces de travail via des variables, voici un exemple de
|
||||
personnalisation (`~/.config/sway/config`)
|
||||
|
||||
```shell
|
||||
# Workspaces:
|
||||
# -----------
|
||||
[...]
|
||||
set $ws1 1: term
|
||||
set $ws2 2: mail
|
||||
set $ws3 3: www
|
||||
set $ws4 4: irc
|
||||
|
||||
# switch to workspace
|
||||
bindsym $mod+1 workspace $ws1
|
||||
[...]
|
||||
```
|
||||
|
||||
Je vais donc pouvoir utiliser ces variables avec `swaymsg`. Je veux donc que
|
||||
l'espace de travail `2: mail` déjà utilisé se retrouve sur mon écran
|
||||
HDMI, depuis un terminal ouvert sur `$ws1` je vais donc lancer la commande :
|
||||
|
||||
```shell
|
||||
swaymsg 'workspace $ws2; move to DP-1'
|
||||
```
|
||||
|
||||
## Utiliser `swaymsg` avec un lanceur maison
|
||||
|
||||
Pour lancer les applications depuis *Sway*, j'utilise un lanceur maison : un
|
||||
simple terminal s'ouvre et un script se lance avec [`fzf`][l_fzf] et me permet
|
||||
de taper le nom de l'application à lancer. Celui-ci me permet aussi de lancer
|
||||
directement les commandes `swaymsg`. Par exeample, pour déplacer mon espace de
|
||||
travail courant sur l'écran HDMI j'appelle mon lanceur avec `ctrl+d` puis
|
||||
lance :
|
||||
|
||||
```shell
|
||||
swaymsg 'move workspace to DP-1'
|
||||
```
|
||||
|
||||

|
||||
|
||||
Je peux aussi lancer n'importe quelle commande listée dans cet article de cette
|
||||
façon, le code du script est disponible dans le [dépôt suivant][l_sway_dotfile]
|
||||
|
||||
## En conclusion
|
||||
|
||||
*Sway* et *Wayland* facilitent vraiment la gestion des écrans : finis les
|
||||
problèmes de reconnaissance du matériel qu'on avait avec Xorg. Il est tout de
|
||||
même nécessaire d'affiner les réglages, et `swaymsg` le permet facilement.
|
||||
|
||||
Aidé par un lanceur maison, cette configuration se montre **facile et rapide à
|
||||
mettre en œuvre**.
|
||||
|
||||
[l_sway]:https://swaywm.org/
|
||||
[l_i3]:https://i3wm.org/
|
||||
[l_fzf]:https://github.com/junegunn/f
|
||||
[l_sway_dotfile]:https://git.epha.se/ephase/sway_config/
|
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
|
@ -29,7 +29,7 @@ commande / TUI écrit en Python.
|
|||
### Projets personnels divers
|
||||
|
||||
Vous pouvez trouver sur mon [instance git][l_gitea] en ligne un ensemble de
|
||||
scripts écrits par mes soins. Ils sont tous disponible sous licences libres.
|
||||
scripts écrits par mes soins. Ils sont tous disponibles sous licences libres.
|
||||
|
||||
[l_cv]:{static}/files/resume_fr.pdf
|
||||
[l_cv_code]:https://git.epha.se/ephase/resume
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue