TheDcoder / mapmywindows

A small program to show and hide windows in X window system (commonly used in Linux desktops)
MIT License
0 stars 0 forks source link

mapmywindows make install error: "make: help2man: No such file or directory" #1

Open sreedta8 opened 2 years ago

sreedta8 commented 2 years ago

Hi

I'm trying to compile mapmywindows on Ubuntu Impish (21.10) distribution. I have installed all the necessary Xlib, libxdo, and libx11 dependencies appropriate for Ubuntu. I have downloaded the libxkeymacro files separately and included then in the untarred folder.

make runs okay but sudo make install gives the following error: make: help2man: No such file or directory

I have examined the various source files downloaded and I could not find any file named help2man

sreedta8 commented 2 years ago

@TheDcoder one additional question, where should the xkeymacro.c and xkeymacro.h be saved?

TheDcoder commented 2 years ago

Hi @sreedta8,

I have examined the various source files downloaded and I could not find any file named help2man

help2man is a GNU program which generates man pages from a program's --help output. You need to install it from your distro's package repository. You can find out the package name and version of help2man in your distro from this list: https://repology.org/project/help2man/versions

After you find it, simply install it like any other package, that should satisfy the need for help2man :)

Thanks for bringing it up though, looks like I forgot to mention it.

one additional question, where should the xkeymacro.c and xkeymacro.h be saved?

In the xkeymacro directory, it's included in the repository but you'll have to initialize the sub-modules in git as it doesn't do that by default.

This can be done while cloning (git clone --recurse-submodules) or after cloning (git submodule update --init --recursive) to automatically fetch all the files under sub-modules.

And finally, I too have a question for you @sreedta8, how did you find this repo? Just curious.

sreedta8 commented 2 years ago

@TheDcoder thanks for your prompt reply. Thanks for your guidance as well. I have been a WIndows user for 25+ years. Never touched Linux for real work. Now some significant pieces of data science and analytics I do works well when I'm on Linux, so I began working with Ubuntu about 2 months ago. On Windows, I use the Hide My Windows program to declutter my workspace and I was looking for something similar on Linux and the HMW webpage has a direct link to your repo mapmywindows. That is how I found this repo!

Thanks for your effort in developing this tool. I'm an applied statistician and not a programmer. I program only on an as needed basis which is not often. Working in Linux has been frustrating (coming from Windows) and liberating (the power and control a user has and the robustness of the OS, "not a single BSOD"). Once I'm able get it working I will let you know. If I run into any issues, I will report on this thread.

TheDcoder commented 2 years ago

@sreedta8 Welcome to the club :grin:

I've been a long-time Windows user as well but I made the switch a few years ago and never turned back.

Good to know that the link-back in HMW's website is serving the purpose, makes me glad that I asked the author to mention it on their webpage :)

Best of luck with whatever you are doing. I'll be happy to answer any help queries.

sreedta8 commented 2 years ago

