Talk:Xdotool

Return to "Xdotool" page.
xmodmap -pme




read this



The name of the button can be found this way: run xev, then press the button and the name shows up in the brackets. In my case it was this: keycode 135 (keysym 0xff67, Menu), here Menu is the name of the key.

Then I could run xdotool Menu. However to make it work with a custom shortcut I had to add sleep before it, so I ended up with this code:

sleep 0.5 && xdotool key 'Menu' sleep 0.01 && xdotool key 's' sleep 0.01 && xdotool key 'e'

move the focused window in X to different parts of the screen

  1. !/bin/bash
  1. Written by Andrew McDonough
  2. A simple bash script that uses xdotool to move the window that is currently in focus to different parts of the screen.
  3. Particularly useful for reading web pages with flexible layouts on wide monitors.
  4. Assign the various options to keyboard shortcuts e.g. '<Super>Left' assigned to 'swind left'
  5. See http://tinyurl.com/ubuntukeys for help with assigning keyboard shortcuts.
  1. Change the following to suit your own monitor's resolution. Mine is 1920x1200

width=1920 height=1200

winid=`xdotool getwindowfocus`

case "$1" in )

 echo "Usage: swind <left|right|top|bottom|top-left|top-right|bottom-left|bottom-right>"

'left')

 xdotool windowmove $winid 0 0
 xdotool windowsize $winid $(( $width/2 )) $height

'right')

 xdotool windowmove $winid $(( $width/2))  0
 xdotool windowsize $winid $(( $width/2)) $height

'top')

 xdotool windowmove $winid 0 0
 xdotool windowsize $winid $width $(( $height/2 ))

'bottom')

 xdotool windowmove $winid 0 $(( $height/2 ))
 xdotool windowsize $winid $width $(( $height/2 ))

'top-left')

 xdotool windowmove $winid 0 0
 xdotool windowsize $winid $(( $width/2 )) $(( $height/2))

'top-right')

 xdotool windowmove $winid $(( $width/2))  0
 xdotool windowsize $winid $(( $width/2 )) $(( $height/2 ))

'bottom-left')

 xdotool windowmove $winid 0 $(( $width/2 ))
 xdotool windowsize $winid $(( $width/2 )) $(( $height/2 ))

'bottom-right')

 xdotool windowmove $winid $(( $width/2))  $(( $height/2 ))
 xdotool windowsize $winid $(( $width/2 )) $(( $height/2 ))

esac

minimize all other windows

  1. !/bin/bash

active_window_id=$(xdotool getactivewindow) for window_id in $(xdotool search --onlyvisible ".*") do

   if [ $window_id != $active_window_id ]
   then
       xdotool windowminimize $window_id
   fi

done

Last modified on 6 July 2020, at 00:04