diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0a155d4 --- /dev/null +++ b/flake.lock @@ -0,0 +1,173 @@ +{ + "nodes": { + "base16": { + "inputs": { + "nixpkgs": [ + "stylix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1658847131, + "narHash": "sha256-X6Mml7cT0YR3WCD5fkUhpRVV5ZPcwdcDsND8r8xMqTE=", + "owner": "SenchoPens", + "repo": "base16.nix", + "rev": "6b404cda2e04ca3cf5ca7b877af9c469e1386acb", + "type": "github" + }, + "original": { + "owner": "SenchoPens", + "repo": "base16.nix", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1683459775, + "narHash": "sha256-Ab1pIKOj7XRZbJAv4g9937ElhaZF7Pob3hqGTDKt5w8=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "6fc82e56971523acfe1a61dbcb20f4bb969b3990", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "stylix", + "nixpkgs" + ], + "utils": "utils" + }, + "locked": { + "lastModified": 1680000368, + "narHash": "sha256-TlgC4IJ7aotynUdkGRtaAVxquaiddO38Ws89nB7VGY8=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "765e4007b6f9f111469a25d1df6540e8e0ca73a6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1683286087, + "narHash": "sha256-xseOd7W7xwF5GOF2RW8qhjmVGrKoBz+caBlreaNzoeI=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "3e313808bd2e0a0669430787fb22e43b2f4bf8bf", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1683466960, + "narHash": "sha256-cDTGzQ3z1rqEjc/3Z/+DB3r8IYtM8HXuBO6ofeynH1w=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9757bdca3bfc13fd21d9e9d28517793bfc5143a8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1679793451, + "narHash": "sha256-JafTtgMDATE8dZOImBhWMA9RCn9AP8FVOpN+9K/tTlg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0cd51a933d91078775b300cf0f29aa3495231aa2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs_2", + "stylix": "stylix" + } + }, + "stylix": { + "inputs": { + "base16": "base16", + "flake-compat": "flake-compat", + "home-manager": "home-manager_2", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1683100629, + "narHash": "sha256-c+cHSnwkWYJNydJJYo0vS1uy/NoLW4OAkQZsxRl4WCY=", + "owner": "danth", + "repo": "stylix", + "rev": "a9367cea1bdc0ad35b3b0b2afc4aa9cf94cdecdb", + "type": "github" + }, + "original": { + "owner": "danth", + "repo": "stylix", + "type": "github" + } + }, + "utils": { + "locked": { + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index a96aa14..057265b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,11 +1,22 @@ { - description = "A very basic flake"; + description = "Snowflakes are fractals"; - outputs = { self, nixpkgs }: { + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + home-manager.url = "github:nix-community/home-manager"; + stylix.url = "github:danth/stylix"; + }; - packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello; + outputs = { self, nixpkgs, home-manager, stylix }: { + nixosConfigurations.snowfire = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ ./system/configuration.nix ]; + }; - packages.x86_64-linux.default = self.packages.x86_64-linux.hello; + homeConfigurations."emmet" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + modules = [ stylix.homeManagerModules.stylix ./user/home.nix ]; + }; }; } diff --git a/user/wm/xmonad/xmonad.hs b/user/wm/xmonad/xmonad.hs index 0fbe93b..8561909 100644 --- a/user/wm/xmonad/xmonad.hs +++ b/user/wm/xmonad/xmonad.hs @@ -157,7 +157,7 @@ myModMask = mod4Mask myWorkspaces :: [String] myWorkspaces = [ "\xf15c¹", -- document icon for writing - "\xf059f²", -- globe icon for browsing + "\xfa9e²", -- globe icon for browsing "\xf121³", -- dev icon for programming "\xf001⁴", -- music file icon for composition "\xf1fc⁵", -- paint icon for art @@ -528,7 +528,7 @@ myNavigation2DConfig = def {layoutNavigation = [("Tall", hybridOf sideNavigation -- Startup hook myStartupHook = do - spawnOnce ("~/.xmonad/startup.sh '" ++ trayerBgNormal ++ "' '" ++ colorBgNormal ++ "' '" ++ color08Bright ++ "' '" ++ colorFocus ++ "' '" ++ color08Bright ++ "' '" ++ gtkTheme ++ "' '" ++ alacrittyTheme ++ "' '" ++ doomEmacsTheme ++ "' '" ++ color01Normal ++ "' '" ++ color01Bright ++ "' '" ++ color02Normal ++ "' '" ++ color02Bright ++ "' '" ++ color03Normal ++ "' '" ++ color03Bright ++ "' '" ++ color04Normal ++ "' '" ++ color04Bright ++ "' '" ++ color05Normal ++ "' '" ++ color05Bright ++ "' '" ++ color06Normal ++ "' '" ++ color06Bright ++ "' '" ++ color07Normal ++ "' '" ++ color07Bright ++ "' '" ++ color08Normal ++ "' '" ++ color08Bright ++ "' '" ++ colorFocus ++ "' '" ++ colorSecondary ++ "' '" ++ colorBgBright ++ "'") + spawnOnce ("~/.config/xmonad/startup.sh '" ++ trayerBgNormal ++ "' '" ++ colorBgNormal ++ "' '" ++ color08Bright ++ "' '" ++ colorFocus ++ "' '" ++ color08Bright ++ "' '" ++ gtkTheme ++ "' '" ++ alacrittyTheme ++ "' '" ++ doomEmacsTheme ++ "' '" ++ color01Normal ++ "' '" ++ color01Bright ++ "' '" ++ color02Normal ++ "' '" ++ color02Bright ++ "' '" ++ color03Normal ++ "' '" ++ color03Bright ++ "' '" ++ color04Normal ++ "' '" ++ color04Bright ++ "' '" ++ color05Normal ++ "' '" ++ color05Bright ++ "' '" ++ color06Normal ++ "' '" ++ color06Bright ++ "' '" ++ color07Normal ++ "' '" ++ color07Bright ++ "' '" ++ color08Normal ++ "' '" ++ color08Bright ++ "' '" ++ colorFocus ++ "' '" ++ colorSecondary ++ "' '" ++ colorBgBright ++ "'") --myPP = def { ppCurrent = xmobarColor colorFocus "" } myPP = xmobarPP { ppTitle = xmobarColor colorFocus "", diff --git a/user/wm/xmonad/xmonad.org b/user/wm/xmonad/xmonad.org index 9d326dd..88ff2f0 100644 --- a/user/wm/xmonad/xmonad.org +++ b/user/wm/xmonad/xmonad.org @@ -206,7 +206,7 @@ By default, workspaces are simply numeric strings ("1", "2", "3", etc..), but an myWorkspaces :: [String] myWorkspaces = [ "\xf15c¹", -- document icon for writing - "\xf059f²", -- globe icon for browsing + "\xfa9e²", -- globe icon for browsing "\xf121³", -- dev icon for programming "\xf001⁴", -- music file icon for composition "\xf1fc⁵", -- paint icon for art @@ -813,7 +813,7 @@ In my xmonad config, it is then autostarted by setting a =startupHook=. Inside #+BEGIN_SRC haskell :tangle xmonad.hs -- Startup hook myStartupHook = do - spawnOnce ("~/.xmonad/startup.sh '" ++ trayerBgNormal ++ "' '" ++ colorBgNormal ++ "' '" ++ color08Bright ++ "' '" ++ colorFocus ++ "' '" ++ color08Bright ++ "' '" ++ gtkTheme ++ "' '" ++ alacrittyTheme ++ "' '" ++ doomEmacsTheme ++ "' '" ++ color01Normal ++ "' '" ++ color01Bright ++ "' '" ++ color02Normal ++ "' '" ++ color02Bright ++ "' '" ++ color03Normal ++ "' '" ++ color03Bright ++ "' '" ++ color04Normal ++ "' '" ++ color04Bright ++ "' '" ++ color05Normal ++ "' '" ++ color05Bright ++ "' '" ++ color06Normal ++ "' '" ++ color06Bright ++ "' '" ++ color07Normal ++ "' '" ++ color07Bright ++ "' '" ++ color08Normal ++ "' '" ++ color08Bright ++ "' '" ++ colorFocus ++ "' '" ++ colorSecondary ++ "' '" ++ colorBgBright ++ "'") + spawnOnce ("~/.config/xmonad/startup.sh '" ++ trayerBgNormal ++ "' '" ++ colorBgNormal ++ "' '" ++ color08Bright ++ "' '" ++ colorFocus ++ "' '" ++ color08Bright ++ "' '" ++ gtkTheme ++ "' '" ++ alacrittyTheme ++ "' '" ++ doomEmacsTheme ++ "' '" ++ color01Normal ++ "' '" ++ color01Bright ++ "' '" ++ color02Normal ++ "' '" ++ color02Bright ++ "' '" ++ color03Normal ++ "' '" ++ color03Bright ++ "' '" ++ color04Normal ++ "' '" ++ color04Bright ++ "' '" ++ color05Normal ++ "' '" ++ color05Bright ++ "' '" ++ color06Normal ++ "' '" ++ color06Bright ++ "' '" ++ color07Normal ++ "' '" ++ color07Bright ++ "' '" ++ color08Normal ++ "' '" ++ color08Bright ++ "' '" ++ colorFocus ++ "' '" ++ colorSecondary ++ "' '" ++ colorBgBright ++ "'") #+END_SRC @@ -840,7 +840,6 @@ Then, a few things are set up before starting any applications, including the dp #+BEGIN_SRC sh :tangle startup.sh :tangle-mode (identity #o755) # pre-launch configurations # dbus-update-activation-environment --all & -gnome-keyring-daemon --daemonize --login & # ~/.local/bin/setup-external-monitor.sh & # picom --experimental-backends & picom --animations --animation-window-mass 1 --animation-for-open-window zoom --animation-stiffness 200 --experimental-backends && # requires picom-pijulius @@ -866,7 +865,7 @@ sed -i "s/(setq doom-theme .*/(setq doom-theme '"$themeDoomEmacsName")/" ~/.doom sed -i "s/(setq doom-theme .*/(setq doom-theme '"$themeDoomEmacsName")/" ~/.doom.d/doom.org & sed -i "s/(setq doom-theme .*/(setq doom-theme '"$themeDoomEmacsName")/" ~/.doom.d/doom-pub.org & -cp -f ~/.config/xmobar/base-t-xmobarrc ~/.config/xmobar/xmobarrc && +cp -f ~/.config/xmobar/base-xmobarrc ~/.config/xmobar/xmobarrc && sed -i "s/colorBgNormal/"$colorBgNormal"/g" ~/.config/xmobar/xmobarrc # normal background sed -i "s/colorBgBright/"$colorBgBright"/g" ~/.config/xmobar/xmobarrc # bright background sed -i "s/colorFgNormal/"$colorFgNormal"/g" ~/.config/xmobar/xmobarrc # normal foreground @@ -889,34 +888,6 @@ sed -i "s/color08Bright/"$color08Bright"/g" ~/.config/xmobar/xmobarrc # bright w sed -i "s/colorFocus/"$colorFocus"/g" ~/.config/xmobar/xmobarrc # wm focus color sed -i "s/colorSecondary/"$colorSecondary"/g" ~/.config/xmobar/xmobarrc & # xmobar highlight color -cp -f ~/.config/xmobar/base-xmobarrc-trayer ~/.config/xmobar/xmobarrc-trayer && -sed -i "s/colorBgNormal/"$colorBgNormal"/g" ~/.config/xmobar/xmobarrc-trayer # normal background -sed -i "s/colorBgBright/"$colorBgBright"/g" ~/.config/xmobar/xmobarrc-trayer # bright background -sed -i "s/colorFgNormal/"$colorFgNormal"/g" ~/.config/xmobar/xmobarrc-trayer # normal foreground -sed -i "s/color01Normal/"$color01Normal"/g" ~/.config/xmobar/xmobarrc-trayer # normal black -sed -i "s/color01Bright/"$color01Bright"/g" ~/.config/xmobar/xmobarrc-trayer # bright black -sed -i "s/color02Normal/"$color02Normal"/g" ~/.config/xmobar/xmobarrc-trayer # normal red -sed -i "s/color02Bright/"$color02Bright"/g" ~/.config/xmobar/xmobarrc-trayer # bright red -sed -i "s/color03Normal/"$color03Normal"/g" ~/.config/xmobar/xmobarrc-trayer # normal green -sed -i "s/color03Bright/"$color03Bright"/g" ~/.config/xmobar/xmobarrc-trayer # bright green -sed -i "s/color04Normal/"$color04Normal"/g" ~/.config/xmobar/xmobarrc-trayer # normal yellow -sed -i "s/color04Bright/"$color04Bright"/g" ~/.config/xmobar/xmobarrc-trayer # bright yellow -sed -i "s/color05Normal/"$color05Normal"/g" ~/.config/xmobar/xmobarrc-trayer # normal blue -sed -i "s/color05Bright/"$color05Bright"/g" ~/.config/xmobar/xmobarrc-trayer # bright blue -sed -i "s/color06Normal/"$color06Normal"/g" ~/.config/xmobar/xmobarrc-trayer # normal magenta -sed -i "s/color06Bright/"$color06Bright"/g" ~/.config/xmobar/xmobarrc-trayer # bright magenta -sed -i "s/color07Normal/"$color07Normal"/g" ~/.config/xmobar/xmobarrc-trayer # normal cyan -sed -i "s/color07Bright/"$color07Bright"/g" ~/.config/xmobar/xmobarrc-trayer # bright cyan -sed -i "s/color08Normal/"$color08Normal"/g" ~/.config/xmobar/xmobarrc-trayer # normal white -sed -i "s/color08Bright/"$color08Bright"/g" ~/.config/xmobar/xmobarrc-trayer # bright white -sed -i "s/colorFocus/"$colorFocus"/g" ~/.config/xmobar/xmobarrc-trayer # wm focus color -sed -i "s/colorSecondary/"$colorSecondary"/g" ~/.config/xmobar/xmobarrc-trayer & # xmobar highlight color - -sed -i "s/Nsxiv.window.background: .*/Nsxiv.window.background: "$colorBgNormal"/" ~/.Xresources -sed -i "s/Nsxiv.window.foreground: .*/Nsxiv.window.foreground: "$colorFgNormal"/" ~/.Xresources & - -sed -i "s/export GTK_THEME=.*/export GTK_THEME="$themeGTKName"/" ~/.xsession & - #+END_SRC Lastly, desktop applications are started in the background. @@ -934,10 +905,11 @@ GOMAXPROCS=1 syncthing --no-browser & rclone mount adantium-nextcloud:/ ~/Nextcloud & syncthing-gtk -m & # flatpak run com.discordapp.Discord --start-minimized & -gnome-keyring-daemon --start --components=secrets & protonmail-bridge --no-window ~/.local/bin/setup-external-monitor.sh & -rm -rf ~/org +rm -rf ~/org & +gnome-keyring-daemon --daemonize --login & +gnome-keyring-daemon --start --components=secrets & #back4.sh 0.04 ~/Media/Backgrounds/steampunk-city.gif & ##sleep 2 && xwinwrap -b -s -fs -st -sp -nf -ov -fdt -- mpv -wid WID --really-quiet --framedrop=vo --no-audio --panscan="1.0" --loop-file=inf --osc=no ~/Downloads/gruvbox-town-mod.gif --scale="bilinear" #+END_SRC @@ -995,57 +967,8 @@ I utilize xmobar as a status bar on one of my monitors. To manage my xmobar con - [[./../.config/xmobar/base-xmobarrc-trayer][~/.config/xmobar/base-xmobarrc-trayer]] which contains the structure of my xmobar config with a trayer pad (for when I use trayer) - [[./startup.sh][~/.xmonad/startup.sh]] which has a section which generates a copy of my xmobarrcs for the current color scheme I set in [[./xmonad.hs][xmonad.hs]] ** Base xmobarrc -My 2nd base xmobarrc is used for non-primary monitors, which don't have trayer. This also depends on =UbuntuMono=, =Symbols Nerd Font= and =Inconsolata for Powerline=. +This is my base xmobarrc. This also depends on =UbuntuMono=, =Symbols Nerd Font= and =Inconsolata for Powerline=. #+BEGIN_SRC haskell :tangle ~/.config/xmobar/base-xmobarrc -Config { font = "UbuntuMono-R 18" - , additionalFonts = ["Symbols Nerd Font 21","Inconsolata for Powerline 28"] - , border = NoBorder - , bgColor = "colorBgNormal" - , alpha = 255 - , fgColor = "colorFgNormal" - , position = TopSize C 100 28 - , textOffset = -1 - , iconOffset = -1 - , lowerOnStart = True - , pickBroadest = False - , persistent = False - , hideOnStart = False - , iconRoot = "." - , allDesktops = True - , overrideRedirect = True - , commands = [ - Run UnsafeStdinReader - , Run Date "\xe0b2 \xf073 %a %-m/%-d/%y %-I:%M:%S%P \xe0b0" "date" 10 - , Run BatteryP ["BAT0"] - ["-t", "", - "-L", "10", "-H", "80", "-p", "3", "--", - "-O"," \xf303\xe0b0 \xf583% \xe0b0", - "-i"," \xf303\xe0b0 \xf578% \xe0b0", - "-o"," \xf303\xe0b0 \xf58b% \xe0b0", - "-L", "-15", "-H", "-5", - "-l", "color02Normal", "-m", "color05Normal", "-h", "color03Normal"] 10 - , Run Brightness - [ "-t", "\xf5dd % \xe0b0", "--", - "-D", "amdgpu_bl1" - ] 2 - , Run Volume "default" "Master" - [ "-t", "", "--" - , "--on", " \xf028 % \xe0b0" - , "--onc", "color07Normal" - , "--off", " \xf026Mute \xe0b0" - , "--offc", "color06Normal" - ] 1 - ] - , sepChar = "%" - , alignSep = "}{" - , template = "%battery% %bright%%default:Master%}%date%{%UnsafeStdinReader%" - } -} - -#+END_SRC -** Transparent xmobarrc -This is my transparent xmobarrc. This also depends on =UbuntuMono=, =Symbols Nerd Font= and =Inconsolata for Powerline=. -#+BEGIN_SRC haskell :tangle ~/.config/xmobar/base-t-xmobarrc Config { font = "UbuntuMono-R 18" , additionalFonts = ["Symbols Nerd Font 21","Inconsolata for Powerline 28"] , border = NoBorder @@ -1068,9 +991,9 @@ Config { font = "UbuntuMono-R 18" , Run BatteryP ["BAT0"] ["-t", "", "-L", "10", "-H", "80", "-p", "3", "--", - "-O"," \xf303 \xf17e3% ", - "-i"," \xf303 \xf17e7% ", - "-o"," \xf303 \xf17e4% ", + "-O"," \xf303 \xf583% ", + "-i"," \xf303 \xf578% ", + "-o"," \xf303 \xf58b% ", "-L", "-15", "-H", "-5", "-l", "color02Normal", "-m", "color05Normal", "-h", "color03Normal"] 10 , Run Brightness @@ -1092,113 +1015,3 @@ Config { font = "UbuntuMono-R 18" } #+END_SRC -** Base xmobarrc (trayer) -My base xmobarrc depends on =UbuntuMono=, =Symbols Nerd Font= and =Inconsolata for Powerline=. -#+BEGIN_SRC haskell :tangle ~/.config/xmobar/base-xmobarrc-trayer -Config { font = "UbuntuMono-R 18" - , additionalFonts = ["Symbols Nerd Font 21","Inconsolata for Powerline 28"] - , border = NoBorder - , bgColor = "colorBgNormal" - , fgColor = "colorFgNormal" - , position = TopSize C 100 28 - , textOffset = -1 - , iconOffset = -1 - , lowerOnStart = True - , pickBroadest = False - , persistent = False - , hideOnStart = False - , iconRoot = "." - , allDesktops = True - , overrideRedirect = True - , commands = [ - Run UnsafeStdinReader - , Run Date "\xe0b2 \xf073 %a %-m/%-d/%y %-I:%M:%S%P \xe0b0" "date" 10 - , Run BatteryP ["BAT0"] - ["-t", "", - "-L", "10", "-H", "80", "-p", "3", "--", - "-O"," \xe61f+\xf303 \xe0b0 \xf583% \xe0b0", - "-i"," \xe61f+\xf303 \xe0b0 \xf578% \xe0b0", - "-o"," \xe61f+\xf303 \xe0b0 \xf58b% \xe0b0", - "-L", "-15", "-H", "-5", - "-l", "color02Normal", "-m", "color05Normal", "-h", "color03Normal"] 10 - , Run Brightness - [ "-t", "\xf5dd % \xe0b0", "--", - "-D", "amdgpu_bl1" - ] 2 - , Run Volume "default" "Master" - [ "-t", "", "--" - , "--on", " \xf028 % \xe0b0" - , "--onc", "color07Normal" - , "--off", " \xf026Mute \xe0b0" - , "--offc", "color06Normal" - ] 1 - , Run Com "/home/librephoenix/.config/xmobar/padding-icon.sh" [] "trayerpad" 2 - ] - , sepChar = "%" - , alignSep = "}{" - , template = "%battery% %bright%%default:Master% }%date%{%UnsafeStdinReader% %trayerpad%" - } -} - -#+END_SRC - -In order to get xmobar to work with trayer (systray), a padding-icon script must be used. This script is based on [[https://github.com/jaor/xmobar/issues/239#issuecomment-233206552][Jonas Camillus Jeppensen's code]]. I have this called =padding-icon.sh=. -#+BEGIN_SRC sh :tangle ~/.config/xmobar/padding-icon.sh :tangle-mode (identity #o755) -#!/bin/bash - -# Detects the width of running window with name given as first -# argument (xprop name '$1') and creates an XPM icon of that width, -# 1px height, and transparent. Outputs an -tag for use in -# xmobar to display the generated XPM icon. -# -# Run script from xmobar and trayer: -# `Run Com "/where/ever/padding-icon.sh" ["panel"] "trayerpad" 10` -# and use `%trayerpad%` in your template. -# or, if you're using for instance stalonetray: -# `Run Com "/where/ever/padding-icon.sh" ["stalonetray"] "tray" 10` - -# Very heavily based on Jonas Camillus Jeppensen code -# https://github.com/jaor/xmobar/issues/239#issuecomment-233206552 - -# Function to create a transparent Wx1 px XPM icon -create_xpm_icon () { -timestamp=$(date) -pixels=$(for i in `seq $1`; do echo -n "."; done) - -cat << EOF > "$2" -/* XPM * -static char * trayer_pad_xpm[] = { -/* This XPM icon is used for padding in xmobar to */ -/* leave room for trayer-srg. It is dynamically */ -/* updated by by trayer-pad-icon.sh which is run */ -/* by xmobar. */ -/* Created: ${timestamp} */ -/* */ -"$1 1 1 1", -/* Colors (none: transparent) */ -". c none", -/* Pixels */ -"$pixels" -}; -EOF -} - -# panel window name -pname=${1:-panel} - -# Width of the trayer window, uncorrected for HiDPI scaling -width=$(xprop -name $pname | grep 'program specified minimum size' | cut -d ' ' -f 5) -correct_width=$((width+5)) - -# Icon file name -iconfile="/tmp/$pname-padding-${correct_width:-0}px.xpm" - -# If the desired icon does not exist create it -if [ ! -f $iconfile ] -then - create_xpm_icon $correct_width $iconfile -fi - -# Output the icon tag for xmobar -echo "" -#+END_SRC