@TheDcoder I spent at least 3 days looking for alternatives in Linux. I was exploring how to use the `wmctrl. So I'm really keen to get your MMW to work!

sreedta8 commented 2 years ago

@TheDcoder I installed help2man and also set up the xkeymacro files correctly. Now the sudo make install ran correctly without any errors. I was next able to change the default keys to Hide, Show and Exit - I'm using your app and this is really cool - I'm going to write an installation document and share it here. Thanks again!

sreedta8 commented 2 years ago

@TheDcoder mapmywindows stopped working after I installed some security updates on my Lubuntu (Impish 21.10). When I use Ctrl+Shift+F7, the window blinks a little and is not hidden. Any ideas why that might be happening

Additionally when I run mapmywindows at my prompt (I do not know if I can run it or not) I get the following error:

(base) sreedta@home:~$ mapmywindows
Hide shortcut: Ctrl+Shift+F7
Show shortcut: Ctrl+Shift+F8
Exit shortcut: Ctrl+Shift+F9
X Error of failed request:  BadAccess (attempt to access private resource denied)
  Major opcode of failed request:  33 (X_GrabKey)
  Serial number of failed request:  18
  Current serial number in output stream:  20

I have restarted my machine, removed mapmywindows and compiled and installed it again. So far no luck!

TheDcoder commented 2 years ago

The error is from libX11 which is responsible for communicating with the X GUI server in Linux. Most likely your X configuration disallows grabbing keys from unprivileged processes, this is not a common configuration so unfortunately you'll have to ask for help in a distro specific support channel.

It could also be possible that you're using the newer Wayland display protocol which has more severe restrictions, if this is true then I am afraid MMW won't work for you.

An easy solution could be to try a different distro, you can safely migrate your home folder to preserve all of your local user settings and files :)

sreedta8 commented 2 years ago

@TheDcoder Thanks a lot for note. I'm using the Lubuntu Default LxQt Desktop. The interesting thing is that the short cut keys worked for about 3 hours and then they stopped. Knowing the source of the error (libX11) is helpful. I will see how best to get it working again.

TheDcoder commented 2 years ago

Very interesting indeed. Did you change any settings after 3 hours? Did the error occur while the program was still running or did it stop working after you started it fresh?

sreedta8 commented 2 years ago

@TheDcoder I did not change any settings. There were security updates and updates to my Ubuntu-Desktop. I ran those updates and rebooted my machine and the MMW functionality disappeared. So I removed the install folders and files and went through the installation from scratch to no avail.

TheDcoder commented 2 years ago

There's nothing wrong with your build, the issue is with permissions in your display server. I am not sure how the updates effected it, generally they shouldn't change any major functionality in security updates.

sreedta8 commented 2 years ago

Do you know what should be the right set of permissions tI should set for the Display Server? When I checked what Display server I was using the output shows:

(base) sreedta@home~$ ps -e | grep tty
   1542 tty2     00:00:00 gdm-x-session
   1544 tty2     02:05:09 Xorg
   1556 tty2     00:00:07 lxqt-session
   1630 tty2     02:39:17 kwin
   1665 tty2     00:00:10 pcmanfm-qt
   1667 tty2     00:00:02 lxqt-globalkeys
   1668 tty2     00:00:02 lxqt-notificati
   1669 tty2     00:01:16 lxqt-panel
   1670 tty2     00:00:02 lxqt-policykit-
   1672 tty2     00:00:03 lxqt-runner
   1923 tty2     00:00:07 lxqt-powermanag

How do I check and change the permissions on any one of them?

sreedta8 commented 2 years ago

@TheDcoder I figured out what I was doing wrong. I was launching mapmywindows at the main prompt without changing the directory to where I had installed mapmywindows. Once I did that everything is working well. Do I need add the install location to the PATH so that I do not need to change to the install directory? Thanks for your patience and your help! Have a wonderful weekend! Update: After adding the install directory to the PATH, the command now works at the main prompt!

TheDcoder commented 2 years ago

I was launching mapmywindows at the main prompt without changing the directory to where I had installed mapmywindows.

It shouldn't matter once you have it installed, you should be able to run it from anywhere as make install automatically copies the binary to /usr/bin which should always be in $PATH

Once I did that everything is working well.

Which shell are you using? Normally you shouldn't be able to run a program in the current directory without prefixing ./ to the executable name.

sreedta8 commented 2 years ago

@TheDcoder Working with bash shell - I added the mapmywindows directory explicitly to the ~/.bashrc file. What you mention is interesting - I did notice after the installation, the script printed out it was copying the binary to usr/bin. I will examine further.

TheDcoder commented 2 years ago

We can diagnose this issue further.

Would you mind removing the directory from path and running which mapmywindows? Also what does stat /usr/bin/mapmywindows say?

sreedta8 commented 2 years ago

Let me do that and get back

(base) sreedta@home:~$ which mapmywindows
/usr/bin/mapmywindows

It is referencing /usr/bin/mapmywindows - Could it be referencing the xkeymacro folder and after I added it on the path everything worked?

The next command output looks as follows:

(base) sreedta@home:~$ stat /usr/bin/mapmywindows
  File: /usr/bin/mapmywindows
  Size: 17864           Blocks: 40         IO Block: 4096   regular file
Device: 10302h/66306d   Inode: 6032417     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2022-03-18 07:54:37.225668675 -0400
Modify: 2022-03-18 07:54:09.524863692 -0400
Change: 2022-03-18 07:54:09.524863692 -0400
 Birth: 2022-03-18 07:54:09.524863692 -0400
sreedta8 commented 2 years ago

@TheDcoder I was able to find an additional constraint that affects whether mapmywindows runs correctly or not.

Originally I had the Lubuntu Desktop and the LXQt Desktop. Then installed KDE Plasma and then Ubuntu. When I installed X11 / Xorg, Plasma label changed to Plasma (X11) and there was an Ubuntu Desktop and an Ubuntu with Xorg Desktop.

mapmywindows does not work by default on either Lubuntu or LXQt Desktops. Searching the Internet I saw some suggestions on how to turn on or turn off an option related to QT but it was a little beyond my pay-grade. It works correctly on Plasma (X11). I will test and post about the Ubuntu with Xorg also.

TheDcoder commented 2 years ago

Could it be referencing the xkeymacro folder and after I added it on the path everything worked?

Nope, everything is embedded inside the final executable (i.e statically linked) so the xkeymacro folder is not needed anymore.

Anyway, I think the obvious conclusion is that some of your sessions use Wayland instead of X11. Always make sure to use vanilla X11-based sessions if you want to use mapmywwindows.

sreedta8 commented 2 years ago

Thanks a lot for taking the time so far @TheDcoder - your feedback has been very helpful.