rockowitz / ddcui

Graphical user interface for ddcutil - control monitor settings
http://www.ddcutil.com
GNU General Public License v2.0
147 stars 2 forks source link

[Feature]: Add `pkexec` if `/dev/i2c` is not accessible on invocation #39

Open stdedos opened 2 years ago

stdedos commented 2 years ago

It might be useful to add a ddcui.desktop entry for ddcui, as well as a pkexec entry - since I am to understand that it "most likely" cannot work otherwise (quick example here https://askubuntu.com/a/1184444/645458)

rockowitz commented 2 years ago

File ddcui.desktop is in the top level package directory, and should be installed by the ddcui installation program. Did you install ddcui using the ppa on launchpad, or using command sudo make install?

Re pkexec, any user can make changes using ddcui if they have RW permissions to the /dev/i2c devices. Typically this is granted by adding the user to group i2c. All this is discussed in the ddcutil documentation, but I'll grant that most users will likely not have read it. As to distributing a version of ddcui.desktop with pkexec specified in its .desktop file, I'll have to consult with the Debian gurus to see if that is acceptable.

stdedos commented 2 years ago

File ddcui.desktop is in the top level package directory, and should be installed by the ddcui installation program. Did you install ddcui using the ppa on launchpad, or using command sudo make install?

I used the ppa ofc (I like pre-compiled stuff and clean uninstall processes 😛) Idk what to tell you, but it's not the case that ddcui is on the Activities view 😕

Re pkexec, any user can make changes using ddcui if they have RW permissions to the /dev/i2c devices. Typically this is granted by adding the user to group i2c. All this is discussed in the ddcutil documentation, but I'll grant that most users will likely not have read it.

Didn't know that, but that's good to know! In that case, I think you need to "catch" that behavior, and inform the user about it (this-and-that happened, sudo usermod ... or sudo ddcui, [read more man ddcui])

As to distributing a version of ddcui.desktop with pkexec specified in its .desktop file, I'll have to consult with the Debian gurus to see if that is acceptable.

If you can auto-detect this and self-elevate, that cannot hurt either (or use a wrapper caller?)

rockowitz commented 2 years ago

By Activities view, I assume you're referring to gnome.

File ddcui.desktop is installed in /usr/share/applications as per the freedesktop spec. I don't normally use gnome, but more steps are required to add an application to Activities. In my own case, only a handful of applications appear. There are instructions online for using Gnome Tweak Tool to add applications (https://www.lifewire.com/how-to-create-desktop-app-launchers-in-linux-4685137), but I haven't found documentation on how to add an application as part of the installation program. I'll continue to look.

Re lack of permissions, I'll look at replacing the "No displays detected" dialog box with something more informative.

stdedos commented 2 years ago

The only think I've seen e.g. in codium deb package, is:

# Install the desktop entry
if hash update-desktop-database 2>/dev/null; then
    update-desktop-database
fi

but, btw, I don't see anything here for me:

$ ls -lah /usr/share/applications/ | grep dd
$ grep -Trin ddcui /usr/share/applications/      
$  sudo ddcui
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
$ 

image

I mean, I can see that I am running an older version

$ apt-cache policy ddcui
ddcui:
  Installed: 0.1.2-3
  Candidate: 0.1.2-3
  Version table:
 *** 0.1.2-3 500
        500 http://ppa.launchpad.net/rockowitz/ddcutil/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status

but idk what to do about it. Building from sources is not really what I want; nor IMHO what would help with this ticket.

rockowitz commented 2 years ago

Launchpad makes it difficult to publish a package for other than the latest Ubuntu version. However, the deb files for Impish should work for any recent Ubuntu release.

It may be easier to use the OBS repos, as packages there are built for multiple Ubuntu versions. To add the repo see here. You'll want to install packages ddcutil, libddcutil4, and ddcui.

Re update-desktop-database, per the man page it builds the cache database of MIME types handled by desktop files, so isn't relevant.

stdedos commented 2 years ago

Re update-desktop-database, per the man page it builds the cache database of MIME types handled by desktop files, so isn't relevant.

Yeah - I did read that as well. Idk; I find it very weird that "simply adding that file there" does not work. But it can be that the package I have is simply too outdated.

Launchpad makes it difficult to publish a package for other than the latest Ubuntu version.

So, even if "everything works alright", you cannot do updates? 😕 that's sad

stdedos commented 2 years ago

Oh - now I noticed! You are the same person that does the blivet-gui? :-D

That's a very awesome addition - thank you so much for all the trouble you are going through with it :-D

stdedos commented 2 years ago

Good stuff - so the .desktop is actually coming up on the latest versions via the https://software.opensuse.org/download/package?package=ddcutil&project=home%3Arockowitz!

However, the

Didn't know that, but that's good to know! In that case, I think you need to "catch" that behavior, and inform the user about it (this-and-that happened, sudo usermod ... or sudo ddcui, [read more man ddcui])

stuff needs to be addressed somehow. And since ddcui is a UI application, also the "info" must be in UI as well.