Is it possible to do this in linux?

New to Debian (Or Linux in general)? Ask your questions here!

Is it possible to do this in linux?

Postby emil_21 » 2017-04-16 13:43

I am linux noob and i am wondering if it is possible, with a script or some other way, to make mouse send left click when the mouse cursor hover over the top panel? I have a autohotkey that can do this in Windows and i am wondering if it is possible something like this to be implemented in linux. I am using debian gnome.
emil_21
 
Posts: 22
Joined: 2017-04-14 06:13

Re: Is it possible to do this in linux?

Postby debiman » 2017-04-16 14:16

one word: xdotool
User avatar
debiman
 
Posts: 1173
Joined: 2013-03-12 07:18

Re: Is it possible to do this in linux?

Postby emil_21 » 2017-04-16 15:59

I read some guides about xdotool, but i've never done any bash scripting so far, and i don't think i can do that on my own. For example, how to make xdotool detect when the mouse is over the top panel?
emil_21
 
Posts: 22
Joined: 2017-04-14 06:13

Re: Is it possible to do this in linux?

Postby GarryRicketson » 2017-04-16 16:18

So , why not ?
how to make xdotool detect when the mouse is over the top panel?
----------
This is pretty straight forward:
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.

But you need to actually install xdtool ,first , then you will have the manual,
Code: Select all
apt install xdtool

See:
https://packages.debian.org/jessie/x11/xdotool
Then start experimenting with
it,.... try the things in the tutorial.
Nobody can do this for you,



And as far as this goes:
but i've never done any bash scripting so far, and i don't think i can do that on my own


I suppose you expect someone to do it for you, I mean write the script, and that is ok, but it would be better to learn how to do the things you want to do "on your own" so to speak,..
a good place to start :
How to write a bash script for Debian
-----------------------
https://wiki.debian.org/BashScripting
"What we expect you have already Done"

Before doing anything, read the Debian documentation:
Debian Documentation
How to ask the smart way
Debian Foro Español
======================
For the Birds
User avatar
GarryRicketson
 
Posts: 4206
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Is it possible to do this in linux?

Postby Bulkley » 2017-04-16 16:43

emil_21 wrote:I am linux noob and i am wondering if it is possible, with a script or some other way, to make mouse send left click when the mouse cursor hover over the top panel?


To clarify, as I understand it you want to make windows active when the cursor hovers over the bar on top of said window. In my Openbox wm this is easily set in Obconf. There is probably a similar setting in whichever desktop or wm you are using.
Bulkley
 
Posts: 5264
Joined: 2006-02-11 18:35

Re: Is it possible to do this in linux?

Postby emil_21 » 2017-04-16 17:49

Bulkley wrote:
To clarify, as I understand it you want to make windows active when the cursor hovers over the bar on top of said window. In my Openbox wm this is easily set in Obconf. There is probably a similar setting in whichever desktop or wm you are using.


What i want to do is to bring window in focus just by hovering on the window button on the panel. I have an autohotkey script for Windows that can do this and it saves me lot of clicks.
I installed openbox but i am having problem activating it. If i type 'openbox --replace' my desktop go black and everything stops working. I am using debian 8.6 with Gnome DE.
emil_21
 
Posts: 22
Joined: 2017-04-14 06:13

Re: Is it possible to do this in linux?

Postby GarryRicketson » 2017-04-16 18:16

I am using debian 8.6 with Gnome DE.



Do you have OpenBox installed ?
Open Box is a windows manager, it is not a DE, like gnome,

When you start OpenBox, it will be a black screen, What happens if you , left click the mouse ?
*****IMPORTANT EDIT***
I mean "right click", the other left,..sorry about that,
***********************

Also "obconf" needs to be installed,... You also might want to install a panel, like
'tint2',...
I don't use Gnome, so can't say anything on that.
Last edited by GarryRicketson on 2017-04-17 01:47, edited 2 times in total.
User avatar
GarryRicketson
 
Posts: 4206
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Is it possible to do this in linux?

Postby phenest » 2017-04-16 18:17

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.
NEC Spirit 550 P4 3.8GHz HT - 2GB RAM - nVidia 7600GT - Pioneer BDR-209DBK
ASUS Sabertooth P67 i7 3770K - 32GB RAM - 2x nVidia 660GTX SLI'd
User avatar
phenest
 
Posts: 1571
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Is it possible to do this in linux?

Postby emil_21 » 2017-04-16 19:38

GarryRicketson wrote:
Do you have OpenBox installed ?
Open Box is a windows manager, it is not a DE, like gnome,

When you start OpenBox, it will be a black screen, What happens if you , left click the mouse ?
Also "obconf" needs to be installed,... You also might want to install a panel, like
'tint2',...
I don't use Gnome, so can't say anything on that.


Yes, openbox is installed. I installed it with 'sudo apt-get install openbox obconf'. I am trying to activate it with the command 'openbox --replace' though i don't know if this is the right way or i have to make some configuration before that. When i run the command my desktop go black and my panels disappear. Also, i can't open the dashboard with the super key, though i can open the home folder from the icon on the desktop.
Is this the right way to activate openbox and how to return to the default window manger?
emil_21
 
Posts: 22
Joined: 2017-04-14 06:13

Re: Is it possible to do this in linux?

Postby emil_21 » 2017-04-16 19:41

phenest wrote: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 have taskbar extension installed recently but didn't know it has this option. Thanks, for pointing it out. This is exactly what i was looking for.

I am still trying to make a script with xdotool that can do this though. It might be useful to learn some scripting.
emil_21
 
Posts: 22
Joined: 2017-04-14 06:13

Re: Is it possible to do this in linux?

Postby GarryRicketson » 2017-04-16 20:11

Is this the right way to activate openbox and how to return to the default window manger?


I am not sure about starting it from the Gnome shell, or Gnome,...but that is not
how I start it.
When your Debian first boots, and you have the login screen, there is options
to select the DE or window manage you want to use,
]Image

Sometimes it is below the window where you type in the username and password,
as well, so you may have to look for it a little.
Yours probably has Gnome, selected as default,..if OpenBox has been installed
it will show where, if you select OpenBox, it stays as the default, until you select another one, and change it.
You can have as many DE's (Desktop Enirinment) or Window Managers as you want, on a Debian system, this is only limited by how much disk space you have,
if you do not have much disk space, you shouldn't install very many.
With Open Box, like I said, it will be just a black screen, you need to use the "right click" on your mouse, that will show the menu,
***** edited*** I said "left" but I meant the other left, which is the "right" side,..
maybe this varies as well, depending on how ones mouse is configured, so it can't hurt to try both.
********************end edit************
There is a huge difference between a DE, like Gnome, and a WM (WindowManager),... you might enjoy trying one called TWM, as well.
https://en.wikipedia.org/wiki/Twm
twm was the first window manager I ever used.
Last edited by GarryRicketson on 2017-04-17 01:50, edited 1 time in total.
User avatar
GarryRicketson
 
Posts: 4206
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Is it possible to do this in linux?

Postby emil_21 » 2017-04-16 21:05

GarryRicketson wrote:
I am not sure about starting it from the Gnome shell, or Gnome,...but that is not
how I start it.
When your Debian first boots, and you have the login screen, there is options
to select the DE or window manage you want to use,


I don't see any option about openbox on my login screen. Do i have to install some additional login screen manager?

I come up with simple one line xdotool script which doesn't work by detecting when the mouse cursor is over the panel but it suppose to send left mouse click with delay when the mouse touch the top screen:
Code: Select all
xdotool behave_screen_edge --delay 500 top click 1
But for some reason it doesn't send the left mouse click. Am i on the right direction or this is completely wrong?
emil_21
 
Posts: 22
Joined: 2017-04-14 06:13

Re: Is it possible to do this in linux?

Postby GarryRicketson » 2017-04-16 22:51

I don't see any option about openbox on my login screen

Are you sure ? it is the little "wrench tool" thing, up in the upper right corner, you have to click it.
I think on some it is a "cog wheel" thing. Look close at the screen shot, I posted
and if you click it , it gives a full screen view.
Even if Open Box is not installed, there should be 2 or 3 Gnome options,
User avatar
GarryRicketson
 
Posts: 4206
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Is it possible to do this in linux?

Postby GarryRicketson » 2017-04-17 01:29

I have never used xdotool myself , so I had to install it,..I can see there
would be a learning curve involved, but:
I come up with simple one line xdotool script which doesn't work by detecting when the mouse cursor is over the panel but it suppose to send left mouse click with delay when the mouse touch the top screen:

Code: Select all
 by emil_21 »xdotool behave_screen_edge --delay 500 top click 1


But for some reason it doesn't send the left mouse click. Am i on the right direction or this is completely wrong?

No you are not completely wrong, It does work,..I just now tried it.
First I copied / pasted into a terminal, then I moved the mouse to the top center
of the screen, since the screen is full with the browser. as well, and the terminal
I opened was in a smaller window at the bottom.
When I move the mouse curser to the top center of the screen, the termianl window "disappeared", actually it just shrank and went to the panel,... this is what would have happened if I clicked the mouse when it was at the top of the
screen,...or actually any where, but I did not click it.
You can try some variations, like :
Code: Select all
 xdotool behave_screen_edge --delay 500 top-left click 1

Or for example, if the command you try is invalid, :
Code: Select all
 xdotool behave_screen_edge  click 1                     
Invalid edge or corner, 'click'
Usage: behave_screen_edge [options] edge-or-corner action [args...]
--delay MILLISECONDS     - delay before activating. During this time,
        your mouse must stay in the area selected (corner or edge)
        otherwise this timer will reset. Default is no delay (0).
--quiesce MILLISECONDS   - quiet time period after activating that no
        new activation will occur. This helps prevent accidental
        re-activation immediately after an event. Default is 2000 (2
        seconds).
edge-or-corner can be any of:
  Edges: left, top, right, bottom
  Corners: top-left, top-right, bottom-left, bottom-right
The action is any valid xdotool command (chains OK here)
 

It will tell you it was invalid, and suggest other options. You just need to experiment with it , ....I don't completely understand exactly what you are trying
to accomplish with it, but also, since this is the first time I have tried it, I wouldn't be able to say exactly how,..but it does look like you are on the right track.
Maybe :


Post by debiman » 2017-04-16 08:16
one word: xdotool

Maybe Debian can say more ? Since he seemed to all ready know something about "xdotool", and suggested it. ?
User avatar
GarryRicketson
 
Posts: 4206
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Is it possible to do this in linux?

Postby GarryRicketson » 2017-04-17 01:56

I made 2 edits, on the OpenBox,... it is the "right click" , not Left click,..I have a tendency to get the right and left mixed up,
sorry
User avatar
GarryRicketson
 
Posts: 4206
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Next

Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable