mirror of
https://github.com/hyprwm/hyprpicker.git
synced 2024-11-16 16:15:58 +01:00
Add autocopy support for HSL, HSV, CMYK (#14)
This commit is contained in:
parent
7d2db8b232
commit
3255d91668
3 changed files with 13 additions and 2 deletions
|
@ -16,7 +16,7 @@ Launch it. Click. That's it.
|
||||||
|
|
||||||
`-h | --help` prints a help message
|
`-h | --help` prints a help message
|
||||||
|
|
||||||
`--autocopy` automatically copies the output to the clipboard (requires [wl-clipboard](https://github.com/bugaevc/wl-clipboard))
|
`-a | --autocopy` automatically copies the output to the clipboard (requires [wl-clipboard](https://github.com/bugaevc/wl-clipboard))
|
||||||
|
|
||||||
# Building
|
# Building
|
||||||
|
|
||||||
|
|
|
@ -158,6 +158,9 @@ void Events::handlePointerButton(void *data, struct wl_pointer *wl_pointer, uint
|
||||||
Debug::log(NONE, "\033[38;2;%i;%i;%im%g%% %g%% %g%% %g%%\033[0m", COL.r, COL.g, COL.b, c, m, y, k);
|
Debug::log(NONE, "\033[38;2;%i;%i;%im%g%% %g%% %g%% %g%%\033[0m", COL.r, COL.g, COL.b, c, m, y, k);
|
||||||
else
|
else
|
||||||
Debug::log(NONE, "%g%% %g%% %g%% %g%%", c, m, y, k);
|
Debug::log(NONE, "%g%% %g%% %g%% %g%%", c, m, y, k);
|
||||||
|
|
||||||
|
if (g_pHyprpicker->m_bAutoCopy)
|
||||||
|
Clipboard::copy("%g%% %g%% %g%% %g%%", c, m, y, k);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OUTPUT_HEX:
|
case OUTPUT_HEX:
|
||||||
|
@ -238,6 +241,9 @@ void Events::handlePointerButton(void *data, struct wl_pointer *wl_pointer, uint
|
||||||
Debug::log(NONE, "\033[38;2;%i;%i;%im%g %g%% %g%%\033[0m", COL.r, COL.g, COL.b, h, s, l_or_v);
|
Debug::log(NONE, "\033[38;2;%i;%i;%im%g %g%% %g%%\033[0m", COL.r, COL.g, COL.b, h, s, l_or_v);
|
||||||
else
|
else
|
||||||
Debug::log(NONE, "%g %g%% %g%%", h, s, l_or_v);
|
Debug::log(NONE, "%g %g%% %g%%", h, s, l_or_v);
|
||||||
|
|
||||||
|
if (g_pHyprpicker->m_bAutoCopy)
|
||||||
|
Clipboard::copy("%g %g%% %g%%", h, s, l_or_v);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ static void help(void) {
|
||||||
std::cout << "Hyprpicker usage: hyprpicker [arg [...]].\n\nArguments:\n" <<
|
std::cout << "Hyprpicker usage: hyprpicker [arg [...]].\n\nArguments:\n" <<
|
||||||
" -f | --format=fmt | Specifies the output format (cmyk, hex, rgb, hsl, hsv)\n" <<
|
" -f | --format=fmt | Specifies the output format (cmyk, hex, rgb, hsl, hsv)\n" <<
|
||||||
" -n | --no-fancy | Disables the \"fancy\" (aka. colored) outputting\n" <<
|
" -n | --no-fancy | Disables the \"fancy\" (aka. colored) outputting\n" <<
|
||||||
|
" -a | --autocopy | Automatically copies the output to the clipboard (requires wl-clipboard)\n" <<
|
||||||
" -h | --help | Show this help message\n";
|
" -h | --help | Show this help message\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,10 +19,11 @@ int main(int argc, char** argv, char** envp) {
|
||||||
{"format", required_argument, NULL, 'f'},
|
{"format", required_argument, NULL, 'f'},
|
||||||
{"help", no_argument, NULL, 'h'},
|
{"help", no_argument, NULL, 'h'},
|
||||||
{"no-fancy", no_argument, NULL, 'n'},
|
{"no-fancy", no_argument, NULL, 'n'},
|
||||||
|
{"autocopy", no_argument, NULL, 'a'},
|
||||||
{NULL, 0, NULL, 0 }
|
{NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
int c = getopt_long(argc, argv, ":f:hn", long_options, &option_index);
|
int c = getopt_long(argc, argv, ":f:hna", long_options, &option_index);
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -48,6 +50,9 @@ int main(int argc, char** argv, char** envp) {
|
||||||
case 'n':
|
case 'n':
|
||||||
g_pHyprpicker->m_bFancyOutput = false;
|
g_pHyprpicker->m_bFancyOutput = false;
|
||||||
break;
|
break;
|
||||||
|
case 'a':
|
||||||
|
g_pHyprpicker->m_bAutoCopy = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
help();
|
help();
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
Loading…
Reference in a new issue