mirror of
https://github.com/hyprwm/hyprpicker.git
synced 2024-12-22 06:09:48 +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
|
||||
|
||||
`--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
|
||||
|
||||
|
|
|
@ -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);
|
||||
else
|
||||
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;
|
||||
}
|
||||
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);
|
||||
else
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ static void help(void) {
|
|||
std::cout << "Hyprpicker usage: hyprpicker [arg [...]].\n\nArguments:\n" <<
|
||||
" -f | --format=fmt | Specifies the output format (cmyk, hex, rgb, hsl, hsv)\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";
|
||||
}
|
||||
|
||||
|
@ -18,10 +19,11 @@ int main(int argc, char** argv, char** envp) {
|
|||
{"format", required_argument, NULL, 'f'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"no-fancy", no_argument, NULL, 'n'},
|
||||
{"autocopy", no_argument, NULL, 'a'},
|
||||
{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)
|
||||
break;
|
||||
|
||||
|
@ -48,6 +50,9 @@ int main(int argc, char** argv, char** envp) {
|
|||
case 'n':
|
||||
g_pHyprpicker->m_bFancyOutput = false;
|
||||
break;
|
||||
case 'a':
|
||||
g_pHyprpicker->m_bAutoCopy = true;
|
||||
break;
|
||||
default:
|
||||
help();
|
||||
exit(1);
|
||||
|
|
Loading…
Reference in a new issue