linuxmint / sticky

A sticky notes app for the linux desktop
GNU General Public License v2.0
187 stars 40 forks source link

Notes default to upper left corner of secondary display #67

Open ra50 opened 2 years ago

ra50 commented 2 years ago

New notes are created in upper left corner of secondary display, even if New Note was clicked on primary display. This can be very far from the cursor or even hard to spot depending on screen size. Can new notes be created on the primary display, or the display where New Note was clicked, or physically close to where New Note was clicked?

CatoAntonsen commented 2 years ago

I vote for this! Other than that: GREAT app! :-)

the0neWhoKnocks commented 1 year ago

I think I just ran into this, but in my case it's out of the vertical viewing area of the monitor? I have 3 monitors total, one is the laptop's (which is closed and off), one is the primary (horizontal), and the secondary (which is vertical). When I create a new note it doesn't appear on any monitor. So I opened ~/.config/sticky/notes.json and saw that there was a new note in the current group:

{
  "x": 40,
  "y": 40,
  "height": 200,
  "width": 250,
  "color": "yellow",
  "title": "",
  "text": ""
}

I wondered if it had something to do with no text being added so I killed sticky, added some text in the json, and restarted sticky. Still nothing. Next I changed the y to 400 to match what my other notes were at, and then it was visible after a restart.

Best I can tell is that it's getting the available height from my secondary (vertical) monitor and not my primary (horizontal) one.

OS: Linux Mint 21.1 Cinnamon
Python: 3.10.6
collinss commented 1 year ago

@the0neWhoKnocks That's because the coordinates it uses are based on the entire screen real estate of all monitors combined, with the y value starting at the highest pixel of the highest monitor, and the x value starting at the leftmost pixel of the leftmost monitor. That means, if you have at least 300 X 300 pixels in the top left where there are no monitors, it will appear off the screen when you create the note from the menu. Since I run a dual monitor setup, with the top edges aligned, I've never run into this problem, and so never thought to address it. I do plan to work some more on new note placement at some point, and I'll address it then. In the mean time, as a workaround, you can create notes by clicking the '+' icon on a note and it will place them relative to that note rather than the absolute coordinates.

the0neWhoKnocks commented 1 year ago

Ah nice, my guess was correct.

What's the reasoning behind using a combination of all monitors? With the multitude of possibilities a user can have for monitor configuration, I'd imagine others are having similar issues.

I could see this as being a deal breaker for new users. Imagine someone with my setup starting sticky for the first time. Their only option would be to use the panel's New Note option, which would end in the result I described - "Strange, it says a new note was created... I don't see one on any monitor... meh, guess it doesn't work on my system. Time to find another note app".

Nice to know about that + button though, I'll use that for the time being.

collinss commented 1 year ago

What's the reasoning behind using a combination of all monitors?

Simplicity. This is the way that gtk handles coordinates. I wont get into the technical reasons for that, but suffice it to say that it makes a lot of things a lot easier.

I could see this as being a deal breaker for new users.

Well, yes, this is not intended behavior (obviously), but initial placement is not something that is simple to decide (or even configure) given all the possible configurations, preferences, and workflows. That is why there are at least 3 of us (just off the top of my head) who have worked on this, and it's still not to a place I'm satisfied with (and not for lack of effort either - a lot of thought and effort went into trying to get this right, but as I said before, this is not a simple thing to figure out). And with all those changes, at least one of us (and probably all, at least to a certain extent) failed to consider a configuration such as yours. It might seem obvious to you, but that's because you have a setup like that; when you don't, it's easy to overlook such details.

the0neWhoKnocks commented 1 year ago

It's a shame GTK doesn't/can't expose a simpler API to query Display properties. Perhaps you've already tried/considered this solution, but I wonder if it'd simpler to map a new note's position based on one of two options:

  1. If adding a note to an existing group, just run the + command for the last note in the group so a new note is added relative to existing items.
  2. If there are no groups/notes, center the new note based on the user's last mouse click coordinates.

Anyway, sorry to be an armchair-developer. I appreciate your time and effort on these issues/fixes, and the time you've taken to respond.

collinss commented 1 year ago

It's a shame GTK doesn't/can't expose a simpler API to query Display properties.

The api is there for determining monitor dimensions, but trying to figure out which monitor to place it on is not a trivial matter, and then for placement, it still needs to be translated into the above-mentioned coordinates - all of which introduces more complexity, and thus more ways for this to go wrong. Then you factor in offsetting the new notes so that they don't completely cover each other, and it gets really complicated, really fast. It was much easier at the time to just hard-code the starting point at a fixed value. The downside, of course, is the issue that you're facing, but at the time, that wasn't even consideration that crossed our minds (iirc the placement code for menu-created notes was figured out right before the initial release, so there were a ton of different things we were looking at all at the same time). And as I said, I do plan to revisit this at some point, but it really needs to be done right, so that it 'just works' for as many as possible, and is easy to configure for those who prefer to have a bit more control. Anything less is just as likely to make things worse.

collinss commented 1 year ago

If there are no groups/notes, center the new note based on the user's last mouse click coordinates.

This is not possible to do (at least reliably), and is definitely not the right way to do it. I can see a lot of users getting really frustrated by that kind of behavior. And with that kind of approach, there is so much that could go wrong (like the header for the note appearing under a top panel, or off the screen so that the user can't actually move the note if they don't have the technical know-how).

ra50 commented 1 year ago

It's a shame GTK doesn't/can't expose a simpler API to query Display properties.

The api is there for determining monitor dimensions, but trying to figure out which monitor to place it on is not a trivial matter, and then for placement, it still needs to be translated into the above-mentioned coordinates - all of which introduces more complexity, and thus more ways for this to go wrong. Then you factor in offsetting the new notes so that they don't completely cover each other, and it gets really complicated, really fast. It was much easier at the time to just hard-code the starting point at a fixed value. The downside, of course, is the issue that you're facing, but at the time, that wasn't even consideration that crossed our minds (iirc the placement code for menu-created notes was figured out right before the initial release, so there were a ton of different things we were looking at all at the same time). And as I said, I do plan to revisit this at some point, but it really needs to be done right, so that it 'just works' for as many as possible, and is easy to configure for those who prefer to have a bit more control. Anything less is just as likely to make things worse.

Thanks for your thoughts on this. It's a great sticky note app. I think a quick fix would be to just place the note on the primary display, or the display from which New Note was clicked, still in the upper left corner as now. Would be an improvement over the absolute upper left of all monitors combined, which could be a far off corner not close to where the user's cursor already was.