calandoa / movescreen

Linux script to move windows across screens
254 stars 40 forks source link

Issue with xmodmap #1

Closed MahmoudDolah closed 6 years ago

MahmoudDolah commented 6 years ago

First, I'd like to thank you for creating this script, it works very well However I did find an issue with my keyboard. I have a CM Devastator 2 keyboard and i use the following command to make i light up sudo xmodmap -e 'add mod3 = Scroll_Lock'
I've noticed that when I have the keyboard lit up, the the movescreen.py script doesn't work As for why, I'm not too sure, but if you require any additional information

OS: Ubuntu DE: XFCE

Edit: I'll also note that I came across this same issue wit hall the rest of the answers from this stack overflow answer (which is how I found out about your script) https://unix.stackexchange.com/questions/48456/xfce-send-window-to-other-monitor-on-keystroke#198663

MahmoudDolah commented 6 years ago

It' s clear at this point that this is an issue with xmodmap and not with your script. Using the following command instead of the xmodmap command doesn't have this issue $ xset led on http://failtime.freeshell.org/2017/02/05/cooler-master-devastator-ii-leds-on-ubuntu-linux/

calandoa commented 6 years ago

The problem is probably due to the output of one of the external tools. A possible way to investigate would be to check these outputs. You can do this by adding a print after each subprocess call, like this:

# orignal line
out = subprocess.check_output(['xrandr']).decode('ascii', 'ignore')
# add this one (3x times)
print "---xandr---\n", out, "---end---\n"

Then, in a terminal, try directly "movescreen.py left" (or right) and capture the log with the leds and without. The differences between each log might give us an hint.

MahmoudDolah commented 6 years ago

https://gist.github.com/MahmoudDolah/67985d53460ae712e5a80129e52cf188 This gist contains where I put the debug code (identified by the # Debug code comment

Here, you'll see the output from the script with xset led on https://gist.github.com/MahmoudDolah/539ded43d7038737cd37ddcfe12059d6

Here, I turned the LEDs on using the xmodmap command https://gist.github.com/MahmoudDolah/72f2a94f567ffb921033d77228d6d5a7

And finally, here is from all LEDs off https://gist.github.com/MahmoudDolah/88d4f06c0efddf941202229d2381d564

Also, I'll note that the script works when I have the LEDs on with xmodmap and type the command manually, but not when I use my keyboard shortcut

image

Edit: I'll also note that I'm not using the keybindings that you recommend in the README (https://github.com/calandoa/movescreen#xfce-setup) and that I have tried it with those keybindings but it still doesn't work

calandoa commented 6 years ago

It looks like Xfce is not calling movescreen at all, i.e. the shortcuts are temporarily disabled.

You can confirm that by logging each execution in a file with a hack at the top of the script like:

import datetime
sys.stdout = open('/tmp/ms_' + str(datetime.datetime.now().time()) + '.log', 'w')

All the following print will be done in a log in /tmp named with the current time, and you will probably find out that no file appears when LED are on.

MahmoudDolah commented 6 years ago

It looks like you're correct, thanks for the debugging Looks like we've confirmed what I said here https://github.com/calandoa/movescreen/issues/1#issuecomment-372154486 that this issue isn't with your script I'm going to close this issue Thanks again :+1: