Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Is it possible to do this in linux?

New to Debian (Or Linux in general)? Ask your questions here!
Message
Author
emil_21
Posts: 98
Joined: 2017-04-14 06:13

Re: Is it possible to do this in linux?

#21 Post by emil_21 »

I am using virtualbox in full screen mode.

I also run 'gnome-panel' in openbox but i get 'bash: gnome-panel: command not found'. I think i have to install the gnome panel inside openbox.

Anyway, i will search more info about this.

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Is it possible to do this in linux?

#22 Post by GarryRicketson »

I think i have to install the gnome panel inside openbox.
Maybe that will work.

I need to take this back ,
y GarryRicketson » but it could be,... I tried it on both, my HD (bare metal), Debian 7,
I had not tried the command you showed on the Debian installation,
I just tried a simple command :

Code: Select all

xdotool  click 3
, but when I try the command you showed
I get a error, as well, there seems to be something wrong with the way
Debian handles the command,.. or the command needs to written different
for Debian,.. maybe some one that know more on this will share.
======== additional note====
Apparently the version of xdotool that is in the Debian repositories is different
The command is valid, looking at the manual that came with the version I installed
on OpenBsd,
from:

Code: Select all

man xdotool
behave_screen_edge [options] where command ...
Bind an action to events when the mouse hits the screen edge or
corner.

Options are:

Code: Select all

xdotool version: xdotool-3.20150503.1v0
=========================
When I looked at the manual on Debian, it does not show the command.
But ok , now that makes sense, since I am using Debian 7 (wheexy)
it is a different version:
https://packages.debian.org/wheezy/xdotool

Code: Select all

