Strange behaviour running from script

Bug #2084343 reported by Andrew Myers
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Xpad
Fix Committed
Medium
Arthur Borsboom

Bug Description

So, toggle from the taskbar icon does not work, so I decided to write a simple script to replace the taskbar icon, Here is what I did:

Turn off 'Enable Tray Icon' in 'Tray'

$ xpad -h -N # runs xpad and shows notes already created
$ xpad -h -N & # runs xpad and shows notes already created in new process
$ xpad -t & # stops xpad

Retry

$ xpad -t & # runs xpad and shows notes already created in new process
$ xpad -t & # stops xpad
$ xpad -t & # runs xpad and shows notes already created in new process
$ xpad -t & # stops xpad

Retry

$ xpad -h & # runs xpad and shows notes already created in new process (no new note)
[3] 24179
[1] Done xpad -t
[2] Done xpad -t
$ xpad -t & # stops xpad

All rather strange?

I can work with it by using 'xpad -t &' to start and toggle xpad I think but it seems rather strange behaviour.

Related branches

Revision history for this message
Emmanuel (ubuntu-oi) wrote :

Hi Andrew
Could you please provide information as result of the following command :
$ xpad --version
$ lsb_release -a
$ cat /etc/os-release

Regards

Revision history for this message
Andrew Myers (andym48) wrote :

$ xpad --version
Xpad 5.7

$ lsb_release -a
LSB Version: n/a
Distributor ID: Artix
Description: Artix Linux
Release: rolling
Codename: n/a

$ cat /etc/os-release
NAME="Artix Linux"
PRETTY_NAME="Artix Linux"
ID=artix
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://artixlinux.org/"
DOCUMENTATION_URL="https://wiki.artixlinux.org/"
SUPPORT_URL="https://forum.artixlinux.org/"
BUG_REPORT_URL="https://bugs.artixlinux.org/"
PRIVACY_POLICY_URL="https://terms.artixlinux.org/docs/privacy-policy/"
LOGO=artixlinux-logo

Revision history for this message
Arthur Borsboom (arthurborsboom) wrote :

> toggle from the taskbar icon does not work

I am trying to understand the issue.

"... toggle from the taskbar icon does not work", therefore you are trying to create a workaround by a script and CLI commands and that doesn't work either.

Is that correct?

I prefer to fix the actual issue (if I can) before trying to fix the workaround. :-)

On my desktop, when I click with the left mouse button on the taskbar icon, it shows the Xpad menu, even though the tray setting in preferences says "Toggle Show All".

Is this what you mean by "toggle from the taskbar icon does not work" ?

Revision history for this message
Emmanuel (ubuntu-oi) wrote :

Looks like he's launching 2 instances of xpad.
that because he put an "&" at the end of all

There's no reason to launch 2 instances and i think this could cause problem depending which process save its data at last.

I had to reinstall my Virtual Box to make test but i think we should take care of having only one instance.

I also think that we have to build 2 groups of option for command line :
- 1st group for command that could be used at startup (-N, -h, -s)
- 2nd group for command that could be used with the current running xpad (-v, -f, -t but also -s, -h)
    - with the 2nb group we should never need "&" because it's only to change the way the current instance is working and the command will simply exit at the end.

Revision history for this message
Andrew Myers (andym48) wrote :

Sorry, this was awhile ago.

I will try to recreate the problem.

start xpad
$ /bin/xpad # I am on arch so all the binaries are in /bin
displays all the notes, now check that the taskbar icon preference is ticked - yes

Left click on the tray icon shows a menu
Right click on the tray icon shows a menu

So, toggle from the taskbar icon does not work - my understanding is that left click on the tray icon will toggle display of the notes

So now I turn off the tray icon and try controlling xpad from the command line.

$ /bin/xpad
shows all the notes - no tray icon
kill xpad

$ /bin/xpad -h -N
shows all the notes (-h should be hidden) (-N no new note, correct)

$ /bin/xpad -t
shows all the notes (-t = toggle)
so in a new terminal instance:
$ /bin/xpad -t
kills (stops) xpad

etc.etc.

My problem is that toggle the tray icon does not seem to work and the cli does not seem to act on a running instance ox xpad. What I would expect for the cli is something like:

$ xpad (start xpad and show all notes, if not already running)
$ xpad -h (start xpad hidden if not already running)
$ xpad -h -N (same as -h, no New note at start)
$ xpad -t (same as 'xpad' above if not already running, toggle show/noshow all notes if running)

