artizirk / wdisplays

Mirror of cyclopsian/wdisplays
https://web.archive.org/web/20210204184506/https://github.com/cyclopsian/wdisplays
Other
194 stars 14 forks source link

New feature: automatically save display settings in kanshi's config file. #11

Open petertheprocess opened 1 year ago

alex-courtis commented 1 year ago

Nice work!

kRHYME7 commented 12 months ago

Thanks! Nice Work

sigboe commented 11 months ago

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?

    exec kanshi
    exec_always kanshictl reload 
sigboe commented 10 months ago

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 button to enable or disable saving the config. Before switching to this PR, I thought that this is what the Automatically Apply Changes did. So I never turned it off prior to switching to this PR. When I activated this feature, then it became obvious that it was to not have to click the apply button.

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 makepkg -sic, I derived it from the wdisplays-git

sigboe commented 7 months ago

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.

petertheprocess commented 4 months ago

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.

petertheprocess commented 4 months ago

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.

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.