[Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet?)

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
User avatar
lockmartkyushu
Level 1
Level 1
Posts: 20
Joined: Sun Dec 03, 2017 8:09 pm

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by lockmartkyushu » Mon Aug 13, 2018 10:01 pm

Thank you kindly, this was very helpful.

I am currently studying easystroke and xdotool. It still does not seem to work for Full Screen Apps, so unfortunately I am still stuck. (It also forces you to scroll and hold-the mouse key to create a gesture, which is painful for the carpell tunnel handicapped users with bad hands), so unfortunately we are still stuck... man... this was so close though... :( :shock: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry:

[Monitor#1][Monitor#2, with /Full Screen App]

We need to scroll-wheel on the monitor #1 to switch to a different workspace. I am still struggling with this. (Gnome 3 + DashToDock allows you to scroll-wheel on the activitiesapp button, and it switches workspaces, its not fair that Cinnamon doesnt allow you to scroll on the desktop to change workspaces). :(

User avatar
lockmartkyushu
Level 1
Level 1
Posts: 20
Joined: Sun Dec 03, 2017 8:09 pm

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by lockmartkyushu » Tue Aug 14, 2018 12:14 am

I will keep trying but I dont know what else to do.

I did learn that `nemo-desktop` is the app that controls the desktop... so that app you showed me sorta revealed that, but I dont know how to get nemo-desktop to support mouse-scrolling.

Its so weird because the old cinnamon on gnome2.0 did do this, and now we need the new Linux Mint and Cinnamon to do this for the handicapped and impaired. Please someone help us, we are sick :(

I hope some one can help. Im trying my hardest but I dont know what to do :( :?:

User avatar
smurphos
Level 8
Level 8
Posts: 2037
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by smurphos » Fri Aug 17, 2018 2:24 am

Current cinnamon is forked from Gnome 3. Ultimately the feature you want doesn't exist as it stands. Cinnamon (like Gnome 3) is tied to it's specific Window Manager (Muffin in Cinnamon which is a fork of Gnome 3's Mutter) so Compiz isn't an option like it is in Mate or XFCE.

To be honest I'm a bit bemused by how tied you are to this particular feature as a cure-all for various accessibility issues. E.g for someone with RSI issues I'd have thought keyboard shortcuts would be better.

Anyway the choices as I seen them.

1) Use the native mouse scroll feature built in to the Workspace Switcher applet (hover over the applet and scroll with the mouse scroll wheel)

2) Use native hotcorners plus xdotool to switch workspace.

3) Use the Desktop Scroller extension. It can be configured to have the activation area as wide as you like (i.e. full screen). The downside is that in it's current version normal mouse actions don't work in the activation area. It hasn't got a maintainer so is prime to be patched to fix this. Another option is to build a small script to modify its settings on the fly and assign that to a shortcut key - effectively a toggle to switch on or off full mouse scrolling.

4) Workspace switcher extension.

5) Smart panel extension - you can set up workspace switching via mouse-wheel scrolling on any empty panel space.

6) Easystroke plus xdotool - it doesn't have to use the middle mouse button as the gesture activator. BTW it works fine for me for apps running full screen.

7) Wait for the devs to look at your feature request on github. Don't expect a quick response. They are a small team of volunteers with a lot to juggle.

8) Use a DE that supports this.

9) Explore voice control options - e.g. it looks like this - https://sourceforge.net/projects/perlbox/ could be combined with xdotool to allow voice activated workspace switching....

JosephM
Level 6
Level 6
Posts: 1079
Joined: Sun May 26, 2013 6:25 pm

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by JosephM » Fri Aug 17, 2018 5:39 am

We need to be able to scroll the desktop area to switch to another workspace
So I have a question about this. Not having used this functionality in other desktops. Someone pointed out Cinnamons workspace switcher applet which would let you do what you want. You said no because of fullscreen apps. In the case of full screen apps, you wouldn't be scrolling the desktop. You'd be scrolling over the app which could need that functionality. Think scrolling a web page. So how does that work? A modifier key plus scroll wheel. In that case you could just use the hot key for switching workspaces.
When I give opinions, they are my own. Not necessarily those of any other Linux Mint developer or the Linux Mint project as a whole.