This only really became an issue because toggle on the tray icon does not seem to work.

PS he is only starting new instances of xpad with & where he has said that he is starting it in a new process :)

Revision history for this message
Arthur Borsboom (arthurborsboom) wrote :

The configurable tray icon left mouse click behavior is a feature of the GtkStatusIcon. However this feature has been deprecated by GTK3 for a long time and has been replaced (1 or 2 years ago) by libayatana.

The libayatana-appindicator, always displays the associated menu on left-click. Unfortunately, the library doesn't natively support customizing the left-click behavior to perform an arbitrary action directly.

Knowing this limitation, it seems we have to focus on the CLI workaround.

Revision history for this message
Arthur Borsboom (arthurborsboom) wrote :

About the CLI workaround
When I run "xpad -t" it seems to toggle the pads.
If the pads are shown, it hides them and when the pads are hidden it shows them.

However, I do see that xpad does not return to the CLI after showing all the pads.

"xpad -t" should show either show or hide all the pads and then return to the CLI, in case there is already an instance running.

Right now, xpad quits when all pads are hidden and there is no tray icon. This has been a conscience choice in the past, but looking at your use case, this is probably not the right thing to do.

Do you agree that if xpad keeps running, even when all the pads are hidden (and thus returning control the CLI), this should fix the problem of your script?

So "xpad -t" will always return to the CLI after the command.

Changed in xpad:
importance: Undecided → Medium
status: New → Incomplete
assignee: nobody → Arthur Borsboom (arthurborsboom)
Revision history for this message
Andrew Myers (andym48) wrote :

"Do you agree that if xpad keeps running, even when all the pads are hidden (and thus returning control the CLI), this should fix the problem of your script?"

I would think it should. In reality once the CLI is running then xpad -q should be the correct way to exit the cli and all other commands should act on the running instance.

I would have to try the mod to see if it has fixed the problem.

Revision history for this message
Arthur Borsboom (arthurborsboom) wrote : Re: [Bug 2084343] Re: Strange behaviour running from script

I havent changed anything yet. Right now I understand the need. The coding
still has to be done.

On Sun, Dec 22, 2024, 15:40 Andrew Myers <email address hidden> wrote:

> "Do you agree that if xpad keeps running, even when all the pads are
> hidden (and thus returning control the CLI), this should fix the problem
> of your script?"
>
> I would think it should. In reality once the CLI is running then xpad -q
> should be the correct way to exit the cli and all other commands should
> act on the running instance.
>
> I would have to try the mod to see if it has fixed the problem.
>
> --
> You received this bug notification because you are a bug assignee.
> Matching subscriptions: Arthur Borsboom
> https://bugs.launchpad.net/bugs/2084343
>
> Title:
> Strange behaviour running from script
>
> Status in Xpad:
> Incomplete
>
> Bug description:
> So, toggle from the taskbar icon does not work, so I decided to write
> a simple script to replace the taskbar icon, Here is what I did:
>
> Turn off 'Enable Tray Icon' in 'Tray'
>
> $ xpad -h -N # runs xpad and shows notes already created
> $ xpad -h -N & # runs xpad and shows notes already created in new process
> $ xpad -t & # stops xpad
>
> Retry
>
> $ xpad -t & # runs xpad and shows notes already created in new process
> $ xpad -t & # stops xpad
> $ xpad -t & # runs xpad and shows notes already created in new process
> $ xpad -t & # stops xpad
>
> Retry
>
> $ xpad -h & # runs xpad and shows notes already created in new
> process (no new note)
> [3] 24179
> [1] Done xpad -t
> [2] Done xpad -t
> $ xpad -t & # stops xpad
>
> All rather strange?
>
> I can work with it by using 'xpad -t &' to start and toggle xpad I
> think but it seems rather strange behaviour.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/xpad/+bug/2084343/+subscriptions
>
>

Revision history for this message
Andrew Myers (andym48) wrote :

In fact the real problem is that left-click on the tray icon does not toggling the display. So fixing the cli probably will not help.

What I have done is replicate the tray icon and then using xpad -t to show or hide the notes. Clearly 'hide' kills xpad, but not the tray icon.

What I have not done is to reproduce the right click menu in full. I still have a problem with xpad -n which restarts xpad, displays a new note,

_but_

at the same time displays all the other existing notes on top of the new note.

Revision history for this message
Andrew Myers (andym48) wrote :

