Skip to content

Instantly share code, notes, and snippets.

@juju2143
Last active December 14, 2015 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juju2143/aece6992955462333712 to your computer and use it in GitHub Desktop.
Save juju2143/aece6992955462333712 to your computer and use it in GitHub Desktop.
swaybar replacement with conky
conky.config = {
out_to_x = true,
alignment = 'bottom_left',
background = false,
border_width = 1,
cpu_avg_samples = 2,
default_color = 'white',
default_outline_color = 'white',
default_shade_color = 'white',
double_buffer = true,
draw_borders = false,
draw_graph_borders = true,
draw_outline = false,
draw_shades = false,
use_xft = true,
font = 'DejaVu Sans Mono:size=9',
gap_x = 0,
gap_y = 0,
minimum_height = 16,
minimum_width = 1440,
net_avg_samples = 2,
no_buffers = true,
out_to_console = false,
out_to_stderr = false,
extra_newline = false,
own_window = true,
own_window_class = 'Conky',
own_window_colour = 'black',
own_window_type = 'panel',
own_window_title = 'Conky',
stippled_borders = 0,
update_interval = 1.0,
uppercase = false,
use_spacer = 'none',
show_graph_scale = false,
show_graph_range = false,
short_units = true,
lua_load = '~/.config/conky/i3.lua'
}
conky.text =
"${lua_parse i3_get_workspaces} "..
"CPU ${freq_g 1}GHz ${cpu cpu1}% ${freq_g 2}GHz ${cpu cpu2}% | "..
"RAM $memperc% | "..
"FS / ${fs_used_perc /}% | "..
"${wireless_essid wlp11s0} ${wireless_link_qual_perc wlp11s0}% "..
"${addr wlp11s0} ${color red}↑${color}${upspeed wlp11s0} ${color green}↓${color}${downspeed wlp11s0} "..
"${wireless_essid wlan0} ${wireless_link_qual_perc wlan0}% "..
"${addr wlan0} ${color red}↑${color}${upspeed wlan0} ${color green}↓${color}${downspeed wlan0} "..
"$alignr$time"
-- Call this file in lua_load of your conky.config
-- Add ${lua_parse i3_get_workspaces} in your conky.text
-- You'll need lua-lgi (in extra) and i3ipc-glib-git (in AUR) so it works.
-- It should work with both i3 and sway
do
i3ipc = (require 'lgi').i3ipc
conn = i3ipc.Connection{socket_path=os.getenv("I3SOCK")}
function conky_i3_get_workspaces()
local workspaces = conn:get_workspaces()
s="${color}"
for _,v in ipairs(workspaces) do
str="["
if v.urgent then
str=str.."${color red}"
elseif v.focused then
str=str.."${color green}"
elseif v.visible then
str=str.."${color orange}"
end
str=str..v.name
if v.urgent or v.focused or v.visible then
str=str.."${color}"
end
str=str.."]"
s=str..s
end
return s
end
end
# Add those 4 lines in your sway config
exec "swaybar 0"
exec "conky"
for_window [class="Conky"] floating enable
for_window [class="Conky"] sticky enable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment