New display manager for GhostBSD.

Open development discussions

Moderator: Developer

New display manager for GhostBSD.

Postby ericbsd » Wed Feb 22, 2017 2:59 pm

I am looking for the possibility of replacing slim, but it is not most do now, slim is not viable solution.

I am still looking at mdm, lxdm and lightdm there, mdm is more interesting because it is based on the old GDM 2.20 .

I am looking on maybe to start a new one from the ground up base of MDM, but it is not primary project for GhostBSD , I am starting that conversation in hope that people could help realize that project. This would be the first step to a GTK desktop for FreeBSD/GhostBSD.

I would say it is a must have for the future of BSD.
User avatar
ericbsd
Developer
 
Posts: 1080
Joined: Mon Nov 19, 2012 7:54 pm
Has thanked: 29 times
Been thanked: 53 times

New display manager for GhostBSD.


Re: New display manager for GhostBSD.

Postby kraileth » Thu Feb 23, 2017 2:04 am

Agreed! While Slim "works" it's really just a stopgap and I'm not happy with it at all. Sure, GDM has gone completely crazy and I can completely understand why it was replaced with Slim. But I also hope that we can find a solution to this (I was even considering replacing Slim with PCDM from PC-BSD/TrueOS which works nicely but has that Qt looks that wouldn't fit into GhostBSD and that I personally don't like at all).

From the Linux world I'd say that LXDM would fit us best. It's somewhat light-weight, has all the functionality that most people probably need and can be made pretty nice looking. The problem there seems to be that one (?) Linuxism it makes use of that has so far prevented it to be ported to FreeBSD. Too bad...

I must say that I don't particularly like Lightdm but it's modular approach (different greeters for the various TKs) is rather nice.

MDM is something that I've used a while on the Mint box that I had set up for my wife in the past. It works well but I'm not entirely convinced that it'd be a good option. The Linux Mint team does good work at making a very user friendly distro but in the past they had massive problems with neglected security and things like that. I wouldn't bet a high amount on the high quality of their work. Also they tend to bloat things up unnecessarily.

For that reason I took a look at "what else" there is (leaving out Qt-based stuff and things like that):

  • Entrance - Enlightenment's take at a DM. Toolkit agnostic (uses the EFS). Experimental and obviously unmaintained.
  • Enter - Looks like a one-man show that didn't get too far. Might still have value as a reference
  • Orthos - OpenGL only DM. Nice idea but long dead
  • Qingy - Minimalistic, makes use of Framebuffer and doesn't use X itself. Supports session selection. Nice idea but currently unmaintained.

And then there's one not too many people know about: ELMA. This has been an experiment by the Equinox project (responsible for the EDE desktop). It makes use of the extremely light-weight toolkit FLTK and the "edelibs" (both are available in FreeBSD packages, the later for some reason merged into the ede package - this should be split off if I ever find the time...). Elma has a very nice theming engine and even though the code is quite old now, it still just compiles using today's modern compilers (I've tried it in early January).

I know the author since I helped a bit with EDE in the past (doing package work and things like that) and asked him about Elma. If it's not different from the rest of EDE, it's written in C++ but mostly in a "C-like" way and should be rather readable code. I also know that the author is also into Python and we talked about pyFLTK in the past. Maybe a DM written in Python could be a worthwile project? If it's portable (and light-weight) I'd assume that there would also be quite some Linux folks interested in such a thing and maybe a healthy project could emerge from it. Just thinking.
kraileth
Developer
 
Posts: 305
Joined: Sun Sep 04, 2016 11:30 am
Has thanked: 57 times
Been thanked: 51 times

Re: New display manager for GhostBSD.

Postby kraileth » Sat Apr 29, 2017 5:53 am

When I took a look at gbi's code, I quickly figured that I didn't understand much of it and would have to dig a bit into some prerequisites... Since SLiM is something that I'm not happy with and I'm dreaming of having it replaced, I thought that I might just play with something related to a display manager.

I found this excellent howto, which I wanted to point to here. It gave me an idea about what to do. The howto is targeting Arch Linux. I followed along the first steps on an Arch system and was immediately met with success. Not being too interested in Linux, I decided to give the same thing a try on FreeBSD. That didn't really work (got some linking errors that I wasn't able to fix despite searching on the net for quite a while).

Eventually I decided that I didn't want to use C anyways and that a display manager written in Python would be a cool thing. There's a project called "PyDM" out there that uses Python and the Qt toolkit to create a display manager - however it does seem to be something way different from what a *nix display manager is. So this is not very helpful. So what about a quick attempt to bring what the C howto does to Python?

Since I've never done anything with GTK at all and just a little Python on the console in the past this has given me some valuable insights. I'm running out of free time again, but I want to share what I got so far.