So may be I have missed something - it seems that the cli is not really a command line interface to xpad, as I had assumed, but, in fact, is a command line interface to an already running instance of xpad.

Am I right?

Revision history for this message
Arthur Borsboom (arthurborsboom) wrote :

> but, in fact, is a
command line interface to an already running instance of xpad.

This is how I see it. But maybe this wrong. Need to rethink?

On Sun, Dec 22, 2024, 16:10 Andrew Myers <email address hidden> wrote:

> So may be I have missed something - it seems that the cli is not really
> a command line interface to xpad, as I had assumed, but, in fact, is a
> command line interface to an already running instance of xpad.
>
> Am I right?
>
> --
> You received this bug notification because you are a bug assignee.
> Matching subscriptions: Arthur Borsboom
> https://bugs.launchpad.net/bugs/2084343
>
> Title:
> Strange behaviour running from script
>
> Status in Xpad:
> Incomplete
>
> Bug description:
> So, toggle from the taskbar icon does not work, so I decided to write
> a simple script to replace the taskbar icon, Here is what I did:
>
> Turn off 'Enable Tray Icon' in 'Tray'
>
> $ xpad -h -N # runs xpad and shows notes already created
> $ xpad -h -N & # runs xpad and shows notes already created in new process
> $ xpad -t & # stops xpad
>
> Retry
>
> $ xpad -t & # runs xpad and shows notes already created in new process
> $ xpad -t & # stops xpad
> $ xpad -t & # runs xpad and shows notes already created in new process
> $ xpad -t & # stops xpad
>
> Retry
>
> $ xpad -h & # runs xpad and shows notes already created in new
> process (no new note)
> [3] 24179
> [1] Done xpad -t
> [2] Done xpad -t
> $ xpad -t & # stops xpad
>
> All rather strange?
>
> I can work with it by using 'xpad -t &' to start and toggle xpad I
> think but it seems rather strange behaviour.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/xpad/+bug/2084343/+subscriptions
>
>
>

Revision history for this message
Andrew Myers (andym48) wrote :

> Need to rethink?

Time for a pause I think. Let me mull it over for a while and come back to you.

Thank you for your help.

Revision history for this message
Emmanuel (ubuntu-oi) wrote (last edit ):

Hi all,
I ran a lot of test
It look like the 1st xpad close because xpad_app_quit is called by xpad_pad_close at line 857
 if (!xpad_tray_has_indicator () &&
   xpad_pad_group_num_visible_pads (pad->priv->group) == 0)
 {
  xpad_app_quit ();
  return;
 }
If i understand well xpad stop if all pads are invisible and there's no indicator in tray
And these's no tray if libayatana is not used (or libayatana_src not present at compilation time)

@Andrew : could you list packages with ayatana in their name ?
$ apt list | grep ayatana

@Andrew : What are you using : xfce, kde, gnome, etc... ? cause i don't know your artrix configuration

@Andrew : do you compile xpad yourself ?

However, even if there's no visible pad and no xpad in the indicator tray, is it normal to quit the program according to the fact that there's no visible pad ? this question is not as simple as it looks first.

Revision history for this message
Arthur Borsboom (arthurborsboom) wrote :

My gut feeling tells me that the first run of Xpad should startup normal and always stay resident until a shutdown is requested either through the GUI, or through the CLI, or through a system call.

All other automated shutdowns in the code should be removed.

Any run of Xpad from the CLI (ie. xpad --new) with Xpad already running, should apply to the running instance and then exit again.

The code you have found I found as well. I think it should be removed.

Thoughts?

Revision history for this message
Andrew Myers (andym48) wrote :

@Andrew : could you list packages with ayatana in their name ?

ayatana-idp 0.10.4-1
libappindicator-gtk3 12.10.0.r298-4 (Allow applications to extend a menu via Ayatana indicators in Unity, KDE or Systray (GTK+ 3 library))
libayatana-appindicator 0.5.93-1
libayatana-indicator 0.9.4-1.1

@Andrew : What are you using : xfce, kde, gnome, etc... ? cause i don't know your artrix configuration

Openbox running on Artix (which is Arch without systemd)

@Andrew : do you compile xpad yourself ?

No, installed from the Arch 'extra' repo

Revision history for this message
Andrew Myers (andym48) wrote :

So, treating the cli as an interface to a running instance of xpad, it seems to be rather limited in its functions. For example, there is no cli command to open a specific 'pad', it is all or nothing. Once a pad is opened then all the necessary commands are available through the pad's interface, provided that 'Show Toolbar' is enabled. If it not enabled then, again, there is no access to any of the preferences dialogues from the cli.

In passing, it seems that there is no 'close' button on the taskbar for each pad.

Bear with me, I am trying to re-think my way round it, now that I understand what the cli is doing.

Revision history for this message
Emmanuel (ubuntu-oi) wrote :

@Andrew : Do you have a xpad icon in your tray with a menu : "New", "Open All", "Close All", list of pads, "Preferences", "Help", "Quit" ?

@Arthur :
    I'm not sure that's a good idea to remove other automated shutdowns.
    I think they are here for good reason.
    The way the program works is (as per now) is :
        - if there's no xpad in tray and every pads are hidden, then xpad is closed
        - if xpad is launched again and every padds are hidden, then it display all
    From my point of view it's ok.

So i think that the CLI is working fine
but this do not solve the switching from hidden to showed with left click on an specific xpad from the tool bar.

@Andrew : As i wrote the previous line a light show in my mind, could you tell me if you try to switch show/hide by "clicking on the name of a pad in tray tool bar" or "the name of a pad in the xpad menu in the tray" ?

Revision history for this message
Andrew Myers (andym48) wrote :

@Emmanuel
I think, no offence, but you forget how this thread started: "So, toggle from the taskbar icon does not work, so I decided to write a simple script to replace the taskbar icon". My only aim would be to get the cli to be sufficiently useful that I could replace the taskbar icon, and drive xpad from the cli. At present I have replaced the taskbar icon, but all I can do is left-click toggle all the pads on and off (show and hide), and right-click add a new pad or quit. Of course, now that I know how the cli is intended to work I am pretty sure I can improve on it, but only within the limits of the available commands.

Revision history for this message
Arthur Borsboom (arthurborsboom) wrote :

I agree that the CLI commands are limited.

At best they are several commands that apply to either the whole program (like new pad) are only to all pads (like show all). Controlling a single pad is not yet implemented.

Nevertheless I believe it is still wrong that when xpad is already running and a CLI command is run to hide all pads, that the currently running Xpad is shutdown and a new instance is started up. This results in your script as a non-returning CLI command, which in essence keeps the script waiting.

IMO, the currently running Xpad should remain running, the CLI command should be executed on the running instance and then return control back to the CLI / script.

Revision history for this message
Arthur Borsboom (arthurborsboom) wrote :

I have removed the auto shutdown on all pads hidden even without app indicator icon.
This change has been pushed into the master branch.

Would you mind to try this (build from master) and test if this fixes the scripting issue?

Changed in xpad:
status: Incomplete → Fix Committed
Revision history for this message
Emmanuel (ubuntu-oi) wrote :

@Andrew
There's no offense.
I'm just trying to reproduce but i can't so i try to understand.
In my case, left click on the toolbar icon of a pad toggle it properly. So there's no need to workaround.
I use the openrc version of Artrix with openbox

It's sometimes difficult to understand each other with words and a video is sometimes easier. (don't know how to do it). So i hope it doesn't bother you if i ask question.

When you said "taskbar icon" : i understand that you have disabled the "hide all notes from taskbar and possibly [...]" in the Xpad->Preferences->View
So that each Notes have its own "label" in the taskbar.
If i left click on this label it toogle show/hide as expected.

But on the xpad menu, from the Tray icon (or let's call it notification bar) it doesn't toogle but only bring pad to the front.

So i'm still trying to figure out what's happening to you.
In my case, it works fine and i do not need workaround.

Revision history for this message
Emmanuel (ubuntu-oi) wrote :

@Arthur : Our post crossed.
I agree with you : Cli command should return except the 1st one used to launch xpad)

Revision history for this message
Andrew Myers (andym48) wrote :

@Emmanuel Sorry, I think I have used the wrong terminology. I have been referring to toggle for the icon in the notification area (referred to as the tray icon in Xpad preferences).

Sorry for any confusion.

For me, I already have half a dozen 'pads', and having them all on the taskbar is not really an option for me. I agree that having them in the taskbar would have worked.

> Bear with me, I am trying to re-think my way round it, now that I understand what the cli is doing.

Please be patient with me. I will return with some constructive comments in due course.

