how to add padding to my alacritty terminal in awesomeWM - terminal

So, Im slowly learning lua, awesomewm, and how to configure my os. Now I have a beautiful terminal, but it has no padding, so characters basically touch the edge and its not very aesthetic. Im not sure if I should configure my rc.lua (awesomewm config file) or the alacritty config file. Here is a picture.
https://i.stack.imgur.com/la5AV.png
EDIT:
¦ -- Terminal config
¦ {
¦ ¦ rule_any = {
¦ ¦ ¦ class = {
¦ ¦ ¦ ¦ "Alacritty",
¦ ¦ ¦ },
¦ ¦ }, properties = {beautiful.useless_gap = 200}
¦ },
I just tried this snippet but it returns an error.

You're likely looking for Alacritty's padding options.
window:
padding:
x: 0
y: 0
Increasing gaps in Awesome will increase the space between windows, but it won't change anything about what a single window renders inside its boundaries.

You are looking to adding a "gap" to the "tag layout". See https://awesomewm.org/apidoc/core_components/tag.html#gap . The easiest way is to set this theme variable https://awesomewm.org/apidoc/core_components/tag.html#beautiful.useless_gap

Related

Graphviz arrowhead doesn't work when dir=back

I can't figure out how to change the tail of an edge.
No problem with the arrow head, for example this works fine
digraph foo {
x->y [arrowhead=odot]
}
But since I want to change the tail I tried to invert the direction:
digraph foo {
x->y [arrowhead=odot dir=back]
}
This doesn't work, the arrow gets back to the default style.
Also the arrowtail attribute seems not to work, I always get the default style
digraph foo {
x->y [arrowtail=odot]
}
You almost had it - not all combinations of dir, arrowhead and arrowtail are valid.
Here's what works for which dir value:
dir arrowhead arrowtail
-----------------------------
forward x
back x
both x x
none
Therefore, the following should work in your case:
digraph foo {
x->y [arrowtail=odot, dir=back]
}
dir determines which arrows are allowed to be displayed. Which end of the arrow is the head and which end is considered to be the tail doesn't change.

Sprite loading in compass

I am learning how to use Compass from a tutorial that is about 4 years old. My problem is that the sprites are not loading at all, although the directory listed in the error is the correct location of the sprites.
I receive these two error messages:
Failed to load resource: net::ERR_EMPTY_RESPONSE (12:12:47:223 | error, network)
at http://localhost:8383/images/spr-sf52e1e883c.png
Failed to load resource: net::ERR_EMPTY_RESPONSE (12:13:45:615 | error, network)
at http://localhost:8383/images/pitch-s4b17d3ee2e.png
This looks like the correct address to me given the directory structure of my project. See the image attached.
I discovered either my sprite files are in the incorrect location or my generated css is incorrect in where the sprite files are located. Below is the code generate in the CSS.
/* ===================================================== */
/* Sprites
/* ===================================================== */
.spr-sprite, header h1 {
background-image: url('/images/spr-sf52e1e883c.png');
background-repeat: no-repeat;
}
.pitch-sprite, .pitch.left div, .pitch.middle div, .pitch.right div {
background-image: url('/images/pitch-s4b17d3ee2e.png');
background-repeat: no-repeat;
}
What works is to back up one directory in the calling the sprite:
.spr-sprite, header h1 {
background-image: url('../images/spr-sf52e1e883c.png');
background-repeat: no-repeat;
}
.pitch-sprite, .pitch.left div, .pitch.middle div, .pitch.right div {
background-image: url('../images/pitch-s4b17d3ee2e.png');
background-repeat: no-repeat;
}
Now I can see sprites.
What I don’t know is where to look to resolve this issue and I hope my description is enough for someone to offer me advice
All of my research points to using the configuration parameter “relative_assests = true”, to resolve this but I can’t seem to convince my compass project to give me relative directories “../” for my sprite images. I compile my sprites with this configuration file.
/* ===================================================== */
/* Sprites
/* ===================================================== */
#import "spr/*.png";
#import "pitch/*.png";
And this is my config.rb
# Require any additional compass plugins here.
# -----------------------------------------------------------------------------
project_path = File.expand_path("..",File.dirname(__FILE__))
# Set this to the root of your project when deployed:
# -----------------------------------------------------------------------------
relative_assets = true
http_images_dir = "images"
http_path = "/"
css_dir = "css"
sass_dir = "scss"
images_dir = "images"
javascripts_dir = "js"
# Output style and comments
# -----------------------------------------------------------------------------
# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
# Over-ride with force compile to change output style with: compass compile --output-style compressed --force
output_style = :expanded
#environment = :development
line_comments = false
cache = true
color_output = false # required for Mixture
require 'sass-globbing'
# Obviously
preferred_syntax = :scss
# SASS core
# -----------------------------------------------------------------------------
# Chrome needs a precision of 7 to round properly
Sass::Script::Number.precision = 7
I wonder if anyone sees a problem
There is something I don't know what incorrect in the config.rb file. By substituting one from another tutorial it worked.

