summaryrefslogtreecommitdiff
path: root/pacman-widget
diff options
context:
space:
mode:
Diffstat (limited to 'pacman-widget')
-rw-r--r--pacman-widget/README.md37
-rw-r--r--pacman-widget/icons/pacman-full.svg86
-rw-r--r--pacman-widget/icons/pacman.svg82
-rw-r--r--pacman-widget/icons/upgrade.svg60
-rw-r--r--pacman-widget/pacman.lua256
-rw-r--r--pacman-widget/screenshots/pacman.gifbin0 -> 10520147 bytes
-rwxr-xr-xpacman-widget/upgrade2
7 files changed, 523 insertions, 0 deletions
diff --git a/pacman-widget/README.md b/pacman-widget/README.md
new file mode 100644
index 0000000..f9c4325
--- /dev/null
+++ b/pacman-widget/README.md
@@ -0,0 +1,37 @@
+# Pacman widget for AwesomeWM
+
+This widget displays the number of upgradable Pacman packages. Clicking the icon reveals a scrollable list of available upgrades. A full system upgrade can be performed from the widget via Polkit.
+
+![](screenshots/pacman.gif)
+
+## Requirements
+`lxpolkit` is the default [Polkit agent](https://wiki.archlinux.org/title/Polkit).
+
+The widget also uses the `checkupdates` script from the `pacman-contrib` package.
+
+
+## Installation
+
+Clone the repo under **~/.config/awesome/** and add the following to **rc.lua**:
+
+```lua
+local pacman_widget = require('pacman-widget.pacman')
+...
+s.mytasklist, -- Middle widget
+ { -- Right widgets
+ layout = wibox.layout.fixed.horizontal,
+ ...
+ -- default
+ pacman_widget(),
+ -- custom (shown with defaults)
+ pacman_widget {
+ interval = 600, -- Refresh every 10 minutes
+ popup_bg_color = '#222222',
+ popup_border_width = 1,
+ popup_border_color = '#7e7e7e',
+ popup_height = 10, -- 10 packages shown in scrollable window
+ popup_width = 300,
+ polkit_agent_path = '/usr/bin/lxpolkit'
+ },
+```
+
diff --git a/pacman-widget/icons/pacman-full.svg b/pacman-widget/icons/pacman-full.svg
new file mode 100644
index 0000000..50bb939
--- /dev/null
+++ b/pacman-widget/icons/pacman-full.svg
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ id="svg7384"
+ version="1.1"
+ height="16"
+ width="16"
+ inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
+ sodipodi:docname="pacman-full.svg"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1918"
+ inkscape:window-height="1060"
+ id="namedview15"
+ showgrid="true"
+ inkscape:zoom="45.254834"
+ inkscape:cx="6.2866212"
+ inkscape:cy="6.7948542"
+ inkscape:window-x="0"
+ inkscape:window-y="18"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg7384"
+ inkscape:pagecheckerboard="0">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2992" />
+ </sodipodi:namedview>
+ <title
+ id="title9167">Gnome Symbolic Icon Theme</title>
+ <metadata
+ id="metadata90">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Gnome Symbolic Icon Theme</dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs7386" />
+ <g
+ transform="translate(-60,-518)"
+ id="layer9"
+ style="display:inline" />
+ <g
+ transform="translate(-60,-518)"
+ id="layer10" />
+ <g
+ transform="translate(-60,-518)"
+ id="layer11" />
+ <g
+ transform="translate(-60,-518)"
+ id="layer13" />
+ <g
+ transform="translate(-60,-518)"
+ id="layer14" />
+ <g
+ transform="translate(-60,-518)"
+ id="layer15" />
+ <path
+ style="fill:#bebebe;fill-opacity:1;stroke-width:0.00053838;stroke-miterlimit:4;stroke-dasharray:none;stop-color:#000000"
+ d="M 7.137907,15 C 4.7704514,14.776062 2.5561882,13.49017 1.2988905,11.6091 0.79747814,10.858926 0.49643804,10.201556 0.28424508,9.393458 0.10319664,8.703968 0.0591173,8.344087 0.05851897,7.5505417 0.05794903,6.7946932 0.09325863,6.5011405 0.27018463,5.7908221 0.91800602,3.1899639 3.1057688,1.0572385 5.8544488,0.347041 6.4964407,0.1811648 6.8897088,0.1296549 7.676287,0.1084186 c 1.3819864,-0.037311 2.508907,0.1977289 3.727246,0.7773864 0.884514,0.4208305 2.018807,1.267639 2.19481,1.6385382 0.0915,0.1928442 0.0646,0.4652894 -0.06391,0.6471215 -0.05214,0.073786 -1.096508,1.0846044 -2.320797,2.2462633 -1.2242884,1.1616587 -2.2228574,2.1228325 -2.2190416,2.1359417 0.00384,0.013109 1.0256906,0.9973153 2.2708336,2.1871253 1.32711,1.268133 2.291056,2.220522 2.329529,2.301599 0.154458,0.325496 0.04807,0.61462 -0.355908,0.967204 C 11.534053,14.497691 9.3522859,15.209459 7.1379079,15 Z M 7.2640101,5.2005925 C 7.3561446,5.153025 7.5089557,5.0301046 7.6035913,4.9274371 8.1096052,4.3784769 7.934244,3.5083912 7.2501327,3.1736868 6.9136982,3.0090851 6.492102,3.0092422 6.1551549,3.1740968 5.2143239,3.6344027 5.3235795,4.9484956 6.3300682,5.2778973 6.522594,5.3409068 7.0819085,5.2946119 7.2640101,5.2005945 Z"
+ id="path1342" />
+ <path
+ id="path5401"
+ style="fill:#bebebe;fill-opacity:1;stroke-width:0.0134083;stop-color:#000000"
+ d="M 7.9804688,0.12304688 A 7.9527636,7.4228802 0 0 0 0.02734375,7.5449219 7.9527636,7.4228802 0 0 0 7.9804688,14.96875 7.9527636,7.4228802 0 0 0 15.933594,7.5449219 7.9527636,7.4228802 0 0 0 7.9804688,0.12304688 Z M 7.1113281,2.6757812 c 0.1700559,2.455e-4 0.2916155,0.062047 0.3574219,0.1484376 0.028105,0.00325 0.055941,0.00597 0.083984,0.00977 0.059417,0.010654 0.120023,0.018078 0.1777344,0.037109 0.010273,0.00339 0.019438,0.00723 0.029297,0.011719 0.00198,7.727e-4 0.00267,0.00151 0.00391,0.00195 0.041112,0.020851 0.083943,0.040081 0.1230469,0.064453 0.020038,0.012489 0.036875,0.029381 0.052734,0.046875 0.075451,0.083228 0.084982,0.1287079 0.1230469,0.2382812 0.015629,0.062837 0.01248,0.1274133 0.015625,0.1914062 0.00173,0.035224 0.0082,0.070464 0.011719,0.1054688 0.00873,0.081246 0.029737,0.1622443 0.046875,0.2421875 0.019228,0.080299 0.030194,0.1617471 0.035156,0.2441406 0.00366,0.060532 -0.00155,0.025886 0.00391,0.060547 0.00487,0.075836 0.023068,0.1645304 0.017578,0.2402344 C 8.1905024,4.3578147 8.1839475,4.398172 8.1796875,4.4375 8.1492511,4.5887154 8.0802417,4.7282398 8.0117188,4.8652344 7.9433593,5.0079133 7.8568225,5.1386572 7.7578125,5.2617188 7.7060348,5.3244608 7.6485966,5.3816269 7.5878906,5.4355469 7.5003047,5.5145717 7.3901911,5.5622156 7.28125,5.6035156 7.1552183,5.6506336 7.0221317,5.665665 6.8886719,5.671875 6.7940907,5.675436 6.7011959,5.6717012 6.6074219,5.6601562 6.524039,5.6389473 6.4395727,5.6195185 6.3554688,5.6015625 6.2745388,5.5856395 6.1998145,5.5540174 6.1328125,5.5058594 c -0.01689,-0.012141 -0.028992,-0.022961 -0.037109,-0.03125 0.2265217,0.151495 0.2281395,0.040864 0.1835938,-0.1328125 -0.016972,-0.00728 -0.034199,-0.014424 -0.050781,-0.023437 -0.029309,-0.016155 -0.059248,-0.031522 -0.087891,-0.048828 0,0 -0.00195,-0.00195 -0.00195,-0.00195 C 6.0940254,5.302676 6.0460508,5.3274789 6,5.3300781 5.9185606,5.3346731 5.8387315,5.3091011 5.7578125,5.2988281 5.5507906,5.1986069 5.4569476,4.9804356 5.3847656,4.7773438 5.3525276,4.6782488 5.3307345,4.5773916 5.3046875,4.4765625 5.2782495,4.3817563 5.2695206,4.2835969 5.2695312,4.1855469 5.2677593,4.1057527 5.2790621,4.0264427 5.2988281,3.9492188 5.3289931,3.8254231 5.413894,3.7322464 5.5,3.6445312 c 0.017672,-0.018994 0.037888,-0.036717 0.056641,-0.054687 5.431e-4,-0.00136 0.0014,-0.00255 0.00195,-0.00391 0.016267,-0.040196 0.035718,-0.080403 0.054687,-0.1191406 0.013024,-0.022687 0.025574,-0.045945 0.039063,-0.068359 0.022022,-0.036591 0.050384,-0.062475 0.058594,-0.1074219 C 5.7712025,3.1610968 5.8405659,3.04918 5.9628906,2.96875 c 0.031982,-0.016438 0.063195,-0.03541 0.095703,-0.050781 0.060892,-0.028793 0.1309523,-0.039673 0.1933593,-0.064453 0.094596,-0.027193 0.1891083,-0.05078 0.2851563,-0.072266 0.131824,-0.0289 0.264402,-0.058238 0.3964844,-0.085937 0.064228,-0.013469 0.123227,-0.01961 0.1777343,-0.019531 z" />
+</svg>
diff --git a/pacman-widget/icons/pacman.svg b/pacman-widget/icons/pacman.svg
new file mode 100644
index 0000000..9c1cb2c
--- /dev/null
+++ b/pacman-widget/icons/pacman.svg
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ id="svg7384"
+ version="1.1"
+ height="16"
+ width="16"
+ inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
+ sodipodi:docname="pacman.svg"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1918"
+ inkscape:window-height="1060"
+ id="namedview15"
+ showgrid="true"
+ inkscape:zoom="45.254834"
+ inkscape:cx="6.2866212"
+ inkscape:cy="6.8611455"
+ inkscape:window-x="0"
+ inkscape:window-y="18"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg7384"
+ inkscape:pagecheckerboard="0">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2992" />
+ </sodipodi:namedview>
+ <title
+ id="title9167">Gnome Symbolic Icon Theme</title>
+ <metadata
+ id="metadata90">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Gnome Symbolic Icon Theme</dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs7386" />
+ <g
+ transform="translate(-60,-518)"
+ id="layer9"
+ style="display:inline" />
+ <g
+ transform="translate(-60,-518)"
+ id="layer10" />
+ <g
+ transform="translate(-60,-518)"
+ id="layer11" />
+ <g
+ transform="translate(-60,-518)"
+ id="layer13" />
+ <g
+ transform="translate(-60,-518)"
+ id="layer14" />
+ <g
+ transform="translate(-60,-518)"
+ id="layer15" />
+ <path
+ style="fill:#bebebe;fill-opacity:1;stroke-width:0.00053838;stroke-miterlimit:4;stroke-dasharray:none;stop-color:#000000"
+ d="M 7.137907,15 C 4.7704514,14.776062 2.5561882,13.49017 1.2988905,11.6091 0.79747814,10.858926 0.49643804,10.201556 0.28424508,9.393458 0.10319664,8.703968 0.0591173,8.344087 0.05851897,7.5505417 0.05794903,6.7946932 0.09325863,6.5011405 0.27018463,5.7908221 0.91800602,3.1899639 3.1057688,1.0572385 5.8544488,0.347041 6.4964407,0.1811648 6.8897088,0.1296549 7.676287,0.1084186 c 1.3819864,-0.037311 2.508907,0.1977289 3.727246,0.7773864 0.884514,0.4208305 2.018807,1.267639 2.19481,1.6385382 0.0915,0.1928442 0.0646,0.4652894 -0.06391,0.6471215 -0.05214,0.073786 -1.096508,1.0846044 -2.320797,2.2462633 -1.2242884,1.1616587 -2.2228574,2.1228325 -2.2190416,2.1359417 0.00384,0.013109 1.0256906,0.9973153 2.2708336,2.1871253 1.32711,1.268133 2.291056,2.220522 2.329529,2.301599 0.154458,0.325496 0.04807,0.61462 -0.355908,0.967204 C 11.534053,14.497691 9.3522859,15.209459 7.1379079,15 Z M 7.2640101,5.2005925 C 7.3561446,5.153025 7.5089557,5.0301046 7.6035913,4.9274371 8.1096052,4.3784769 7.934244,3.5083912 7.2501327,3.1736868 6.9136982,3.0090851 6.492102,3.0092422 6.1551549,3.1740968 5.2143239,3.6344027 5.3235795,4.9484956 6.3300682,5.2778973 6.522594,5.3409068 7.0819085,5.2946119 7.2640101,5.2005945 Z"
+ id="path1342" />
+</svg>
diff --git a/pacman-widget/icons/upgrade.svg b/pacman-widget/icons/upgrade.svg
new file mode 100644
index 0000000..0a556ae
--- /dev/null
+++ b/pacman-widget/icons/upgrade.svg
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ width="28"
+ height="24"
+ viewBox="0 0 42 36"
+ fill="none"
+ stroke="#eceff4"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ class="feather feather-refresh-cw"
+ version="1.1"
+ id="svg8"
+ sodipodi:docname="upgrade.svg"
+ inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ id="namedview10"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ showgrid="false"
+ inkscape:zoom="11.313708"
+ inkscape:cx="-18.252194"
+ inkscape:cy="17.942835"
+ inkscape:window-width="1918"
+ inkscape:window-height="1049"
+ inkscape:window-x="1920"
+ inkscape:window-y="29"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg8"
+ width="32px" />
+ <g
+ id="g6"
+ transform="matrix(0.02256226,0,0,0.02256226,-74.040677,-3.6385702)">
+ <path
+ d="M 985.9,987.9 C 868,918.8 744.1,854.8 609.7,825.1 609.1,757 617.6,682.2 572.2,625.1 548.6,584.7 489.1,566.1 452.8,601 392.8,656.4 382.7,747.9 398.7,824.2 258.9,849.9 135,923.2 10,986.8 118.1,782.1 235.4,582 338,374.3 c 14.5,-30.7 28,-74.8 61.7,-33.3 19.7,13.1 81.4,52 80.9,40.3 -30.1,-32.8 -97,-61.9 -93.9,-106.5 39.7,-87.3 74,-177.9 113.3,-264.8 37,73.6 65,152.3 100.9,227 84.8,181.1 181.2,356.5 273.2,533.9 -30,-11.9 -94.2,-46 -102.1,-36.5 47.8,32.4 99.3,62.2 138.8,104.6 28.5,47.7 55.4,96.8 79.2,147 l -0.1,4.3 z"
+ id="path4" />
+ </g>
+ <path
+ style="fill:#ebebeb;fill-opacity:1;stroke-width:0.00090697;stop-color:#000000"
+ d="M 31.312365,26.079447 C 28.861561,24.640024 25.824727,23.328726 23.90615,22.881449 l -0.53218,-0.124073 -0.03624,-1.366789 c -0.04024,-1.518424 -0.110163,-1.892166 -0.505753,-2.70207 -0.304112,-0.622641 -0.783511,-1.162183 -1.24743,-1.403918 -0.47477,-0.247395 -1.189056,-0.262174 -1.622533,-0.03356 -0.587363,0.309743 -1.236011,1.258388 -1.562096,2.284554 -0.179979,0.566406 -0.269097,2.18695 -0.154441,2.808324 0.06674,0.361812 0.06511,0.367764 -0.114835,0.406637 -1.844159,0.398494 -3.568922,1.07367 -6.411086,2.509677 -1.237862,0.62543 -2.2506107,1.115467 -2.2505634,1.088974 1.014e-4,-0.05671 1.3524644,-2.561078 3.6416334,-6.74386 1.863027,-3.404118 3.21703,-5.965324 3.823674,-7.232774 0.228097,-0.47657 0.48113,-0.950863 0.5623,-1.053984 0.199381,-0.253331 0.428941,-0.238696 0.747868,0.0477 0.512495,0.460193 1.891004,1.217829 2.043945,1.123363 0.110221,-0.06808 -0.0086,-0.186519 -0.927327,-0.921778 -0.795428,-0.63685 -1.098936,-0.993674 -1.20206,-1.413264 -0.03012,-0.122524 0.05261,-0.3922934 0.278054,-0.9067054 0.176507,-0.4027635 0.664156,-1.5528645 1.083675,-2.5557755 0.419515,-1.002913 0.867067,-2.053323 0.994556,-2.3342497 l 0.231803,-0.5107764 0.230367,0.485958 c 0.126706,0.2672811 0.568211,1.2706121 0.981126,2.2296271 1.351379,3.1385995 2.446902,5.3647779 5.542579,11.2628389 1.016405,1.936522 1.840078,3.528888 1.830372,3.53858 -0.0099,0.01006 -0.408057,-0.150689 -0.885235,-0.356481 -1.580164,-0.681378 -1.786551,-0.587691 -0.538416,0.244415 1.059544,0.706375 1.898027,1.35257 2.226399,1.715834 0.267759,0.296191 1.00605,1.561684 1.587782,2.721591 0.196862,0.392504 0.357911,0.729908 0.357911,0.749783 0,0.07619 -0.125463,0.01754 -0.767653,-0.359787 z"
+ id="path1172" />
+ <path
+ style="fill:#878787;fill-opacity:1;stroke-width:0.000533639;stop-color:#000000"
+ d="m 29.330098,16.094503 c -0.590752,-0.159911 -1.033235,-0.581029 -1.221172,-1.162327 -0.107553,-0.332651 -0.07298,-0.892872 0.07486,-1.214081 0.208471,-0.452878 0.51303,-0.735522 1.008575,-0.936008 l 0.230087,-0.09306 3.214625,-0.02096 3.21462,-0.02096 -2.167858,-2.036857 C 32.491483,9.4901306 31.248086,8.3192421 30.920724,8.0084311 29.598854,6.7533981 28.477353,5.9626441 27.051365,5.2801931 23.143087,3.4097679 18.627478,3.4465011 14.747442,5.3803271 13.396741,6.0535121 12.299713,6.8327191 11.222858,7.8838131 9.7539457,9.3175716 8.7188163,10.87449 7.9466622,12.811463 7.8026446,13.172784 7.6253278,13.557269 7.5525237,13.666017 7.3649184,13.946303 7.0002189,14.209533 6.6533878,14.314875 5.310285,14.72293 4.0770564,13.488263 4.4898159,12.148907 4.7864744,11.186127 5.5110691,9.6779666 6.1994067,8.5903731 8.8328447,4.4294471 13.059083,1.5838964 17.908191,0.70679876 c 1.143939,-0.2069187 1.689047,-0.2502233 3.119721,-0.2481617 1.388065,0.0021 1.805151,0.034215 2.955522,0.2276378 2.823964,0.47471094 5.689344,1.76721174 7.950832,3.58640494 0.58105,0.4674073 0.458059,0.3541283 4.012223,3.6951513 1.392989,1.3094665 2.54955,2.3868629 2.570106,2.3942319 0.02223,0.0077 0.042,-1.3885429 0.04857,-3.4481149 l 0.011,-3.4614969 0.131014,-0.276708 c 0.24494,-0.5171085 0.742023,-0.884402 1.32364,-0.9780706 0.658639,-0.1060599 1.39903,0.2539623 1.748542,0.8504537 0.234472,0.4002314 0.226414,0.1643261 0.214584,6.2386623 l -0.01052,5.5815444 -0.152893,0.309451 c -0.186979,0.378336 -0.46005,0.646358 -0.843591,0.828045 l -0.276195,0.130751 -5.58266,0.0077 c -4.71328,0.0066 -5.616214,-0.0012 -5.798137,-0.05049 z"
+ id="path4066" />
+ <path
+ style="fill:#878787;fill-opacity:1;stroke-width:0.000533639;stop-color:#000000"
+ d="m 19.899076,35.385093 c -0.0903,-0.0086 -0.376633,-0.03586 -0.636257,-0.06043 -1.160639,-0.10916 -2.644653,-0.4285 -3.797028,-0.817051 C 13.499409,33.844618 11.65667,32.840207 10.080523,31.572311 9.4965009,31.102514 9.5963951,31.194525 6.0692991,27.877153 4.6770606,26.567695 3.5205913,25.490298 3.4993725,25.482941 c -0.023934,-0.0077 -0.042856,1.310817 -0.04977,3.448109 l -0.010804,3.461485 -0.1310536,0.276746 C 2.900133,33.529984 1.8831288,33.897274 1.0066675,33.500358 0.75231493,33.385181 0.38394112,33.049896 0.23786606,32.800651 7.576168e-4,32.39607 0.0092101,32.638965 0.02100209,26.560355 l 0.0105857,-5.579395 0.1307513,-0.275972 C 0.34404727,20.321414 0.61206897,20.048372 0.9904031,19.861389 l 0.3094657,-0.152957 h 5.6463547 c 5.3660685,0 5.6570585,0.0034 5.8618655,0.0751 0.217409,0.07576 0.244778,0.102086 0.180045,0.173241 -0.01943,0.02162 -0.102602,0.163649 -0.184754,0.316117 -0.08211,0.152437 -0.217722,0.401761 -0.301351,0.554166 -0.08361,0.152438 -0.402827,0.73887 -0.709271,1.3033 l -0.557199,1.02623 -2.5353287,0.02096 -2.5353302,0.02096 2.14655,2.016638 c 1.1805955,1.109151 2.4236219,2.279682 2.7622829,2.601194 0.685457,0.650745 1.24527,1.121938 1.821318,1.532985 1.710335,1.220438 3.738637,2.055271 5.84084,2.404031 1.561885,0.259117 3.217235,0.24481 4.812744,-0.04183 3.136552,-0.56321 6.090143,-2.275163 8.171926,-4.736603 0.998887,-1.181063 1.760106,-2.459966 2.357743,-3.961218 0.29991,-0.753296 0.43486,-0.969806 0.756696,-1.213756 0.788772,-0.597922 1.9416,-0.401049 2.48876,0.425011 0.164922,0.249032 0.288147,0.656381 0.288147,0.952931 0,0.366148 -0.229764,1.032894 -0.722368,2.096277 -2.398135,5.176643 -7.168457,8.85827 -12.782732,9.865428 -1.016206,0.182271 -1.628323,0.235372 -2.873434,0.24939 -0.643436,0.0071 -1.243783,0.0057 -1.334083,-0.0027 z"
+ id="path4105" />
+</svg>
diff --git a/pacman-widget/pacman.lua b/pacman-widget/pacman.lua
new file mode 100644
index 0000000..3f6a930
--- /dev/null
+++ b/pacman-widget/pacman.lua
@@ -0,0 +1,256 @@
+local naughty = require("naughty")
+local wibox = require("wibox")
+local awful = require("awful")
+local beautiful = require("beautiful")
+local gears = require("gears")
+
+local DIR = os.getenv("HOME") .. "/.config/awesome/pacman-widget/"
+local ICON_DIR = DIR .. "icons/"
+
+local pacman_widget = {}
+local config, timer = {}, {}
+
+config.interval = 600
+config.popup_bg_color = "#222222"
+config.popup_border_width = 1
+config.popup_border_color = "#7e7e7e"
+config.popup_height = 10
+config.popup_width = 300
+config.polkit_agent_path = "/usr/bin/lxpolkit"
+
+local function worker(user_args)
+ local args, _config = user_args or {}, {}
+ for prop, value in pairs(config) do
+ _config[prop] = args[prop] or beautiful[prop] or value
+ end
+
+ awful.spawn.once(_config.polkit_agent_path)
+
+ pacman_widget = wibox.widget {
+ {
+ {
+ id = "icon",
+ resize = false,
+ widget = wibox.widget.imagebox,
+ },
+ valign = "center",
+ layout = wibox.container.place,
+ },
+ {
+ id = "txt",
+ font = args.font,
+ widget = wibox.widget.textbox
+ },
+ spacing = 5,
+ layout = wibox.layout.fixed.horizontal,
+ }
+ function pacman_widget.set(new_value)
+ pacman_widget:get_children_by_id("txt")[1]:set_text(new_value)
+ pacman_widget:get_children_by_id("icon")[1]:set_image(
+ ICON_DIR .. (tonumber(new_value) > 0 and "pacman" or "pacman-full") .. ".svg"
+ )
+ end
+
+ local rows, ptr = wibox.layout.fixed.vertical(), 0
+ rows:connect_signal("button::press", function(_,_,_,button)
+ if button == 4 then
+ if ptr > 0 then
+ rows.children[ptr].visible = true
+ ptr = ptr - 1
+ end
+ elseif button == 5 then
+ if ptr < #rows.children and ((#rows.children - ptr) > _config.popup_height) then
+ ptr = ptr + 1
+ rows.children[ptr].visible = false
+ end
+ end
+ end)
+
+ local popup = awful.popup {
+ border_width = _config.popup_border_width,
+ border_color = _config.popup_border_color,
+ shape = gears.shape.rounded_rect,
+ visible = false,
+ ontop = true,
+ offset = { y = 5 },
+ widget = {}
+ }
+
+ pacman_widget:buttons(
+ awful.util.table.join(
+ awful.button({}, 1, function()
+ if popup.visible then
+ popup.visible = false
+ else
+ popup.visible = true
+ popup:move_next_to(_G.mouse.current_widget_geometry)
+ end
+ end)
+ )
+ )
+
+ local upgr_opacity = 0.6
+ local upgr_btn = wibox.widget {
+ {
+ image = ICON_DIR .. "upgrade.svg",
+ resize = false,
+ layout = wibox.widget.imagebox
+ },
+ opacity = upgr_opacity,
+ layout = wibox.container.background
+ }
+
+ local old_cursor, old_wibox
+ local busy, upgrading = false, false
+ upgr_btn:connect_signal("mouse::enter", function(c)
+ if not busy then
+ c:set_opacity(1)
+ c:emit_signal("widget::redraw_needed")
+ local wb = _G.mouse.current_wibox
+ old_cursor, old_wibox = wb.cursor, wb
+ wb.cursor = "hand2"
+ end
+ end)
+ upgr_btn:connect_signal("mouse::leave", function(c)
+ if not busy then
+ c:set_opacity(upgr_opacity)
+ c:emit_signal("widget::redraw_needed")
+ if old_wibox then
+ old_wibox.cursor = old_cursor
+ old_wibox = nil
+ end
+ end
+ end)
+ upgr_btn:connect_signal("button::press", function(c)
+ c:set_opacity(1)
+ c:emit_signal("widget::redraw_needed")
+ if old_wibox then
+ old_wibox.cursor = old_cursor
+ old_wibox = nil
+ end
+ if not busy then
+ busy = true
+ local one_shot = true
+ awful.spawn.with_line_callback("bash -c " .. DIR .. "upgrade", {
+ stdout = function()
+ if one_shot then
+ upgrading, one_shot = true, false
+ timer:emit_signal("timeout")
+ end
+ end,
+ stderr = function(line)
+ if (line ~= nil and line ~= "") then
+ if string.find(line, "warning") then
+ naughty.notify({
+ title = "Warning!",
+ text = line,
+ timeout = 0
+ })
+ else
+ naughty.notify({
+ preset = naughty.config.presets.critical,
+ title = "Error!",
+ text = line,
+ })
+ end
+ end
+ end,
+ exit = function()
+ upgrading, busy = false, false
+ c:set_opacity(upgr_opacity)
+ c:emit_signal("widget::redraw_needed")
+ timer:emit_signal("timeout")
+ end,
+ })
+ end
+ end)
+
+ timer = select(2, awful.widget.watch([[bash -c "checkupdates 2>/dev/null"]],
+ _config.interval,
+ function(widget, stdout)
+ local upgrades_tbl = {}
+ for value in stdout:gmatch("([^\n]+)") do
+ upgrades_tbl[#upgrades_tbl+1] = value
+ end
+ widget.set(#upgrades_tbl)
+
+ local popup_header_height, popup_row_height = 30, 20
+ local header = wibox.widget {
+ {
+ nil,
+ {
+ markup = "<b>" .. (upgrading and "Upgrading " .. #upgrades_tbl .. " Packages" or
+ (#upgrades_tbl == 0 and "No" or #upgrades_tbl) .. " Available Upgrades") .. "</b>",
+ layout = wibox.widget.textbox,
+ },
+ #upgrades_tbl > 0 and {
+ upgr_btn,
+ valign = "center",
+ layout = wibox.container.place,
+ },
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+ },
+ forced_height = popup_header_height,
+ left = 20,
+ right = 20,
+ layout = wibox.container.margin
+ }
+
+ for k, v in ipairs(upgrades_tbl) do
+ for i = 1, #rows.children do
+ if v == rows.children[i].get_txt() then goto continue end
+ end
+ local row = wibox.widget{
+ {
+ id = "idx",
+ text = tostring(k),
+ widget = wibox.widget.textbox
+ },
+ {
+ id = "txt",
+ text = v,
+ forced_height = popup_row_height,
+ paddings = 1,
+ widget = wibox.widget.textbox
+ },
+ layout = wibox.layout.ratio.horizontal,
+ }
+ function row.get_txt() return row:get_children_by_id("txt")[1].text end
+ function row.set_idx(idx) row:get_children_by_id("idx")[1]:set_text(idx) end
+ row:ajust_ratio(2, 0.1, 0.9, 0)
+ rows:insert(k, row)
+ ::continue::
+ end
+
+ local height = popup_header_height + math.min(#upgrades_tbl, _config.popup_height) * popup_row_height
+ popup:setup {
+ {
+ {
+ {
+ {
+ header,
+ rows,
+ forced_height = height,
+ layout = wibox.layout.fixed.vertical
+ },
+ content_fill_horizontal = true,
+ layout = wibox.container.place
+ },
+ margins = 10,
+ layout = wibox.container.margin
+ },
+ bg = _config.popup_bg_color,
+ layout = wibox.widget.background
+ },
+ forced_width = _config.popup_width,
+ layout = wibox.layout.fixed.horizontal
+ }
+ end,
+ pacman_widget
+ ))
+ return pacman_widget
+end
+
+return setmetatable(pacman_widget, { __call = function(_, ...) return worker(...) end })
+
diff --git a/pacman-widget/screenshots/pacman.gif b/pacman-widget/screenshots/pacman.gif
new file mode 100644
index 0000000..1c26bcc
--- /dev/null
+++ b/pacman-widget/screenshots/pacman.gif
Binary files differ
diff --git a/pacman-widget/upgrade b/pacman-widget/upgrade
new file mode 100755
index 0000000..af2f9f7
--- /dev/null
+++ b/pacman-widget/upgrade
@@ -0,0 +1,2 @@
+#!/bin/bash
+pkexec --disable-internal-agent pacman -Syu --noconfirm