One small question about the terminology - the word 'pad' to me suggests that there can be more than one page for each 'pad', however, I have not found any way to add pages to a 'pad', so I assume that each 'pad' is a separate note. Please let me know if I have misunderstood.

Revision history for this message
Arthur Borsboom (arthurborsboom) wrote :

@andrew, please let me know if the committed fix (available in git master) is the solution to fixing the scripting issue.

git clone https://git.launchpad.net/xpad

Be sure to shutdown the non-working Xpad version before testing the manually build version. :-)

Revision history for this message
Andrew Myers (andym48) wrote :

I tried the new version in master, but I cannot see any difference I'm afraid.

I think I see what the problem is:

As you know, I am trying to work around the fact that the icon in the notification area does not toggle-show a note, or all notes on left click. What I can do is hide the inbuilt notification tray icon, and replace it with my own version. I can toggle show/hide all the notes, but that is all.

My idea was to use the cli to make the alternate icon useful. But, it seems that the cli does not work as expected unless the notification tray icon is enabled. Once again; may be I have misunderstood something?

My steps to try the cli were:

Turn off the tray icon
Start xpad "$ xpad -h &"
Try any cli commands "$ xpad -t"

Revision history for this message
Arthur Borsboom (arthurborsboom) wrote :

> the notification area does not toggle-show a note

I can make a note show through the notification area by

- left click on the notification icon - this should show a menu including all notes
- left click on the note (= pad) - this should bring the note to the front

Is this of any help?

Changed in xpad:
milestone: none → 5.9.0
Revision history for this message
Andrew Myers (andym48) wrote :

Thank you for all your help, and I am sorry for all the 'rabbit holes'.

In summary:

- xpad is the best Sticky Notes programme that I have found.
- I dislike the inability to left-click on the notification icon to toggle show/hide one or more notes.
- I tried to recreate the notification icon using the cli to interact with xpad but the cli is quite limited and does not work unless xpad is running AND the notification icon is enabled.

So I think I will stick with my workaround, which creates a notification icon, toggles show/hide all the notes, and leaves it to the right-click menus on the notes to control them. The notification icon is only displayed if there are sticky notes saved, otherwise it is launched from the desktop menu. With only a handful of notes it works tolerably well.

Revision history for this message
Emmanuel (ubuntu-oi) wrote (last edit ):

@Andrew,
I'm sorry to ask again but but your answer is not clear enough for me.
If you left click on that xpad icon in the "Notification Tray" does it display a menu ?

The Menu should have from top to bottom : : "New", "Open All", "Close All", <list of notes>, "Preferences", "Help", "Quit" ?

See Picture included (Mine is in French). Then if you click on a Notes (example "2.linux" from my pictures) does it toggle hide/show ?

So 2 questions (sorry if it looks rude but i'm really thinking we have a communication glitch). could you answer each with a simple yes or no.

Revision history for this message
Andrew Myers (andym48) wrote :

It is no problem whatsoever, I just don't want to waste your valuable time.

> If you left click on that xpad icon in the "Notification Tray" does it display a menu ?
Yes it does (left click or right click)

> The Menu should have from top to bottom : : "New", "Open All", "Close All", <list of notes>, "Preferences", "Help", "Quit" ?
Yes it does

> Then if you click on a Notes (example "2.linux" from my pictures) does it toggle hide/show ?
No, it opens the note but does not close it on the second click. (May be due to my window manager - Openbox)

Hope this helps

Revision history for this message
Emmanuel (ubuntu-oi) wrote :

@Andrew : Great.

Would it be nice of you click on a note's name in the menu it toogle show/hide ?
if the note is hidden it shows
if the note is showed it hides

Is it what you're looking for ?

Revision history for this message
Andrew Myers (andym48) wrote :

>> Then if you click on a Notes (example "2.linux" from my pictures) does it toggle hide/show ?
> No, it opens the note but does not close it on the second click. (May be due to my window manager - Openbox)

> Would it be nice of you click on a note's name in the menu it toogle show/hide ?
> Is it what you're looking for ?

Not really. I want to show/hide the notes directly from clicking on the icon. The only way to do this for xpad (as I see it) would be to change the click-on-icon from 'toggle the menu' to 'toggle the notes', since libayatana allows for only one action from clicking the icon. I don't think you would be happy with that idea :)

I suppose that you could change the 'Tray left mouse click behaviour' on the Tray tab in the preferences to
'Tray mouse click behaviour' and allow the user to select his/her preferred action when the icon is clicked. But that sounds like a lot of work.

Revision history for this message
Emmanuel (ubuntu-oi) wrote :

Well, that's not the way it works for now.
So the issue is a features request.

It would be nice to have usecases. Something like :

As a user i want to be able to very quickly hide/show all notes.
Or is it
As a user i want to very quickly toggle hide/show parameter for each notes so hidden notes show and showed hides.

Could you please clarify your usecase ? (Try to explain it without giving solution)

I understand that it is acceptable to do it thru command line.
There's multiple way to do it. It needs to think twice before doing anything.

Revision history for this message
Andrew Myers (andym48) wrote :

Sure, I think I can do that:

* It would be nice if the cli worked, as designed, without the notification tray icon being enabled.

* It would be nice if the user could choose the mouse click action on the notification tray icon (for example: toggle show/hide notes, show menu)

Revision history for this message
Arthur Borsboom (arthurborsboom) wrote :

> It would be nice if the user could choose the mouse click action on the notification tray icon (for example: toggle show/hide notes, show menu).

This will be a bit intrusive, since this means replacing the ayatana app indicator. This indicator is following KDE design principles, which means left-click on the notification area always shows a menu. It cannot be changed to another custom option, like it used to be in the past. Maybe by now (2 years later) there is a newer/better alternative for the ayatana app indicator ?

> It would be nice if the cli worked, as designed, without the notification tray icon being enabled.

Well I am not sure there was an actual design for the CLI ever. :-)
I do agree that the CLI of Xpad does not provide all the commands which are available through the menus.

However, after the recent fix of the CLI hide command, are there _existing_ CLI commands which are not working properly?

Revision history for this message
Andrew Myers (andym48) wrote :

No offence, but I don't understand your comments.

> This will be a bit intrusive - why?

> since this means replacing the ayatana app indicator - why?

> This indicator is following KDE design principles, which means left-click on the notification area always shows a menu - KDE is very nice, but I don't use it because (a) it is a bit heavyweight and (b) the way it handles notification icons. I know that they rowed back on their principles almost immediately, but the workaround did not work very well last time I looked.

> It cannot be changed to another custom option, like it used to be in the past - really?

> Maybe by now (2 years later) there is a newer/better alternative for the ayatana app indicator - no idea, clipit uses ayatana, clipit and network-manager-applet use libappindicator-gtk3, which 'Allow[s] applications to extend a menu via Ayatana indicators in Unity, KDE or Systray (GTK+ 3 library)'. Network-manager-applet has different left-click and right-click actions on its notification tray icon. :)

Revision history for this message
Andrew Myers (andym48) wrote :

> It would be nice if the cli worked, as designed, without the notification tray icon being enabled.

Try this:

Make sure that xpad is not running and that the notification tray icon is disabled

$ xpad -h &

$ xpad -s

$ xpad -h

Now do the same with the notification tray enabled.

Revision history for this message
Emmanuel (ubuntu-oi) wrote (last edit ):

* It would be nice if the cli worked, as designed, without the notification tray icon being enabled.
I tested it on ArtixLinux with OpenBox
1st test
./xpad & (ok : launch xpad with all notes viewable or hidden as per settings)
./xpad -h (nok : just close xpad)

2nd test
./xpad -h & (nok : launch xpad with notes viewable)
./xpad -h (nok : just close xpad)

3test
./xpad & (do not show all notes. some are hidden probably as a result of 2nd test)
./xpad -s (ok : show all notes)
./xpad -t (nok : just close xpad)

* It would be nice if the user could choose the mouse click action on the notification tray icon (for example: toggle show/hide notes, show menu)
This is a "how". The question i'm asking you is "why" ? There's many ways to do it. The one you suggested in not necessary the more convenient.
However, when the CLI command will work the way it should, i think that you had a quick solution (icon calling a script) and there's no need to dig further.

Suggested fix :
- Always have xpad running. Should never be stopped by a CLI
- On 1st start, if all notes are hidden ans no tray indicator : add a notes which says : "All notes hidden. please consider xpad -s, xpad -h xpad -t -?". something like a small help for CLI command only.
i'll try to code it next weekend.

Have a nice end of year all.
Emmanuel

Revision history for this message
Arthur Borsboom (arthurborsboom) wrote :

Hi Emanuelle,

I see in your test results that ./xpad -h does not work. I was under
the assumption that I had fixed this issue about a week ago.
Did you pull in the latest changes from git master and built it after that?

