GithubHelp home page GithubHelp logo

emersion / kanshi Goto Github PK

View Code? Open in Web Editor NEW
637.0 18.0 46.0 171 KB

Dynamic display configuration (mirror)

Home Page: https://wayland.emersion.fr/kanshi/

License: MIT License

C 92.67% Meson 7.33%
sway monitor display autorandr

kanshi's Introduction

Heads up! This project has moved to SourceHut.

kanshi allows you to define output profiles that are automatically enabled and disabled on hotplug. For instance, this can be used to turn a laptop's internal screen off when docked.

This is a Wayland equivalent for tools like autorandr. kanshi can be used on Wayland compositors supporting the wlr-output-management protocol.

Join the IRC channel: #emersion on Libera Chat.

Building

Dependencies:

  • wayland-client
  • scdoc (optional, for man pages)
  • libvarlink (optional, for remote control functionality)
meson build
ninja -C build

Usage

mkdir -p ~/.config/kanshi && touch ~/.config/kanshi/config
kanshi

Configuration file

Each output profile is delimited by brackets. It contains several output directives (whose syntax is similar to sway-output(5)). A profile will be enabled if all of the listed outputs are connected.

profile {
	output LVDS-1 disable
	output "Some Company ASDF 4242" mode 1600x900 position 0,0
}

profile {
	output LVDS-1 enable scale 2
}

Contributing

The upstream repository can be found on SourceHut. Open tickets on the SourceHut tracker, send patches on the mailing list.

License

MIT

kanshi's People

Contributors

alkino avatar bwidawsk avatar colemickens avatar diraol avatar edrex avatar emersion avatar ericonr avatar jameswalmsley avatar jampe avatar jbeich avatar kaniini avatar kennylevinsen avatar layus avatar mayeulc avatar michaelaquilina avatar misterda avatar mlbullett avatar nenad avatar oersen avatar rikardfalkeborn avatar tbm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kanshi's Issues

configuration applied twice

I don't know if this is a kanshi or sway issue (since I assume kanshi just reacts to information from sway), but I noticed that sometimes the same profile gets applied twice.

When I start sway with an external monitor connected, I get:

applying profile
applying profile output 'eDP-1' on connected head 'eDP-1'
applying profile output 'Samsung Electric Company SyncMaster HVGQ901
399' on connected head 'DP-2'
applying profile
applying profile output 'eDP-1' on connected head 'eDP-1'
applying profile output 'Samsung Electric Company SyncMaster HVGQ901
399' on connected head 'DP-2'
configuration applied
configuration applied

when I disconnect the internal monitor, I get:

applying profile
applying profile output 'eDP-1' on connected head 'eDP-1'
configuration applied

i.e. it's applied once.

But then I killed kanshi and started it from the command line and now I get:

applying profile
applying profile output 'eDP-1' on connected head 'eDP-1'
applying profile
applying profile output 'eDP-1' on connected head 'eDP-1'
configuration applied
configuration applied
applying profile
applying profile output 'Samsung Electric Company SyncMaster HVGQ901399' on connected head 'DP-2'
applying profile output 'eDP-1' on connected head 'eDP-1'
applying profile
applying profile output 'Samsung Electric Company SyncMaster HVGQ901399' on connected head 'DP-2'
applying profile output 'eDP-1' on connected head 'eDP-1'
configuration applied
configuration applied

I never noticed this before, but then again I was paying more attention to kanshi's output now.

As far as I can tell, there's only one instance of kanshi running.

Feature request: Use regex in output name

At work, we don't have a set workstation and therefore often change monitors (flex office). All the monitors are of the same brand and model however they all have a different hexadecimal number in their names, for example, three similar monitors will have those names:

  • Goldstar Company Ltd LG Ultra HD 0x0000EDE5
  • Goldstar Company Ltd LG Ultra HD 0x0000E7C8
  • Goldstar Company Ltd LG Ultra HD 0x00007FB9

It is a burden to have to add all of them one by one. I'd like to be able to use a regex like so:

