The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
4

How can I change the position of i3-input prompt?

asked Jun 10 '14

montiainen gravatar image

I have four monitors, and regardless of the active workspace, i3-input prompt always opens up on top left monitor. Why is it so, since it hasn't even been defined as primary monitor? Is it possible to re-position it?

4 answers

Sort by » oldest newest most voted
4

answered Jun 10 '14

Adaephon gravatar image

updated Oct 8 '15

TL;DR

You cannot without changing the source code.


The position of the i3-input window is hardcoded to geometry 500x(fontheight+8)+50+50. That means upper left corner of the virtual screen spanning all displays. There are no configuration or command line options that allow changing that.

As far as I can tell, it is not mapped in the i3 window tree (i3-msg -t get_tree). Therefore it cannot be moved to a specific workspace or output with i3 commands. It even will remain visible if the workspace on the display, on which it is displayed, is changed.

While the window could theoretically be moved with xdotool, it does not have a title or window class, which could be used to reference the window.

At the moment, if you really want to change the position you can do so only in the source code in i3-input/main.c, search for "dimensions":

50, 50, 500, font.height + 8, /* dimensions */

Even better would be if you could give the window a name, so that it can be found with xdotool or similar programs. Maybe you could even submit a patch for that.

Update version 4.11

As of version 4.11 the placement of the i3-input window is improved. While still not configurable the i3-input window now appears inside the currently focused window.

Comments

Based on your answer I made a [patch](http://cr.i3wm.org/patch/570) using my very limited C know-how. It seems to be working: #!/bin/sh xdotool search --sync test windowmove 1000 1000 & i3-input -n test , prompt opens up on different location. Thank you very much for your fine answer!

montiainen gravatar imagemontiainen (Jun 11 '14)edit

I don't have enough karma to post links.

montiainen gravatar imagemontiainen (Jun 11 '14)edit
0

answered May 19 '15

GenghisKen gravatar image

Zenity++. I put the renaming logic into a script, enhanced to maintain the workspace number:

#! /bin/bash
#
# Script to prompt to rename the current workspace.
#
# Cadged from
#  https://faq.i3wm.org/question/3936/how-can-i-change-the-position-of-i3-input-prompt/
#
WSNUMBER=$(ruby -rjson -e 'puts(JSON.parse(`i3-msg -t get_workspaces`).find { |ws| ws["focused"] }["num"])')
NEWNAME="`zenity --entry --text 'Rename workspace to: '`"
if [[ ! "${NEWNAME}" =~ ^[0-9]+: ]] ; then
    NEWNAME="${WSNUMBER}:${NEWNAME}"
fi
i3-msg "rename workspace to \"${NEWNAME}\""

Comments

In case you don't know: with the next release of i3, the i3-input window will be positioned at the currently focused window.

Airblader gravatar imageAirblader (May 19 '15)edit
0

answered May 8 '15

My workaround is using zenity + i3-msg

As an exmaple for renaming workspace, instead of:

bindsym $mod+Shift+A exec i3-input -F 'rename workspace to "%s"' -P 'New name: '

I use:

bindsym $mod+Shift+A exec i3-msg rename workspace to `zenity --entry --text "Rename workspace to:"`
0

answered May 27 '15

gurkensalat gravatar image

updated May 27 '15

To answer the question directly, it is possible to reposition i3-input using xdotool with a short delay (in this case 0.1s):

#!/bin/bash
i3-input "$@" &
pid=$!
sleep 0.1
xdotool getwindowfocus windowmove 500 500
# xdotool getwindowfocus windowmove $(($RANDOM%1420)) $(($RANDOM%1060))
wait $pid

Question Tools

Stats

Asked: Jun 10 '14

Seen: 812 times

Last updated: Oct 08