Koristim widget za Memory koji mi ne pokazuje većinu podataka.
mem.sh
Kod: Označi sve
#!/bin/bash
# Run sudo dmidecode commands and redirect output to mem.txt
> mem.txt
sudo dmidecode --type memory | grep "Number Of Devices" | sed 's/^[ \t]*//' > mem.txt
sudo dmidecode --type memory | awk '/Memory Device/{flag=1; next} flag && $1=="Size:"{print "Size:", $2; exit}' >> mem.txt
sudo dmidecode --type memory | grep "Maximum Capacity" | sed 's/^[ \t]*//' >> mem.txt
sudo dmidecode --type memory | awk '/Memory Device/{flag=1; next} flag && $1=="Type:"{print "Type:", $2; exit}' >> mem.txt
sudo dmidecode --type memory | awk '/Memory Device/{flag=1; next} flag && $1=="Speed:"{print "Speed:", $2" "$3; exit}' >> mem.txt
sudo dmidecode --type memory | grep -m1 "Configured Voltage" | sed 's/^[[:blank:]]*//' >> mem.txt
sudo dmidecode --type memory | awk '/Memory Device/ {flag=1; next} flag && $1=="Form" && $2=="Factor:" {print "Form Factor:", $3; exit}' >> mem.txt
sudo dmidecode --type memory | awk '/Memory Device/,/Type Detail/ {if ($0 ~ /Type Detail/) {print "Type Detail:", $3; exit}}' >> mem.txt
Kod: Označi sve
-- Load Cairo functions (explicitly require the library)
require 'cairo'
-- Function to draw a rectangle with rounded corners
function draw_rounded_rectangle(cr, x, y, width, height, roundness, color, thickness)
-- Set the color for the outline
cairo_set_source_rgba(cr, color[1], color[2], color[3], color[4])
-- Set the thickness of the outline
cairo_set_line_width(cr, thickness)
-- Calculate the radius of rounded corners based on the given percentage (roundness)
local radius = math.min(width, height) * (roundness / 100)
-- Draw the rounded rectangle
cairo_new_sub_path(cr)
cairo_arc(cr, x + width - radius, y + radius, radius, -math.pi / 2, 0) -- Top-right corner
cairo_arc(cr, x + width - radius, y + height - radius, radius, 0, math.pi / 2) -- Bottom-right corner
cairo_arc(cr, x + radius, y + height - radius, radius, math.pi / 2, math.pi) -- Bottom-left corner
cairo_arc(cr, x + radius, y + radius, radius, math.pi, 3 * math.pi / 2) -- Top-left corner
cairo_close_path(cr)
-- Stroke the outline to actually draw it
cairo_stroke(cr)
end
-- Main Conky function
function conky_main()
if conky_window == nil then return end
-- Create a Cairo drawing context
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
-- Set the color to white with full opacity
local white = {1, 1, 1, 1} -- (R, G, B, A)
-- Set the roundness percentage here (e.g., 20 for 20% rounded corners)
local roundness_percentage = 10
-- Draw the rounded rectangle outline
draw_rounded_rectangle(cr, 2, 2, 254, 280, roundness_percentage, white, 1)
-- Clean up
cairo_destroy(cr)
cairo_surface_destroy(cs)
end
Kod: Označi sve
--[[
Bleys 2024
]]
conky.config = {
-- — Conky settings
background = false,
alignment = 'middle_middle',
gap_x = -100,
gap_y = -430,
minimum_width = 240,
minimum_height = 420,
font = 'Copperplate Gothic Light:size=9',
use_xft = true,
border_inner_margin = 10,
draw_graph_borders = true,
draw_outline = false,
double_buffer = true,
no_buffers = true,
-- Window Settings --
background = false,
border_width = 0,
draw_borders = false,
draw_graph_borders = false,
draw_outline = false,
draw_shades = false,
own_window = true,
own_window_colour = '000000',
own_window_class = 'Conky',
own_window_argb_visual = true,
own_window_argb_value = 0,
own_window_type = 'dock',
own_window_transparent = true,
own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
stippled_borders = 0,
update_interval = 5,
total_run_times = 0,
color0 = 'ffffff',
color1 = '8dddff',
lua_load = './transparent-image.lua mem_box.lua',
lua_draw_hook_post = 'conky_main',
};
conky.text = [[
${execpi 43200 ./mem.sh}
${lua conky_image ./images/ram8.png 10 14 63 64}${color1}${font Copperplate Gothic Light:size=14}${voffset 20 }${offset 100}Memory${font}
${voffset 22}${execpi 5 awk 'NR==1 {printf "${color1}Number of Devices: ${color0}${alignr 8} %s\n", $4}' ./mem.txt}
${execpi 5 awk 'FNR==4 {printf "${color1}Memory Type: ${color0}${alignr 8}%s\n", $2; exit}' ./mem.txt}
${execpi 5 awk 'FNR==2 {printf "${color1}Max Size per Device: ${color0}${alignr 8}%s GB\n", $2}' ./mem.txt}
${execpi 5 awk 'FNR==8 {printf "${color1}Type Detail: ${color0}${alignr 8}%s\n", $3}' ./mem.txt}
${execpi 5 awk 'FNR==3 {printf "${color1}Maximum Capacity: ${color0}${alignr 8}%s GB\n", $3 GB}' ./mem.txt}
${execpi 5 awk 'FNR==5 {printf "${color1}Speed: ${color0}${alignr 8}%s %s\n", $2, $3; exit}' ./mem.txt}
${execpi 5 awk 'FNR==7 {printf "${color1}Form Factor: ${color0}${alignr 8}%s\n", $3}' ./mem.txt}
${execpi 5 awk 'FNR==6 {printf "${color1}Configured Voltage: ${color0}${alignr 8}%s\n", $3" "$4}' ./mem.txt}
${color1}RAM : ${color0}${alignr 8}${mem}/${memmax} ${alignr}${memperc}%
${membar 8,236}
${color1}SWAP: ${color0}${alignr 8}${swap}/${swapmax} ${alignr}${swapperc}%
${swapbar 8,236}
]];
Nakon što widget pokrenem u Terminalu i unesem lozinku dobijem ovo:
U /usr/share/polkit-1/actions napravio sam datoteku pod nazivom 'org.mandak.dmidecode.policy'.
Kod: Označi sve
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
<policyconfig>
<vendor>The Mandak Project</vendor>
<vendor_url>http://www.mandak.org/</vendor_url>
<icon_name>dmidecode</icon_name>
<action id="org.mandak.dmidecode">
<description gettext-domain="dmidecode">Run dmidecode as root</description>
<message gettext-domain="dmidecode">Authentication is NOT required to run dmidecode as root</message>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/dmidecode</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">false</annotate>
</action>
</policyconfig>