{
  output "Goldstar Company Ltd LG Ultra HD .*" enable scale 2.0
}

Add support for transform (i.e rotation)

Hi there,

Great job you're doing here.
Adding transform 90 (sway screen rotation) to an output in .config/kanshi/config causes the parser to silently fail. Upon inspection, I noticed the frontend and store don't seem to handle screen rotation. I think this would be fairly easy addition and much appreciated feature for portrait output lovers.

Cheers,

can't get kanshi to match a configuration

Apologies beforehand if this is me missing something obvious (I feel like it must be) but the following behaviour seems odd to me

~/.config/kanshi
cat config
{
    output "*" mode 1920x1080
}
~/.config/kanshi
kanshi
Connected outputs:
output eDP-1 vendor AUO product 0x2036 serial 0x0
Matching configuration: None
Waiting for output changes...

How does "*" end up with Matching configuration: None? I've tried several different strings to a get a match but nothing seems to get picked up by kanshi (e.g. eDP-1) doesn't work either.

This is on ubuntu 19.04 and

sway version 1.1-rc1-55-gc9cb5ced (Jul  9 2019, branch 'master')
wlroots=df3f0ffbb0bcce8a12c83b577fd688a4ec290e7e

Matching configuration: None

.config/kanshi/config is

{
  output VGA-1 enable
  output LVDS-1 disable
}
{
  output LVDS-1 enable
  output VGA-1 disable
}

kanshi gives

Connected outputs:
output VGA-1 vendor PHL product Philips 170S serial VN  004623
output LVDS-1 vendor SEC product 0x3651 serial 0x0
Matching configuration: None

As per IRC have tried the full reported output names in the config, also with output VGA-1 vendor PHL enable etc., and with output "LVDS-1" disable

I've also tried all the above with kanshi -s kanshi -f sway --primary-workspace "LVDS-1".

(I'm assuming the expected behaviour should be to toggle between the 'profiles'.)

kanshi produces the wrong parameters for position on sway

My configuration produces

$ kanshi 2>/dev/null
output eDP-1 disable
output DP-1 position 0,0 scale 1

If I try running the second line:

$ swaymsg "output DP-1 position 0,0 scale 1"
Error: Missing position argument (y).

This seems to be because position is marked as x,y rather than x y. The documentation on man sway-output specifies that x and y should be separated by a space and using a space instead seems to work:

$ swaymsg 'output DP-1 position 0 0'
<no error message>

kanshi uses last matching output when two external monitors are identical

I have two identical external monitors connected to their own DP outputs. When I run kanshi it finds my configuration, but will use the last output for both monitors. Nothing seems to get applied in the end. Positioning remains the same as before I ran kanshi

Here's my config:

{
	output eDP-1
}

{
	output eDP-1 position 0,360
	output DP-3 position 1920,0
	output DP-6 position 4480,0
}

Kanshi output:

Connected outputs:
output DP-6 vendor LEN product P24q-10 serial U4P00001
output eDP-1 vendor AUO product 0x243D serial 0x0
output DP-3 vendor LEN product P24q-10 serial U4P00001
Matching configuration: Some([MatchedOutput { connected: ConnectedOutput { name: "eDP-1", edid: EDID { header: Header { vendor: ['A', 'U', 'O'], product: 9277, serial: 0, week: 0, year: 26, version: 1, revision: 4 }, display: Display { video_input: 149, width: 31, height: 17, gamma: 120, features: 2 }, chromaticity: (), established_timing: (), standard_timing: (), descriptors: [DetailedTiming, DetailedTiming, UnspecifiedText("AUO"), UnspecifiedText("B140HAN02.4")] } }, saved: SavedOutput { name: "eDP-1", vendor: "", product: "", serial: "", enabled: true, width: 0, height: 0, rate: 0.0, x: 0, y: 360, primary: false, scale: 0 } }, MatchedOutput { connected: ConnectedOutput { name: "DP-6", edid: EDID { header: Header { vendor: ['L', 'E', 'N'], product: 24997, serial: 16843009, week: 51, year: 28, version: 1, revision: 4 }, display: Display { video_input: 165, width: 53, height: 30, gamma: 120, features: 24 }, chromaticity: (), established_timing: (), standard_timing: (), descriptors: [DetailedTiming, SerialNumber("U4P00001"), RangeLimits, ProductName("P24q-10")] } }, saved: SavedOutput { name: "DP-3", vendor: "", product: "", serial: "", enabled: true, width: 0, height: 0, rate: 0.0, x: 1920, y: 0, primary: false, scale: 0 } }, MatchedOutput { connected: ConnectedOutput { name: "DP-6", edid: EDID { header: Header { vendor: ['L', 'E', 'N'], product: 24997, serial: 16843009, week: 51, year: 28, version: 1, revision: 4 }, display: Display { video_input: 165, width: 53, height: 30, gamma: 120, features: 24 }, chromaticity: (), established_timing: (), standard_timing: (), descriptors: [DetailedTiming, SerialNumber("U4P00001"), RangeLimits, ProductName("P24q-10")] } }, saved: SavedOutput { name: "DP-6", vendor: "", product: "", serial: "", enabled: true, width: 0, height: 0, rate: 0.0, x: 4480, y: 0, primary: false, scale: 0 } }])
output eDP-1 position 0,360
output DP-6 position 1920,0
output DP-6 position 4480,0

As you can see, kanshi outputs DP-6 for both monitors.

kanshi prints matched configuration and exits

I don't really understand how to use this program. Judging from the description I'd guess that kanshi monitors external screen connect and disconnect events and adjusts display configuration accordingly.
I have the following config:

{
    output eDP-1 vendor SHP product 0x144A serial 0x0 scale 2
}

{
    output eDP-1 vendor SHP product 0x144A serial 0x0 scale 2 position 0,1050
    output DP-1 vendor SAM product SyncMaster serial H9XPC04698 position 0,0
}

It looks like it successfully matches configurations for both cases - a single laptop screen and a laptop screen with an external monitor.
This is the kanshi output in casae of a single laptop screen:

Connected outputs:
output eDP-1 vendor SHP product 0x144A serial 0x0
Matching configuration: Some([MatchedOutput { connected: ConnectedOutput { name: "eDP-1", edid: EDID { header: Header { vendor: ['S', 'H', 'P'], product: 5194, serial: 0, week: 23, year: 25, version: 1, revision: 4 }, display: Display { video_input: 165, width: 29, height: 17, gamma: 120, features: 14 }, chromaticity: (), established_timing: (), standard_timing: (), descriptors: [DetailedTiming, DetailedTiming, UnspecifiedText("RXN49\u00b6LQ133Z1"), Unknown([2, 65, 3, 40, 0, 18, 0, 0, 11, 1, 10, 32, 32])] } }, saved: SavedOutput { name: "eDP-1", vendor: "SHP", product: "0x144A", serial: "0x0", enabled: true, width: 0, height: 0, rate: 0.0, x: 0, y: 0, primary: false, scale: 2 } }])
output eDP-1 position 0,0 scale 2

This is the kanshi output in case of a laptop screen and a monitor plugged in via USB-C port (with HDMI to USB-C adapter if that matters):

Connected outputs:
output eDP-1 vendor SHP product 0x144A serial 0x0
output DP-1 vendor SAM product SyncMaster serial H9XPC04698
Matching configuration: Some([MatchedOutput { connected: ConnectedOutput { name: "eDP-1", edid: EDID { header: Header { vendor: ['S', 'H', 'P'], product: 5194, serial: 0, week: 23, year: 25, version: 1, revision: 4 }, display: Display { video_input: 165, width: 29, height: 17, gamma: 120, features: 14 }, chromaticity: (), established_timing: (), standard_timing: (), descriptors: [DetailedTiming, DetailedTiming, UnspecifiedText("RXN49\u00b6LQ133Z1"), Unknown([2, 65, 3, 40, 0, 18, 0, 0, 11, 1, 10, 32, 32])] } }, saved: SavedOutput { name: "eDP-1", vendor: "SHP", product: "0x144A", serial: "0x0", enabled: true, width: 0, height: 0, rate: 0.0, x: 0, y: 1050, primary: false, scale: 2 } }, MatchedOutput { connected: ConnectedOutput { name: "DP-1", edid: EDID { header: Header { vendor: ['S', 'A', 'M'], product: 542, serial: 1212232240, week: 50, year: 17, version: 1, revision: 3 }, display: Display { video_input: 128, width: 43, height: 27, gamma: 120, features: 42 }, chromaticity: (), established_timing: (), standard_timing: (), descriptors: [DetailedTiming, RangeLimits, ProductName("SyncMaster"), SerialNumber("H9XPC04698")] } }, saved: SavedOutput { name: "DP-1", vendor: "SAM", product: "SyncMaster", serial: "H9XPC04698", enabled: true, width: 0, height: 0, rate: 0.0, x: 0, y: 0, primary: false, scale: 0 } }])
output eDP-1 position 0,1050 scale 2
output DP-1 position 0,0

As you see kanshi prints out commands suitable for swaymsg (I'm using sway) but nothing actually happens - the program just exits.
Am I missing something here?

sway reload breaks kanshi config

This is my config

{
    output eDP-1 enable mode 1920x1080
}
{
    output eDP-1 disable
    output "Dell Inc. DELL U3415W F1T1W88R0A1L" enable mode 3440x1440
}

On sway start, profiles are applied correctly.
When i reload sway (mod+shift+r), both profiles get applied, resulting in both displays being turned on.
Kanshi is started via sway config (exec kanshi). If I rerun kanshi from the terminal, profiles gets applied correcly.

Is kanshi meant to be started this way (via sway config)?

Running it on archlinux via aur packages (kanshi-git, sway-git, wlroots-git, ... the whole shabang )

Panic after matching configuration

Hi @emersion ๐Ÿ‘‹ Thanks very much for kanshi, and all your other Wayland utils!

I seem to be hitting an issue with kanshi, however - so I figured I'd report it.

Environment

sway: 0.15.2
kanshi: 970267e

Config

{
  output eDP-1
}

Output

Connected outputs:
output eDP-1 vendor APP product Color LCD serial 0x0
Matching configuration: Some(MatchedConfiguration { outputs: [MatchedOutput { connected: ConnectedOutput { name: "eDP-1", edid: EDID { header: Header { vendor: ['A', 'P', 'P'], product: 40178, serial: 0, week: 26, year: 21, version: 1, revision: 4 }, display: Display { video_input: 149, width: 26, height: 14, gamma: 120, features: 2 }, chromaticity: (), established_timing: (), standard_timing: (), descriptors: [DetailedTiming, Dummy, UnspecifiedText("LP116WH4-TJA3"), ProductName("Color LCD")] } }, saved: SavedOutput { name: "eDP-1", vendor: "", product: "", serial: "", enabled: true, width: 0, height: 0, rate: 0.0, x: 0, y: 0, transform: Rotation(0), primary: false, scale: 0.0 } }], saved: SavedConfiguration { outputs: [SavedOutput { name: "eDP-1", vendor: "", product: "", serial: "", enabled: true, width: 0, height: 0, rate: 0.0, x: 0, y: 0, transform: Rotation(0), primary: false, scale: 0.0 }], exec: [] } })
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:335:21
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::panicking::panic
   9: i3ipc::I3Connection::run_command
  10: <kanshi::frontend::SwayFrontend as kanshi::frontend::Frontend>::apply_configuration
  11: kanshi::main
  12: std::rt::lang_start::{{closure}}
  13: std::panicking::try::do_call
  14: __rust_maybe_catch_panic
  15: std::rt::lang_start_internal
  16: main
  17: __libc_start_main
  18: _start

More info

As you can see, it panics even with a very basic configuration.
It's the same results with this config, or something a little more elaborate like including an HDMI output.

This happens if I just run kanshi or kanshi -s kanshi -f sway

Config confuses outputs

Sway 5ff330e (today)
Kanshi 725d788 (today)

Something about my config is getting kanshi confused between outputs:

{
    output eDP-1 mode 3840x2160 scale 2 position 960,1081
    output "Lenovo Group Limited T24i-10 VT509484" mode 1920x1080 scale 1 position 0,0
    output "Lenovo Group Limited T24i-10 VT580487" mode 1920x1080 scale 1 position 1921,0
}
~ kanshi   
applying profile
output 'eDP-1' doesn't support mode '[email protected]'

By tweaking the config with a weird mode, I can determine it's confusing edp-1 with the last output on the config list above.

Output list (positions below are correct as I'm currently scripting my displays via sway output commands):

~ swaymsg -t get_outputs -p                                                                                                                                             
Output eDP-1 'Sharp Corporation 0x1476 0x00000000' (focused)
  Current mode: 3840x2160 @ 59.997002 Hz
  Position: 960,1081
  Scale factor: 2.000000
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 1
  Available modes:
    3840x2160 @ 59.997002 Hz

Output HDMI-A-1 'Lenovo Group Limited T24i-10 VT509484'
  Current mode: 1920x1080 @ 60.000000 Hz
  Position: 0,0
  Scale factor: 1.000000
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 2
  Available modes:
    720x400 @ 70.082001 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 60.000000 Hz
    640x480 @ 72.808998 Hz
    640x480 @ 75.000000 Hz
    720x480 @ 59.939999 Hz
    720x480 @ 59.939999 Hz
    720x480 @ 60.000000 Hz
    720x480 @ 60.000000 Hz
    720x576 @ 50.000000 Hz
    720x576 @ 50.000000 Hz
    720x576 @ 50.000000 Hz
    800x600 @ 56.250000 Hz
    800x600 @ 60.317001 Hz
    800x600 @ 72.188004 Hz
    800x600 @ 75.000000 Hz
    832x624 @ 74.551003 Hz
    1024x768 @ 60.004002 Hz
    1024x768 @ 70.069000 Hz
    1024x768 @ 75.028999 Hz
    1280x720 @ 50.000000 Hz
    1280x720 @ 50.000000 Hz
    1280x720 @ 59.939999 Hz
    1280x720 @ 60.000000 Hz
    1152x864 @ 75.000000 Hz
    1440x900 @ 59.901001 Hz
    1280x1024 @ 60.020000 Hz
    1280x1024 @ 70.000999 Hz
    1280x1024 @ 75.025002 Hz
    1600x900 @ 60.000000 Hz
    1600x900 @ 75.000000 Hz
    1680x1050 @ 59.882999 Hz
    1920x1080 @ 50.000000 Hz
    1920x1080 @ 50.000000 Hz
    1920x1080 @ 59.939999 Hz
    1920x1080 @ 60.000000 Hz
    1920x1080 @ 60.000000 Hz

Output DP-2 'Lenovo Group Limited T24i-10 VT580487'
  Current mode: 1920x1080 @ 60.000000 Hz
  Position: 1921,0
  Scale factor: 1.000000
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 3
  Available modes:
    720x400 @ 70.082001 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 60.000000 Hz
    640x480 @ 72.808998 Hz
    640x480 @ 75.000000 Hz
    720x480 @ 59.939999 Hz
    720x480 @ 59.939999 Hz
    720x480 @ 60.000000 Hz
    720x480 @ 60.000000 Hz
    720x576 @ 50.000000 Hz
    720x576 @ 50.000000 Hz
    720x576 @ 50.000000 Hz
    800x600 @ 56.250000 Hz
    800x600 @ 60.317001 Hz
    800x600 @ 72.188004 Hz
    800x600 @ 75.000000 Hz
    832x624 @ 74.551003 Hz
    1024x768 @ 60.004002 Hz
    1024x768 @ 70.069000 Hz
    1024x768 @ 75.028999 Hz
    1280x720 @ 50.000000 Hz
    1280x720 @ 50.000000 Hz
    1280x720 @ 59.939999 Hz
    1280x720 @ 60.000000 Hz
    1152x864 @ 75.000000 Hz
    1440x900 @ 59.887001 Hz
    1280x1024 @ 60.020000 Hz
    1280x1024 @ 70.000999 Hz
    1280x1024 @ 75.025002 Hz
    1600x900 @ 60.000000 Hz
    1600x900 @ 75.000000 Hz
    1680x1050 @ 59.953999 Hz
    1920x1080 @ 50.000000 Hz
    1920x1080 @ 50.000000 Hz
    1920x1080 @ 59.939999 Hz
    1920x1080 @ 60.000000 Hz
    1920x1080 @ 60.000000 Hz

Doesn't restore laptop display when switching TTYs+undocking

I have two accounts on my machine (both using sway) and I switch between them using control+alt+f{1,2}. Kanshi remembers the state of the TTY when I switch but doesn't detect any changes when I switch back. My kanshi config is:

{
    output "Unknown 0x109D 0x00000000" enable  # Laptop
}

{
    output "Unknown 0x109D 0x00000000" disable  # Laptop
    output "ViewSonic Corporation VP2768 Series UY5182100007" enable  # external monitor
}

To illustrate the issue, here's a scenario:

  • Work in TTY1 undocked
  • dock laptop (external monitor)
  • Switch to TTY2 and work
  • Undock laptop while in TTY2
  • Switch to TTY1 and notice a dead screen

At this point, Kanshi hasn't returned the display back to the laptop. TTY1 is also unresponsive, i.e. I'm unable to blindly type commands to save the situation - something's blocking (perhaps not a Kanshi bug, then?).

The situation then gets more awkward because, while I can rescue the session by docking the laptop and undocking again, Kanshi somehow does detect the dock on TTY2 and then activates the external monitor/disables the laptop display in the background.

Refresh values are not respected

My config:

$ cat .config/kanshi/config
{
        output eDP-1 disable
        output "Goldstar Company Ltd LG HDR 4K 0x0000F7F3" mode 3840x2160@30Hz position 0,0 scale 2
}

{
        output eDP-1 enable mode 1920x1080
}

This is the output of kanshi: log.gz.

This result in the monitor set to 60Hz instead of 30Hz.

Compile error with Rust 1.34

  Compiling kanshi v0.2.1 (file:///home/martin/.cache/pikaur/build/kanshi-git/src/kanshi)
error: non-reference pattern used to match a reference (see issue #42640)
  --> src/frontend.rs:38:8
   |
38 |             for MatchedOutput{connected, saved} in config {
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a reference: `&MatchedOutput{connected, saved}`

Support lid closure

As far as I can tell, kanshi doesn't support a config based on whether my laptop lid is open or closed.

I'd like to have a different configuration between:

  • Laptop open and external monitor
  • Laptop closed and external monitor

Invalid monitors.xml format

My monitors.xml, which is generated by gnome, doesn't seem to match the XML tree expected by the code.

My monitors.xml is the following :

<monitors version="2">
  <configuration>
    <logicalmonitor>
      <x>0</x>
      <y>0</y>
      <scale>1</scale>
      <primary>yes</primary>
      <monitor>
        <monitorspec>
          <connector>DP-1</connector>
          <vendor>AOC</vendor>
          <product>2460G5</product>
          <serial>0x00000a03</serial>
        </monitorspec>
        <mode>
          <width>1920</width>
          <height>1080</height>
          <rate>60.000495910644531</rate>
        </mode>
      </monitor>
    </logicalmonitor>
    <logicalmonitor>
      <x>0</x>
      <y>1080</y>
      <scale>1</scale>
      <monitor>
        <monitorspec>
          <connector>eDP-1</connector>
          <vendor>CMN</vendor>
          <product>0x14c0</product>
          <serial>0x00000000</serial>
        </monitorspec>
        <mode>
          <width>1920</width>
          <height>1080</height>
          <rate>60.008350372314453</rate>
        </mode>
      </monitor>
    </logicalmonitor>
  </configuration>
</monitors>

The GnomeStore expect to find some elements named output inside a configuration, but as we can see, there is none.

invalid arguments for [email protected]_head

Not sure what happened. Logs:

applying profile '<anonymous at line 1, col 1>'
applying profile output 'LVDS-1' on connected head 'LVDS-1'
applying profile output 'VGA-1' on connected head 'VGA-1'
applying profile output 'HDMI-A-3' on connected head 'HDMI-A-3'
running commands for configuration '<anonymous at line 1, col 1>'
configuration for profile '<anonymous at line 1, col 1>' applied
applying profile '<anonymous at line 15, col 1>'
applying profile output 'LVDS-1' on connected head 'LVDS-1'
applying profile output '*' on connected head 'HDMI-A-3'
applying profile '<anonymous at line 7, col 1>'
applying profile output 'LVDS-1' on connected head 'LVDS-1'
wl_display@1: error 1: invalid arguments for [email protected]_head

Config:

{
	output LVDS-1 disable
	output HDMI-A-3 position 0,0 mode 1680x1050
	output VGA-1 position 1680,0 mode 1680x1050
}

{
	output LVDS-1 position 0,0
}

{
	output * position 0,0 scale 1
}

{
	output LVDS-1
	output *
}

Match any output name

So I have kanshi output:

Connected outputs:
output DP-8 vendor DEL product Dell S2417DG serial YNY1D8140HMU
output DP-6 vendor ACI product VG248 serial H5LMQS083427
output eDP-1 vendor SHP product 0x1476 serial 0x0
Matching configuration: None

And this is my config

{
  output DP-8 vendor DEL product Dell S2417DG serial YNY1D8140HMU resolution 2560x1440 position 1920,0
  output DP-6 vendor ACI product VG248 serial H5LMQS083427 resolution 1920x1080 position 0,0
  output eDP-1 vendor SHP product 0x1476 serial 0x0 resolution 3840x2160 scale 2 position 4480,0
}

Initially I thougth it was because my ports keep changing. I have tried without the port names, and also using the same syntax I use for sway outputs. None match anything.

Configuration parser returns empty list

The config:

{
	output eDP-1 scale 1.0
}

Printed here:

//writeln!(&mut stderr, "Saved configurations: {:?}", configurations).unwrap();

The output:

Connected outputs:
output eDP-1 ...
output DP-4 ...
output DP-3 ...
Saved configurations: []
...

Tested on both master and the last commit of 2017. Latest everything.

I've gone through store.rs a couple of times, but was unable to find any gaping holes. I assume you're using this util yourself, and it's working fine for you? Configured through KanshiStore?

Config file comment support

I'm going to have a fairly large config file as I move my laptop around quite a lot (home, desk@office, meeting room etc). It would be great if the config file would accept comments so that I could identify each block.

Man pages

Document the config file format and the kanshi command.

How to stack monitors vertically?

Hi!

Thank you for your work on coding utilities for Sway :-)

I'd like to stack my monitors vertically. Given the following kanshi config:

{                                                                             
    output HDMI-A-2 position 0,0 mode 2560x1440                               
    output eDP-1 position 2560,0 mode 1920x1080                               
}                                                                             

I'd expect HDMI-A-2 to be "above" and move to eDP-1 hovering the mouse cursor vertically. What actually happens is that I can switch monitors moving the cursor horizontally.

I've read the man page for sway-output and it looks that my config should do. Am i missing something?

$ swaymsg -t get_outputs 
Output eDP-1 'Unknown 0x0521 0x00000000' (focused)
  Current mode: 1920x1080 @ 60.020000 Hz
  Position: 1920,0
  Scale factor: 1.000000
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 2
  Available modes:
    1920x1080 @ 47.999001 Hz
    1920x1080 @ 60.020000 Hz

Output HDMI-A-2 'Dell Inc. DELL U2515H 9X2VY71J16EL'
  Current mode: 2560x1440 @ 59.951000 Hz
  Position: 0,0
  Scale factor: 1.000000
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 3
  Available modes:
    ...
    2560x1440 @ 59.951000 Hz

Thanks

EDIT: possibly related to swaywm/sway#1666 (comment)

set background using kanshi

I would like to be able to set the background as if I start sway without my external monitor set up any directive (i.e. setting the background) for the ext monitor won't get applied. Kanshi could do this I guess but doesn't currently support it.

conf file
{
    output eDP-1 background /home/tsampson/Wallpapers/Mount-Cook-New-Zealand1-2560x1440.jpg center
}

kanshi:
unknown directive 'background' in profile output 'eDP-1'
failed to parse config file: error on line 2, column 28

Cannot compile in Ubuntu 19.04

meson build fails at locating wayland-client, although the libraries are installed:

~  apt search wayland|grep -i client|grep -i installed

libwayland-client++0/disco,now 0.2.5-0ubuntu1 amd64 [installed]
libwayland-client-extra++0/disco,now 0.2.5-0ubuntu1 amd64 [installed]
libwayland-client0/disco,now 1.16.0-1ubuntu2 amd64 [installed]
root@66825bb79e9b:/workdir# 

There are no dev headers for wayland client in ubuntu and debian. libwayland-dev is also installed.

Add different idle options based on profile

Use case:

  • when only the screen laptop is connected, lock the screen after 5 minutes, suspend after 10
  • when I'm using the monitor at home, lock after 30 minutes, never suspend
  • when I'm using the monitor at the workplace, lock after 5 minutes, never suspend.

This would actually require the integration of swayidle into kanshi.

kanshi errors on startup

โ”‚ RUST_BACKTRACE=1 kanshi
Connected outputs:
output eDP-1 vendor CMN product 0x14D5 serial 0x0
thread 'main' panicked at 'called  on an  value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:1009:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::continue_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: <kanshi::store::KanshiStore as kanshi::store::Store>::list_configurations
  10: kanshi::main
  11: std::rt::lang_start::{{closure}}
  12: std::panicking::try::do_call
  13: __rust_maybe_catch_panic
  14: std::rt::lang_start_internal
  15: main
  16: __libc_start_main
  17: _start

Kanshi doesn't apply display position configuration after disabling display

I have been trying to use kanshi to control my displays.
I expected kanshi to switch between these modes by itself upon realising that eDP-1 was inactive.
My current config is :

{
	output eDP-1 enable position 0,0
	output "Goldstar wtv" enable mode 1920x1080  position 1366,0    
}
{
        output eDP-1 disable
        output "Goldstar wtv" enable mode 1920x1080  position 0,0
}

Upon running swaymsg -t get_outputs, after turning off eDP-1, I get that the position of the "GoldStar wtv" is 1366,0 instead of 0,0.

On the wayland-session.log, I get the following messages:

2020-02-18 13:52:53 - [swaybg-1.0/main.c:168] Destroying output eDP-1 
applying profile

Am I doing something wrong ? Or is this an expected behaviour?

Release newer version

The current version of Kanshi available in cargo is from 2017, please consider releasing the latest as it's currently incompatible with sway 1.x due to incorrect output syntax.

Profile names

  1. Add an optional name in front of configuration blocks: <name> { โ€ฆ }
  2. Add an IPC and kanshictl switch <name>
  3. Be able to specify multiple configurations for the same profile. The configuration matching the current output configuration is chosen.

Add support for subpixel hinting

output subpixel rgb|bgr|vrgb|vbgr|none

Manually sets the subpixel hinting for the specified output. This value is usually auto-detected, but some displays may misreport their subpixel geometry. Using the correct subpixel hinting allows for sharper text. Incorrect values will result in blurrier text. When changing this via swaymsg, some applications may need to be restarted to use the new value.

Currently complains about unknown directive 'subpixel' in profile output ... and fails.

Thanks !!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.