From 14b6f585764afb09d124ec00e0bf61375e28f7dd Mon Sep 17 00:00:00 2001 From: bmago Date: Thu, 3 Oct 2024 11:23:22 +0200 Subject: [PATCH] powerprofilesctl: add powerprofilesctl script, change powerprofile easily --- powerprofilesctl/README.md | 18 +++++++++++++ powerprofilesctl/powerprofilesctl | 25 ++++++++++++++++++ .../powerprofilesctl-balanced.png | Bin 0 -> 1396 bytes .../powerprofilesctl-performance.png | Bin 0 -> 1681 bytes .../powerprofilesctl-power-saver.png | Bin 0 -> 1699 bytes powerprofilesctl/powerprofilesctl.conf | 4 +++ 6 files changed, 47 insertions(+) create mode 100644 powerprofilesctl/README.md create mode 100755 powerprofilesctl/powerprofilesctl create mode 100644 powerprofilesctl/powerprofilesctl-balanced.png create mode 100644 powerprofilesctl/powerprofilesctl-performance.png create mode 100644 powerprofilesctl/powerprofilesctl-power-saver.png create mode 100644 powerprofilesctl/powerprofilesctl.conf diff --git a/powerprofilesctl/README.md b/powerprofilesctl/README.md new file mode 100644 index 00000000..a73a517a --- /dev/null +++ b/powerprofilesctl/README.md @@ -0,0 +1,18 @@ +# powerprofilesctl + +Shows the current powerprofile and gives the ability to change it by clicking on it. + +![powerprofilesctl-performance](./powerprofilesctl-performance.png) +![powerprofilesctl-balanced](./powerprofilesctl-balanced.png) +![powerprofilesctl-power-saver](./powerprofilesctl-power-saver.png) + +# Dependencies +- [powerprofilesctl](https://manpages.debian.org/unstable/power-profiles-daemon/powerprofilesctl.1.en.html) + +# Config +``` +[powerprofilesctl] +command=$SCRIPT_DIR/powerprofilesctl +label=🔌 +interval=30 +``` diff --git a/powerprofilesctl/powerprofilesctl b/powerprofilesctl/powerprofilesctl new file mode 100755 index 00000000..1ce1df7c --- /dev/null +++ b/powerprofilesctl/powerprofilesctl @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +get_power_state() { + powerprofilesctl | grep '*' | awk '{ print $2 }' | sed 's/: *//' +} + +toggle_power_state() { + current_state=$(get_power_state) + + if [ "$current_state" == "power-saver" ]; then + powerprofilesctl set performance + elif [ "$current_state" == "balanced" ]; then + powerprofilesctl set power-saver + else + powerprofilesctl set balanced + fi +} + +if [[ "$BLOCK_BUTTON" ]]; then + case "$BLOCK_BUTTON" in + 1) toggle_power_state;; + esac +fi + +echo "$(get_power_state)" diff --git a/powerprofilesctl/powerprofilesctl-balanced.png b/powerprofilesctl/powerprofilesctl-balanced.png new file mode 100644 index 0000000000000000000000000000000000000000..0bf0a542ea715fa7464c354c4e1058cdfd94fa32 GIT binary patch literal 1396 zcmV-)1&jKLP)iMmpBqE~GX!Z5=dcFR;3_?*FMeA_V%-9&n|7lSQ->X`}+FKX0zMv-q_fX zN~L5RhGC6Hv%S52c6PS5w${+lKnAs1t;6B)dcAMozAY>)B*iQi>&1%~KA+ESx65R* zcpngFDzjLuxw$!m!9W_pU@%%*S{^@s+}heIlgaAp>f&32qNvN|QYw{vKEJoO7sv73 z+*|-adwY9rZ7r9}t*EH5TCHlen$$@<2vR5%M@L6DZrlI>7z_r7 z!}0LpLq4A`l}aTN2>?K=)mki;^73*%pRZP{ola+ZdO84Le0Q=?EQ)M|BJUS526%w}`sad~-JqtTqxG&VL`t=5a~ z#L}QBYBHI~H3UH(k4G#Pr>3UjIDW1Rm`tY6=eu|BUL^AIon@ zc{xE4KRA`$Zns=6r%)(zxtva?`~CjCy}h)wG=d;}KA%`Dj-PI^SR(7?<>mbRd;ow* zBwAQlI668a2;%kY*LUvRxtJJ7v$?rRE(n4+JUrxZI0AuyPNy#}E=KPl5C{+iSzTQv zzEMSQ z_en4q42Q$9YQEZ?jEoGjYxei|)6&v1Gc(CJhG8z3tE{XnPHt&wY4rNbmoGdXFDolc zr_(u|&QK^6nUv8aqKRf>W5e(FpF16EYiq$^Ffz6yY;JCb!(pLNNIn)66i}(uSUX?s zj??LU^XAQ~SFe~%CY#NU#L2e5fB$}*%d4uYN~u)xc)Z@;-s0lo(a}+d!+~KKS+r0n z?CR>en3aeo8n4%DG#Z~je=d{BxLodo2M;6?$?@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##3v(jL%+ebvLZQ&-&!6c+^LRXgKmY*n`~5jN zIm}u%n@!sYf&c*cd_DjmH#gVg@g(~PgTYinVph=|o9gO`L#p>62-4fz+uhx*P$*n3 z*Ve6DO(qj9kHun%t3eR-+s?$CNHQtC`LeUKsY3tw@gp-cGdDMvn)mztzkdDNv}qHA zwz9G^(f<1NtJP|aMx%7kNfDdP7L7*fYa|wng+k%T$jF=)p%IJ4d3kwSt=8di#A2~o zd)nyeXgD0+vSmx+0CP;j>nH52LgfW>gr|7meKPbk7w!9r5iVH92y#;PEax^ zing`2J$dq^xw*Ntv~>6G-BVLjU0q$5E?tVp<8R--&CkzoY;3%F^QP5mWrzXC@msfU z84QMl2M_vuK7+w9I5;>wJe*>lGqBt3e!pKPlRbR+P%4!kJ$jVcpCAamUVr7v6##(Q zY?eqQ5ClDa`gBf-q*QAF0Ci1zdU~W%X=!OGhr{uBJn?v(!{LmLjR}Q9>d%6%&kQXmr zw6?aU7<@8bueZ6mxwErVuh&mZOz3pFbLY-6OHQ9Y9goMmy1H_5a>mBSPMkO~*F;zV z0Hspd-Q7K>SXnIAwr$%)A`y<`OO`BwVffLbN6~0>h8y)HxP1BYoEBe{D3!`o&-DyQ zl6?8{B@DwGHf&hFd^rF>C=}Z5_Wv}z#l}CZH2{Dl$w(yf=FOYz?CgSqf^?zNq)C$| b%_89sQ~4%RC0Ek~00000NkvXXu0mjfu0Ar~ literal 0 HcmV?d00001 diff --git a/powerprofilesctl/powerprofilesctl-power-saver.png b/powerprofilesctl/powerprofilesctl-power-saver.png new file mode 100644 index 0000000000000000000000000000000000000000..634daa7d807d06cef712eb29d59ecbbd2f837a6f GIT binary patch literal 1699 zcmV;U23+}xP)k3L>Z$ ztP(2dGJ-L>ta6sckP0iewWZOva8^rm-X5R%ynmcG882m9@m_k_=dbhpo^#Ik=ht(7 z=R5#2%rL_Y(}cxh?cTjRD=X{YPUQE4_QM_w24lm94b9EXGyeW9aJk%Dw{9IhdXz?^ zu~;lNoBeNR^n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?1t5^Su^z@+7XiJtX zK^F!b$2V@=SYKbS)oSO?o%_xHE|<$>GTpp+GZu^ad_IjvgW|clx#_D|dwV;&iXkpt zx)h7WPyrE%L=;7}w6vt((&==Q$@KQ^TY?~lhK4R&xG-nVoXo#aDwU$UU@R7U{`~o- zO`A|$tJS`F^JaK>*y(ic+O=!4xqLpKAPB$TPp8v=MH(^fFWRiEtTk)ah(w}LC`6~z zF$}wQ?HbxalX1CRZEbBQPoA9a{QoDg=?h9gU7>2D{wF)g;p-?z7GV(X%_S-XU ta{+*&sAMwv=+PrSpDz}RXPo^We*m7gJSuJpA=>}|002ovPDHLkV1hkWLjnK* literal 0 HcmV?d00001 diff --git a/powerprofilesctl/powerprofilesctl.conf b/powerprofilesctl/powerprofilesctl.conf new file mode 100644 index 00000000..811bddb4 --- /dev/null +++ b/powerprofilesctl/powerprofilesctl.conf @@ -0,0 +1,4 @@ +[powerprofilesctl] +command=$SCRIPT_DIR/powerprofilesctl +label=🔌 +interval=30