xdotool (1:2.20100701.2961-3 
So that explains why it did not work for me, and is not in the manual.
============ edite ===note:
I did install xdotool to a Debian Jessie VM, it is the newer version xdotool-3.2
and it works, including the command the OP gave, but it does need to be using
"switch to scale mode" <host-c> That is <right ctrl-c> , at least it seemed that way,
now it is working either way,..

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Is it possible to do this in linux?

#23 Post by debiman »

emil_21, sorry i don't log in here that often.
this thread has grown a lot meanwhile, and i can see we are now mixing up all sorts of different things, trying to swat a fly with 3 hammers...

go back to the beginning (i hope you haven't messed up your install completely by now)

and ask yourself, what do you want to achieve?

because what you did instead is this:
- i want to achieve something
- i think i should use X
- X doesn't work
- please, help!

so i am asking, what is this thing that led you to believe that you need linux' equivalent of autohotkey?

emil_21
Posts: 98
Joined: 2017-04-14 06:13

Re: Is it possible to do this in linux?

#24 Post by emil_21 »

debiman wrote:
so i am asking, what is this thing that led you to believe that you need linux' equivalent of autohotkey?
Because autohotkey scripts are increasing my productivity.

By the way, is it possible for xdotool to detect active window? For example, something like this:

Code: Select all

if (firefox window is the active window and the mouse touch the bottom screen)
send action (keyboard key press)

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Is it possible to do this in linux?

#25 Post by dasein »

emil_21 wrote:By the way, is it possible for xdotool to detect active window?
What does the manual say?

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Is it possible to do this in linux?

#26 Post by GarryRicketson »

by emil_21 » By the way, is it possible for xdotool to detect active window?
Yes it is possible maybe something like this:

Code: Select all

focused_window_id=$(xdotool getwindowfocus)
active_window_id=$(xdotool getactivewindow)
active_window_pid=$(xdotool getwindowpid "$active_window_id") 
Or

Code: Select all

xdotool getactivewindow getwindowname 

--------------

Code: Select all

 xdotool search --name  firefox 
Some of the tutorials as well as the manual go into details on this.
========== edit ============
by emil_21 » Did you look at this tutorial ?
Me : http://tuxradar.com/content/xdotool-script-your-mouse
Have a peek at the manual page (

Code: Select all

man xdotool
) to see a full list of available options.
The first command it demonstrates,

Code: Select all

 xdotool click 1

I s very simple, which is where one should start when learning how to use a
new cli program.
They don't mention in the tutorial, but if you open 2 windows, the first being the terminal, keep it small so it does not take up the entire screen.
The second window, let's use firefox as the example, also keep it small, so you can have both windows on your screen.
Now, in the terminal, type or copy/paste:

Code: Select all

xdotool click 1
BUT DO NOT hit enter just yet.
Now, move the mouse cursor to the top right corner of the Firefox window,...
or any option that requires a "click" to activate it. Just move the cursor to the area,.DO NOT click it.
Then , hit enter, but for your terminal, it will run the command, watch what happens, ...Just with that command, and the fact that after it is run once, it is in the command history,..one can keep their right hand on the mouse, and with the left hand , use the arrow keys, to repeat the command, any time they want to use the "left" click button.
According to the manual, that command can be assigned to a "hotkey", as you call it,... I still have not really looked into exactly how, but it can be done,
In the same tutorial, they do go into the windowactivate options,...
------------------

Code: Select all

 xdotool Parole “Firefox” windowactivate 
=============================

Code: Select all

xdotool search “Parole” windowactivate --sync mousemove
--window %1 0 0
-------------
How ever, I suggest not imediately jumping into more advanced scripts and options, until after you have some understanding of the first steps, and basic
commands,..
at the bottom of the tutorial it says:
To wrap up, in this tutorial we’ve explored various different ways to interact with the GUI: moving the mouse, sending virtual clicks and drags, and finding specific windows. Putting these actions together, and exploring more possibilities with the xdotool manual page, you can automate pretty much everything on your desktop, leaving you with more time to spend on important things.
I do find the parts in the manual about assigning the commands to a "hotkey"
confusing myself, so that is why I don't give you a example,..maybe if some one
knows how, and they just give a example, of assigning the

Code: Select all

xdotool click 1
to a specific keyboard key, it would help,...it seems
to me like that is what the OP needs, after that they could use the example to
apply to other xdotool commands and keys,..

emil_21
Posts: 98
Joined: 2017-04-14 06:13

Re: Is it possible to do this in linux?

#27 Post by emil_21 »

@GarryRicketson Thanks, will try it.

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Is it possible to do this in linux?

#28 Post by debiman »

@garry one more time steals the show by elaborating on man pages.
and i really mean elaborating...
emil_21 wrote:Because autohotkey scripts are increasing my productivity.
By the way, is it possible for xdotool to detect active window?
very nice, but you still haven't told us what you want to achieve. but one step closer

anyhow, you've been given plenty of hints now, it's your turn now.

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Is it possible to do this in linux?

#29 Post by GarryRicketson »

Post by debiman » 2017-04-18 11:52
@garry one more time steals the show by elaborating on man pages.
and i really mean elaborating...
I am sorry, I am not trying to "steal the show",..or anything like that,
About 95 % of the time though, for me, using the search engine and
reading the manual works,...
But also, thank you for sharing about xdotool, I am finding it usefull, and
it was even available for OpenBsd, works really well.

phenest wrote:
emil_21 wrote:What i want to do is to bring window in focus just by hovering on the window button on the panel.
...
I am using debian 8.6 with Gnome DE.
But Gnome Shell only shows the currently focused window and no others. So you would need a Shell Extension such as gnome-shell-extension-taskbar which will do exactly what you want.
I wonder if the OP ever tried this,..he says it does exactly what the OP wants ?

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Is it possible to do this in linux?

#30 Post by GarryRicketson »

There does seem to be a packaged program that the OP might find useful,
I have never liked this sort of GUI , program, but often many other people
do. A example, many or most people like and prefer Gimp, but I prefer ImageMagick, ..but any way that is another topic,...

https://packages.debian.org/jessie/autokey-common
desktop automation utility - common data

AutoKey is a desktop automation utility for Linux and X11. It allows the automation of virtually any task by responding to typed abbreviations and hotkeys. It offers a full-featured GUI that makes it highly accessible for novices, as well as a scripting interface offering the full flexibility and power of the Python language.

This package contains the common data shared between the various frontends
Just like everything else, the only way I know of to learn to use the program will be to read the manual and documentation. There are also some tutorials
on it , if one does a search for them.

I have not tried it, and don't plan on it, 'xdotool' combined with 'xkbset' ,
'setxkbmap', and 'xkbind' is sufficient, for me.

emil_21
Posts: 98
Joined: 2017-04-14 06:13

Re: Is it possible to do this in linux?

#31 Post by emil_21 »

debiman wrote: very nice, but you still haven't told us what you want to achieve. but one step closer

anyhow, you've been given plenty of hints now, it's your turn now.
I need a script that can do this: when the mouse touch the bottom of the screen, and the firefox is the active window, the script to send ctrl+shift+e key press to the firefox window. This will open the tab groups panel in firefox. This way i can switch between tabs by clicking on the tab thumbnail in the tab group panel, since i like my tabbar to be hidden.
When the mouse touch the bottom of the screen and firefox is not the active window the script should not be activated.

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Is it possible to do this in linux?

#32 Post by debiman »

yes this is scriptable with the above mentioned tools.
i'll just add wmctrl to the pool of available utilities.
you know, in linux there's almost always more than 1 way to skin a cat.

if you've never done anything like this on linux, there will be a learning curve, and i think it is clear that this is a highly personal setup so you'll have to make it yourself.

i suggest this workflow:
1) see if you can trigger a command on touching certain hot corners (screen edge). sometimes the window manager already has the ability, sometimes you can install a separate app for that, e.g. http://linux.softpedia.com/get/Desktop- ... 3672.shtml or https://github.com/mstraube/x-corners (but already packaged versions may exist in your repos, search "hot corner")

2) write a shell script (most probably bash) that checks if the right window is in focus, and if so, performs the necessary actions. i think xdotool can do most, if not all, of what you require. be prepared to use wmctrl also. maybe also xprop, xwininfo etc.

Post Reply