Vous n'êtes pas identifié(e).
L'icône rouge permet de télécharger chaque page du wiki visitée au format PDF et la grise au format ODT →
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
utilisateurs:captnfab:tutos:i3wm-deplacer-workspace-x-vers-ecran-actif [02/08/2014 21:37] captnfab créée |
utilisateurs:captnfab:tutos:i3wm-deplacer-workspace-x-vers-ecran-actif [03/08/2014 23:52] (Version actuelle) captnfab [Installation] |
||
---|---|---|---|
Ligne 3: | Ligne 3: | ||
* Objet : Un script pour déplacer un Workspace vers l'écran actif sous i3 | * Objet : Un script pour déplacer un Workspace vers l'écran actif sous i3 | ||
* Niveau requis : {{tag>débutant}} | * Niveau requis : {{tag>débutant}} | ||
- | * Commentaires : ///i3wm n'a pas do commande ''move workspace X to active display'', nous la réalisons// | + | * Commentaires : //i3wm n'a pas do commande ''move workspace X to active display'', nous la réalisons// |
* Débutant, à savoir : [[:doc:systeme:commandes:le_debianiste_qui_papillonne|Utiliser GNU/Linux en ligne de commande, tout commence là !.]] :-) | * Débutant, à savoir : [[:doc:systeme:commandes:le_debianiste_qui_papillonne|Utiliser GNU/Linux en ligne de commande, tout commence là !.]] :-) | ||
Ligne 22: | Ligne 22: | ||
def ipc_query(req="command", msg=""): | def ipc_query(req="command", msg=""): | ||
- | ans = popen("i3-msg -t " + req + " " + msg).readlines()[0] | + | ans = popen("i3-msg -t " + req + " " + msg).readlines()[0] |
return loads(ans) | return loads(ans) | ||
Ligne 35: | Ligne 35: | ||
# Retrieving active display | # Retrieving active display | ||
active_display = None | active_display = None | ||
+ | old_display = None | ||
for w in ipc_query(req="get_workspaces"): | for w in ipc_query(req="get_workspaces"): | ||
if w['focused']: | if w['focused']: | ||
active_display = w['output'] | active_display = w['output'] | ||
+ | if w['name'] == newworkspace: | ||
+ | old_display = w['output'] | ||
+ | if newworkspace.isdigit() and w['num'] == int(newworkspace): | ||
+ | old_display = w['output'] | ||
+ | print w | ||
+ | |||
+ | # Pre-computing commands | ||
+ | if newworkspace.isdigit(): | ||
+ | cmd_show = "workspace number " + newworkspace | ||
+ | else: | ||
+ | cmd_show = "workspace " + newworkspace | ||
+ | cmd_move = "move workspace to output " + active_display | ||
# Moving workspace to active display | # Moving workspace to active display | ||
- | ipc_query(msg="workspace " + newworkspace) | + | if active_display == old_display: |
- | ipc_query(msg="move workspace to output " + active_display + "; workspace " + newworkspace) | + | print cmd_show |
+ | print ipc_query(msg=cmd_show) | ||
+ | else: | ||
+ | cmd="'" + cmd_show + ";" + cmd_move + ";" + cmd_show + "'" | ||
+ | print cmd | ||
+ | print ipc_query(msg=cmd) | ||
</code> | </code> | ||