Xdotool Simulates Key Presses and Mouse Clicks

Поділитися
Вставка
  • Опубліковано 24 сер 2022
  • xdotool is a command line utility that is most often used to simulate key presses or mouse clicks. This is especially useful to those of us that use standalone window managers because sometimes you want to bind an action to a keyboard event or mouse event rather than a shell command.
    REFERENCED:
    ► github.com/jordansissel/xdotool
    WANT TO SUPPORT THE CHANNEL?
    💰 Patreon: / distrotube
    💳 Paypal: ua-cam.com/users/redirect?even...
    🛍️ Amazon: amzn.to/2RotFFi
    👕 Teespring: teespring.com/stores/distrotube
    DONATE CRYPTO:
    💰 Bitcoin: 1Mp6ebz5bNcjNFW7XWHVht36SkiLoxPKoX
    🐶 Dogecoin: D5fpRD1JRoBFPDXSBocRTp8W9uKzfwLFAu
    📕 LBC: bMfA2c3zmcLxPCpyPcrykLvMhZ7A5mQuhJ
    DT ON THE WEB:
    🕸️ Website: distrotube.com/
    📁 GitLab: gitlab.com/dwt1
    🗨️ Mastodon: fosstodon.org/@distrotube
    👫 Reddit: / distrotube
    📽️ LBRY/Odysee: odysee.com/@DistroTube:2
    FREE AND OPEN SOURCE SOFTWARE THAT I USE:
    🌐 Brave Browser - brave.com/dis872
    📽️ Open Broadcaster Software: obsproject.com/
    🎬 Kdenlive: kdenlive.org
    🎨 GIMP: www.gimp.org/
    🎵 Tenacity: github.com/tenacityteam/tenacity
    💻 VirtualBox: www.virtualbox.org/
    🗒️ Doom Emacs: github.com/hlissner/doom-emacs
    Your support is very much appreciated. Thanks, guys!
  • Наука та технологія