`git log` should show the following commit.

```
commit 48bc65791d370958445e0860574a5dbef40f0a07
Author: Arthur Borsboom <email address hidden>
Date: Thu Dec 26 11:43:24 2024 +0100

    xpad-app: do not shutdown the application when all pads are hidden
even if there is no app indicator. The application will remaining
running, giving the possiblity to execute CLI commands. Fixes
lp:2084343
```

If not, you can update xpad by pulling and building the changes.

git pull
make
src/xpad

On Sun, 29 Dec 2024 at 13:20, Emmanuel <email address hidden> wrote:
>
> * It would be nice if the cli worked, as designed, without the notification tray icon being enabled.
> I tested it on ArtixLinux with OpenBox
> 1st test
> ./xpad & (ok : launch xpad with all notes viewable or hidden as per settings)
> ./xpad -h (nok : just close xpad)
>
> 2nd test
> ./xpad -h & (nok : launch xpad with notes viewable)
> ./xpad -h (nok : just close xpad)
>
> 3test
> ./xpad & (do not show all notes. some are hidden probably as a result of 2nd test)
> ./xpad -s (ok : show all notes)
> ./xpad -t (nok : just close xpad)
>
>
> * It would be nice if the user could choose the mouse click action on the notification tray icon (for example: toggle show/hide notes, show menu)
> This is a "how". The question i'm asking you is "why" ? There's many ways to do it. The one you suggested in not necessary the more convenient.
> However, when the CLI command will work the way it should, i think that you had a quick solution (icon calling a script) and there's no need to dig further.
>
> --
> You received this bug notification because you are a bug assignee.
> Matching subscriptions: Arthur Borsboom
> https://bugs.launchpad.net/bugs/2084343
>
> Title:
> Strange behaviour running from script
>
> Status in Xpad:
> Fix Committed
>
> Bug description:
> So, toggle from the taskbar icon does not work, so I decided to write
> a simple script to replace the taskbar icon, Here is what I did:
>
> Turn off 'Enable Tray Icon' in 'Tray'
>
> $ xpad -h -N # runs xpad and shows notes already created
> $ xpad -h -N & # runs xpad and shows notes already created in new process
> $ xpad -t & # stops xpad
>
> Retry
>
> $ xpad -t & # runs xpad and shows notes already created in new process
> $ xpad -t & # stops xpad
> $ xpad -t & # runs xpad and shows notes already created in new process
> $ xpad -t & # stops xpad
>
> Retry
>
> $ xpad -h & # runs xpad and shows notes already created in new process (no new note)
> [3] 24179
> [1] Done xpad -t
> [2] Done xpad -t
> $ xpad -t & # stops xpad
>
> All rather strange?
>
> I can work with it by using 'xpad -t &' to start and toggle xpad I
> think but it seems rather strange behaviour.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/xpad/+bug/2084343/+subscriptions
>

Revision history for this message
Emmanuel (ubuntu-oi) wrote :

Hi, Arthur

Happy New year.
I'm back from vacation.
I was up to date with your commit on 29-12-2024 when running my test.

I'll run more test this week-end.

Regards

Revision history for this message
Emmanuel (ubuntu-oi) wrote :

Hi Guys,
Sorry for the delay. i had to explain the true life to my son.

In order to reproduce things i've made small changes in the code (from latest branch).
1st change simulate when there no tray icon by adding #undef HAVE_APP_INDICATOR in xpad-tray.c
2nd change is to avoid quitting from start by immediatly returning FALSE in xpad_app_first_idle_check

When this is done, you need 2 shell
sh1 $ xpad
It launch xpad and display notes as per configuration

sh2 $ xpad -h
It hides all notes and quit the xpad launched from 1st shell
there's no xpad alive

what was expected after xpad -h is :
xpad from 1st shell should still be alive
xpad from 2nd shell should have exited (that's ok)
All pads should be hidden

Others tests to do after this is solved :
- try xpad -s and expect xpad from 1st shell still alive and all notes shows
- try xpad -t and expect xpad from 1st shell still alive and notes invert hidden/show
Then we could remove the changes i've done and discuss what to do if there's no pad displayed on start.

Here the result of : git diff origin
diff --git a/src/xpad-app.c b/src/xpad-app.c
index 1bd8cf8da..e14f7df02 100644
--- a/src/xpad-app.c
+++ b/src/xpad-app.c
@@ -436,6 +436,7 @@ register_stock_icons (void)
 static gboolean
 xpad_app_first_idle_check (XpadPadGroup *group)
 {
+return FALSE; // immediately return FALSE to avoid quitting app from start (to be reconsidered later)
        /* We do this check at the first idle rather than immediately during
           start because we want to give the tray time to become embedded. */
        if (!xpad_tray_has_indicator () &&

diff --git a/src/xpad-tray.c b/src/xpad-tray.c
index 5a59d8bcc..c73f6ed20 100644
--- a/src/xpad-tray.c
+++ b/src/xpad-tray.c
@@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

 #include "xpad-settings.h"

+#undef HAVE_APP_INDICATOR
 #ifdef HAVE_APP_INDICATOR
 #include <libayatana-appindicator/app-indicator.h>

Revision history for this message
Emmanuel (ubuntu-oi) wrote (last edit ):

Once again this is because in the fonction xpad_pad_close there's this code which close xpad when there's no notes visible.

if (!xpad_tray_has_indicator () && xpad_pad_group_num_visible_pads (pad->priv->group) == 0)
{
 xpad_app_quit ();
 return;
}

Arthur, i suggest to remove all of this because xpad should not stop because there's no notes visible
Is that ok for you ?

And when xpad is launched and there's no visible notes and no icon tray, i suggest to display a small help focused on explaining Command line only
Is that ok for you ?

If you said yes to both, i could try to makes the changes

Revision history for this message
Andrew Myers (andym48) wrote :

I am following this discussion with interest.

> And when xpad is launched and there's no visible notes and no icon tray, i suggest to display a small help focused on explaining Command line only

I am not certain, thinking about this. When xpad is first launched, without a tray icon, how will that launch take place? :

(1) xpad -h
(2) xpad -s
(3) xpad -n
(4) xpad

I would expect that (1) launches xpad with no notes displayed (2) launches xpad will all notes displayed (3) launches xpad with a new note displayed (4) launches xpad in a default mode, which might be 1,2 oe 3 as you think best.

Since this would be a choice by then user there would be no need for any displayed note of the CLI options.

Revision history for this message
Emmanuel (ubuntu-oi) wrote :

This is working fine for me
Still need to implement small help

Revision history for this message
Emmanuel (ubuntu-oi) wrote :

@Andrew, i've patched CLI but not sure Arthur is ok. Waiting for his comments.

With my patch : I've checked what you said and here are the results :
On the 1st launch :
(1) xpad -h
All notes are hidden and xpad still running. need add "&" to issue other command in the same shell
then i stop it whith "xpad -q" from another shell

(2) xpad -s
All notes are showed and xpad still running. need add "&" to issue other command in the same shell
Then i stop it whith "xpad -q" from another shell

(3) xpad -n
All notes are displayed according to their hide/show status and a new note is created
Then i stop it whith "xpad -q" from another shell

(4) xpad
All notes are displayed according to their hide/show
Then i stop it whith "xpad -q" from another shell

Still have to think about combination. exemple : xpad -hn
hide all and create one visible ?
hide all and create on hidden ?

does it look great for you ?

Revision history for this message
Andrew Myers (andym48) wrote :

It sounds good to me.

Revision history for this message
Emmanuel (ubuntu-oi) wrote :

humm... i had a side effect when i remove the #undef HAVE_APP_INDICATOR in xpad-tray.c
It's not working the same way when there's the tray icon.
I'll dig in.

Revision history for this message
Emmanuel (ubuntu-oi) wrote (last edit ):

Files in attachement should work fine.
xpad no longer quit when all notes are hidden.

(1) xpad -h : All notes are hidden and xpad still running. need add "&" to issue other command in the same shell
(2) xpad -s : All notes are showed and xpad still running. need add "&" to issue other command in the same shell
(3) xpad -n : All notes are displayed according to their hide/show status and a new note is created
(4) xpad : All notes are displayed according to the preferences : all hidden, all visible or per individual configuration

On any other shell :
- "xpad -q" Can stop xpad
- "xpad -s" : show all notes
- "xpad -h" : hide all notes
- "xpad -t" : toggle individual notes status hide/show

I'll try to use git to commit the patch but i need to understand how git works. It looks like i need a ssh key

Revision history for this message
Emmanuel (ubuntu-oi) wrote :

Patch submitted
See merge proposal ~ubuntu-oi/xpad:patch_#2084343 ⇒ xpad:master

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.