Swappy: Use replaceVars.
This commit is contained in:
parent
8d48872d3c
commit
0163b0534c
|
@ -3,13 +3,21 @@
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}@args:
|
}:
|
||||||
|
let
|
||||||
|
color = config.module.style.color;
|
||||||
|
accentR = color.accentDecR;
|
||||||
|
accentG = color.accentDecG;
|
||||||
|
accentB = color.accentDecB;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
# SEE: https://github.com/jtheoof/swappy/issues/131
|
# SEE: https://github.com/jtheoof/swappy/issues/131
|
||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
(final: prev: {
|
(final: prev: {
|
||||||
swappy = prev.swappy.overrideAttrs (old: {
|
swappy = prev.swappy.overrideAttrs (old: {
|
||||||
patches = (old.patches or [ ]) ++ [ (import <patch/swappy/DefaultColor.nix> args).file ];
|
patches = (old.patches or [ ]) ++ [
|
||||||
|
(pkgs.replaceVars <patch/swappy/DefaultColor.patch> { inherit accentR accentG accentB; })
|
||||||
|
];
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
{ config, pkgs, ... }:
|
|
||||||
let
|
|
||||||
color = config.module.style.color;
|
|
||||||
accentR = color.accentDecR;
|
|
||||||
accentG = color.accentDecG;
|
|
||||||
accentB = color.accentDecB;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
file = pkgs.writeText "SwappyDefaultColorPatch" ''
|
|
||||||
diff --git a/res/style/swappy.css b/res/style/swappy.css
|
|
||||||
index 66013b3..9c88f84 100644
|
|
||||||
--- a/res/style/swappy.css
|
|
||||||
+++ b/res/style/swappy.css
|
|
||||||
@@ -21,9 +21,9 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-box .color-green image {
|
|
||||||
- background-color: rgb(0, 255, 0);
|
|
||||||
+ background-color: rgb(255, 255, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-box .color-blue image {
|
|
||||||
- background-color: rgb(0, 0, 255);
|
|
||||||
+ background-color: rgb(0, 0, 0);
|
|
||||||
}
|
|
||||||
diff --git a/src/application.c b/src/application.c
|
|
||||||
index 5b98590..5c7e99c 100644
|
|
||||||
--- a/src/application.c
|
|
||||||
+++ b/src/application.c
|
|
||||||
@@ -601,11 +601,11 @@ void color_red_clicked_handler(GtkWidget *widget, struct swappy_state *state) {
|
|
||||||
|
|
||||||
void color_green_clicked_handler(GtkWidget *widget,
|
|
||||||
struct swappy_state *state) {
|
|
||||||
- action_update_color_state(state, 0, 1, 0, 1, false);
|
|
||||||
+ action_update_color_state(state, 0, 0, 0, 1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void color_blue_clicked_handler(GtkWidget *widget, struct swappy_state *state) {
|
|
||||||
- action_update_color_state(state, 0, 0, 1, 1, false);
|
|
||||||
+ action_update_color_state(state, 1, 1, 1, 1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void color_custom_clicked_handler(GtkWidget *widget,
|
|
||||||
@@ -875,9 +875,9 @@ static gboolean is_file_from_stdin(const char *file) {
|
|
||||||
}
|
|
||||||
|
|
||||||
static void init_settings(struct swappy_state *state) {
|
|
||||||
- state->settings.r = 1;
|
|
||||||
- state->settings.g = 0;
|
|
||||||
- state->settings.b = 0;
|
|
||||||
+ state->settings.r = ${accentR};
|
|
||||||
+ state->settings.g = ${accentG};
|
|
||||||
+ state->settings.b = ${accentB};
|
|
||||||
state->settings.a = 1;
|
|
||||||
state->settings.w = state->config->line_size;
|
|
||||||
state->settings.t = state->config->text_size;
|
|
||||||
'';
|
|
||||||
}
|
|
47
patch/swappy/DefaultColor.patch
Normal file
47
patch/swappy/DefaultColor.patch
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
diff --git a/res/style/swappy.css b/res/style/swappy.css
|
||||||
|
index 66013b3..9c88f84 100644
|
||||||
|
--- a/res/style/swappy.css
|
||||||
|
+++ b/res/style/swappy.css
|
||||||
|
@@ -21,9 +21,9 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-box .color-green image {
|
||||||
|
- background-color: rgb(0, 255, 0);
|
||||||
|
+ background-color: rgb(255, 255, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-box .color-blue image {
|
||||||
|
- background-color: rgb(0, 0, 255);
|
||||||
|
+ background-color: rgb(0, 0, 0);
|
||||||
|
}
|
||||||
|
diff --git a/src/application.c b/src/application.c
|
||||||
|
index 5b98590..5c7e99c 100644
|
||||||
|
--- a/src/application.c
|
||||||
|
+++ b/src/application.c
|
||||||
|
@@ -601,11 +601,11 @@ void color_red_clicked_handler(GtkWidget *widget, struct swappy_state *state) {
|
||||||
|
|
||||||
|
void color_green_clicked_handler(GtkWidget *widget,
|
||||||
|
struct swappy_state *state) {
|
||||||
|
- action_update_color_state(state, 0, 1, 0, 1, false);
|
||||||
|
+ action_update_color_state(state, 0, 0, 0, 1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void color_blue_clicked_handler(GtkWidget *widget, struct swappy_state *state) {
|
||||||
|
- action_update_color_state(state, 0, 0, 1, 1, false);
|
||||||
|
+ action_update_color_state(state, 1, 1, 1, 1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void color_custom_clicked_handler(GtkWidget *widget,
|
||||||
|
@@ -875,9 +875,9 @@ static gboolean is_file_from_stdin(const char *file) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void init_settings(struct swappy_state *state) {
|
||||||
|
- state->settings.r = 1;
|
||||||
|
- state->settings.g = 0;
|
||||||
|
- state->settings.b = 0;
|
||||||
|
+ state->settings.r = @accentR@;
|
||||||
|
+ state->settings.g = @accentG@;
|
||||||
|
+ state->settings.b = @accentB@;
|
||||||
|
state->settings.a = 1;
|
||||||
|
state->settings.w = state->config->line_size;
|
||||||
|
state->settings.t = state->config->text_size;
|
Loading…
Reference in a new issue