КОМЕНТАРІ • 81

  • @NekoiNemo
    @NekoiNemo Рік тому +49

    Fun fact, if you're sitting on a toilet with a laptop, wearing headphones connected to your other PC, and you want to continue video playback on it so you can keep listening - xdotool over SSH is a viable way to shift X's window focus to that YT window and send it the space key to continue playback. Don't ask how i know that.

    • @nobeltnium
      @nobeltnium Рік тому +1

      noice 😘

    • @watermelongaming8658
      @watermelongaming8658 Рік тому +3

      step 1: figure out friends password
      step 2: have fun

    • @reveninja5252
      @reveninja5252 Рік тому

      You embody the spirit of a true nerd... and you probably have adhd.

    • @anon_y_mousse
      @anon_y_mousse Рік тому

      I won't ask how you know that, but I will ask, what were you doing that you couldn't wait until you were out of the bathroom to do it?

    • @NekoiNemo
      @NekoiNemo Рік тому +2

      @@anon_y_mousse I just didn't want to sit in silence while i *could* be keep listening to a podcast ^^"

  • @developerpranav
    @developerpranav Рік тому +13

    Replaced xdotool for ydotool for my DIY-macro keyboard, since it works on wayland and tty as well.

  • @davidgomez79
    @davidgomez79 Рік тому +8

    I used it to automate a farm game since I seem to have a thing against computer mice. Plus I'm too impatient and lazy to wait for that corn to grow.

  • @braelinmichelus
    @braelinmichelus Рік тому

    What an incredible discovery!
    This seems incredibly useful even in a full desktop environment like KDE Plasma.
    I've set it up in a shell script with a bunch of functions and with a couple custom keybindings,
    I've added macros into Gimp! For automatically shrinking the selection for clean crops,
    applying the same crop using quick mask to a bunch of photos, and even auto-cropping the subject!
    Really awesome little tool! Made my universal macro dreams come true!
    If only it could move your mouse cursor too, not just click.

  • @LordHonkInc
    @LordHonkInc Рік тому +4

    I love xdotool, especially for managing macros on keyboards or mice with macro buttons that don't provide native configuration frontends (like my G300s; and yes, ratslap does exist, but it's clunky if you change options frequently): use xev to find the keycode of your non-standard button or key, add a custom keymap for that keycode (e.g. i3 uses the "bindcode" option) and execute your xdotool command. I've got it set up for all the ways of taking screenshots (i.e. [save to clipboard / file] * [the entire screen / the active window (using xdotool) / a custom selection]) so I don't have to remember if it's Shift+PrtScr or Ctrl+PrtScr to take a screenshot of the active window.

    • @anon_y_mousse
      @anon_y_mousse Рік тому

      Is that because you haven't set the shortcuts yourself? Or because you use them infrequently?

    • @LordHonkInc
      @LordHonkInc Рік тому +1

      @@anon_y_mousse Just because of the frequency, between the six options I get confused with what chord I assigned them to.
      That said, if you've got a keyboard with multimedia buttons (like XF86HomePage or XF86Mail) those are also good candidates for remapping (unless you actually use them for their intended purpose)

    • @anon_y_mousse
      @anon_y_mousse Рік тому +1

      @@LordHonkInc Totally relatable. I usually just hit PrtScr to bring up Spectacle because I forget what keys I assigned as well.

  • @katalytic69420
    @katalytic69420 Рік тому +1

    Thank you dt.

  • @mattfromeurope
    @mattfromeurope Рік тому +3

    How come that you JUST publish this video when I discovered this tool myself TODAY?!? ;-)

  • @YannMetalhead
    @YannMetalhead Рік тому

    Good video.

  • @theodorealenas3171
    @theodorealenas3171 Рік тому

    I would add a window manager some code to be able to read from named pipes. Though that would only work for the window manager.

  • @umop3plsdn
    @umop3plsdn Рік тому +1

    I tried to make a script to use xdotool in awesomewm keybind I got it to select the window fine but it isn’t sending keystrokes for some reason. If I run the script in terminal it runs fine. But in the awesomewm config it only changes focus lol. I’m using it to play pause UA-cam video with xf86audioplay

  • @johnpearson6910
    @johnpearson6910 Рік тому

    Had a little play around with this, but can't seem to get "$ xdotool key super+Return" to work to open a terminal (in dwm).
    "$ xdotool key super+KP_Enter" doesn't work either.
    Anyone know what's going wrong here?

  • @wayneswildworld
    @wayneswildworld 6 місяців тому

    How does he get that tiling screen to work? Also hwo do you get xdotool to permanately listen for a certain key combination and then perform a script to do so ?

  • @AshnSilvercorp
    @AshnSilvercorp Рік тому

    can xdotool theoretically trigger from MIDI information?

  • @user-wh3wp2yz9t
    @user-wh3wp2yz9t 5 місяців тому

    What I need to do is have a macro that I can select a point on the graphic desktop scene, MB#1 to select the point, then have the macro simulate a repeated MB#1 click there every 10 seconds. The screen should not change for the duration of this macro and if it does change drastically or I manually move the mouse - I need the macro to end.
    So I guess in other words, I'm looking for a repeating mouse click every 10 seconds (or whatever I program into the script) after the initial 'locating click'...
    Is this something XdoTool can DO ?

  • @rtheben
    @rtheben 4 місяці тому

    Derek seems to be a good soul

  • @scientiac
    @scientiac Рік тому +2

    Just found about xdotool and here you made a video about it. I found about it when I wanted to restart the gnome shell in my script. What would I use as a replacement for Wayland?

    • @MrHaomich
      @MrHaomich Рік тому +2

      There is ydotool for Wayland (though I never tried it because I don't use Wayland).

    • @valizeth4073
      @valizeth4073 Рік тому +1

      Afaik xdotool has partial support for wayland but since I dont use it, i dont know to what extent.

    • @vanadium4167
      @vanadium4167 Рік тому

      @@valizeth4073 Essentially not. It will only work in applications that run in Xorg on Wayland, i.e. through XWayland.

  • @darthchaos5966
    @darthchaos5966 Рік тому

    Can you do a tutorial on how to install GNOME 42 on FreeBSD 13.1 and FreeBSD 14.0? I jnever had any problems installing GNOME 3 on older versions of FreeBSD, but I've never been able to properly configure GNOME 41 or GNOME 42 on FreeBSD.

  • @SB-qm5wg
    @SB-qm5wg Рік тому

    xbindkeys & xdotool is my macro jam ⌨

  • @taimai8471
    @taimai8471 Рік тому

    3:22 which tool you are using

  •  Рік тому

    I have xdotool seted so I can use Control + Alt + LeftClick and paste primary selection everywhere

  • @gornhunter
    @gornhunter Рік тому +1

    What script are you using in your terminal when you type in for example clear command the colorful line graph above the prompt appears @DistroTube

    • @josipbroztito5519
      @josipbroztito5519 Рік тому

      dt shell colorscripts on his gitlab also in aur

    • @gornhunter
      @gornhunter Рік тому

      @@josipbroztito5519 I already have that but that line graph is not there or am i just missing it.

    • @gornhunter
      @gornhunter Рік тому

      @GeoMinesDiamonds If you mean that line graph specifically i don't but i have shell colorscript active when i open terminal it generates random script but not the one i was asking for.

    • @gornhunter
      @gornhunter Рік тому

      @GeoMinesDiamonds Yea i know what -e flag does but my question was if someone knows what is that color script specifically that appears on his terminal when he enters clear command.

    • @keshavbhatta5401
      @keshavbhatta5401 Рік тому

      @@gornhunter look at his fishrc there is an alias of clear command use that to get clear command like his

  • @Aehpt
    @Aehpt Рік тому +1

    Just realized one of the top tiered patrons is "why you bald, homie?"😂 #dtnotbald

  • @srijalkc1975
    @srijalkc1975 Рік тому +1

    which window manager is that on ur pc @DistroTube

    • @Son0fBeelzebub
      @Son0fBeelzebub Рік тому +2

      if you talking bout WM at the video: it is xmonad wm and xmobar bar

    • @srijalkc1975
      @srijalkc1975 Рік тому +2

      @@Son0fBeelzebub thank u sir 🌻🌻🌻

    • @Son0fBeelzebub
      @Son0fBeelzebub Рік тому +1

      @@srijalkc1975 youre welcome :)

  • @rashie
    @rashie Рік тому

    👍👍

  • @rickforges8918
    @rickforges8918 Рік тому +1

    I believe keepass uses XDOTOOL for autotype user/pw

  • @anon_y_mousse
    @anon_y_mousse Рік тому +1

    I think duct tape is an apt comparison, and truthfully, this should be one of those rarely used tools and not a quality of life enhancement. It's a pretty big failing of whatever system anyone is using that you'd need that to setup clickable buttons using that instead of some standard programmatic interface. I'd say that's an argument for continuing to use a DE.

  • @lzlxleldorado8646
    @lzlxleldorado8646 Рік тому

    Dt can you review plotinus

  • @petepf3212
    @petepf3212 Рік тому

    I used to use xdotool. I was trying to auto-login to gnome. It didnt work out.

  • @leviticus8930
    @leviticus8930 Рік тому

    I see 200k in your future

  • @gnuemacs1166
    @gnuemacs1166 Рік тому +1

    Is that an x11 tool ?

  • @tylerdean980
    @tylerdean980 Рік тому

    Now if only you could set this up to do the grindy/annoying parts of games so you can do something enjoyable while your character does the grinding for you.

  • @josipbroztito5519
    @josipbroztito5519 Рік тому

    Waylandsisters, I'm sorry....

  • @raphaeldrouin2934
    @raphaeldrouin2934 Рік тому

    I use it to close steam without killing it for a year

    • @skarlok1
      @skarlok1 Рік тому

      What command in Xdotool do you use to close window without killing it?

    • @raphaeldrouin2934
      @raphaeldrouin2934 Рік тому

      @@skarlok1
      -- close client
      awful.key({modkey}, "q",
      function(c)
      if(c.name == "Steam") then
      awful.spawn.with_shell("xdotool windowunmap $(xdotool getactivewindow)")
      else
      c:kill()
      end
      end,
      {description = "close", group = "client"}
      ),
      I do this in awesome wm, you can use it in other way, you can use " xdotool windowunmap $(xdotool getactivewindow) " in the shell the $(xdotool getactivewindow) is to close the active window but you can enter manually the window you want to close

    • @raphaeldrouin2934
      @raphaeldrouin2934 Рік тому

      @@skarlok1 I just read the man page and found that I can use xdotool getactivewindow windowclose, it make more sense for what I want to do, I can change my code to look like
      -- close client
      awful.key({modkey}, "q",
      function(c)
      awful.spawn.with_shell("xdotool getactivewindow windowclose")
      end,
      {description = "close", group = "client"}
      ),
      this is for awesome wm but you can do this on other window manager, I just call the shell command
      -- Edit sorry when I use windowclose I'm not able to reopen steam, so I just stick to windowunmap I think
      awful.spawn.with_shell("xdotool getactivewindow windowunmap") is the best way I found for my use

    • @skarlok1
      @skarlok1 Рік тому

      @@raphaeldrouin2934 Thanks, Will test that later.

  • @sarahross7515
    @sarahross7515 Рік тому

    kinda similar to pyautogui

  • @ppdd3651
    @ppdd3651 Рік тому +3

    fish is not a shell

    • @BurgerKingHarkinian
      @BurgerKingHarkinian Рік тому +3

      I'm sorry Luke, you're wrong.

    • @csehszlovakze
      @csehszlovakze Рік тому

      @@BurgerKingHarkinian you haven't heard of recursive backronyms, have you? :) FISH can easily stand for Fish Is Not a Shell just like GNU can also mean GNU's Not Unix

    • @BurgerKingHarkinian
      @BurgerKingHarkinian Рік тому

      I have. But I've never heard if that one before.

    • @theodorealenas3171
      @theodorealenas3171 Рік тому +1

      @@csehszlovakze it's Fish Is SHell.
      Or you can add a not like fish is not a shell.
      Or I can make it fish is deeznutz shell.
      Or you can put a use vim in there, it's flexible.

  • @josipbroztito5519
    @josipbroztito5519 Рік тому +1

    Linus Sebastian bought the linux foundation, what is your response? I thought it was fake news but it's real.

  • @aminipo8829
    @aminipo8829 Рік тому

    does not work with wayland. thumbs down for that. tried to setup touchpad gestures with libinput gestures which depends on xdotool for keystroke simulation in x11. not everythings works. i especially tried to setup 2 finger pinch for zooming which should be available by default does not work in vlc for subtitle resizing (this gesture works flawlessly in windows). i will take wayland gestures on gnome and kde anyday over xdotool bullshit .

    • @kingterrysservant2104
      @kingterrysservant2104 Рік тому +2

      Calling something bullshit because it doesn't support wayland... Maybe you should fix your attitude before you worry about your computer gestures. Oh, and by the way, you could fork it and add all of those things if you want.

    • @notuxnobux
      @notuxnobux Рік тому

      It's your fault for using wayland lol. Wayland is intentionally designed to work like that. You only have yourself to blame.

    • @paulsorensen8489
      @paulsorensen8489 Рік тому +1

      Xdotool uses an security risk exploit in Xorg which was there by design for 35 years ago - not something that could be fixed. Wayland did through fundamental design changes. There is Ydotool if the applications are written to use Ydotool keyboard server - outside of Wayland. I tried it a year ago and it was more trouble than it was worth. I would rather write my own capture feature in the application. Personally, I won't give up Wayland just to be able to use Xdotool.

    • @notuxnobux
      @notuxnobux Рік тому

      @@paulsorensen8489 "not something that could be fixed" that's false, it was "fixed" 20 years ago with XACE but nobody cares about that because in the real world it doesn't matter. Never in those 35 years has anybody ever exploited that "security risk". Wayland "security" is a fix for a problem nobody had, while it just introduced more problems (in the real world). If you are really serious about security you would run every application in a separate virtual machine, in which case it doesn't matter if you use x11 or not.

  • @itsfish8672
    @itsfish8672 Рік тому

    GVDT.