Skip to content

feat: Configurable anchor positioning for cosmic launcher (top, center). - #405

Open
l-const wants to merge 1 commit into
pop-os:masterfrom
l-const:position-anchor-config
Open

feat: Configurable anchor positioning for cosmic launcher (top, center).#405
l-const wants to merge 1 commit into
pop-os:masterfrom
l-const:position-anchor-config

Conversation

@l-const

@l-const l-const commented Feb 28, 2026

Copy link
Copy Markdown

Fixes #268

Why? :

Similar configurations for other launchers: https://github.com/davatorium/rofi/blob/next/config/config.c#L80-L90 , https://github.com/abenz1267/walker/blob/master/src/config.rs#L165-L171 .
Docs: https://davatorium.github.io/rofi/guides/Positioning/theme3-positioning/
For me, without being able to put it in the center, this doesn't feel like a launcher. Also, from the perspective that this app could be used by other DEs that won't have the limitations or the design of the COSMIC DE in mind, making the app more friendly to other desktops would be beneficial.

  • I have disclosed use of any AI generated code in my commit messages.
    • If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR.
    • In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the Developer Certificate of Origin and certify my contribution under its conditions.
  • Demo 1 (alt-tab switching) :
alt-tab-switch-center.mp4
  • Demo 2 (workspace view) :
workspace-view.mp4

The file is not created by default(not sure why but is not needed for the default) , the path is ~/.config/cosmic/com.system76.CosmicLauncher/v1/anchor .

The distribution wide settings under /usr also works, and is read as fallback at startup. ( e.g. : echo "center" | sudo tee /usr/share/cosmic/com.system76.CosmicLauncher/v1/anchor )

Testing

  1. cargo build --release
  2. backup /usr/bin/cosmic-launcher
  3. sudo mv ./target/release/cosmic-laucher /usr/bin/cosmic-launcher
  4. pkill cosmic-launcher (cosmic-session will restart launcher from the new binary)
  5. create the file anchor on the new config folder and change values( center | top).

Comment thread src/config.rs Outdated
@garrettjwilke

Copy link
Copy Markdown

@maria-komarova do you have any thoughts/input on this? at the moment, it is set only by config files.

here is how it looks with all 3 positions set (top, center, bottom) :

IMG_0109
IMG_0110
IMG_0111

@git-f0x

git-f0x commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

I think it would look better without the extra top margin (150 for center and 250 for bottom), and it makes Center more ergonomic (and shows more entries).
Screenshot_2026-03-04_21-07-27
I've increased the max_height to 620 here, since it seems to more closely match the original launcher.

IMO, the Bottom config isn't needed, since it's really bad for ergonomics and can overlap panels. So maybe the config can be simplified with just Top and Center (maybe a bool?). Otherwise, it might be better to rename the config to just Anchor, to be more consistent with other configs that use anchor, rather than anchor_position.

@maria-komarova

maria-komarova commented Mar 4, 2026

Copy link
Copy Markdown

I am not sure I can see the benefit of having bottom position but it seems fine to add top center and center to the config.

@l-const

l-const commented Mar 4, 2026

Copy link
Copy Markdown
Author

I generally tried to make the text input close to the center which is exactly the opossite of what your describing: @git-f0x . I do admit the bottom might not be that useful @maria-komarova , i just tried to take into consideration what other lauchers do without creating to much future tech debt for the maintaners. Maybe an additional y offset / margin config value could be added as rofid does: https://github.com/davatorium/rofi/blob/next/config/config.c#L97 . Didn't 22.04 had the launcer in the center, does the current center configuration comes close @git-f0x @maria-komarova ? All of this (margin/offset config) could be done on a second change assuming it is something the cosmic devs are willing to maintain?!!

Ok, so i think I am close to 22.04 "center" configuration from what i've seen here: https://youtu.be/Cs4QRBm0C_8?t=308 . Of course, it would be readjusted in the future i just care to have the option to have it in the center.

@git-f0x

git-f0x commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Personally, the current Center looks to low and isn't good for ergonomics (since the top of the screen should be in line with eyes per OSHA guidelines, so the text input shouldn't be too low). Also the arbitrary margin numbers might not scale well with different resolutions or aspect ratios.
Centering the overall launcher like in my screenshot above looks nicer and is more comfortable, imo.
But of course, up to the UX team.

@l-const
l-const marked this pull request as draft March 5, 2026 17:30
@l-const
l-const force-pushed the position-anchor-config branch 2 times, most recently from 2e4d739 to 949317a Compare March 5, 2026 18:22
@l-const l-const changed the title feat: Configurable anchor positioning for cosmic launcher (top-center,center, bottom-center). feat: Configurable anchor positioning for cosmic launcher (top, center). Mar 5, 2026
@l-const
l-const marked this pull request as ready for review March 5, 2026 18:26
@l-const

l-const commented Mar 5, 2026

Copy link
Copy Markdown
Author

Ok, so I updated to remove the extra config and the "bottom" option as you suggested @git-f0x @maria-komarova @garrettjwilke . There is only the anchor (renamed from anchor_position config with the two only options available being "top" and "center".

@l-const
l-const force-pushed the position-anchor-config branch from 949317a to 5166613 Compare March 5, 2026 18:37
@wash2

wash2 commented Mar 5, 2026

Copy link
Copy Markdown
Collaborator

If you anchor to both the top and bottom edges instead, you'd probably have a much easier time positioning the text input in the center. You could use a column with a vertical space and container heights set using FillPortion to adjust the height in a way that consistently places the input. You'd have to add mouse areas to catch the input above and below the launcher interface so that you can detect mouse buttons in those areas and dismiss the launcher though.

@l-const
l-const force-pushed the position-anchor-config branch from 5166613 to 91dfea8 Compare March 5, 2026 18:48
@git-f0x

git-f0x commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

You'd have to add mouse areas to catch the input above and below the launcher interface so that you can detect mouse buttons in those areas and dismiss the launcher though.

That can cause issues where the launcher eats a click when being dismissed, rather than being dismissed and clicking whatever was clicked at that point (e.g. an applet).
I did it like that some time back, and the result wasn't that great. And also, it might be better for the text input to not be centered itself, for ergonomics.

@wash2

wash2 commented Mar 5, 2026

Copy link
Copy Markdown
Collaborator

I mentioned it on mattermost, but I believe input regions could be used instead and wouldn't eat a click.

@KodeBarista

Copy link
Copy Markdown
Contributor

Any updates?

@l-const
l-const force-pushed the position-anchor-config branch 4 times, most recently from 517887d to a61d379 Compare July 21, 2026 16:34
@l-const

l-const commented Jul 21, 2026

Copy link
Copy Markdown
Author

Any updates?

@KodeBarista There were some recent additions: a new dummy wayland surface that when is blurred kind of breaks my previous solution with the constraints to make the prompt centered despite the search result numbers, so it is kind of broken. Regardless of that, @wash2 has discussed a totally different solution for that anyway so perhaps i should close this PR. I am still trying to find a way for my fork as I think this is low on the priority list of the cosmic team. The new issue with the blurred "dummy" surface from the recent changes can be seen in the video:

  • The issue is manifested when you have frosted glass enabled for the System Interface option!
Video_2026-07-21_19-40-05.mp4

@l-const
l-const force-pushed the position-anchor-config branch from a61d379 to 932b9a3 Compare July 21, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Add option to change vertical position (from top to center) in screen

6 participants