Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 58 additions & 3 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,4 +1,59 @@
---
IndentWidth: '2'

...
IndentWidth: 2
# SPDX-SnippetBegin
# SPDX-License-Identifier: CC0-1.0
# SPDX-SnippetCopyrightText: NONE
Language: Cpp
AlignConsecutiveAssignments:
Enabled: true
AcrossEmptyLines: false
AcrossComments: true
AlignCompound: true
PadOperators: true
AlignConsecutiveBitFields: Consecutive
AlignConsecutiveMacros: Consecutive
AlignConsecutiveShortCaseStatements:
Enabled: true
# AlignCaseArrows: true
AlignCaseColons: true
AlignOperands: Align
AlignTrailingComments: Always
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: true
# AllowShortCaseExpressionOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
BinPackArguments: true
BinPackParameters: true
BreakBeforeBraces: Attach
BreakBeforeConceptDeclarations: Never
BreakBeforeBinaryOperators: true
BreakBeforeTernaryOperators: true
ColumnLimit: 128
IndentCaseBlocks: false
IndentCaseLabels: true
IndentPPDirectives: AfterHash
InsertBraces: false
InsertNewlineAtEOF: true
LineEnding: LF
PointerAlignment: Right
QualifierAlignment: Left
ReferenceAlignment: Right
ReflowComments: true
RemoveBracesLLVM: true
SeparateDefinitionBlocks: Always
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeParens: ControlStatementsExceptControlMacros
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesInAngles: Never
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: 1
SpacesInParens: Never
UseTab: Never
# SPDX-SnippetEnd
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/build/
.vscode
*.user
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ This project tries to adhere to [Semantic Versioning][2].

## [Unreleased]

### Added

Support for saving kanshi config file

### Changed

### Fixed

## [1.1.1] - 2023-07-01

### Added
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Compositors that are known to support the protocol are [Sway] and [Wayfire].
The goal of this project is to allow precise adjustment of display settings in
kiosks, digital signage, and other elaborate multi-monitor setups.


![Screenshot](wdisplays.png)

# Installation
Expand Down Expand Up @@ -70,8 +71,16 @@ It's intended to be the Wayland equivalent of an xrandr GUI, like [ARandR].
Sway, like i3, doesn't save any settings unless you put them in the config
file. See man `sway-output`. If you want to have multiple configurations
depending on the monitors connected, you'll need to use an external program
like [kanshi] or [way-displays]. Integration with that and other external
daemons is planned.
like [kanshi] or [way-displays].

When you apply a new change, the setting will be defaultly added to $HOME/.config/kanshi/config,
if there is already a profile for the same monitors combination, the change will be applied on
existing one.
you can add kanshi autostart to your sway config:
```
exec kanshi
exec_always kanshictl reload
```

### How do I add support to my compositor?

Expand Down
2 changes: 1 addition & 1 deletion protocol/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ wayland_scanner = find_program('wayland-scanner')
wayland_client = dependency('wayland-client')
wayland_protos = dependency('wayland-protocols', version: '>=1.17')

wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir')
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')

wayland_scanner_code = generator(
wayland_scanner,
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ static void activate(GtkApplication* app, gpointer user_data) {

int main(int argc, char *argv[]) {
g_setenv("GDK_GL", "gles", FALSE);
GtkApplication *app = gtk_application_new(WDISPLAYS_APP_ID, G_APPLICATION_FLAGS_NONE);
GtkApplication *app = gtk_application_new(WDISPLAYS_APP_ID, G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
int status = g_application_run(G_APPLICATION(app), argc, argv);
g_object_unref(app);
Expand Down
3 changes: 2 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ m_dep = cc.find_library('m', required : false)
rt_dep = cc.find_library('rt', required : false)
gdk = dependency('gdk-3.0', version: '>= 3.24')
gtk = dependency('gtk+-3.0', version: '>= 3.24')
assert(gdk.get_pkgconfig_variable('targets').split().contains('wayland'), 'Wayland GDK backend not present')
assert(gdk.get_variable('targets').split().contains('wayland'), 'Wayland GDK backend not present')
epoxy = dependency('epoxy')

configure_file(input: 'config.h.in', output: 'config.h', configuration: conf)
Expand All @@ -20,6 +20,7 @@ executable(
'outputs.c',
'overlay.c',
'render.c',
'store.c',
resources,
],
dependencies : [
Expand Down
17 changes: 12 additions & 5 deletions src/outputs.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include "wlr-screencopy-unstable-v1-client-protocol.h"
#include "wlr-layer-shell-unstable-v1-client-protocol.h"

extern int store_config(struct wl_list *outputs);

static void noop() {
// This space is intentionally left blank
}
Expand All @@ -52,6 +54,11 @@ static void config_handle_succeeded(void *data,
struct wd_pending_config *pending = data;
zwlr_output_configuration_v1_destroy(config);
wd_ui_apply_done(pending->state, pending->outputs);
if (store_config(pending->outputs) == 0)
{
wd_ui_show_error(pending->state,
"Change was applied successfully and config was saved.");
}
destroy_pending(pending);
}

Expand Down Expand Up @@ -526,7 +533,7 @@ static void output_manager_handle_done(void *data,
static const struct zwlr_output_manager_v1_listener output_manager_listener = {
.head = output_manager_handle_head,
.done = output_manager_handle_done,
.finished = noop,
.finished = (void (*)(void *, struct zwlr_output_manager_v1 *))noop,
};
static void registry_handle_global(void *data, struct wl_registry *registry,
uint32_t name, const char *interface, uint32_t version) {
Expand All @@ -553,7 +560,7 @@ static void registry_handle_global(void *data, struct wl_registry *registry,

static const struct wl_registry_listener registry_listener = {
.global = registry_handle_global,
.global_remove = noop,
.global_remove = (void (*)(void *, struct wl_registry *, uint32_t))noop,
};

void wd_add_output_management_listener(struct wd_state *state, struct
Expand Down Expand Up @@ -603,10 +610,10 @@ static void output_name(void *data, struct zxdg_output_v1 *zxdg_output_v1,

static const struct zxdg_output_v1_listener output_listener = {
.logical_position = output_logical_position,
.logical_size = noop,
.done = noop,
.logical_size = (void (*)(void *, struct zxdg_output_v1 *, int32_t, int32_t))noop,
.done = (void (*)(void *, struct zxdg_output_v1 *))noop,
.name = output_name,
.description = noop
.description = (void (*)(void *, struct zxdg_output_v1 *, const char *))noop
};

void wd_add_output(struct wd_state *state, struct wl_output *wl_output,
Expand Down
Loading