New feature: automatically save display settings in kanshi's config file.#11
New feature: automatically save display settings in kanshi's config file.#11petertheprocess wants to merge 5 commits intoartizirk:masterfrom
Conversation
|
Nice work! |
|
Thanks! Nice Work |
|
I looked up wdisplays on github to request this very feature! So thank you! But I am wondering if the readme should rather suggest launching kanshi from sway like this instead? |
|
I've been running this PR for a bit now, and I just want to say so far so good. The only thing I expected, keep in mind I do not have anything to say in this project, I am just a happy user. What I expected, is that there was an option in the hamburger menu But I think this PR, in my flawed knowledge opinion is probably makes wdisplays strictly better, and I hope it is merged! :) This is my PKGBUILD file I used to make a package on Arch pkgname=wdisplays-kanshi
_pkgname="wdisplays"
pkgver=r67.4411521
pkgrel=2
pkgdesc='GUI display configurator for wlroots compositors'
url='https://github.com/petertheprocess/wdisplays'
license=('GPL3')
provides=("$_pkgname")
conflicts=("$_pkgname")
arch=('i686' 'x86_64' 'armv6h' 'armv7h')
depends=('gtk3')
makedepends=('git' 'meson' 'gtk3' 'libepoxy' 'wayland' 'wayland-protocols')
source=("${_pkgname}::git+$url")
sha256sums=('SKIP')
pkgver() {
cd "$_pkgname"
( set -o pipefail
git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
)
}
build() {
cd "$_pkgname"
arch-meson "$srcdir/build"
ninja -C "$srcdir/build"
}
package() {
DESTDIR="$pkgdir" ninja -C "$srcdir/build" install
install -D -m 644 "$srcdir/wdisplays/resources/wdisplays.svg" "$pkgdir"/usr/share/pixmaps/wdisplays.svg
install -D -m 644 "$srcdir/wdisplays/resources/wdisplays.desktop.in" "$pkgdir"/usr/share/applications/wdisplays.desktop
install -d -m 755 "$pkgdir"/usr/share/licenses/"$_pkgname"
install -D -m 644 "$_pkgname"/LICENSES/* "$pkgdir"/usr/share/licenses/"$_pkgname"/
}To use this package, you put it in a folder, and run |
|
After using this for an extended period I want to report back that there is one major change that should be done before merging this. It needs two small changes to the code this writes to kanshi's config file the (critiria or) name of the display with parenthesis behind with the connected port in them. So this parenthesis should not be added. With this parenthesis kanshi doesn't recognize the display. Also if the name of the monitor contains characters that needs to be escaped. then the criteria should be single quoted instead of double quoted. |
|
Thank you for the valuable advices @sigboe @JasonGantner. I am currently preparing for several final exams and also haven’t use this app for a while since I switched my OS back to popos for more stable work experience. But after the exams, I am glad to take your advices and test it. |
I don't think it will be an issue, with this parenthesis, kanshi can recognize this display but treat them as 2 different display if using different port. I have a laptop which support hdmi and also typec(DP), when I wanna use laptop's keyboard, I will connect my screen by typec. And if I wanna connect my keyboard by typec and put laptop on a stand, hdmi will used for my screen. With this patenthesis 'feature', I can restore my display layout setting automatically. |
2. check $XDG_CONFIG_HOME before $HOME 3. all MAX SIZE now use platform-based macro from limits.h rather than magic number
|
@sigboe was absolutely right about the parentheses issue. I've created a fix for this: petertheprocess#2 The problem is that kanshi cannot parse output descriptions containing parentheses like My fix changes This should be applied to this PR as well to make the kanshi integration actually functional. |
* wip * Fix deprecated flag * check config path only on startup * use HEADS_MAX from wdisplays.h * remove useless strcpy * update readme and meson syntax * clang-format * Fix C23 issues gcc 15 is more strict and compiles C by default with C23. `noop` is used as a default null initializer, but now it must have the correct type, so add a cast. See also: https://bugs.gentoo.org/946954 --------- Co-authored-by: Viorel Munteanu <ceamac@gentoo.org>
|
@petertheprocess check my new PR for missing licensing information that need to be added |
* Add partial licensing header * add licensing info where needed * Update SPDX header in store.c --------- Co-authored-by: TanShaochang <30321432+petertheprocess@users.noreply.github.com>
|
Sry about the parentheses issue, I was using the old version of Kanshi v1.2, I thought it is the latest but just found it had migrated from github to https://gitlab.freedesktop.org/emersion/kanshi and didn't get your points, now I figured it out, and would look into it for a best solution. Maybe a PR for Kanshi? It is caused by that: static bool match_profile_output(struct kanshi_profile_output *output,
struct kanshi_head *head) {
const char *make = head->make ? head->make : "Unknown";
const char *model = head->model ? head->model : "Unknown";
const char *serial_number =
head->serial_number ? head->serial_number : "Unknown";
char identifier[1024];
assert(sizeof(identifier) >= strlen(make) + strlen(model) + strlen(serial_number) + 3);
snprintf(identifier, sizeof(identifier), "%s %s %s", make, model, serial_number);
return strcmp(output->name, "*") == 0 ||
strcmp(output->name, head->name) == 0 ||
fnmatch(output->name, identifier, 0) == 0;
} |
No description provided.