chore(code): remove intermediary variables

In this commit I did various chores, I removed the intermediary
variables from the clipboard and notify, and other various fixes in the
hyprpicker.cpp
This commit is contained in:
r3b00thx 2025-06-07 11:25:53 +03:00
parent 0a02379432
commit 9fa9b06afb
No known key found for this signature in database
GPG key ID: D972C6E6008EA013
3 changed files with 8 additions and 19 deletions

View file

@ -6,11 +6,7 @@
#include <vector>
void NClipboard::copy(std::string data) {
std::string clipboardBinary = "wl-copy";
std::vector<std::string> clipboardArgs = {data};
Hyprutils::OS::CProcess copy(clipboardBinary, clipboardArgs);
Hyprutils::OS::CProcess copy("wl-copy", {data});
copy.runAsync();
}

View file

@ -671,7 +671,7 @@ void CHyprpicker::initMouse() {
return result;
};
std::string hexColor = std::format("#{}{}{}", toHex(COL.r), toHex(COL.g), toHex(COL.b));
std::string hexColor = std::format("#{0:02x}{1:02x}{2:02x}", COL.r, COL.g, COL.b);
switch (m_bSelectedOutputMode) {
case OUTPUT_CMYK: {
@ -688,9 +688,8 @@ void CHyprpicker::initMouse() {
if (m_bAutoCopy)
NClipboard::copy(formattedColor);
if (m_bNotify) {
if (m_bNotify)
NNotify::send(hexColor, formattedColor);
}
finish();
break;
@ -705,9 +704,8 @@ void CHyprpicker::initMouse() {
if (m_bAutoCopy)
NClipboard::copy(hexColor);
if (m_bNotify) {
if (m_bNotify)
NNotify::send(hexColor, hexColor);
}
finish();
break;
@ -723,9 +721,8 @@ void CHyprpicker::initMouse() {
if (m_bAutoCopy)
NClipboard::copy(formattedColor);
if (m_bNotify) {
if (m_bNotify)
NNotify::send(hexColor, formattedColor);
}
finish();
break;
@ -748,9 +745,8 @@ void CHyprpicker::initMouse() {
if (m_bAutoCopy)
NClipboard::copy(formattedColor);
if (m_bNotify) {
if (m_bNotify)
NNotify::send(hexColor, formattedColor);
}
finish();
break;

View file

@ -11,12 +11,9 @@
#include <hyprutils/os/Process.hpp>
void NNotify::send(std::string hexColor, std::string formattedColor) {
std::string notifyBody = std::format("<span>You selected the color: <span color='{}'><b>{}</b></span></span>", hexColor, formattedColor);
std::string notifyBody = std::format("<span>Selected color: <span color='{}'><b>{}</b></span></span>", hexColor, formattedColor);
std::string notifyBinary = "notify-send";
std::vector<std::string> notifyArgs = {"-t", "5000", "-i", "color-select-symbolic", "Color Picker", notifyBody};
Hyprutils::OS::CProcess notify(notifyBinary, notifyArgs);
Hyprutils::OS::CProcess notify("notify-send", {"-t", "5000", "-i", "color-select-symbolic", "Color Picker", notifyBody});
notify.runAsync();
}