summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs
diff options
context:
space:
mode:
authorlassulus <git@lassul.us>2023-01-31 00:34:07 +0100
committerlassulus <git@lassul.us>2023-01-31 00:34:07 +0100
commit62bd490d1e7217898bc793afc20de853ac1e6622 (patch)
tree454b9cbf6f72c54b993487ebc1f8deeb1cbb6506 /krebs/5pkgs
parent369fa6b7eb3f0fa3e1034bcad438eeda017949f8 (diff)
parenta85de9a0deb81f8b8759bfc6a54db0d823ab7a19 (diff)
Merge remote-tracking branch 'ni/master'
Diffstat (limited to 'krebs/5pkgs')
-rw-r--r--krebs/5pkgs/override/default.nix14
-rw-r--r--krebs/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch35
-rw-r--r--krebs/5pkgs/simple/q-power_supply.nix45
3 files changed, 31 insertions, 63 deletions
diff --git a/krebs/5pkgs/override/default.nix b/krebs/5pkgs/override/default.nix
index ae42bc1a3..f85f3f678 100644
--- a/krebs/5pkgs/override/default.nix
+++ b/krebs/5pkgs/override/default.nix
@@ -9,20 +9,6 @@ self: super: {
};
});
- flameshot = super.flameshot.overrideAttrs (old: rec {
- name = "flameshot-${version}";
- version = "0.10.2";
- src = self.fetchFromGitHub {
- owner = "flameshot-org";
- repo = "flameshot";
- rev = "v${version}";
- sha256 = "sha256-rZUiaS32C77tFJmEkw/9MGbVTVscb6LOCyWaWO5FyR4=";
- };
- patches = old.patches or [] ++ [
- ./flameshot/flameshot_imgur_0.10.2.patch
- ];
- });
-
# https://github.com/proot-me/PRoot/issues/106
proot = self.writeDashBin "proot" ''
export PROOT_NO_SECCOMP=1
diff --git a/krebs/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch b/krebs/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch
deleted file mode 100644
index c4c0bf38a..000000000
--- a/krebs/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch
+++ /dev/null
@@ -1,35 +0,0 @@
---- a/src/tools/imgur/imguruploader.cpp
-+++ b/src/tools/imgur/imguruploader.cpp
-@@ -31,6 +31,7 @@
- #include <QTimer>
- #include <QUrlQuery>
- #include <QVBoxLayout>
-+#include <stdlib.h>
-
- ImgurUploader::ImgurUploader(const QPixmap& capture, QWidget* parent)
- : QWidget(parent)
-@@ -79,8 +80,11 @@ void ImgurUploader::handleReply(QNetworkReply* reply)
- m_imageURL.setUrl(data[QStringLiteral("link")].toString());
-
- auto deleteToken = data[QStringLiteral("deletehash")].toString();
-+ char *deleteImageURLPattern = secure_getenv("IMGUR_DELETE_URL");
-+ if (deleteImageURLPattern == NULL)
-+ deleteImageURLPattern = "https://imgur.com/delete/%1";
- m_deleteImageURL.setUrl(
-- QStringLiteral("https://imgur.com/delete/%1").arg(deleteToken));
-+ QString::fromUtf8(deleteImageURLPattern).arg(deleteToken));
-
- // save history
- QString imageName = m_imageURL.toString();
-@@ -133,7 +137,10 @@ void ImgurUploader::upload()
- QString description = FileNameHandler().parsedPattern();
- urlQuery.addQueryItem(QStringLiteral("description"), description);
-
-- QUrl url(QStringLiteral("https://api.imgur.com/3/image"));
-+ char *createImageURLPattern = secure_getenv("IMGUR_CREATE_URL");
-+ if (createImageURLPattern == NULL)
-+ createImageURLPattern = "https://api.imgur.com/3/image";
-+ QUrl url(QString::fromUtf8(createImageURLPattern));
- url.setQuery(urlQuery);
- QNetworkRequest request(url);
- request.setHeader(QNetworkRequest::ContentTypeHeader,
diff --git a/krebs/5pkgs/simple/q-power_supply.nix b/krebs/5pkgs/simple/q-power_supply.nix
index 87f900194..627e3f905 100644
--- a/krebs/5pkgs/simple/q-power_supply.nix
+++ b/krebs/5pkgs/simple/q-power_supply.nix
@@ -8,7 +8,7 @@ writeDashBin "q-power_supply" ''
s/^\([A-Z_]\+=[0-9A-Za-z_-]*\)$/export \1/p
' $uevent)"
case $POWER_SUPPLY_NAME in
- AC)
+ AC|Mains)
exit # not battery
;;
esac
@@ -24,24 +24,41 @@ writeDashBin "q-power_supply" ''
return sprintf("%dh%dm", h, m)
}
- function print_bar(n, r, t1, t2, t_col) {
- t1 = int(r * n)
- t2 = n - t1
- if (r >= .42) t_col = "1;32"
- else if (r >= 23) t_col = "1;33"
- else if (r >= 11) t_col = "1;31"
- else t_col = "5;1;31"
- return sgr(t_col) strdup("■", t1) sgr(";30") strdup("■", t2) sgr()
+ function print_bar(r) {
+ return \
+ (r >= .1 ? bar_gradient[0] : bar_background) "■" \
+ (r >= .2 ? bar_gradient[1] : bar_background) "■" \
+ (r >= .3 ? bar_gradient[2] : bar_background) "■" \
+ (r >= .4 ? bar_gradient[3] : bar_background) "■" \
+ (r >= .5 ? bar_gradient[4] : bar_background) "■" \
+ (r >= .6 ? bar_gradient[5] : bar_background) "■" \
+ (r >= .7 ? bar_gradient[6] : bar_background) "■" \
+ (r >= .8 ? bar_gradient[7] : bar_background) "■" \
+ (r >= .9 ? bar_gradient[8] : bar_background) "■" \
+ (r >= 1 ? bar_gradient[9] : bar_background) "■" \
+ sgr()
+ }
+
+ function rgb(r, g, b) {
+ return sgr("38;2;" r ";" g ";" b)
}
function sgr(p) {
return "\x1b[" p "m"
}
- function strdup(s,n,t) {
- t = sprintf("%"n"s","")
- gsub(/ /,s,t)
- return t
+ BEGIN {
+ bar_gradient[0] = rgb(216, 100, 83)
+ bar_gradient[1] = rgb(210, 113, 72)
+ bar_gradient[2] = rgb(201, 125, 65)
+ bar_gradient[3] = rgb(190, 137, 63)
+ bar_gradient[4] = rgb(178, 148, 67)
+ bar_gradient[5] = rgb(166, 158, 75)
+ bar_gradient[6] = rgb(153, 167, 88)
+ bar_gradient[7] = rgb(140, 174, 104)
+ bar_gradient[8] = rgb(127, 181, 122)
+ bar_gradient[9] = rgb(116, 187, 141)
+ bar_background = rgb( 64, 64, 64)
}
END {
@@ -101,7 +118,7 @@ writeDashBin "q-power_supply" ''
charge_ratio = charge_now / charge_full
out = out name
- out = out sprintf(" %s", print_bar(10, charge_ratio))
+ out = out sprintf(" %s", print_bar(charge_ratio))
out = out sprintf(" %d%", charge_ratio * 100)
out = out sprintf(" %.2f%s", charge_now, charge_unit)
if (current_now != 0) {