🆕 New Post on Pywal
This commit is contained in:
parent
eed7133038
commit
f97c649653
|
@ -0,0 +1,167 @@
|
||||||
|
---
|
||||||
|
author: "Devoalda"
|
||||||
|
authorEmoji: 🐺
|
||||||
|
title: "Pywal"
|
||||||
|
date: 2020-09-21T15:22:09+08:00
|
||||||
|
description: How I use pywal
|
||||||
|
draft: false
|
||||||
|
hideToc: false
|
||||||
|
enableToc: true
|
||||||
|
enableTocContent: true
|
||||||
|
tocPosition: inner
|
||||||
|
tocLevels: ["h1", "h2", "h3"]
|
||||||
|
tags:
|
||||||
|
- arch
|
||||||
|
- linux
|
||||||
|
- pywal
|
||||||
|
series:
|
||||||
|
- Linux
|
||||||
|
categories:
|
||||||
|
- arch
|
||||||
|
- linux
|
||||||
|
image: images/postImages/Rainbow.svg
|
||||||
|
---
|
||||||
|
|
||||||
|
# Introduction
|
||||||
|
|
||||||
|
[Pywal](https://github.com/dylanaraps/pywal) is a incredible script for colorscheme generation and theming/ricing Linux desktops. Pywal will generate colors based on the image given to the script, it will then make that image the wallpaper.
|
||||||
|
|
||||||
|
In this article, I will share about how I integrated this script with my desktop.
|
||||||
|
|
||||||
|
Checkout my [Desktop](https://devoalda.gitlab.io/gallery/carnage/) themed with pywal
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
|
||||||
|
I use the Arch linux AUR:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yay -S python-pywal
|
||||||
|
```
|
||||||
|
|
||||||
|
# Window Manager/Status Bar
|
||||||
|
|
||||||
|
## Xmonad/Xmobar
|
||||||
|
|
||||||
|
{{< img src="https://devoalda.gitlab.io/gallery/Carnage/Carnage%20Xmonad%20050720201.png" alt="archlinux" position="center" >}}
|
||||||
|
I use Xmonad as my Linux window manager, here are my [Configurations](https://gitlab.com/devoalda/dotdrop-dotfiles/-/blob/master/dotfiles/xmonad/xmonad.hs)
|
||||||
|
|
||||||
|
Adding the following lines of code, I am able to use pywal to dynamically theme my status bars
|
||||||
|
|
||||||
|
```Haskell
|
||||||
|
-- Colors
|
||||||
|
import Control.Monad(when)
|
||||||
|
import Data.List
|
||||||
|
import System.Directory
|
||||||
|
import System.Environment
|
||||||
|
import System.Exit
|
||||||
|
import System.IO
|
||||||
|
|
||||||
|
getConfigFilePath f =
|
||||||
|
getHomeDirectory >>= \hd -> return $ hd ++ "/" ++ f
|
||||||
|
|
||||||
|
getWalColors = do
|
||||||
|
file <- getConfigFilePath ".cache/wal/colors"
|
||||||
|
contents <- readFile file
|
||||||
|
let colors = lines contents
|
||||||
|
return (colors ++ (replicate (16 - length colors) "#000000"))
|
||||||
|
```
|
||||||
|
|
||||||
|
My main method consists of the function `getWalColors` and uses the colors generated by pywal to theme the statusbar
|
||||||
|
|
||||||
|
```Haskell
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
---MAIN
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
main = do
|
||||||
|
nScreens <- countScreens
|
||||||
|
colors <- getWalColors
|
||||||
|
xmproc <- spawnPipe "xmobar ~/.xmonad/xmobarrc"
|
||||||
|
xmonad $ ewmh $ desktopConfig
|
||||||
|
{ manageHook = ( isFullscreen --> doFullFloat ) <+> manageDocks <+> myManageHook <+> manageHook desktopConfig
|
||||||
|
, modMask = myModMask
|
||||||
|
, terminal = myTerminal
|
||||||
|
, startupHook = myStartupHook
|
||||||
|
, layoutHook = myLayoutHook
|
||||||
|
, workspaces = myWorkspaces
|
||||||
|
, borderWidth = myBorderWidth
|
||||||
|
, normalBorderColor = colors!!10
|
||||||
|
, focusedBorderColor = colors!!12
|
||||||
|
, logHook = dynamicLogWithPP xmobarPP
|
||||||
|
{ ppOutput = hPutStrLn xmproc
|
||||||
|
, ppCurrent = xmobarColor (colors!!14) "" . wrap "[" "]" -- Current workspace in xmobar
|
||||||
|
, ppVisible = xmobarColor (colors!!13) "" -- Visible but not current workspace
|
||||||
|
, ppHidden = xmobarColor (colors!!15) "" . wrap "*" "" -- Hidden workspaces in xmobar
|
||||||
|
, ppHiddenNoWindows = xmobarColor (colors!!11) "" -- Hidden workspaces (no windows)
|
||||||
|
, ppTitle = xmobarColor (colors!!14) "" . shorten 60 -- Title of active window in xmobar
|
||||||
|
, ppSep = "<fc=" ++ (colors!!2) ++ "> :: </fc>" -- Separators in xmobar
|
||||||
|
, ppUrgent = xmobarColor (colors!!15) "" . wrap "!" "!" -- Urgent workspace
|
||||||
|
, ppExtras = [windowCount] -- # of windows current workspace
|
||||||
|
, ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t]
|
||||||
|
}
|
||||||
|
} `additionalKeysP` myKeys
|
||||||
|
```
|
||||||
|
|
||||||
|
## DWM/DWMBlocks
|
||||||
|
|
||||||
|
{{< img src="https://devoalda.gitlab.io/gallery/Carnage/Carnage%20DWM%20110720202.png" alt="archlinux" position="center" >}}
|
||||||
|
|
||||||
|
I use [LukeSmith's build of DWM](https://github.com/LukeSmithxyz/dwm) and [DWMBlocks](https://github.com/LukeSmithxyz/dwmblocks) as it is configured to use Xresources colors to theme the window manager
|
||||||
|
|
||||||
|
# Terminal Emulators
|
||||||
|
|
||||||
|
{{< img src="https://devoalda.gitlab.io/gallery/Carnage/Carnage%20Xmonad%2015082020.png" alt="archlinux" position="center" >}}
|
||||||
|
|
||||||
|
I use [LukeSmith's build of ST](https://github.com/LukeSmithxyz/st) as it is configured to use Xresources colors to theme the terminal emulator
|
||||||
|
|
||||||
|
{{< alert theme="info" dir="ltr" >}}
|
||||||
|
**_BONUS_** Any terminal based applications like ncmpcpp, visualisers(vis,cava,etc.), htop, etc. will be themed according to the terminal colors (in my experience)!
|
||||||
|
{{< /alert >}}
|
||||||
|
|
||||||
|
# Pywal templates
|
||||||
|
|
||||||
|
Pywal templates is another powerful function of pywal, they allow for dynamic theming of individual applications to your liking. [Here](https://gitlab.com/devoalda/dotdrop-dotfiles/-/tree/master/dotfiles/config/wal/templates) are some of the templates I use.
|
||||||
|
|
||||||
|
## Notification Manager
|
||||||
|
|
||||||
|
{{< img src="https://devoalda.gitlab.io/gallery/Carnage/Carnage%20Xmonad%2005072020.png" alt="archlinux" position="center" >}}
|
||||||
|
I use [dunst](https://dunst-project.org/) as my notification manager of choice. This is themed with pywal with the following lines of configurations in the templates
|
||||||
|
|
||||||
|
```
|
||||||
|
# Set the background and foreground (text) color for all notifications
|
||||||
|
[urgency_low]
|
||||||
|
background = "{background}"
|
||||||
|
foreground = "{foreground}"
|
||||||
|
|
||||||
|
[urgency_normal]
|
||||||
|
background = "{color9}"
|
||||||
|
foreground = "{foreground}"
|
||||||
|
|
||||||
|
[urgency_critical]
|
||||||
|
background = "{color10}"
|
||||||
|
foreground = "{foreground}"
|
||||||
|
```
|
||||||
|
|
||||||
|
After creating the template and adding these lines, run the following command to add a symbolic link to the main dunstrc file.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ ln -sf "${HOME}/.cache/wal/dunstrc" "${HOME}/.config/dunst/dunstrc"
|
||||||
|
```
|
||||||
|
|
||||||
|
# Script
|
||||||
|
|
||||||
|
To dynamically theme all these with a click of a button, I have created a [script](https://gitlab.com/devoalda/dotdrop-dotfiles/-/blob/master/dotfiles/local/bin/wallpaper) to generate new colors and update necessary files.
|
||||||
|
|
||||||
|
# Extras
|
||||||
|
|
||||||
|
Here are some of the other applications that can be themed with pywal:
|
||||||
|
|
||||||
|
- [Spotify](https://github.com/khanhas/spicetify-cli)
|
||||||
|
- [Steam](https://github.com/kotajacob/wal_steam)
|
||||||
|
- [Discord/lightcord](https://github.com/abou123/pywal-discord)
|
||||||
|
- [Others](https://github.com/dylanaraps/pywal/wiki/Customization)
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
|
||||||
|
Pywal is an incredible script to help theme everything in my desktop. I strongly recommend pywal to linux users who are new to ricing.
|
||||||
|
|
||||||
|
Do checkout my [Dotfiles](https://gitlab.com/devoalda/dotdrop-dotfiles/-/tree/master/dotfiles) for other applications that can be themed by pywal!
|
|
@ -0,0 +1 @@
|
||||||
|
<svg id="Capa_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g><g><path d="m466 130c-118.47 0-214.33 111.16-209.85 230.03l60.07.13v-.01c-4.62-85.56 64.36-170.15 149.78-170.15h36v-60z" fill="#aaf9dd"/><path d="m466 70c-140.65 0-256.54 120.12-268.91 257.6l31.91 36.4 27.15-3.97c-4.48-118.87 91.38-230.03 209.85-230.03h36v-60z" fill="#ffda8f"/><path d="m466 10c-173.77 0-316.17 146.32-329.05 316.79l60.14.81c12.37-137.48 128.26-257.6 268.91-257.6h36v-60z" fill="#ff7b79"/><path d="m361 412c24.85 0 45 20.15 45 45s-20.15 45-45 45h-306c-24.85 0-45-20.15-45-45s20.15-45 45-45h21c0-49.496 40.089-90 90-90 33.368 0 62.874 18.493 78.5 46.81 10.883-10.449 25.485-16.81 41.5-16.81 33.073 0 60 26.808 60 60z" fill="#eefaff"/></g><g><path d="m502 0h-36c-177.018 0-322.228 146.868-338.467 319.676-33.989 14.144-57.389 45.846-61.035 82.324h-11.498c-30.327 0-55 24.673-55 55s24.673 55 55 55h111c5.522 0 10-4.478 10-10s-4.478-10-10-10h-111c-19.299 0-35-15.701-35-35s15.701-35 35-35h21c5.522 0 10-4.478 10-10 0-44.197 35.76-80 80-80 29.782 0 55.903 16.559 69.745 41.642 3.172 5.748 10.944 6.93 15.68 2.382 9.539-9.156 21.877-14.024 34.575-14.024 27.958 0 50 22.811 50 50 0 5.522 4.478 10 10 10h15c19.299 0 35 15.701 35 35s-15.701 35-35 35h-105c-5.522 0-10 4.478-10 10s4.478 10 10 10h105c30.327 0 55-24.673 55-55s-24.673-55-55-55h-5.726c-2.774-19.04-13.378-36.293-29.237-47.386-1.372-78.039 61.836-154.614 139.963-154.614h36c5.522 0 10-4.478 10-10v-180c0-5.522-4.478-10-10-10zm-353.705 313.579c19.373-163.122 159.08-293.579 317.705-293.579h26v40h-26c-142.087 0-259.289 117.542-277.51 254.582-7.328-1.709-14.852-2.582-22.49-2.582-5.979 0-11.895.541-17.705 1.579zm59.512 7.697c15.681-133.695 130.036-241.276 258.193-241.276h26v40h-26c-121.586 0-220.369 110.939-219.983 232.708-9.974-13.528-23.104-24.357-38.21-31.432zm258.193-141.276c-86.503 0-155.974 79.787-159.814 164.97-6.512-1.957-13.314-2.97-20.186-2.97-6.747 0-13.441.993-19.865 2.909 3.721-107.853 92.186-204.909 199.865-204.909h26v40z"/><circle cx="211" cy="502" r="10"/></g></g></svg>
|
After Width: | Height: | Size: 2.0 KiB |
Loading…
Reference in New Issue