From e01902a3fa9e3349d217f2d7c57a22fd93206a64 Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 27 Sep 2019 14:34:39 +0200 Subject: [PATCH 01/21] Moved icons to config file --- autoname_workspaces.py | 107 ++++++++++++----------------------------- icons.ini | 76 +++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 77 deletions(-) create mode 100644 icons.ini diff --git a/autoname_workspaces.py b/autoname_workspaces.py index c57a91a..4d92e6d 100755 --- a/autoname_workspaces.py +++ b/autoname_workspaces.py @@ -13,7 +13,6 @@ # Dependencies # * xorg-xprop - install through system package manager # * i3ipc - install with pip -# * fontawesome - install with pip # # Installation: # * Download this repo and place it in ~/.config/i3/ (or anywhere you want) @@ -30,94 +29,40 @@ # bindsym $mod+1 workspace number 1 import argparse +import configparser import i3ipc import logging import signal import sys -import fontawesome as fa +from inspect import getsourcefile +from os.path import abspath,dirname,isfile from util import * -# Add icons here for common programs you use. The keys are the X window class -# (WM_CLASS) names (lower-cased) and the icons can be any text you want to -# display. -# -# Most of these are character codes for font awesome: -# http://fortawesome.github.io/Font-Awesome/icons/ -# -# If you're not sure what the WM_CLASS is for your application, you can use -# xprop (https://linux.die.net/man/1/xprop). Run `xprop | grep WM_CLASS` -# then click on the application you want to inspect. -WINDOW_ICONS = { - 'alacritty': fa.icons['terminal'], - 'atom': fa.icons['code'], - 'banshee': fa.icons['play'], - 'blender': fa.icons['cube'], - 'chromium': fa.icons['chrome'], - 'cura': fa.icons['cube'], - 'darktable': fa.icons['image'], - 'discord': fa.icons['comment'], - 'eclipse': fa.icons['code'], - 'emacs': fa.icons['code'], - 'eog': fa.icons['image'], - 'evince': fa.icons['file-pdf'], - 'evolution': fa.icons['envelope'], - 'feh': fa.icons['image'], - 'file-roller': fa.icons['compress'], - 'filezilla': fa.icons['server'], - 'firefox': fa.icons['firefox'], - 'firefox-esr': fa.icons['firefox'], - 'gimp-2.8': fa.icons['image'], - 'gnome-control-center': fa.icons['toggle-on'], - 'gnome-terminal-server': fa.icons['terminal'], - 'google-chrome': fa.icons['chrome'], - 'gpick': fa.icons['eye-dropper'], - 'imv': fa.icons['image'], - 'java': fa.icons['code'], - 'jetbrains-idea': fa.icons['code'], - 'jetbrains-studio': fa.icons['code'], - 'keepassxc': fa.icons['key'], - 'keybase': fa.icons['key'], - 'kicad': fa.icons['microchip'], - 'kitty': fa.icons['terminal'], - 'libreoffice': fa.icons['file-alt'], - 'lua5.1': fa.icons['moon'], - 'mpv': fa.icons['tv'], - 'mupdf': fa.icons['file-pdf'], - 'mysql-workbench-bin': fa.icons['database'], - 'nautilus': fa.icons['copy'], - 'nemo': fa.icons['copy'], - 'openscad': fa.icons['cube'], - 'pavucontrol': fa.icons['volume-up'], - 'postman': fa.icons['space-shuttle'], - 'rhythmbox': fa.icons['play'], - 'robo3t': fa.icons['database'], - 'slack': fa.icons['slack'], - 'slic3r.pl': fa.icons['cube'], - 'spotify': fa.icons['music'], # could also use the 'spotify' icon - 'steam': fa.icons['steam'], - 'subl': fa.icons['file-alt'], - 'subl3': fa.icons['file-alt'], - 'sublime_text': fa.icons['file-alt'], - 'thunar': fa.icons['copy'], - 'thunderbird': fa.icons['envelope'], - 'totem': fa.icons['play'], - 'urxvt': fa.icons['terminal'], - 'xfce4-terminal': fa.icons['terminal'], - 'xournal': fa.icons['file-alt'], - 'yelp': fa.icons['code'], - 'zenity': fa.icons['window-maximize'], - 'zoom': fa.icons['comment'], -} - -# This icon is used for any application not in the list above -DEFAULT_ICON = '*' - # Global setting that determines whether workspaces will be automatically # re-numbered in ascending order with a "gap" left on each monitor. This is # overridden via command-line flag. RENUMBER_WORKSPACES = True +# The default config file. Can be overwritten by command-line option. +DEFAULT_CONFIG_FILE = dirname(abspath(getsourcefile(lambda:0)))+'/icons.ini' + +def load_config(filename): + global WINDOW_ICONS + global DEFAULT_ICON + + try: + if not isfile(filename): + raise Exception('File "'+filename+'" not found') + Config = configparser.ConfigParser() + Config.read(filename) + + WINDOW_ICONS = dict(Config.items('icons')) + DEFAULT_ICON = Config['general']['default-icon'] + except Exception as e: + print('Could not read in config file: '+str(e)) + sys.exit(-1) + def ensure_window_icons_lowercase(): global WINDOW_ICONS @@ -208,8 +153,16 @@ def on_exit(i3): " - mathematician: factorize with superscripts (e.g. aababa -> a⁴b²)," " - chemist: factorize with subscripts (e.g. aababa -> a₄b₂)." ) + parser.add_argument( + '-c', '--config', + type=str, + default=DEFAULT_CONFIG_FILE, + help="Config file for the icons." + ) args = parser.parse_args() + load_config(args.config) + RENUMBER_WORKSPACES = not args.norenumber_workspaces logging.basicConfig(level=logging.INFO) diff --git a/icons.ini b/icons.ini new file mode 100644 index 0000000..11a24bc --- /dev/null +++ b/icons.ini @@ -0,0 +1,76 @@ +[general] +# This icon is used for any application not in the list below +default-icon = * + +[icons] +# Add icons here for common programs you use. The keys are the X window class +# (WM_CLASS) names (lower-cased) and the icons can be any text you want to +# display. +# +# Most of these are character codes for font awesome: +# https://fontawesome.com/icons?d=gallery +# +# If you're not sure what the WM_CLASS is for your application, you can use +# xprop (https://linux.die.net/man/1/xprop). Run `xprop | grep WM_CLASS` +# then click on the application you want to inspect. +alacritty =  +atom =  +atril =  +banshee =  +blender =  +chromium =  +cura =  +darktable =  +discord =  +eclipse =  +emacs =  +eog =  +evince =  +evolution =  +feh =  +file-roller =  +filezilla =  +firefox =  +firefox-esr =  +gimp-2.8 =  +gnome-control-center =  +gnome-terminal-server =  +google-chrome =  +gpick =  +imv =  +java =  +jetbrains-idea =  +jetbrains-studio =  +keepassxc =  +keybase =  +kicad =  +kitty =  +libreoffice =  +lua5.1 =  +mpv =  +mupdf =  +mysql-workbench-bin =  +nautilus =  +nemo =  +openscad =  +pavucontrol =  +postman =  +rhythmbox =  +robo3t =  +slack =  +slic3r.pl =  +spotify =  +steam =  +subl =  +subl3 =  +sublime_text =  +terminator =  +thunar =  +thunderbird =  +totem =  +urxvt =  +xfce4-terminal =  +xournal =  +yelp =  +zenity =  +zoom =  From 2694302dabf6840c582cb6f8e1382dbd9a30aa76 Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 27 Sep 2019 14:47:43 +0200 Subject: [PATCH 02/21] Add icon for Electrum --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index 11a24bc..1285dcb 100644 --- a/icons.ini +++ b/icons.ini @@ -23,6 +23,7 @@ cura =  darktable =  discord =  eclipse =  +electrum =  emacs =  eog =  evince =  From 521edd6c010642ee415ae3f2f446b025f950186d Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 27 Sep 2019 14:49:23 +0200 Subject: [PATCH 03/21] Add icon for galculator --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index 1285dcb..403771f 100644 --- a/icons.ini +++ b/icons.ini @@ -33,6 +33,7 @@ file-roller =  filezilla =  firefox =  firefox-esr =  +galculator =  gimp-2.8 =  gnome-control-center =  gnome-terminal-server =  From 28a7076cc771adf326400e4233aae1c039545c0b Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 27 Sep 2019 14:51:51 +0200 Subject: [PATCH 04/21] Add icon for the Monero GUI wallet --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index 403771f..94273aa 100644 --- a/icons.ini +++ b/icons.ini @@ -49,6 +49,7 @@ kicad =  kitty =  libreoffice =  lua5.1 =  +monero-wallet-gui =  mpv =  mupdf =  mysql-workbench-bin =  From 04daca6d126080c680b85ab37d9a8abd3ba02898 Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 27 Sep 2019 14:53:21 +0200 Subject: [PATCH 05/21] Add icon for Nextcloud --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index 94273aa..3625d97 100644 --- a/icons.ini +++ b/icons.ini @@ -55,6 +55,7 @@ mupdf =  mysql-workbench-bin =  nautilus =  nemo =  +nextcloud =  openscad =  pavucontrol =  postman =  From f37ceb4dd28b893b2034990935dd8978f4fb7b1b Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 27 Sep 2019 14:54:02 +0200 Subject: [PATCH 06/21] Add icon for virt-manager --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index 3625d97..80ca849 100644 --- a/icons.ini +++ b/icons.ini @@ -73,6 +73,7 @@ thunar =  thunderbird =  totem =  urxvt =  +virt-manager =  xfce4-terminal =  xournal =  yelp =  From 4388df1ccaf0d47fee121811bbb2c07a487ea774 Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 27 Sep 2019 14:55:41 +0200 Subject: [PATCH 07/21] Add icons for VirtualBox --- icons.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/icons.ini b/icons.ini index 80ca849..d7d012c 100644 --- a/icons.ini +++ b/icons.ini @@ -74,6 +74,8 @@ thunderbird =  totem =  urxvt =  virt-manager =  +virtualbox manager =  +virtualbox machine =  xfce4-terminal =  xournal =  yelp =  From 2a49a11768f547b0f22405d58aa31c8d5202247f Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 4 Oct 2019 23:29:53 +0200 Subject: [PATCH 08/21] Add icon for HandBrake --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index d7d012c..3136441 100644 --- a/icons.ini +++ b/icons.ini @@ -34,6 +34,7 @@ filezilla =  firefox =  firefox-esr =  galculator =  +ghb =  gimp-2.8 =  gnome-control-center =  gnome-terminal-server =  From a5d271dd68faf9507ac631d900b3a7405765f974 Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 4 Oct 2019 23:30:16 +0200 Subject: [PATCH 09/21] Add icon for Ghidra --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index 3136441..4e41cea 100644 --- a/icons.ini +++ b/icons.ini @@ -35,6 +35,7 @@ firefox =  firefox-esr =  galculator =  ghb =  +ghidra =  gimp-2.8 =  gnome-control-center =  gnome-terminal-server =  From b522932b226292646c7c9b7f6ab60e32d89ae865 Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 4 Oct 2019 23:30:44 +0200 Subject: [PATCH 10/21] Add icon for lxappearance --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index 4e41cea..bf69cfa 100644 --- a/icons.ini +++ b/icons.ini @@ -51,6 +51,7 @@ kicad =  kitty =  libreoffice =  lua5.1 =  +lxappearance =  monero-wallet-gui =  mpv =  mupdf =  From 363d780efef57e238a28b8a87cfb7c6ccc845079 Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 4 Oct 2019 23:31:04 +0200 Subject: [PATCH 11/21] Add icon for lxrandr --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index bf69cfa..86a6f39 100644 --- a/icons.ini +++ b/icons.ini @@ -52,6 +52,7 @@ kitty =  libreoffice =  lua5.1 =  lxappearance =  +lxrandr =  monero-wallet-gui =  mpv =  mupdf =  From 4a0c7efb5d6b9be5e6367029506476da051df035 Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 4 Oct 2019 23:31:44 +0200 Subject: [PATCH 12/21] Add icons for NetworkManager --- icons.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/icons.ini b/icons.ini index 86a6f39..a358986 100644 --- a/icons.ini +++ b/icons.ini @@ -60,6 +60,8 @@ mysql-workbench-bin =  nautilus =  nemo =  nextcloud =  +nm-applet =  +nm-connection-editor =  openscad =  pavucontrol =  postman =  From 7cb4c230086d91a64662840a96b4c9502f825f35 Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 4 Oct 2019 23:32:16 +0200 Subject: [PATCH 13/21] Add icon for GNU Octave --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index a358986..e3fae7c 100644 --- a/icons.ini +++ b/icons.ini @@ -62,6 +62,7 @@ nemo =  nextcloud =  nm-applet =  nm-connection-editor =  +octave-gui =  openscad =  pavucontrol =  postman =  From 13fde6aeb6af6e9f24ecae20e8fdc9817016e5be Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 4 Oct 2019 23:32:43 +0200 Subject: [PATCH 14/21] Add icon for OpenBazaar --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index e3fae7c..24e6966 100644 --- a/icons.ini +++ b/icons.ini @@ -63,6 +63,7 @@ nextcloud =  nm-applet =  nm-connection-editor =  octave-gui =  +openbazaar desktop client =  openscad =  pavucontrol =  postman =  From 6baf5e8d48e6fa423187dd7af63f3ffd3e4f8aae Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 4 Oct 2019 23:33:16 +0200 Subject: [PATCH 15/21] Add icon for Pluma --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index 24e6966..fcae6db 100644 --- a/icons.ini +++ b/icons.ini @@ -66,6 +66,7 @@ octave-gui =  openbazaar desktop client =  openscad =  pavucontrol =  +pluma =  postman =  rhythmbox =  robo3t =  From 4233067862e59fbfc9a87f64d4fda39dc766d95d Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 4 Oct 2019 23:34:02 +0200 Subject: [PATCH 16/21] Add icon for Qt Creator --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index fcae6db..8acedab 100644 --- a/icons.ini +++ b/icons.ini @@ -68,6 +68,7 @@ openscad =  pavucontrol =  pluma =  postman =  +qtcreator =  rhythmbox =  robo3t =  slack =  From 904ebda4bc0ad1faa93bdf37c5a75a895a1115c2 Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 4 Oct 2019 23:34:23 +0200 Subject: [PATCH 17/21] Add icon for Arduino IDE --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index 8acedab..4e7cafb 100644 --- a/icons.ini +++ b/icons.ini @@ -78,6 +78,7 @@ steam =  subl =  subl3 =  sublime_text =  +sun-awt-x11-xframepeer =  terminator =  thunar =  thunderbird =  From 2ac1c9f29176178a1554d48cf177c88a383244f9 Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 4 Oct 2019 23:34:54 +0200 Subject: [PATCH 18/21] Add icon for Tor Browser --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index 4e7cafb..6f173d8 100644 --- a/icons.ini +++ b/icons.ini @@ -82,6 +82,7 @@ sun-awt-x11-xframepeer =  terminator =  thunar =  thunderbird =  +tor browser =  totem =  urxvt =  virt-manager =  From 9046b187ee84ea7e262826e3e466110c751ffe8a Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 4 Oct 2019 23:35:10 +0200 Subject: [PATCH 19/21] Add icon for VLC Player --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index 6f173d8..468e79e 100644 --- a/icons.ini +++ b/icons.ini @@ -88,6 +88,7 @@ urxvt =  virt-manager =  virtualbox manager =  virtualbox machine =  +vlc =  xfce4-terminal =  xournal =  yelp =  From 25a360579576525c16afaf71177140a3e670dd92 Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Fri, 4 Oct 2019 23:35:33 +0200 Subject: [PATCH 20/21] Add icon for Wireshark --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index 468e79e..5349bee 100644 --- a/icons.ini +++ b/icons.ini @@ -89,6 +89,7 @@ virt-manager =  virtualbox manager =  virtualbox machine =  vlc =  +wireshark =  xfce4-terminal =  xournal =  yelp =  From 247d7d3ebd8576aea0b11f97eed7d8334db41672 Mon Sep 17 00:00:00 2001 From: DrRac27 Date: Sat, 5 Oct 2019 10:25:24 +0200 Subject: [PATCH 21/21] Add icon for Volume Icon --- icons.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/icons.ini b/icons.ini index 5349bee..4370c99 100644 --- a/icons.ini +++ b/icons.ini @@ -89,6 +89,7 @@ virt-manager =  virtualbox manager =  virtualbox machine =  vlc =  +volumeicon =  wireshark =  xfce4-terminal =  xournal = 