User avatar
smurphos
Level 8
Level 8
Posts: 2037
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by smurphos » Sat Aug 18, 2018 1:37 pm

Another alternative solution for you.

You can add additional options to the desktop right click menu using nemo actions. This adds two entries to switch to next or previous desktop using xdotool.

Copy this code into a text editor and save it as ~/.local/share/nemo/actions/Next-Workspace.nemo_action

Code: Select all

[Nemo Action]
Name=Next Workspace
Comment=Change to next workspace
Exec=xdotool key ctrl+alt+Right
Selection=None
Extensions=any;
Icon-Name=go-next-symbolic
Dependencies=xdotool;
Conditions=desktop;dbus org.Cinnamon;
Do the same with the code below but save it as ~/.local/share/nemo/actions/Previous-Workspace.nemo_action

Code: Select all

[Nemo Action]
Name=Previous Workspace
Comment=Change to previous workspace
Exec=xdotool key ctrl+alt+Left
Selection=None
Extensions=any;
Icon-Name=go-previous-symbolic
Dependencies=xdotool;
Conditions=desktop;dbus org.Cinnamon;
Image
Last edited by smurphos on Sun Aug 19, 2018 3:02 pm, edited 1 time in total.

User avatar
smurphos
Level 8
Level 8
Posts: 2037
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by smurphos » Sun Aug 19, 2018 1:33 am

And one more option....this one pretty much does what you want :wink:

1) Install xbindkeys & xdotool - apt install xbindkeys xdotool

2) Create a default xbindkeys config file - xbindkeys --defaults > $HOME/.xbindkeysrc

3) Run xev to determine the button numbers for mousewheel scroll-up and mousewheel scroll-down. For my mouse it's button 4 for a scroll up and 5 for scroll down. You are looking for output like this whilst operating the scroll wheel whilst xev is running....

Code: Select all

ButtonRelease event, serial 38, synthetic NO, window 0x6a00001,
    root 0x122, subw 0x6a00002, time 6427946, (39,46), root:(624,346),
    state 0x1000, button 5, same_screen YES

Code: Select all

ButtonRelease event, serial 38, synthetic NO, window 0x6a00001,
    root 0x122, subw 0x6a00002, time 6423042, (39,45), root:(624,345),
    state 0x800, button 4, same_screen YES
4) Open up your freshly created ~/.xbindkeysrc file and add a couple of lines and save. You'll need to modify the button numbers to match those determined by xev in the previous stage.

Code: Select all

"xdotool key ctrl+alt+Left"
   Alt + b:4

"xdotool key ctrl+alt+Right"
   Alt + b:5
5) Kill and restart xbindkeys - killall xbindkeys && xbindkeys

6) Test - this example as provided uses the Alt key as a modifier. So Alt and a Mouse Scroll will switch workspace no matter what window is in focus or what is under the mouse. If you set it up without the modifier it works fine but you won't be able to use scroll wheel to scroll in any window as all scroll events will switch workspace. Edit to add - this can be worked around by holding any other key e.g. Alt when you want the scroll wheel to scroll the application and not the desktop.

7) Once happy add a start up application entry to launch xbindkeys at startup via the Startup Applications GUI.

There are other ways you can use a modifier - e.g you can use the state of caps lock, scroll lock or num lock. In the example below the scroll wheel will only switch windows with caps lock off. With caps lock on then you can scroll in windows as normal.

Code: Select all

#keystate_numlock = enable
#keystate_scrolllock = enable
keystate_capslock = enable

"xdotool key ctrl+alt+Left"
   b:4

"xdotool key ctrl+alt+Right"
   b:5
