Coder Social home page Coder Social logo

intrntbrn / icon_customizer Goto Github PK

View Code? Open in Web Editor NEW
32.0 1.0 1.0 15 KB

set custom icons for gui and terminal applications in awesomewm

Shell 59.97% Lua 40.03%
awesomewm awesome icon terminal theme customizer dynamic-icons custom-icon unixporn

icon_customizer's Introduction

icon_customizer for awesomewm

Features:

  • Define your own icons for applications
  • Set custom icons for terminal applications based on client title

Prerequisite:

Dynamic terminal icons (as shown on gif) require you to have a shell-terminal-stack that supports dynamic titles (the title of the client (WM_NAME) changes based on the running app or pwd). Not every terminal or shell supports dynamic titles or is configured correctly out of the box.

Minimal configurations are provided for bash and zsh:

echo "source ~/.config/awesome/icon_customizer/dynamictitles.bash" >> ~/.bashrc
echo "source ~/.config/awesome/icon_customizer/dynamictitles.zsh" >> ~/.zshrc

Installation:

Clone the repo and import the module:

  1. git clone https://github.com/intrntbrn/icon_customizer ~/.config/awesome/icon_customizer
  2. echo "require('icon_customizer'){ delay = 0.2 }" >> ~/.config/awesome/rc.lua

Example Configuration:

Define your custom icons in theme.lua:

local icon_dir = os.getenv("HOME") .. "/.config/awesome/icons/"
theme.ic_icons = {
	["Chromium"] = icon_dir .. "chromium.png",
	["firefox"] = icon_dir .. "firefox.png",
	["Zathura"] = icon_dir .. "zathura.png",
	["Steam"] = icon_dir .. "steam.png",
	["discord"] = icon_dir .. "discord.png",
	["Alacritty"] = icon_dir .. "terminal.png",
	["kitty"] = icon_dir .. "terminal.png"
}

theme.ic_dynamic_classes = { "Alacritty", "kitty", "St", "URxvt", "Termite" }
theme.ic_dynamic_icons = {
	["- NVIM$"] = icon_dir .. "vim.png",
	["- VIM$"] = icon_dir .. "vim.png",
	["- TMUX$"] = icon_dir .. "tmux.png",
	["^ranger$"] = icon_dir .. "file-manager.png",
	["^spt$"] = icon_dir .. "spotify.png",
	["^googler$"] = icon_dir .. "google.png",
	["- rtv"] = icon_dir .. "reddit.png"
}

theme.ic_fallback_icon = icon_dir .. "default_icon.png"

Get application class names or titles by using xprop.

Limitations:

Applications can still overwrite your custom icon.

Related Work:

icon_customizer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

norta92

icon_customizer's Issues

Dynamic icons not working without changing the window name

First of all, I would like to thank you for your awesome work here, I enjoy the results of using it every day.

However, I have found a small bug with dynamic icons. If a new window spawns whose class is included in the dynamic_classes list, and it already spawns with a name that matches a key in the dynamic_icons table, the window's icon is not changed.

Example (using the kitty terminal emulator):

require('icon_customizer')({
  dynamic_classes = {"kitty"},
  dynamic_icons = {
    ["^test$"] = "/path/to/icon",
  }
})

With the above in your rc.lua file, launch the command kitty --title 'asdf' nano /tmp/test. You will notice that the icon does not change, because the terminal window already has the name test when it spawns. If you keep the window open and restart awesome, the icon changes correctly.

If you launch the command kitty zsh -i -c 'title "asdf"; nano /tmp/test' (-i stands for interactive and is required for zsh to actually change the window name when executing the title command), the window launches with the name kitty. Then when zsh runs the title command, the window name changes to "asdf" and the icon is correctly displayed.

I would be willing to provide a PR to fix this issue, but didn't want to do so without asking you first.

Getting erros when trying to use this.

This looks like a awesome project, being wanting to find a way to add icon for ST, as I am using only icons and no text. Having St etc its just leaving an empty blank.

When trying to apply icon_customizer I get errors such as

  1. in local 'func'
    438 in function awful.screen.connect_for_each_screen
    main chunk
    attempt to call nil value (field 'at_screen_connect')

And the corresponding lines contains these.

I am not sure how to fix or why it causes problems.

-- Create a wibox for each screen and add it
awful.screen.connect_for_each_screen(function(s) beautiful.at_screen_connect(s) end)
if beautiful.wallpaper then
    for s = 1, screen.count() do
        if s < 2 then
          gears.wallpaper.maximized("/wallie.jpg", s, true)
        else
          gears.wallpaper.maximized("/loner.jpg", s, true)
        end
    end
  end

I've added these to my rc.lua

require('icon_customizer'){ delay = 0.2 }

theme.ic_icons = {
	["st"] = "utils/vim.png"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.