I've built a simple UI placeholder using Glade. Then I wrote a Python program that does the following:

  • Check for multiple monitors and (for now) quit if more than one is present
  • Get the screen dimensions and set the window to fullscreen manually (this is meant to be a DM and thus cannot relay on a WM to maximize it, right?)
  • Show the window with a text entry for username and one for password (with dot characters to make the pw invisible)
  • Check for ESC on key press callback and end the program
  • Check for enter on key press callback, get the entered username and password and display it in a text field

This seems to work pretty nice so far. I've tested it using the Xephyr nested X11 server using various resolutions and there hasn't been any problem.

Next step would be to (somewhat) understand PAM. I'll probably get Michael W. Lucas's PAM Mastery book or at least watch his "PAM is unamarican" video that has been on my playlist for quite a while now before taking a look at how authentication works with Python (on FreeBSD).
Attachments
ghostdm.png
kraileth
Developer
 
Posts: 305
Joined: Sun Sep 04, 2016 11:30 am
Has thanked: 57 times
Been thanked: 51 times

Re: New display manager for GhostBSD.

Postby kraileth » Sat Apr 29, 2017 6:02 am

Anybody who has programmed Python for longer than a week will perhaps laugh at me. Nevertheless I will share what I have in case anybody is interested.
Feedback is appreciated of course. Be gentle, though, I'm venturing in completely unfamiliar territory here. ;)

ghostdm.ui:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
  <requires lib="gtk+" version="3.12"/>
  <object class="GtkWindow" id="ghostdm">
    <property name="can_focus">False</property>
    <child>
      <object class="GtkBox" id="box1">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="valign">center</property>
        <property name="orientation">vertical</property>
        <property name="spacing">4</property>
        <child>
          <object class="GtkLabel" id="label3">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="label" translatable="yes">GhostDM UI placeholder (press ESC to abort)</property>
            <attributes>
              <attribute name="weight" value="bold"/>
            </attributes>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <object class="GtkBox" id="box2">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="halign">center</property>
            <property name="orientation">vertical</property>
            <property name="spacing">4</property>
            <child>
              <object class="GtkBox" id="box3">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <child>
                  <object class="GtkLabel" id="label1">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="label" translatable="yes">Username: </property>
                  </object>
                  <packing>
                    <property name="expand">False</property>
                    <property name="fill">True</property>
                    <property name="position">0</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkEntry" id="username_entry">
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                  </object>
                  <packing>
                    <property name="expand">False</property>
                    <property name="fill">True</property>
                    <property name="position">1</property>
                  </packing>
                </child>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">0</property>
              </packing>
            </child>
            <child>
              <object class="GtkBox" id="box4">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <child>
                  <object class="GtkLabel" id="label2">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="label" translatable="yes">Password:  </property>
                  </object>
                  <packing>
                    <property name="expand">False</property>
                    <property name="fill">True</property>
                    <property name="position">0</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkEntry" id="password_entry">
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                    <property name="visibility">False</property>
                  </object>
                  <packing>
                    <property name="expand">False</property>
                    <property name="fill">True</property>
                    <property name="position">1</property>
                  </packing>
                </child>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">1</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">1</property>
          </packing>
        </child>
      </object>
    </child>
  </object>
</interface>


ghostdm.py:
Code: Select all
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk

debug = True

def print_screen_info(screen, nmons):
   # The screen is the sum of all monitor's sizes
   print("Total screen size: %d x %d" % (Gdk.Screen.get_width(screen),Gdk.Screen.get_height(screen)))
   
   # Print info about each monitor
   print("Number of monitors: %d" % nmons)
   monitors = []
   for c in range(nmons):
      mg = screen.get_monitor_geometry(c)
      print("monitor %d: %d x %d" % (c,mg.width,mg.height))
      monitors.append(mg)

def check_monitor_count(screen):
   nmons = screen.get_n_monitors()
   
   if nmons > 1:
      print("Error: %d monitors detected! However GhostDM is not (yet) multi monitor capable... Aborting." % nmons)
      exit(1)
   
   if debug:
      print_screen_info(screen, nmons)

def get_monitor_geometry(screen):
   mg = screen.get_monitor_geometry(0)
   return mg.width, mg.height

def key_callback(widget, event):
   if event.keyval == Gdk.KEY_Escape:
      Gtk.main_quit()
   elif event.keyval == Gdk.KEY_Return:
      username_entry = builder.get_object("username_entry")
      password_entry = builder.get_object("password_entry")
      label3 = builder.get_object("label3")
      if debug:
         print("Username: %s, password: %s" % (username_entry.get_text(), password_entry.get_text()))
      label3.set_text("Username: %s, password: %s" % (username_entry.get_text(), password_entry.get_text()))

builder = Gtk.Builder()
builder.add_from_file("ghostdm.ui")

win = builder.get_object("ghostdm")
check_monitor_count(win.get_screen())
maxx, maxy = get_monitor_geometry(win.get_screen())


win.connect("key-release-event", key_callback)
win.resize(maxx, maxy)
win.show_all()
Gtk.main()


Needed packages:
  • python36
  • py36-gobject3
  • xephyr

Running it:
1) Run Xephyr from one terminal emulator:
Code: Select all
% Xephyr -ac -br -noreset -screen 640x480 :1

2) Run the program in the additional display provided by Xephyr:
Code: Select all
% env DISPLAY=:1 python3.6 ghostdm.py
kraileth
Developer
 
Posts: 305
Joined: Sun Sep 04, 2016 11:30 am
Has thanked: 57 times
Been thanked: 51 times

Re: New display manager for GhostBSD.

Postby ASX » Sat Apr 29, 2017 12:46 pm

kraileth wrote:That didn't really work (got some linking errors that I wasn't able to fix despite searching on the net for quite a while).


Linking is the stage where objects (functions and/or variables) referenced into the program, but not defined into the program, are linked to the corresponding definition usually residing in a library.

A link failure is a result of:
- missing library, incorrect library path, incorrect library name, or outdated library version;
- the definition of an object could be in a different source file, in this case it is likely that the source files wasn't compiled along with the main source file.
- additionally, a typo, may result in linking error, because the corresponding object cannot be found (with the wrong name).
ASX
Developer
 
Posts: 970
Joined: Wed May 06, 2015 11:46 am
Has thanked: 58 times
Been thanked: 130 times

Re: New display manager for GhostBSD.

Postby kraileth » Sun Apr 30, 2017 9:38 am

ASX wrote:
kraileth wrote:That didn't really work (got some linking errors that I wasn't able to fix despite searching on the net for quite a while).


Linking is the stage where objects (functions and/or variables) referenced into the program, but not defined into the program, are linked to the corresponding definition usually residing in a library.

A link failure is a result of:
- missing library, incorrect library path, incorrect library name, or outdated library version;
- the definition of an object could be in a different source file, in this case it is likely that the source files wasn't compiled along with the main source file.
- additionally, a typo, may result in linking error, because the corresponding object cannot be found (with the wrong name).


I'm not generally having problems with linking (met a lot of those before and fixed them). But this was a special case with pkgconf involved and GCC's compiler runtime, both things that I don't know a lot about. ;)

But anyways: We're doing a lot of stuff with GTK and Python in GhostBSD. Also the Python community is huge and seems to be interested to implement next to anything possible in Python as well. Any comments on the idea of having a display manager in Python? Does anybody know off the top of his head that this is not going to work (why?)?

One potential problem that I'm seeing right now is PAM. I initially thought that Python PAM is simply missing in FreeBSD's ports tree. But after taking a brief look at the matter it seems that the module only supports Linux-PAM whereas FreeBSD makes use of Open-PAM and those two are not completely compatible.

But if it was feasible to write something like this, I think GhostDM would be of interest to a lot of FreeBSD users as well (nobody loves that unmaintained SLiM, right?) and, if implemented in a portable manner, would probably attract some Linux people who like Python, too. If the later happens, this might also help in making GhostBSD better known.
kraileth
Developer
 
Posts: 305
Joined: Sun Sep 04, 2016 11:30 am
Has thanked: 57 times
Been thanked: 51 times

Re: New display manager for GhostBSD.

Postby ASX » Sun Apr 30, 2017 3:37 pm

kraileth wrote:But anyways: We're doing a lot of stuff with GTK and Python in GhostBSD. Also the Python community is huge and seems to be interested to implement next to anything possible in Python as well. Any comments on the idea of having a display manager in Python? Does anybody know off the top of his head that this is not going to work (why?)?


If you are sufficiently motivated, please go on, a new display manager is definitely welcome! Especially if it will be a light display manager. I will help, if I can.

Also I think TrueOS has also a made in house display manager, eventually you can look into the code about specific things, like authentication. (And I think also that they eventually might provide tips and help if needed).

One potential problem that I'm seeing right now is PAM. I initially thought that Python PAM is simply missing in FreeBSD's ports tree. But after taking a brief look at the matter it seems that the module only supports Linux-PAM whereas FreeBSD makes use of Open-PAM and those two are not completely compatible.


Even if they are not compatible, I think they implement similar functionality .... should not be a very big problem.
ASX
Developer
 
Posts: 970
Joined: Wed May 06, 2015 11:46 am
Has thanked: 58 times
Been thanked: 130 times

Re: New display manager for GhostBSD.

Postby angus71 » Mon May 01, 2017 6:06 am

Hi there,
I'm not sure, but what about the Linux Mint "Slick-greeter" mentioned in that post?
http://blog.linuxmint.com/?p=3254
It seems to be maintained by Clem and his team, perhaps GhostBSD could use this one?
Greetings
angus71
 
Posts: 10
Joined: Fri Apr 28, 2017 12:16 pm
Has thanked: 12 times
Been thanked: 2 times

Re: New display manager for GhostBSD.

Postby kraileth » Mon May 01, 2017 8:23 am

ASX wrote:If you are sufficiently motivated, please go on, a new display manager is definitely welcome! Especially if it will be a light display manager. I will help, if I can.


To be honest, I don't know if I have what it takes to write a DM. But motivation is certainly not lacking; I've hoped for a DM that suits my needs but so far none has shown up (my wife and I use different keymaps and it would be neat to be able to configure it per user instead of globally; I would imagine that there are more people out there who learned e.g. dvorak but their partner uses the default national layout). So I've thought about this for a while, really. I cannot make any promises other than giving it a try. And since I'm not a programmer it would only be "sysadmin quality", even if I manage to hack something together. But often enough a start is all that's needed to attract at least one programmer to make some improvements. Probably worth the attempt (and surely not wasted time since there's quite a bit to learn along the way).

Thanks for offering help! I'll ping you when I got a bit ahead with it.

Also I think TrueOS has also a made in house display manager, eventually you can look into the code about specific things, like authentication. (And I think also that they eventually might provide tips and help if needed).


Yes, pcdm is nice and has some useful features. But it's Qt which I don't like the looks of and which is completely alien to me when it comes to source code. Still it might make sense to take a look at it.

Even if they are not compatible, I think they implement similar functionality .... should not be a very big problem.


Well, the thing is that I'm not sure if the Python's PAM wrapper will work on *BSD. But I've decided to at least look into this and bought the PAM Mastery book this morning. When I read it, I'll definitely know more about authentication matters (which certainly won't hurt).

angus71 wrote:Hi there,
I'm not sure, but what about the Linux Mint "Slick-greeter" mentioned in that post?
http://blog.linuxmint.com/?p=3254
It seems to be maintained by Clem and his team, perhaps GhostBSD could use this one?
Greetings


Hi angus, thanks for bringing this to our attention! I kind of lost track of a lot of things in the Linux world when I left that community but it's good to know what's going on there. The thing here is that this "Slick-greeter" is not a DM but rather something you can think of as a DM module. When the MATE desktop project formed to keep the old GNOME² alive, they inherited GDM which was a pretty usable DM in the GNOME² days. For their fork they called it MDM or "MATE display manager" but dropped support for it rather quickly. The Linux Mint team picked it up and modified it and people thought that the name was "Mint display manager". Obviously they've dropped it, too, now (I would guess because it's still an old GTK+2 application whereas MATE has migrated to GTK+3 recently and Mint's other official desktop, Cinnamon, is GTK+3 as well) and adopted LightDM.

One thing that's special about LightDM is that the core is toolkit agnostic. To be of any use, however, you need to use a "greeter" which uses a toolkit (like GTK+3 or Qt4) together with the core. Looks like none of the available greeters suits them and so they've forked one and polished it to meet their needs.

The trouble with DMs is not that there aren't enough of them out there. LXDM for example is a fine piece of software that I like a lot when I'm using a Linux box. However... Those DMs make use of some Linux specific functions (we call those Linuxisms) and are thus not portable. LightDM was known to not work on FreeBSD as well, but after reading your post I checked back only to find that it's in ports now (thanks for that impulse)! Looks like somebody was desperate enough to patch it and port it over. I will try it out this evening. LightDM is certainly not the perfect solution but it might be an option for us to get rid of SLiM which is really lacking some fundamental things...
kraileth
Developer
 
Posts: 305
Joined: Sun Sep 04, 2016 11:30 am
Has thanked: 57 times
Been thanked: 51 times

Re: New display manager for GhostBSD.

Postby kraileth » Mon May 01, 2017 11:22 am

I've just installed the lightdm and lightdm-gtk-greeter packages on a fresh GhostBSD 11.0 Alpha1 installation in Virtualbox and enabled it in rc.conf, replacing SLiM. Well, it's not looking pretty, but it works - mostly. The one thing that's not working is keymap selection: As you can see in the screenshot, the corresponding menu is empty. The icon to the left of it is for session selection and the one to the right for accessibility options (large fonts and/or high contrast).

I'll give it a try on real hardware, test alternate sessions, etc., and report back here. At first glance this may be a viable option for us to get rid of SLiM soon.
Attachments
ghostbsd_lightdm.png
kraileth
Developer
 
Posts: 305
Joined: Sun Sep 04, 2016 11:30 am
Has thanked: 57 times
Been thanked: 51 times

Next

Return to Development Discussions

Who is online

Users browsing this forum: No registered users and 1 guest