There is also a GUI app to manage xbindkeys configuration - xbindkeys-config

This is fairly crude but effective - I'm sure it could be tweaked to call a script rather than xdotool directly. That script could use xdotool to check the mouse position and only apply the switch workspace key combo if on the desktop and if it's on top of any other window pass the scroll wheel events to the window. If I can get that working I'll post back.
Last edited by smurphos on Sun Aug 19, 2018 5:37 am, edited 1 time in total.

User avatar
smurphos
Level 8
Level 8
Posts: 2037
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by smurphos » Sun Aug 19, 2018 3:30 am

OK - here is a slightly different implementation.

This will allow the scroll wheel to switch workspace if the mouse is hovering over any empty area of desktop. If the mouse is over any window the scroll event is passed to the focused window via xdotool. The issue is that not all applications will honour scroll events submitted via xdotool :roll: . In my testing Chrome was fine, Cinnamon shell menu scrolling is fine, Firefox doesn't work, Geany doesn't work, Xed doesn't work, Gnome terminal doesn't work. The workaround - scrolling does work in those applications if you press any other button and scroll - e.g. Alt or another mouse button....

This requires xbindkeys, xdotool and wmctrl to be installed and xbindkeys to be a startup application.

.xbindkeysrc

Code: Select all

#keystate_numlock = enable
#keystate_scrolllock = enable
#keystate_capslock = enable
#Next Workspace
"workspace_next.sh"
   b:4
#Previous Workspace
"workspace_previous.sh"
   b:5
The two scripts should be saved somewhere in your $PATH and be made executable.

workspace_next.sh

Code: Select all

#!/bin/bash

DESKTOP_ID=$(echo "ibase=16; $(wmctrl -l | grep -i nemo-desktop | cut -c 3-11 | tr a-z A-Z)" | bc)
FOCUSED_ID=$(xdotool getactivewindow)
if xdotool getmouselocation | grep "$DESKTOP_ID"; then
	xdotool key ctrl+alt+Right
else
	xdotool click --window "$FOCUSED_ID" 4
fi
workspace_previous.sh

Code: Select all

#!/bin/bash

DESKTOP_ID=$(echo "ibase=16; $(wmctrl -l | grep -i nemo-desktop | cut -c 3-11 | tr a-z A-Z)" | bc)
FOCUSED_ID=$(xdotool getactivewindow)
if xdotool getmouselocation | grep "$DESKTOP_ID"; then
	xdotool key ctrl+alt+Left
else
	xdotool click --window "$FOCUSED_ID" 5
fi

User avatar
smurphos
Level 8
Level 8
Posts: 2037
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by smurphos » Sun Aug 19, 2018 7:09 am

Last implementation. Again uses xbindkeys, xdotool and wmctrl.

This approach uses a looping bash script run from start-up applications to check the mouse position every 0.1 of a second. If the mouse is hovering over the desktop xbindkeys is launched so that a mouse-scroll will switch workspaces.

if the mouse is over an application window xbindkeys is killed and the focussed application will react to mouse-scroll in a standard way for that application.

.xbindkeysrc

Code: Select all

#keystate_numlock = enable
#keystate_scrolllock = enable
#keystate_capslock = enable
#Next Workspace
"xdotool key ctrl+alt+Left"
   b:4
#Previous Workspace
"xdotool key ctrl+alt+Right"
   b:5
workspace_switcher.sh - run this as a Startup application - I'd suggest with a delay of at least 10 seconds.

Code: Select all

#!/bin/bash
for PID in $(pgrep -f "workspace_switcher.sh"); do
    if [ "$PID" != $$ ]; then
        exit 1
    fi  
done
while :
do
	while wmctrl -l | awk "/-1/ && /nemo-desktop/" || wmctrl -l | awk "/-1/ && /Desktop/"
	do
		DESKTOP_ID0=$(echo "ibase=16; $(wmctrl -l | awk "/-1/ && /nemo-desktop/" | cut -c 3-11 | tr a-z A-Z)" | bc)
		DESKTOP_ID1=$(echo "ibase=16; $(wmctrl -l | awk "/-1/ && /Desktop/" | cut -c 3-11 | tr a-z A-Z)" | bc)
	    if [ -z "$DESKTOP_ID0" ] && [ -z "$DESKTOP_ID1" ] ; then
			sleep 0.1
			continue
		fi   
		if pidof xbindkeys; then
			kill "$(pidof xbindkeys)"
		fi
		while xdotool getmouselocation | grep -w "window:$DESKTOP_ID0" || xdotool getmouselocation | grep -w "window:$DESKTOP_ID1"
		do
			if ! pidof xbindkeys >/dev/null; then
				xbindkeys
			fi
			sleep 0.1
		done
	sleep 0.1
    done
sleep 0.1
done
Edit to update the workspace_switcher.sh script.
Last edited by smurphos on Fri Aug 31, 2018 1:47 pm, edited 6 times in total.

User avatar
lockmartkyushu
Level 1
Level 1
Posts: 20
Joined: Sun Dec 03, 2017 8:09 pm

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by lockmartkyushu » Sun Aug 19, 2018 11:53 pm

First and foremost:

Thank you both kindly for your excellent feedback. From the bottom of my heart I am thankful that you reallly tried to help me.

I tested out the workspace_switcher.sh script, along with the methods you guys mentioned, and although they make it easy to switch the desktop using the mousewheel, they override the other application scrolling which makes it difficult to use other applications. As our users are handicapped, we only wanted this script to apply when nemo-desktop was in underneath the location of the mouse, so it almost solved our issue. Your right click option also worked, but is too painful for our carpell tunnel syndrome users with broken hand muscles.

Thank you for explaining the history of where Gnome3 Dependencies have caused changes to affect the way we could have done this.

Unfortunately, with all-due-respect, we are still unable to solve our problem. We have Dual Monitor situation, with full screen apps for Handicapped and Impaired vision users, and we need the ability to scroll anyway on the desktop of the other monitor to switch workspaces. Dash-To-Dock does this if it is a dock, and so does the cinnamon addons you suggested; however--- we need to scroll "Anywhere on the Desktop" to scroll to the next workspace.

Im sorry and trying not to be negative, as we are speaking on behalf of our handicapped users with the utmost respect and still need a way to mouse-scroll the desktop to switch workspaces without affecting any of the other applications. (Man... you guys were so close, if only your script could detect if the mouse was currently placed ontop of the nemo-desktop, then work. You almost had it).

Please help us, and I SINCERELY and UTMOST RESPECTEDLY appreciate your help. Very very sorry... please help us.

User avatar
smurphos
Level 8
Level 8
Posts: 2037
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by smurphos » Mon Aug 20, 2018 1:21 am

lockmartkyushu wrote:
Sun Aug 19, 2018 11:53 pm
First and foremost:

Thank you both kindly for your excellent feedback. From the bottom of my heart I am thankful that you reallly tried to help me.

I tested out the workspace_switcher.sh script, along with the methods you guys mentioned, and although they make it easy to switch the desktop using the mousewheel, they override the other application scrolling which makes it difficult to use other applications. As our users are handicapped, we only wanted this script to apply when nemo-desktop was in underneath the location of the mouse, so it almost solved our issue.
You are welcome - it's an intriguing issue. If you are trying the last version with the workspace-shifter script try setting a longer start-up delay. It's working as it should here - scrolling in applications/menus is normal and the workspace scroll only happens when the mouse is on the desktop. I'm thinking that 10 seconds may be cutting it too fine and perhaps Nemo-Desktop hasn't consistently launched in that time. The other fix may be to move the line defining DESKTOP_ID into the while loop so its continuously refreshed.

I'm keeping it on my system so will spend a bit more time refining it.

BTW if you are testing the script be aware that it works as intended if launched in a terminal, from the run dialog, or as a startup application. It doesn't work properly if launched with Nemo's run option. Need to get my head around why that is. Edit moving the DESKTOP_ID line inside the while loop seems to cure that last problem. Script edited above.

Edit to add - Actually I've only tested this in a single monitor environment - and haven't considered that in multi-monitor there are probably multiple nemo-desktop window IDs.... :roll:. Will need to plug-in the lappy to the TV and test/refine from there....

User avatar
smurphos
Level 8
Level 8
Posts: 2037
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by smurphos » Tue Aug 21, 2018 2:47 am

workspace_switcher.sh script in post - viewtopic.php?p=1514378#p1514378 is updated.

I've added some checks so that it doesn't break if it launches before nemo-desktop, or if nemo-desktop relaunches whilst the script is running (e.g. hotplugging an external monitor, changing display settings) and a rare error where nemo-desktop is running but doesn't provide a valid window ID. Tested on a single monitor and dual monitor set up. I think it's pretty robust now.

Edit to add - further update to prevent multiple instances of the script being launched.
Edit to add - another little bugfix to the script.

User avatar
lockmartkyushu
Level 1
Level 1
Posts: 20
Joined: Sun Dec 03, 2017 8:09 pm

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by lockmartkyushu » Mon Aug 27, 2018 9:37 pm

Thank you so much for the script.

For some reason it still does not work for me. I tried using a fresh install with the Linux Mint 19 DVD and it doesnt seem to work. Can you summarize the process again?

Thank you kindly. I hope you can teach me so that I can implement it for health.

User avatar
smurphos
Level 8
Level 8
Posts: 2037
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by smurphos » Tue Aug 28, 2018 12:47 am

No problem...bear in mind the script as written is for Cinnamon edition only.

Install the dependencies.

apt install xbindkeys xdotool wmctrl x11-utils

Make a default xbindkeys profile

xbindkeys --defaults > $HOME/.xbindkeysrc

Check that there has been no change to the default keyboard shortcuts - Ctrl-Alt-Left arrow and Ctrl-Alt-Right arrow to switch workspaces.

Run xev to double check that mouse scroll up/down is registered as b:4 and b:5

Edit $HOME/.xbindkeysrc to add the definitions with your favorite text editor to add the following lines which tells xbindkeys to convert scroll up and scroll down to the keyboard shortcuts via xdotool.

Code: Select all

#Next Workspace
"xdotool key ctrl+alt+Left"
   b:4
#Previous Workspace
"xdotool key ctrl+alt+Right"
   b:5
Test xbindkeys by running

kill "$(pidof xbindkeys)"
xbindkeys
A mousescroll should switch workspaces now.

To end testing
kill "$(pidof xbindkeys)"

Copy and paste the script below into a text file, save it somewhere you will find it again as workspace_switcher.sh and make executable.

Code: Select all

#!/bin/bash
for PID in $(pgrep -f "workspace_switcher.sh"); do
    if [ "$PID" != $$ ]; then
        exit 1
    fi  
done
while :
do
	while wmctrl -l | awk "/-1/ && /nemo-desktop/" || wmctrl -l | awk "/-1/ && /Desktop/"
	do
		DESKTOP_ID0=$(echo "ibase=16; $(wmctrl -l | awk "/-1/ && /nemo-desktop/" | cut -c 3-11 | tr a-z A-Z)" | bc)
		DESKTOP_ID1=$(echo "ibase=16; $(wmctrl -l | awk "/-1/ && /Desktop/" | cut -c 3-11 | tr a-z A-Z)" | bc)
	    if [ -z "$DESKTOP_ID0" ] && [ -z "$DESKTOP_ID1" ] ; then
			sleep 0.1
			continue
		fi   
		if pidof xbindkeys; then
			kill "$(pidof xbindkeys)"
		fi
		while xdotool getmouselocation | grep -w "window:$DESKTOP_ID0" || xdotool getmouselocation | grep -w "window:$DESKTOP_ID1"
		do
			if ! pidof xbindkeys >/dev/null; then
				xbindkeys
			fi
			sleep 0.1
		done
	sleep 0.1
    done
sleep 0.1
done
To test initially I suggest launching the script from Nemo choosing the run in terminal option. That way you can report back any terminal output you get if it's not working properly.

Assuming that all goes well you can then add a Startup applications job to launch the script after user login. I'd would still suggest using a delayed start but the script will no longer fail if nemo-desktop isn't running at the time of launch.

What's the script doing? Basically polling the mouse position every 0.1 second to check whether it's hovering over nemo-desktop or something else. If it's something else and xbindkeys is running xbindkeys is killed - no mouse scrolling workspaces, and applications will react to mouse scroll normally. If it is nemo-desktop and there is no xbindkeys running it launches xbindkeys - mouse scroll will now switch workspace.

Gnome System Monitor is also handy for testing/troubleshooting so you can monitor xbindkeys being launched/killed as you move the mouse around the screen.

Edit to update workspace_switcher.sh
Last edited by smurphos on Fri Aug 31, 2018 1:46 pm, edited 2 times in total.

Hoser Rob
Level 12
Level 12
Posts: 4333
Joined: Sat Dec 15, 2012 8:57 am

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by Hoser Rob » Tue Aug 28, 2018 7:13 am

Is it really so difficult for a DE that needs over 1Gb of RAM just by itself ... which IMO is ridiculous in Linux ... to enable desktop scrolling via mouse wheel by default? Every other DE I've used, even LXDE, has had that for years.

User avatar
Moem
Level 17
Level 17
Posts: 7029
Joined: Tue Nov 17, 2015 9:14 am
Location: The Netherlands
Contact:

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by Moem » Tue Aug 28, 2018 8:04 am

Hoser Rob wrote:
Tue Aug 28, 2018 7:13 am
Is it really so difficult for a DE that needs over 1Gb of RAM just by itself ... which IMO is ridiculous in Linux ... to enable desktop scrolling via mouse wheel by default? Every other DE I've used, even LXDE, has had that for years.
Then apparently you already know the answer: no, it is indeed not really so difficult. How does that answer help anyone, though?
Image

If your issue is solved, kindly indicate that by editing the first post in the topic, and adding [SOLVED] to the title. Thanks!

User avatar
lockmartkyushu
Level 1
Level 1
Posts: 20
Joined: Sun Dec 03, 2017 8:09 pm

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by lockmartkyushu » Thu Aug 30, 2018 3:41 am

Hello,

Unfortunately I :oops: CAN NOT :oops: get the script to work. I followed your steps exactly with linux-mint-v19, but I will try again with linuxmint-19-cinnamon-64bit-v2.iso which apparently just got released. :mrgreen:

I created the xbindkeys, and the workspace-switcher.sh, but when it is grepping with `wmctrl -l`, running this manually from a terminal I dont see nemo-desktop, so it doesnt work. It just scrolls desktop regardless if the mouse is on a browser or window.

Can you try with the new linuxmint-19-cinnamon-64bit-v2.iso latest live disk to make sure it works?

User avatar
smurphos
Level 8
Level 8
Posts: 2037
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by smurphos » Thu Aug 30, 2018 7:41 am

lockmartkyushu wrote:
Thu Aug 30, 2018 3:41 am
but when it is grepping with `wmctrl -l`, running this manually from a terminal I dont see nemo-desktop
Can you report back the output of wmctrl -l without the grep?

Edit to add - Interestingly I've just checked the output of wmctrl -l on two different user accounts on the same machine. On my user account the desktop process window is called nemo-desktop. On the other user account it's called Desktop. Not sure at time of writing why there is a difference.. :? :roll:

Further edit to add - OK it depends if you've got icons enabled on the desktop or not....no icons enabled the desktop window is called nemo-desktop, with icons it's called Desktop.

Need to go and cook the wife's dinner now (I'm multi-talented :) ) but will have a play with the script in the morning to make it work in both scenarios....

User avatar
smurphos
Level 8
Level 8
Posts: 2037
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by smurphos » Fri Aug 31, 2018 1:41 am

Script updated again to take into account that the Desktop window can be called nemo-desktop or Desktop depending on the status of org.nemo.desktop desktop-layout. Both posts above containing the script have been edited.

This still needs more work to account for multi-monitor where desktop icons are enabled for one but not the other and to allow for switching of the desktop settings whilst the script is active.... :roll: . I'll get there eventually :wink:

User avatar
smurphos
Level 8
Level 8
Posts: 2037
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by smurphos » Fri Aug 31, 2018 1:52 pm

smurphos wrote:
Fri Aug 31, 2018 1:41 am
I'll get there eventually :wink:
Script updated again - previous posts edited. I've tested in a multi-monitor and single monitor setup - all variations of Desktop settings (no icons, icons on, icons on primary only, icons on secondary only) and switching between them whilst the script is running as-well as hotplugging the 2nd display. It works! I hope it works for you lockmartkyushu.

User avatar
lockmartkyushu
Level 1
Level 1
Posts: 20
Joined: Sun Dec 03, 2017 8:09 pm

Re: [Feature Request] How do I change desktops by scrolling the DESKTOP AREA? (NOT EdgeExtension/WorkspaceSwitcherApplet

Post by lockmartkyushu » Sun Sep 02, 2018 10:21 pm

Thank you VERY MUCH.

The issue is now solved. Your latest script solved my problem. I pasted it below in my Wiki Notes (commandline'ized it a bit) for others in case they need it too. Once again, THANK YOU VERY MUCH FOR YOUR HELP.

Smurphos Script to change your MOUSE SCROLL WHEEL BEHAVIOUR:



=== Scroll Desktops via mouse-wheel in Cinnamon with xbindkeys and workspace-switcher.sh script ===


In a multimonitor setup, if your goal is to scroll anywhere on the desktop here is the script and process to do it:

* Run this command (Root):
sudo apt install xbindkeys xdotool wmctrl x11-utils

* Run this as your Local User (Run `xev` once to check mouse wheel up = 4, down = 5):
xbindkeys --defaults > $HOME/.xbindkeysrc
printf "#Next Workspace\n\"xdotool key ctrl+alt+Left\"\n b:4\n#Previous Workspace\n\"xdotool key ctrl+alt+Right\"\n b:5" >> $HOME/.xbindkeysrc


* vi ~/workspace_switcher.sh
#!/bin/bash
for PID in $(pgrep -f "workspace_switcher.sh"); do
if [ "$PID" != $$ ]; then
exit 1
fi
done
while :
do
while wmctrl -l | awk "/-1/ && /nemo-desktop/" || wmctrl -l | awk "/-1/ && /Desktop/"
do
DESKTOP_ID0=$(echo "ibase=16; $(wmctrl -l | awk "/-1/ && /nemo-desktop/" | cut -c 3-11 | tr a-z A-Z)" | bc)
DESKTOP_ID1=$(echo "ibase=16; $(wmctrl -l | awk "/-1/ && /Desktop/" | cut -c 3-11 | tr a-z A-Z)" | bc)
if [ -z "$DESKTOP_ID0" ] && [ -z "$DESKTOP_ID1" ] ; then
sleep 0.1
continue
fi
if pidof xbindkeys; then
kill "$(pidof xbindkeys)"
fi
while xdotool getmouselocation | grep -w "window:$DESKTOP_ID0" || xdotool getmouselocation | grep -w "window:$DESKTOP_ID1"
do
if ! pidof xbindkeys >/dev/null; then
xbindkeys
fi
sleep 0.1
done
sleep 0.1
done
sleep 0.1
done
* Add it to your startup, and reboot and try it out.

Post Reply

Return to “Newbie Questions”