Rectangle with points uniformly distributed inside in Tikz

I'm trying to draw a rectangle wit random points inside using tikz. My attempt is this:
\documentclass[tikz]{standalone}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usetikzlibrary{calc}
\pgfmathsetseed{20}
\tikzset{
particle/.style = {draw,circle,inner sep=0,outer sep=0,minimum size=3}
}
\tikzset{
pics/PE/.style
2 args={
code={
\node[
draw,rectangle,
minimum width=80,minimum height=40] (main) at (0,0) {};
\foreach \i in {1,...,#2}
{
\path let \p1 = (main.south west), \p2 = (main.north east) in
node[particle] at
($ (main.south west) + ({random(\x1,\x2)},{random(\y1,\y2)}) $) {};
}
}
}
}
\begin{document}
\begin{tikzpicture}
\draw pic {PE={1}{30}};
\end{tikzpicture}
\end{document}
...but this doesn't work. It seems I cannot use a coordinate inside a call to the random function. Is that so? Any workaround?
Cheers!!
For what is worth, I ended up doing it like this (probably not the best solution...)
\newcommand{\PEwidth}{10}
\newcommand{\PEheight}{5}
\tikzset{
pics/PE/.style
2 args={
code={
\draw (0,0) rectangle (\PEwidth,\PEheight);
\foreach \i in {1,...,#2}
{
\pgfmathsetmacro\x{0.1*\PEwidth + 0.8*\PEwidth*rnd}
\pgfmathsetmacro\y{0.1*\PEheight + 0.8*\PEheight*rnd}
\node[particle] at (\x,\y) (-\i) {};
}
}
}
}

Graphviz: change font for the whole graph?

I am wondering if I can define an alternative font for the whole graph.
...
digraph script_concept {
graph [layout="dot",fontname="helvetica"];
...
According to this 1 older post the fontname atribute can be defined only separately:
Nodes and edges don't inherit the font of the graph, you need to specify
them separately
Is there any other way, how to define the font globally?
No, there is no other way.
As in the forum post you linked, you have to define the default values separately (like the other attributes) at the beginning of your graphviz file:
digraph g {
graph [fontname = "helvetica"];
node [fontname = "helvetica"];
edge [fontname = "helvetica"];
...
}
Not sure if this is a recent update, but you can change these at the command-line level using the -G, -E and -N attribute flags. That is, the following works for me:
$ dot -Tpng -Nfontname=Roboto -Nfontsize=10 \
-Efontname=Roboto -Efontsize=10 \
tree.dot > tree.png
However, there's one easy trick, if you are exporting svgs:
sed 's/Times,serif/Helvetica/g' thegraph.svg > thegraph_helvetica.svg
combine this with Make and all the horror will be hidden :)
here's an example Makefile:
all: helvetica
svg:
cat thegraph.dot | dot -Tsvg > thegraph.svg
helvetica: svg
sed 's/Times,serif/Helvetica/g' thegraph.svg > thegraph_helvetica.svg

Problems with designing UML - like diagrams in graphviz

I'm currently having issues with designing UML-like diagrams on graphiz. The reason for the problem is that they are not exactly UML diagrams. The main difference is that I make use of indentations to add an hierarchy to an object's properties. Implementing these idiosyncrasies is a little difficult for me. What I'm trying to achieve is this:
I normally use a node shape called record to design these diagrams. The problem arises when I have to link two of these UML-like diagrams just like relationships in UML i.e. aggregation, association, composition, etc.
When I have the diagrams, I can't make the relationship with the arrows because the arrows only go from a random part of one node to another random part of the other node.
The way I have the UML-like diagrams is good, but the relationship arrow causes it not to be what I want as I want the arrows to go from a specific point of one node to another specific point of another node.
The DOT code I used to create this graph is like this:
digraph G {
fontname = "Bitstream Vera Sans"
fontsize = 8
node [
fontname = "Bitstream Vera Sans"
fontsize = 8
shape = "record"
]
edge [
fontname = "Bitstream Vera Sans"
fontsize = 8
]
Person [
label = "{Person \l\l \ age : int\l \ livesIn : City \l \ \ \ sinceYear : int}"
] // \l -new line, \ -indentation
City [
label = "{City \l \ \ name : string}"
]
Person -> City
}
I tried getting around this problem by using horizontal line divisions within the nodes even though I didn't want the lines. The horizontal line divisions make it possible for me to make this specific relationship possible by using ports, but they create a new problem of their own. The problem they create is that they get rid of the indentations I want and had in the previous graph. The way I tried to get around the arrow problems works, but new problems are created - the indentation disappears and the horizontal line divisions can't be made invisible
.
The code I used to create this graph is:
digraph G {
fontname = "Bitstream Vera Sans"
fontsize = 8
node [
fontname = "Bitstream Vera Sans"
fontsize = 8
shape = "record"
penwidth = 0.5
]
edge [
fontname = "Bitstream Vera Sans"
fontsize = 8
]
Person [
label = "{<g0> Person | <g1> age : int | <g2> livesIn : City | <g3> sinceYear : int}"
] // \l -new line, \ -indentation
City [
label = "{<f0> City | <f1> name : string}"
]
Person:<g2> -> City:<f1> [arrowhead = "empty", headlabel = "*"]
}
These indentations are a big part of the relationship, so I'm wondering if anyone knows what I can do to have these indentations back in the diagrams as well what I can do to make the horizontal line divisions invisible?
I'll appreciate if someone has a better way/idea that's also totally different from what I have done in diagrams 2 & 3, that will help me achieve diagram 1.
Your original attempt wasn't bad. I would say using ports is definitely the way to go.
If you place the node in a cluster you can use the cluster's border and hide the border of the record node, getting rid of those divider lines.
As you noted, using a backslash \ no longer works to escape a space. The workaround is to either use \ instead, this will escape the whitespace. As an alternative you could also replace each space with an &nnbsp;. Either one will achieve the required effect.
I made some minor changes to make things more readable, like put Graph properties in a graph block instead of in the root of the graph and rename the port-names to something more sensible. I also removed any ports not in use.
The final result I came up with was this:
...and this is the DOT code I used:
digraph G {
graph [
compound = true // To clip the head at the cluster border
penwidth = 2 // Make the cluster's borders a bit thicker
rankdir = "LR" // Make the arrow and nodes go from Left to Right
ranksep = 1 // Add a bit more space inbetween nodes
]
node [
color = none // Hide the node's border
fontname = "Bitstream Vera Sans"
height = 0 // Make the node as small as possible (it will grow if it needs more space)
margin = 0 // Remove unneeded whitespace
shape = "record" // So we can use ports
]
edge [
arrowhead = "open"
labelangle = -5 // Place the asteriks closer to the line
labeldistance = 2.5 // Place the asteriks further away from the arrow head
penwidth = 2 // Make the line a bit thicker
]
/* #NOTE: escaping spaces in the label using '\' doesn't work so use '&nbsp' or '&#92' instead. */
subgraph cluster_Person {
Person [
label = "\N\l | \ \ \ age : int\l | <livesIn> \ \ \ livesIn : City\l | \ \ \ \ \ \ sinceYear : int\l"
]
}
subgraph cluster_City {
City [
label = "<city> \N\l | \ \ \ name : string\l"
]
}
Person:livesIn -> City:city [headlabel = "*", lhead = "cluster_City"] // lhead allows us to point to the cluster's border instead of the node, as long as we add `compound = true` to the graph
}

Resources