bobstart (gui for managing desktop autostart items)

Forum Forums Kafeneio Chats In a Greek kafeneio bobstart (gui for managing desktop autostart items)

  • This topic has 23 replies, 4 voices, and was last updated Jan 2-2:39 am by skidoo.
Viewing 15 posts - 1 through 15 (of 24 total)
  • Author
    Posts
  • #14598
    Member
    Avatarskidoo

    BobC wrote:
    https://www.antixforum.com/forums/topic/is-it-safe-to-install-the-budgie-desktop-from-the-repos/

    Budgie has a real nice feature

    Attached to this post is a “ported” version of that utility, suitable for use in antiX

    .

    errata:
    The following screenshot, step 4, mentions “/tmp/g/dex.py -a -s ~/.config/autostart &”
    Instead, the inserted line should be
    dex.py -a -s ~/.config/autostart &

    .

    .
    .

    Attachments:
    1. bobstart.zip
    #14600
    Member
    Avatarskidoo

    Of course… 30 seconds after posting, I realize a bug detail staring me in the face.
    screenshot shows “Droopy” among the eligible autostart candidates
    but droopy is among the items blacklisted within the script, @line 384

    To hide droopy from the autostarts picklist:
    izzafname != “droopy”
    ^— change to —v
    izzaname != “droopy”

    #14602
    Forum Admin
    DaveDave

    Many thanks skidoo
    Adding
    img.set_pixel_size(32)
    after the if clause for
    if floop != None:
    on approx line 415 and after
    if icn:
    on approx line 450 should correct the variants in size and set all icons to 32×32 pixels

    On another note, startup items handled in this way would require the
    LOAD_XDG_AUTOSTART="xxxx"
    be set to true as
    LOAD_XDG_AUTOSTART="true"
    in ~/.desktop-session/desktop-session.conf for xdg autostart to be enabled.
    Should we add a toggle switch in this startup manager for enabling / disabling this?
    Similar to turning on / off set-screen-blank

    Looking at todo item sort alphabetically… I am beginning to think that the script is not structured with this in mind. IIUC it is structuring the available apps into a object array, then running through the array to build the list. I think from that object array would need to be built a name array that could then be sorted alphabetically… then build the list off of the sorted name array. However I am not certain how to construct the array in such a way as to retain the name / icon / exec / filename associations at this time.

    • This reply was modified 11 months, 2 weeks ago by Dave.

    Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

    #14604
    Member
    AvatarBobC

    Wow, that’s great, Skidoo and Dave!

    I have a straight 17.2 full x64 test system I’ll give it a try on tonight.

    Thanks much.

    #14606
    Forum Admin
    DaveDave

    Something figured out for sorting by name, not certain if it is the best approach but seems to work.
    Change

    for a in apps:
        izzaname = u""+a.get_name().lower()

    to

    app_dictionary = { }
            for name in apps:
                izzaname = u""+name.get_name().lower()
                app_dictionary[name] = izzaname
            
            for a, value in sorted(app_dictionary.iteritems(), key=lambda (k,v): (v,k)):

    on approx line 270. Which should build an object (a) = name dictionary, sort by the “name” value of the dictionary and finish the procedure using the rearranged object list….

    Will need to look at this function a bit more to see if this can be used for better menu building / managing within the current apps. Have been wanting to update add-start to include ~/.desktop-session/startup and xdg autostart.

    Edit:
    Not certain what is meant by
    “upper pane begs inclusion of a right-click action to view/edit/SaveAs any item of interest”

    Perhaps to edit the startup items as listed as to add a specific parameter to the item?
    Example: I want a startup item to open the forum on startup but I can only select firefox… why not edit firefox exec parameter to include the forum url?

    • This reply was modified 11 months, 2 weeks ago by Dave.

    Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

    #14609
    Forum Admin
    DaveDave

    As far as adding an option to edit, here is a “crude” way of doing so.
    add

           btn2 = Gtk.Button("Edit item")
            grid.attach_next_to(btn2,btn,Gtk.PositionType.RIGHT,1,1)
            btn2.props.vexpand = False
            btn2.props.valign = Gtk.Align.CENTER
            fname = df.get_filename()
            btn2.connect("clicked", self.edit, fname)

    after
    btn.props.valign = Gtk.Align.CENTER
    at approx line 465

    and add slightly down the file

             def edit(self, stuff, fname):
    		os.system("leafpad %s &" % fname)

    after
    self.btn = btn
    at approx line 476

    Which should add an edit button to each item which will open leafpad on the autostart .desktop item.
    Note: the tab values ” ” to avoid incorrect reading and errors thrown when running the program.
    Note #2: adding a button in this way does not follow the writing convention of the remove button.

    Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

    #14610
    Member
    Avatarskidoo

    LOAD_XDG_AUTOSTART=”true”
    In my testing, dex launched ’em successfully without that line.
    Must such a line be injected into each .desktop file in the course of copying it to ~/.config/autostart
    else it will be ignored by openbox, Xfce, mate and other XDG-compliant session managers?

    dex –help
    will display the available options.
    -a
    -s
    instructs dex to (a)utostart only the items in the (s)pecified directory.
    I chose to point it to ~/.config/autostart because the XDG docs state that’s the location checked by compliant clients.

    ================

    “Looking at todo item sort alphabetically…”
    I just slapped together a quickie POC, didn’t expect to personally followthrough and chase those TODO items ~~ was just pointing out to Bob some of its (the gnome tweak tool, as seen in Budgie) inherent limitations. I didn’t find thorough Gio docs & if starting from scratch, would stick with python-xdg and build a less convoluted/opaque pygtk layout. For future reference, I pasted inline comments containing a list of DesktopEntry convenience methods provided by python-xdg (xdg.DesktopEntry). These could be used to populate several additional hidden columns carried in the listbox datastore, toward facilitating various sort functions.

    #14611
    Member
    Avatarskidoo

    reminder:

    antiX 17 Full already contains an “add-start” command.
    ( /usr/local/bin/add-start provided by pkg add-start-antix )

    add-start enables wife (or daughter…) to easily add an autostart item for the currently active window manager ~~ i.e. if user runs it within a fluxbox session, it mods ~/.fluxbox/startup and when run within a icewm session, it mods ~/.icewm/startup

    #14613
    Member
    capreacaprea

    Skidoo, many thanks ! And also many thanks to Dave .
    I like to try it, but I get an Unicode-error

    $ /usr/local/bin/bobstart.py
    Traceback (most recent call last):
      File "/usr/local/bin/bobstart.py", line 505, in _on_add_clicked
        a = _AppChooser( self.main_window, set(self._get_running_executables()) )
      File "/usr/local/bin/bobstart.py", line 271, in __init__
        izzaname = u""+a.get_name().lower()
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 19: ordinal not in range(128)
    
    helga@antix1:~
    $ locale
    LANG=de_DE.UTF-8
    LANGUAGE=
    LC_CTYPE="de_DE.UTF-8"
    LC_NUMERIC="de_DE.UTF-8"
    LC_TIME="de_DE.UTF-8"
    LC_COLLATE="de_DE.UTF-8"
    LC_MONETARY="de_DE.UTF-8"
    LC_MESSAGES="de_DE.UTF-8"
    LC_PAPER="de_DE.UTF-8"
    LC_NAME="de_DE.UTF-8"
    LC_ADDRESS="de_DE.UTF-8"
    LC_TELEPHONE="de_DE.UTF-8"
    LC_MEASUREMENT="de_DE.UTF-8"
    LC_IDENTIFICATION="de_DE.UTF-8"
    LC_ALL=
    

    Can I do something against that?
    Nicely choosen name for the application,btw

    #14614
    Member
    Avatarskidoo

    caprea, as an installable “package” the gnome-tweak-tool comprised more than 100 files, and carried a string of depencencies including mutter wm and gnome-shell-common. For the POC, I stripped it down to just a single .py file (and only 300kb or so overhead from the dex and python-xdg dependencies). Localization support got chucked, along with everything else.

    .
    .
    BTW, for possible future reference, the PyXDG docs are available online here: https://pyxdg.readthedocs.io/…modules/xdg/DesktopEntry.html

    #14622
    Forum Admin
    DaveDave

    LOAD_XDG_AUTOSTART=”true”
    In my testing, dex launched ’em successfully without that line.
    Must such a line be injected into each .desktop file in the course of copying it to ~/.config/autostart
    else it will be ignored by openbox, Xfce, mate and other XDG-compliant session managers?

    That line is in the desktop session configuration. Enabling it should make desktop-session start the autostart items without dex.

    Edit: I see I have said must… this is before I fully knew what dex does and had not reviewed the code. So really it is optional use dex or what is built within desktop-session.

    • This reply was modified 11 months, 2 weeks ago by Dave.

    Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

    #14624
    Forum Admin
    DaveDave

    ================
    “Looking at todo item sort alphabetically…”
    I just slapped together a quickie POC, didn’t expect to personally followthrough and chase those TODO items ~~ was just pointing out to Bob some of its (the gnome tweak tool, as seen in Budgie) inherent limitations. I didn’t find thorough Gio docs & if starting from scratch, would stick with python-xdg and build a less convoluted/opaque pygtk layout. For future reference, I pasted inline comments containing a list of DesktopEntry convenience methods provided by python-xdg (xdg.DesktopEntry). These could be used to populate several additional hidden columns carried in the listbox datastore, toward facilitating various sort functions.

    Yes I would agree to removing the convoluted mess. It does seem to jump around an awful lot in the code just because… python-xdg is already used for the menu generation iirc. In the past I was experimenting with making the menu generator work with the desktop-defaults-set and add-start program as to making a pick list rather than a combobox using the filenames. However in that experiment the icons took far to long to load and always a few were missing.

    Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

    #14630
    Member
    Avatarskidoo

    That line is in the desktop session configuration. Enabling it should make desktop-session start the autostart items without dex.

    But doing so would seem to bring an all-or-nothing scenario:
    per user FULL opt-out via placement of ~/.noxautostart (i can’t recall the exact flagfile name)
    or
    user winds up with “all sorts of crap” being autostarted, due to entries placed in the system-wide dir by various package installers

    Ability to selectively ignore the “all sorts of crap” is the reason I chose dex.
    Maybe (didn’t bother testing) xdg supports per-user shunting of individual entries, checking whether a locally placed same-named .desktop file exists and the local copy contains a restrictive NoDisplay=True (or similar) line? Even so, coding the “easy peasy GUI” would require tomjiggery and would be prone to edge-case breakage. (“Sorry, a .desktop file named ‘spacefm.desktop’ already esists. Choose a different name”, or “Sorry, a .desktop file with a localized ‘Comment’ matching ‘blahblah’ already exists”, or other silly conditional-checking)

    skidoo wrote:
    https://www.antixforum.com/forums/topic/is-it-safe-to-install-the-budgie-desktop-from-the-repos/#post-14402

    the capability is there but is essentially ignored by antiX the desktop-session mechanism. Thankfully so, IMO ~~ too often, individual programs silently install “all sorts of crap” to the system-wide dir. Begs ongoing maintenance b/c after deleting the items you don’t want… checks performed each time an installed package is upgraded are prone to REinject its autostart entry(ies).

    /etc/xdg/autostart/
    ~/.config/autostart/
    https://specifications.freedesktop.org/autostart-spec/0.5/ar01s02.html
    IIRC, contents of the per-user directory SUPPLEMENT (they do not OVERRIDE) the system-wide entries

    see also:
    https://wiki.debian.org/Xinitrc
    https://wiki.debian.org/Xsession

    #14638
    Member
    AvatarBobC

    Ok, I installed it all on my test system, and made the suggested changes. Much of the code is way beyond my python understanding, but I got past my data entry errors entering your tweaks, and that felt good, especially including the edit function, once I got the indentation correct.

    So, in general, I got it to work. Thanks very much for understanding that I was hoping to get to where antiX has its own user friendly AutoStart system and finding a way to get one up and running.

    It did not exclude droopy, though, but I don’t know how to debug it to figure out why. I should be able to figure that one out. This isn’t major for me, as I know not to start things that I don’t know.

    The command to start dex turned out to be dex instead of dex.py, and seems to be for a different version of dex than in the repos, because the -s folder option doesn’t exist. I saw that dex wasn’t running after adding it to the desktop session startup and logging out and back in, so tryed it manually, and then checked synaptic to find that it was dex installed, not dex.py and neither the –help nor man dex showed the -s option.

    Therefore I added
    dex -a &

    and it started the apps that I added, but it also started other apps that I hadn’t expected, like wicd and clipit, which I didn’t understand, and I suspect that dex picked them up from a default folder? Maybe I just need to install the version of dex with -s parameter instead of the repo version? Actually, maybe a better question is that if the other autostart options don’t normally run, why are they needed there? Maybe only for a different window manager, ie not IceWM?

    BTW, with the edit option, once the .desktop entry was created in ~/.config/autostart I was able to tweak the .desktop file via the edit command and bring up MC with an LxTerminal-MC .desktop file for example. Therefore, it would be nicer if it would write the .desktop file before then editing it in that folder. If I can figure out how to debug, maybe I can figure that out.

    Thanks again…

    • This reply was modified 11 months, 1 week ago by BobC.
    #14640
    Member
    Avatarskidoo

    BobC, the inserted line should be
    dex.py -a -s ~/.config/autostart &

    -a -s instructs dex to (a)utostart only the items in the (s)pecified directory.

    also started other apps that I hadn’t expected, like wicd and clipit, which I didn’t understand, and I suspect that dex picked them up from a default folder?

    Yes, exactly right. You can inspect the contents here:
    /etc/xdg/autostart/

    In the absence of the -s /only/THIS/directory option, your -a option instructed dex to autostart all items residing in all potential xdg-autostart paths.

    after .desktop entry was created in ~/.config/autostart I was able to tweak the .desktop file via the edit command and bring up MC with an LxTerminal-MC .desktop

    Excellent, but we can’t expect wife (or daughter…) to do casually this.

    Could point users toward documentation which presents examples & explains the task of editing/customizing existing launchers (.desktop files)

    Step back for a moment, step back from “xdg (aka freedesktop.org) autostart, which I linked to in post #14630, above
    https://specifications.freedesktop.org/autostart-spec/0.5/ar01s02.html
    and spend 3-5 minutes skimming
    https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
    Easy, right?
    A .desktop file is a plaintext file. To be usable, it must contain a minimum of 3 lines:
    Name=
    Icon=
    Exec=

    You (or a distro, or a program author/packager) are free to add custom lines, e.g.
    X-BobWasHere=muhahahahaha
    and your custom line(s) will just be ignored by any menumaker parser (or whatever parser) that doesn’t expect, doesn’t know what to do with, the custom line(s).

    Back to the xdg-autostart mechanism. Per spec, a compliant autostart mechanism will scan for, and parse, “*.desktop” files residing within expected directories.

Viewing 15 posts - 1 through 15 (of 24 total)
  • You must be logged in to reply to this topic.