A collection of scripts

Compare changes

Choose any two refs to compare.

+1
.gitignore
··· 1 + result*
+37
.nix/colorgrab.nix
··· 1 + { writeScriptBin 2 + , bash 3 + , coreutils 4 + , grim 5 + , imagemagick 6 + , libnotify 7 + , slurp 8 + , wl-clipboard 9 + , xdg-utils 10 + , ... 11 + }: 12 + 13 + writeScriptBin "colorgrab" (builtins.replaceStrings 14 + [ 15 + "#!/bin/sh" 16 + "mkdir" 17 + "printf" 18 + "grim" 19 + "slurp" 20 + "convert" 21 + "wl-copy" 22 + "xdg-open " 23 + "notify-send" 24 + ] 25 + [ 26 + "#!${bash}/bin/sh" 27 + "${coreutils}/bin/mkdir" 28 + "${coreutils}/bin/printf" 29 + "${grim}/bin/grim" 30 + "${slurp}/bin/slurp" 31 + "${imagemagick}/bin/convert" 32 + "${wl-clipboard}/bin/wl-copy" 33 + "${xdg-utils}/bin/xdg-open " 34 + "${libnotify}/bin/notify-send" 35 + ] 36 + (builtins.readFile ../scritps/colorgrab) 37 + )
+22
.nix/prefon.nix
··· 1 + { writeScriptBin 2 + , bash 3 + , coreutils 4 + , imagemagick 5 + , ... 6 + }: 7 + 8 + writeScriptBin "prefon" (builtins.replaceStrings 9 + [ 10 + "#!/bin/sh" 11 + "printf" 12 + "convert" 13 + "rm" 14 + ] 15 + [ 16 + "#!${bash}/bin/sh" 17 + "${coreutils}/bin/printf" 18 + "${imagemagick}/bin/convert" 19 + "${coreutils}/bin/rm" 20 + ] 21 + (builtins.readFile ../scritps/prefon) 22 + )
+37
.nix/scr.nix
··· 1 + { writeScriptBin 2 + , bash 3 + , coreutils 4 + , ffmpeg 5 + , grim 6 + , pulseaudio 7 + , slurp 8 + , wf-recorder 9 + , wl-clipboard 10 + , ... 11 + }: 12 + 13 + writeScriptBin "scr" (builtins.replaceStrings 14 + [ 15 + "#!/bin/sh" 16 + "printf" 17 + "mkdir" 18 + "ffmpeg" 19 + "grim" 20 + "slurp" 21 + "wl-copy" 22 + "pactl" 23 + "wf-recorder" 24 + ] 25 + [ 26 + "#!${bash}/bin/sh" 27 + "${coreutils}/bin/printf" 28 + "${coreutils}/bin/mkdir" 29 + "${ffmpeg}/bin/ffmpeg" 30 + "${grim}/bin/grim" 31 + "${slurp}/bin/slurp" 32 + "${wl-clipboard}/bin/wl-copy" 33 + "${pulseaudio}/bin/pactl" 34 + "${wf-recorder}/bin/wf-recorder" 35 + ] 36 + (builtins.readFile ../scritps/scr) 37 + )
+24
.nix/thm.nix
··· 1 + { writeScriptBin 2 + , bash 3 + , coreutils 4 + , gnused 5 + , ... 6 + }: 7 + 8 + writeScriptBin "thm" (builtins.replaceStrings 9 + [ 10 + "#!/bin/sh" 11 + "printf" 12 + "mkdir" 13 + "mv" 14 + "sed" 15 + ] 16 + [ 17 + "#!${bash}/bin/sh" 18 + "${coreutils}/bin/printf" 19 + "${coreutils}/bin/mkdir" 20 + "${coreutils}/bin/mv" 21 + "${gnused}/bin/sed" 22 + ] 23 + (builtins.readFile ../scritps/thm) 24 + )
-24
LICENSE
··· 1 - This is free and unencumbered software released into the public domain. 2 - 3 - Anyone is free to copy, modify, publish, use, compile, sell, or 4 - distribute this software, either in source code form or as a compiled 5 - binary, for any purpose, commercial or non-commercial, and by any 6 - means. 7 - 8 - In jurisdictions that recognize copyright laws, the author or authors 9 - of this software dedicate any and all copyright interest in the 10 - software to the public domain. We make this dedication for the benefit 11 - of the public at large and to the detriment of our heirs and 12 - successors. We intend this dedication to be an overt act of 13 - relinquishment in perpetuity of all present and future rights to this 14 - software under copyright law. 15 - 16 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 - IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 - OTHER DEALINGS IN THE SOFTWARE. 23 - 24 - For more information, please refer to <http://unlicense.org/>
-5
README
··· 1 - # haiku readme 2 - 3 - random shell scripts that 4 - are potentially useful 5 - for various tasks
+2
examples/thm/scripts/reload-mako
··· 1 + #!/bin/sh 2 + makoctl reload
+2
examples/thm/scripts/reload-sway
··· 1 + #!/bin/sh 2 + swaymsg reload
+32
examples/thm/templates/alacritty-colors.yml.template
··· 1 + colors: 2 + primary: 3 + background: '#{bg_color}' 4 + foreground: '#{fg_color}' 5 + 6 + cursor: 7 + text: '#{bg_color}' 8 + cursor: '#{fg_color}' 9 + 10 + selection: 11 + text: '#{bg_color}' 12 + background: '#{fg_color}' 13 + 14 + normal: 15 + black: '#{color0}' 16 + red: '#{color1}' 17 + green: '#{color2}' 18 + yellow: '#{color3}' 19 + blue: '#{color4}' 20 + magenta: '#{color5}' 21 + cyan: '#{color6}' 22 + white: '#{color7}' 23 + 24 + bright: 25 + black: '#{color8}' 26 + red: '#{color9}' 27 + green: '#{color10}' 28 + yellow: '#{color11}' 29 + blue: '#{color12}' 30 + magenta: '#{color13}' 31 + cyan: '#{color14}' 32 + white: '#{color15}'
+43
examples/thm/templates/colors.css.template
··· 1 + :root { 2 + /* HEX */ 3 + --bg-color: #{bg_color}; 4 + --fg-color: #{fg_color}; 5 + 6 + --color0: #{color0}; 7 + --color1: #{color1}; 8 + --color2: #{color2}; 9 + --color3: #{color3}; 10 + --color4: #{color4}; 11 + --color5: #{color5}; 12 + --color6: #{color6}; 13 + --color7: #{color7}; 14 + --color8: #{color8}; 15 + --color9: #{color9}; 16 + --color10: #{color10}; 17 + --color11: #{color11}; 18 + --color12: #{color12}; 19 + --color13: #{color13}; 20 + --color14: #{color14}; 21 + --color15: #{color15}; 22 + 23 + /* RGB */ 24 + --bg-color-rgb: rgb({bg_color.rgb}); 25 + --fg-color-rgb: rgb({fg_color.rgb}); 26 + 27 + --color0-rgb: rgb({color0.rgb}); 28 + --color1-rgb: rgb({color1.rgb}); 29 + --color2-rgb: rgb({color2.rgb}); 30 + --color3-rgb: rgb({color3.rgb}); 31 + --color4-rgb: rgb({color4.rgb}); 32 + --color5-rgb: rgb({color5.rgb}); 33 + --color6-rgb: rgb({color6.rgb}); 34 + --color7-rgb: rgb({color7.rgb}); 35 + --color8-rgb: rgb({color8.rgb}); 36 + --color9-rgb: rgb({color9.rgb}); 37 + --color10-rgb: rgb({color10.rgb}); 38 + --color11-rgb: rgb({color11.rgb}); 39 + --color12-rgb: rgb({color12.rgb}); 40 + --color13-rgb: rgb({color13.rgb}); 41 + --color14-rgb: rgb({color14.rgb}); 42 + --color15-rgb: rgb({color15.rgb}); 43 + }
+45
examples/thm/templates/colors.sh.template
··· 1 + #!/bin/sh 2 + 3 + # Hex 4 + bg_color='{bg_color}' 5 + fg_color='{fg_color}' 6 + 7 + color0='{color0}' 8 + color1='{color1}' 9 + color2='{color2}' 10 + color3='{color3}' 11 + color4='{color4}' 12 + color5='{color5}' 13 + color6='{color6}' 14 + color7='{color7}' 15 + 16 + color8='{color8}' 17 + color9='{color9}' 18 + color10='{color10}' 19 + color11='{color11}' 20 + color12='{color12}' 21 + color13='{color13}' 22 + color14='{color14}' 23 + color15='{color15}' 24 + 25 + # RGB 26 + bg_color_rgb='{bg_color.rgb}' 27 + fg_color_rgb='{fg_color.rgb}' 28 + 29 + color0_rgb='{color0.rgb}' 30 + color1_rgb='{color1.rgb}' 31 + color2_rgb='{color2.rgb}' 32 + color3_rgb='{color3.rgb}' 33 + color4_rgb='{color4.rgb}' 34 + color5_rgb='{color5.rgb}' 35 + color6_rgb='{color6.rgb}' 36 + color7_rgb='{color7.rgb}' 37 + 38 + color8_rgb='{color8.rgb}' 39 + color9_rgb='{color9.rgb}' 40 + color10_rgb='{color10.rgb}' 41 + color11_rgb='{color11.rgb}' 42 + color12_rgb='{color12.rgb}' 43 + color13_rgb='{color13.rgb}' 44 + color14_rgb='{color14.rgb}' 45 + color15_rgb='{color15.rgb}'
+20
examples/thm/templates/colors.template
··· 1 + # Puts the hex and rgb values of the same color on the same line in order 2 + 3 + {bg_color} {bg_color.rgb} 4 + {fg_color} {fg_color.rgb} 5 + {color0} {color0.rgb} 6 + {color1} {color1.rgb} 7 + {color2} {color2.rgb} 8 + {color3} {color3.rgb} 9 + {color4} {color4.rgb} 10 + {color5} {color5.rgb} 11 + {color6} {color6.rgb} 12 + {color7} {color7.rgb} 13 + {color8} {color8.rgb} 14 + {color9} {color9.rgb} 15 + {color10} {color10.rgb} 16 + {color11} {color11.rgb} 17 + {color12} {color12.rgb} 18 + {color13} {color13.rgb} 19 + {color14} {color14.rgb} 20 + {color1} {color1.rgb}
+38
examples/thm/templates/dark/sway-appearance.template
··· 1 + # class border background text indicator child_border 2 + client.focused #{color5} #{color13} #{fg_color} #{color5} #{color5} 3 + client.focused_inactive #{color4} #{color12} #{fg_color} #{color4} #{color4} 4 + client.unfocused #{color8} #{color8} #{fg_color} #{color8} #{color8} 5 + client.urgent #{color1} #{color9} #{fg_color} #{color1} #{color1} 6 + 7 + default_border normal 2 8 + default_floating_border normal 2 9 + titlebar_border_thickness 2 10 + 11 + font pango:monospace 10 12 + 13 + hide_edge_borders both 14 + 15 + title_align center 16 + 17 + set { 18 + $bg_color {bg_color} 19 + $fg_color {fg_color} 20 + 21 + $color0 {color0} 22 + $color1 {color1} 23 + $color2 {color2} 24 + $color3 {color3} 25 + $color4 {color4} 26 + $color5 {color5} 27 + $color6 {color6} 28 + $color7 {color7} 29 + $color8 {color8} 30 + $color9 {color9} 31 + 32 + $color10 {color10} 33 + $color11 {color11} 34 + $color12 {color12} 35 + $color13 {color13} 36 + $color14 {color14} 37 + $color15 {color15} 38 + }
+43
examples/thm/templates/foot.ini.template
··· 1 + font=monospace:size=10 2 + dpi-aware=yes 3 + pad=8x8 4 + initial-window-size-chars=120x36 5 + 6 + [scrollback] 7 + lines=2000 8 + indicator-position=none 9 + 10 + [cursor] 11 + style=bar 12 + color={bg_color} {fg_color} 13 + 14 + [colors] 15 + background={bg_color} 16 + foreground={fg_color} 17 + regular0={color0} 18 + regular1={color1} 19 + regular2={color2} 20 + regular3={color3} 21 + regular4={color4} 22 + regular5={color5} 23 + regular6={color6} 24 + regular7={color7} 25 + bright0={color8} 26 + bright1={color9} 27 + bright2={color10} 28 + bright3={color11} 29 + bright4={color12} 30 + bright5={color13} 31 + bright6={color14} 32 + bright7={color15} 33 + # selection-foreground=<inverse foreground/background> 34 + # selection-background=<inverse foreground/background> 35 + 36 + [csd] 37 + preferred=client 38 + size=32 39 + color=ff{fg_color} 40 + button-width=32 41 + button-minimize-color={color4} 42 + button-maximize-color={color2} 43 + button-close-color={color1}
+41
examples/thm/templates/gtk.css.template
··· 1 + /* HEX */ 2 + @define-color bg-color #{bg_color}; 3 + @define-color fg-color #{fg_color}; 4 + 5 + @define-color color0 #{color0}; 6 + @define-color color1 #{color1}; 7 + @define-color color2 #{color2}; 8 + @define-color color3 #{color3}; 9 + @define-color color4 #{color4}; 10 + @define-color color5 #{color5}; 11 + @define-color color6 #{color6}; 12 + @define-color color7 #{color7}; 13 + @define-color color8 #{color8}; 14 + @define-color color9 #{color9}; 15 + @define-color color10 #{color10}; 16 + @define-color color11 #{color11}; 17 + @define-color color12 #{color12}; 18 + @define-color color13 #{color13}; 19 + @define-color color14 #{color14}; 20 + @define-color color15 #{color15}; 21 + 22 + /* RGB */ 23 + @define-color bg-color-rgb rgb ({bg_color.rgb}); 24 + @define-color fg-color-rgb rgb ({fg_color.rgb}); 25 + 26 + @define-color color0-rgb rgb ({color0.rgb}); 27 + @define-color color1-rgb rgb ({color1.rgb}); 28 + @define-color color2-rgb rgb ({color2.rgb}); 29 + @define-color color3-rgb rgb ({color3.rgb}); 30 + @define-color color4-rgb rgb ({color4.rgb}); 31 + @define-color color5-rgb rgb ({color5.rgb}); 32 + @define-color color6-rgb rgb ({color6.rgb}); 33 + @define-color color7-rgb rgb ({color7.rgb}); 34 + @define-color color8-rgb rgb ({color8.rgb}); 35 + @define-color color9-rgb rgb ({color9.rgb}); 36 + @define-color color10-rgb rgb ({color10.rgb}); 37 + @define-color color11-rgb rgb ({color11.rgb}); 38 + @define-color color12-rgb rgb ({color12.rgb}); 39 + @define-color color13-rgb rgb ({color13.rgb}); 40 + @define-color color14-rgb rgb ({color14.rgb}); 41 + @define-color color15-rgb rgb ({color15.rgb});
+38
examples/thm/templates/light/sway-appearance.template
··· 1 + # class border background text indicator child_border 2 + client.focused #{color5} #{color13} #{bg_color} #{color5} #{color5} 3 + client.focused_inactive #{color4} #{color12} #{bg_color} #{color4} #{color4} 4 + client.unfocused #{color8} #{color8} #{bg_color} #{color8} #{color8} 5 + client.urgent #{color1} #{color9} #{bg_color} #{color1} #{color1} 6 + 7 + default_border normal 2 8 + default_floating_border normal 2 9 + titlebar_border_thickness 2 10 + 11 + font pango:monospace 10 12 + 13 + hide_edge_borders both 14 + 15 + title_align center 16 + 17 + set { 18 + $bg_color {bg_color} 19 + $fg_color {fg_color} 20 + 21 + $color0 {color0} 22 + $color1 {color1} 23 + $color2 {color2} 24 + $color3 {color3} 25 + $color4 {color4} 26 + $color5 {color5} 27 + $color6 {color6} 28 + $color7 {color7} 29 + $color8 {color8} 30 + $color9 {color9} 31 + 32 + $color10 {color10} 33 + $color11 {color11} 34 + $color12 {color12} 35 + $color13 {color13} 36 + $color14 {color14} 37 + $color15 {color15} 38 + }
+47
examples/thm/templates/mako.template
··· 1 + # Global Config 2 + max-visible=2 3 + sort=-time 4 + output=DP-1 5 + layer=top 6 + anchor=top-right 7 + 8 + # All Notifcations 9 + font=monospace 10 10 + background-color=#{bg_color} 11 + text-color=#{fg_color} 12 + width=400 13 + height=200 14 + margin=8,8 15 + padding=8,8 16 + border-size=4 17 + border-color=#{fg_color} 18 + max-icon-size=48 19 + actions=1 20 + format=<b>%a</b>\n%s\n%b 21 + default-timeout=8000 22 + group-by=app-name 23 + 24 + # Low Urgency Notifcations 25 + [urgency=low] 26 + border-color=#{color8} 27 + default-timeout=4000 28 + 29 + # Normal Ugency Notifcations 30 + [urgency=normal] 31 + border-color=#{fg_color} 32 + default-timeout=8000 33 + 34 + # High Urgency Notifcations 35 + [urgency=high] 36 + border-color=#{color1} 37 + default-timeout=0 38 + 39 + [grouped] 40 + format=<b>%a</b>\n%s\n%b 41 + 42 + # Hidden Notification 43 + [hidden] 44 + width=0 45 + height=0 46 + border-size=0 47 + format=
+32
examples/thm/templates/swaylock.template
··· 1 + # Functionality 2 + ignore-empty-password 3 + daemonize 4 + 5 + # Appearance 6 + disable-caps-lock-text 7 + indicator-caps-lock 8 + color={color8} 9 + bs-hl-color={color1} 10 + caps-lock-bs-hl-color={color1} 11 + caps-lock-key-hl-color={color3} 12 + font=monospace 13 + indicator-radius=64 14 + indicator-thickness=16 15 + inside-color={color2} 16 + inside-clear-color={color5} 17 + inside-caps-lock-color={color3} 18 + inside-ver-color={color4} 19 + inside-wrong-color={color1} 20 + key-hl-color={color2} 21 + line-uses-inside 22 + ring-color={color10} 23 + ring-clear-color={color13} 24 + ring-caps-lock-color={color11} 25 + ring-ver-color={color12} 26 + ring-wrong-color={color9} 27 + separator-color={color7}00 28 + text-color={color15} 29 + text-clear-color={color15} 30 + text-caps-lock-color={color15} 31 + text-ver-color={color15} 32 + text-wrong-color={color15}
+23
examples/thm/themes/dark.theme
··· 1 + #!/bin/sh 2 + 3 + theme_type="dark" 4 + 5 + bg_color="1f1f1f" 6 + fg_color="efefef" 7 + 8 + color0="1f1f1f" 9 + color1="e67b7b" 10 + color2="80ba63" 11 + color3="f5a868" 12 + color4="849ce6" 13 + color5="b37fe3" 14 + color6="6ebdc4" 15 + color7="b0b0b0" 16 + color8="3f3f3f" 17 + color9="ed9a9a" 18 + color10="a3d989" 19 + color11="f7c297" 20 + color12="a6baf5" 21 + color13="d1adf2" 22 + color14="bedcde" 23 + color15="efefef"
+23
examples/thm/themes/default-dark.theme
··· 1 + #!/bin/sh 2 + 3 + theme_type="dark" 4 + 5 + bg_color="000000" 6 + fg_color="ffffff" 7 + 8 + color0="000000" 9 + color1="800000" 10 + color2="008000" 11 + color3="808000" 12 + color4="000080" 13 + color5="800080" 14 + color6="008080" 15 + color7="c0c0c0" 16 + color8="808080" 17 + color9="ff0000" 18 + color10="00ff00" 19 + color11="ffff00" 20 + color12="0000ff" 21 + color13="ff00ff" 22 + color14="00ffff" 23 + color15="ffffff"
+23
examples/thm/themes/default-light.theme
··· 1 + #!/bin/sh 2 + 3 + theme_type="light" 4 + 5 + bg_color="ffffff" 6 + fg_color="000000" 7 + 8 + color0="ffffff" 9 + color1="800000" 10 + color2="008000" 11 + color3="808000" 12 + color4="000080" 13 + color5="800080" 14 + color6="008080" 15 + color7="808080" 16 + color8="c0c0c0" 17 + color9="ff0000" 18 + color10="00ff00" 19 + color11="ffff00" 20 + color12="0000ff" 21 + color13="ff00ff" 22 + color14="00ffff" 23 + color15="000000"
+23
examples/thm/themes/grayscale-light.theme
··· 1 + #!/bin/sh 2 + 3 + theme_type="light" 4 + 5 + bg_color="efefef" 6 + fg_color="1f1f1f" 7 + 8 + color0="efefef" 9 + color1="b0b0b0" 10 + color2="9d9d9d" 11 + color3="8a8a8a" 12 + color4="787878" 13 + color5="656565" 14 + color6="525252" 15 + color7="3f3f3f" 16 + color9="808080" 17 + color8="bfbfbf" 18 + color10="707070" 19 + color11="606060" 20 + color12="505050" 21 + color13="3f3f3f" 22 + color14="2f2f2f" 23 + color15="1f1f1f"
+23
examples/thm/themes/light.theme
··· 1 + #!/bin/sh 2 + 3 + theme_type="light" 4 + 5 + bg_color="efefef" 6 + fg_color="1f1f1f" 7 + 8 + color0="efefef" 9 + color1="e67b7b" 10 + color2="80ba63" 11 + color3="f5a868" 12 + color4="849ce6" 13 + color5="b37fe3" 14 + color6="6ebdc4" 15 + color7="3f3f3f" 16 + color8="b0b0b0" 17 + color9="ed9a9a" 18 + color10="a3d989" 19 + color11="f7c297" 20 + color12="a6baf5" 21 + color13="d1adf2" 22 + color14="bedcde" 23 + color15="1f1f1f"
-2
exmaples/thm/scripts/reload-sway
··· 1 - #!/bin/sh 2 - swaymsg reload
-22
exmaples/thm/templates/colors.sh.template
··· 1 - #!/bin/sh 2 - 3 - bg_color='{bg_color}' 4 - fg_color='{fg_color}' 5 - 6 - color0='{color0}' 7 - color1='{color1}' 8 - color2='{color2}' 9 - color3='{color3}' 10 - color4='{color4}' 11 - color5='{color5}' 12 - color6='{color6}' 13 - color7='{color7}' 14 - 15 - color8='{color8}' 16 - color9='{color9}' 17 - color10='{color10}' 18 - color11='{color11}' 19 - color12='{color12}' 20 - color13='{color13}' 21 - color14='{color14}' 22 - color15='{color15}'
-29
exmaples/thm/templates/sway-colors.template
··· 1 - # class border background text indicator child_border 2 - client.focused #{color5} #{color13} #{bg_color} #{color5} #{color5} 3 - client.focused_inactive #{color4} #{color12} #{bg_color} #{color4} #{color4} 4 - client.unfocused #{color8} #{color8} #{bg_color} #{color8} #{color8} 5 - client.urgent #{color1} #{color9} #{bg_color} #{color1} #{color1} 6 - 7 - # set variables 8 - set { 9 - $bg_color {bg_color} 10 - $fg_color {fg_color} 11 - 12 - $color0 {color0} 13 - $color1 {color1} 14 - $color2 {color2} 15 - $color3 {color3} 16 - $color4 {color4} 17 - $color5 {color5} 18 - $color6 {color6} 19 - $color7 {color7} 20 - $color8 {color8} 21 - $color9 {color9} 22 - 23 - $color10 {color10} 24 - $color11 {color11} 25 - $color12 {color12} 26 - $color13 {color13} 27 - $color14 {color14} 28 - $color15 {color15} 29 - }
-21
exmaples/thm/themes/default-dark.theme
··· 1 - #!/bin/sh 2 - 3 - bg_color="000000" 4 - fg_color="ffffff" 5 - 6 - color0="000000" 7 - color1="800000" 8 - color2="008000" 9 - color3="808000" 10 - color4="000080" 11 - color5="800080" 12 - color6="008080" 13 - color7="c0c0c0" 14 - color8="808080" 15 - color9="ff0000" 16 - color10="00ff00" 17 - color11="ffff00" 18 - color12="0000ff" 19 - color13="ff00ff" 20 - color14="00ffff" 21 - color15="ffffff"
-21
exmaples/thm/themes/default-light.theme
··· 1 - #!/bin/sh 2 - 3 - bg_color="ffffff" 4 - fg_color="000000" 5 - 6 - color0="ffffff" 7 - color1="800000" 8 - color2="008000" 9 - color3="808000" 10 - color4="000080" 11 - color5="800080" 12 - color6="008080" 13 - color7="808080" 14 - color8="c0c0c0" 15 - color9="ff0000" 16 - color10="00ff00" 17 - color11="ffff00" 18 - color12="0000ff" 19 - color13="ff00ff" 20 - color14="00ffff" 21 - color15="000000"
-20
exmaples/thm/themes/grayscale-light.theme
··· 1 - #!/bin/sh 2 - bg_color="efefef" 3 - fg_color="1f1f1f" 4 - 5 - color0="efefef" 6 - color1="b0b0b0" 7 - color2="9d9d9d" 8 - color3="8a8a8a" 9 - color4="787878" 10 - color5="656565" 11 - color6="525252" 12 - color7="3f3f3f" 13 - color9="808080" 14 - color8="bfbfbf" 15 - color10="707070" 16 - color11="606060" 17 - color12="505050" 18 - color13="3f3f3f" 19 - color14="2f2f2f" 20 - color15="1f1f1f"
-21
exmaples/thm/themes/light.theme
··· 1 - #!/bin/sh 2 - 3 - bg_color="efefef" 4 - fg_color="1f1f1f" 5 - 6 - color0="efefef" 7 - color1="e67b7b" 8 - color2="80ba63" 9 - color3="f5a868" 10 - color4="849ce6" 11 - color5="b37fe3" 12 - color6="6ebdc4" 13 - color7="3f3f3f" 14 - color8="b0b0b0" 15 - color9="ed9a9a" 16 - color10="a3d989" 17 - color11="f7c297" 18 - color12="a6baf5" 19 - color13="d1adf2" 20 - color14="bedcde" 21 - color15="1f1f1f"
+27
flake.lock
··· 1 + { 2 + "nodes": { 3 + "nixpkgs": { 4 + "locked": { 5 + "lastModified": 1726062873, 6 + "narHash": "sha256-IiA3jfbR7K/B5+9byVi9BZGWTD4VSbWe8VLpp9B/iYk=", 7 + "owner": "NixOS", 8 + "repo": "nixpkgs", 9 + "rev": "4f807e8940284ad7925ebd0a0993d2a1791acb2f", 10 + "type": "github" 11 + }, 12 + "original": { 13 + "owner": "NixOS", 14 + "ref": "nixos-unstable", 15 + "repo": "nixpkgs", 16 + "type": "github" 17 + } 18 + }, 19 + "root": { 20 + "inputs": { 21 + "nixpkgs": "nixpkgs" 22 + } 23 + } 24 + }, 25 + "root": "root", 26 + "version": 7 27 + }
+35
flake.nix
··· 1 + { 2 + inputs = { 3 + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 4 + }; 5 + 6 + outputs = { self, nixpkgs, ... }: 7 + let 8 + forAllSystems = function: nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ] 9 + (system: function (import nixpkgs { 10 + inherit system; 11 + overlays = [ self.overlays.default ]; 12 + })); 13 + in 14 + { 15 + overlays.default = final: prev: rec { 16 + colorgrab = final.callPackage ./.nix/colorgrab.nix { }; 17 + prefon = final.callPackage ./.nix/prefon.nix { }; 18 + scr = final.callPackage ./.nix/scr.nix { }; 19 + thm = final.callPackage ./.nix/thm.nix { }; 20 + yemou-scripts = final.symlinkJoin { 21 + name = "yemou-scripts"; 22 + paths = [ colorgrab prefon scr thm ]; 23 + }; 24 + }; 25 + 26 + packages = forAllSystems (pkgs: { 27 + colorgrab = pkgs.colorgrab; 28 + default = pkgs.yemou-scripts; 29 + prefon = pkgs.prefon; 30 + scr = pkgs.scr; 31 + thm = pkgs.thm; 32 + yemou-scripts = pkgs.yemou-scripts; 33 + }); 34 + }; 35 + }
+24
license
··· 1 + This is free and unencumbered software released into the public domain. 2 + 3 + Anyone is free to copy, modify, publish, use, compile, sell, or 4 + distribute this software, either in source code form or as a compiled 5 + binary, for any purpose, commercial or non-commercial, and by any 6 + means. 7 + 8 + In jurisdictions that recognize copyright laws, the author or authors 9 + of this software dedicate any and all copyright interest in the 10 + software to the public domain. We make this dedication for the benefit 11 + of the public at large and to the detriment of our heirs and 12 + successors. We intend this dedication to be an overt act of 13 + relinquishment in perpetuity of all present and future rights to this 14 + software under copyright law. 15 + 16 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 + IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 + OTHER DEALINGS IN THE SOFTWARE. 23 + 24 + For more information, please refer to <http://unlicense.org/>
+6
readme.md
··· 1 + # haiku readme 2 + random shell scripts that 3 + 4 + are potentially useful 5 + 6 + for various tasks
+29 -22
scritps/colorgrab
··· 22 22 } 23 23 24 24 # Parse arguments 25 - for flag in "$@" 25 + for flag 26 26 do 27 27 # Make sure flag begins with '-' and are atleast two characters long 28 28 case $flag in ··· 34 34 35 35 # Split the flags into individual arguments and set variables 36 36 flag=${flag#-} 37 + 37 38 while [ "$flag" ] 38 39 do 39 - a=${flag%${flag#?}} 40 + a=${flag%"${flag#?}"} 41 + 40 42 case $a in 41 43 c ) copy_to_clipboard=true ;; 42 44 h ) usage; exit 0 ;; ··· 47 49 * ) printf '%s\n' "${0##*/}: -$a invalid argument" 1>&2 48 50 usage 1>&2; exit 1 ;; 49 51 esac 52 + 50 53 flag=${flag#?} 51 54 done 52 55 done 53 56 54 57 # Make sure this directory exist before continuing 55 - [ -d "/tmp/${0##*/}" ] || { 56 - mkdir -p "/tmp/${0##*/}" || \ 57 - printf '%s\n' "${0##*/}: failed to create directory: /tmp/${0##*/}" 1>&2 \ 58 - exit 1 59 - } 58 + [ -d "/tmp/${0##*/}" ] || { mkdir -p "/tmp/${0##*/}" || exit 1; } 60 59 61 60 # Set color_type if not already set 62 - [ $color_type ] || color_type="hex" 61 + [ "$color_type" ] || color_type="hex" 63 62 64 63 # Get a screenshot of the pixel 65 - grim -s 1 -g "$(slurp -b 00000000 -s 00000000 -w -1 -p)" "/tmp/${0##*/}/temp.png" 64 + # shellcheck disable=SC2086 65 + grim -s 1 -g "$(slurp ${SLURP_ARGS} -b 00000000 -s 00000000 -w -1 -p)" "/tmp/${0##*/}/temp.png" 66 66 67 67 case $color_type in 68 68 hex ) color=$(convert "/tmp/${0##*/}/temp.png" -format "%[hex:p]\n" info:) ;; 69 - rgb ) color=$(convert "/tmp/${0##*/}/temp.png" -format "%[pixel:p]\n" info:) 70 - color=${color#*(}; color=${color%)*} ;; 69 + rgb ) 70 + color=$(convert "/tmp/${0##*/}/temp.png" -format "%[pixel:p]\n" info:) 71 + color=${color#*(}; color=${color%)*} 72 + ;; 71 73 * ) printf '%s\n' "${0##*/}: invalid color_type: $color_type" 1>&2; exit 1 ;; 72 74 esac 73 - echo "$color" 75 + printf '%s\n' "$color" 74 76 75 77 # Copy color to clipboard 76 - [ $copy_to_clipboard ] && { 78 + [ "$copy_to_clipboard" ] && { 77 79 wl-copy -n "$color" || printf '%s\n' "${0##*/}: failed to copy color to clipboard" 1>&2 78 80 } 79 81 80 82 # Open color image in the user's perfered image viewer 81 - [ $open_color_image ] && { 83 + [ "$open_color_image" ] && { 82 84 # Create the color image if it doesn't already exist 83 85 [ -f "/tmp/${0##*/}/o$color.png" ] || { 84 86 case $color_type in 85 87 hex ) ocolor="#$color" ;; 86 - rgb ) ocolor="rgb($color)";; 88 + rgb ) ocolor="rgb($color)" ;; 87 89 esac 90 + 88 91 convert -size 150x150 xc:"$ocolor" +size -gravity center \ 89 92 \( -background white pango:"<span font_family=\"monospace\" 90 93 font_weight=\"bold\"> $color </span>" \) \ 91 94 -composite "/tmp/${0##*/}/o$color.png" 92 95 } 96 + 93 97 xdg-open "/tmp/${0##*/}/o$color.png" > "/tmp/${0##*/}/xdg-open.log" 2>&1 & 94 98 } 95 99 96 100 # Send a notification with an image of the color aswell as the value 97 - [ $send_notification ] && { 101 + [ "$send_notification" ] && { 98 102 [ -f "/tmp/${0##*/}/n$color.png" ] || { 99 103 case $color_type in 100 104 hex ) ncolor="#$color"; color_prefix="hex:";; 101 - rgb ) ncolor="rgb($color)" 102 - color_r="${color%%,*}" 103 - color_g="${color#*,}"; color_g="${color_g%,*}" 104 - color_b="${color##*,}" 105 - color_rgb="$color_r$color_g$color_b" 106 - color_prefix="rgb:";; 105 + rgb ) 106 + ncolor="rgb($color)" 107 + color_r="${color%%,*}" 108 + color_g="${color#*,}"; color_g="${color_g%,*}" 109 + color_b="${color##*,}" 110 + color_rgb="$color_r$color_g$color_b" 111 + color_prefix="rgb:";; 107 112 esac 113 + 108 114 convert -size 64x64 xc:"$ncolor" "/tmp/${0##*/}/n$color_rgb.png" 109 115 } 116 + 110 117 notify-send -a "${0##*/}" -i "/tmp/${0##*/}/n$color_rgb.png" "$color_prefix $color" 111 118 }
-37
scritps/ds4-leds
··· 1 - #!/bin/sh 2 - # Change the LEDs of a DualShock4 Controller 3 - 4 - usage() { 5 - printf '%s\n' "usage: ${0##*/} hex|rgb color" \ 6 - "${0##*/} accepts hex values (ffffff) or rgb values (255,255,255)" 7 - } 8 - 9 - [ "$2" ] || { usage; exit 1; } 10 - 11 - hex2rgb() { 12 - hex=$1 13 - hex_r=${hex%????} 14 - hex_g=${hex#??}; hex_g=${hex_g%??} 15 - hex_b=${hex#????} 16 - printf '%d,%d,%d' "0x$hex_r" "0x$hex_g" "0x$hex_b" 17 - } 18 - 19 - ds4leds() { 20 - vendorid="054C" 21 - productid="05C4" 22 - led_path="/sys/class/leds" 23 - 24 - IFS=, read -r rgb_r rgb_g rgb_b <<-EOF 25 - $1 26 - EOF 27 - 28 - printf '%s' "$rgb_r" | tee "$led_path/"*"$vendorid:$productid"*":red/brightness" > /dev/null 29 - printf '%s' "$rgb_g" | tee "$led_path/"*"$vendorid:$productid"*":green/brightness" > /dev/null 30 - printf '%s' "$rgb_b" | tee "$led_path/"*"$vendorid:$productid"*":blue/brightness" > /dev/null 31 - } 32 - 33 - case $1 in 34 - hex ) ds4leds "$(hex2rgb "$2")" ;; 35 - rgb ) ds4leds "$2" ;; 36 - *h|*help ) usage; exit 0 ;; 37 - esac
+147
scritps/prefon
··· 1 + #!/bin/sh 2 + # Script to preview fonts 3 + 4 + usage() { 5 + printf '%b\n' "${0##*/} [-F FILE | -S | -t STRING] [OPTIONS]" \ 6 + "actions:" \ 7 + "\t-F FILE - read from file" \ 8 + "\t-S - read from stdin" \ 9 + "\t-t STRING - use a string" \ 10 + "\noptions:" \ 11 + "\t-b SIZE - border size" \ 12 + "\t-c COLORS - set the color of the text and background" \ 13 + "\t-f FONT - which font to preview" \ 14 + "\t-h - display this message" \ 15 + "\t-i - generate the inverse image (horizontal, vertical, none)" \ 16 + "\t-o FILE - output file for the generated image" \ 17 + "\t-s SIZE - size of the font" \ 18 + "\ndefault values:" \ 19 + "These values can be set before execution to change default values" \ 20 + "\tPREFON_ACTION=text (file, stdin, or text)" \ 21 + "\tPREFON_BORDER_SIZE=16" \ 22 + "\tPREFON_COLORS=\"000000,ffffff\"" \ 23 + "\tPREFON_FONT=\"monospace\"" \ 24 + "\tPREFON_OUTPUT=\"/tmp/prefon.png\"" \ 25 + "\tPREFON_SIZE=16" \ 26 + "\tPREFON_TEXT=\"The quick brown fox jumps\\\n over the lazy dog\"" \ 27 + "\tPREFON_INVERSE=vertical (horizontal, vertical, none)" 28 + } 29 + 30 + info() { 31 + case $1 in 32 + i ) prefix=INFO ;; 33 + w ) prefix=WARNING ;; 34 + e ) prefix=ERROR ;; 35 + * ) printf '%s\n' "sus!" 1>&2; exit 1 ;; 36 + esac; shift 37 + 38 + printf "${0##*/}: $prefix: %b\n" "$*" 1>&2 39 + } 40 + 41 + # Default values 42 + PREFON_ACTION=${PREFON_ACTION:-text} 43 + PREFON_BORDER_SIZE=${PREFON_BORDER_SIZE:-16} 44 + PREFON_COLORS=${PREFON_COLORS:-000000,ffffff} 45 + PREFON_FONT="${PREFON_FONT:-monospace}" 46 + PREFON_OUTPUT="${PREFON_OUTPUT:-/tmp/prefon.png}" 47 + PREFON_SIZE=${PREFON_SIZE:-16} 48 + PREFON_TEXT="${PREFON_TEXT:-The quick brown fox jumps\n over the lazy dog}" 49 + PREFON_INVERSE=${PREFON_WITHOUT_INVERSE:-vertical} 50 + 51 + # Handle arguments 52 + while [ "$*" ] 53 + do 54 + case $1 in 55 + - ) shift; continue ;; 56 + -- ) shift; break ;; 57 + -* ) flag=${1#-}; shift ;; 58 + * ) shift; continue ;; 59 + esac 60 + 61 + while [ "$flag" ] 62 + do 63 + arg=${flag%${flag#?}} 64 + 65 + case $arg in 66 + F ) PREFON_ACTION="file"; PREFON_FILE=$1; shift ;; 67 + S ) PREFON_ACTION=stdin; PREFON_FILE=/dev/stdin ;; 68 + b ) PREFON_BORDER_SIZE=$1; shift ;; 69 + c ) PREFON_COLORS=$1; shift ;; 70 + f ) PREFON_FONT=$1; shift ;; 71 + h ) usage; exit 0 ;; 72 + i ) PREFON_INVERSE=$1; shift ;; 73 + o ) PREFON_OUTPUT=$1; shift ;; 74 + s ) PREFON_SIZE=$1; shift ;; 75 + t ) PREFON_ACTION=text; PREFON_TEXT=$1; shift ;; 76 + * ) printf '%s\n' "${0##*/}: -$arg: invalid argument" 1>&2 77 + usage 1>&2; exit 1 ;; 78 + esac 79 + 80 + flag=${flag#?} 81 + done 82 + done 83 + 84 + _gen_img() { 85 + convert -background "#$2" -bordercolor "#$2" -border "$PREFON_BORDER_SIZE" \ 86 + pango:"<span foreground=\"#$1\" font_desc=\"$PREFON_FONT $PREFON_SIZE\">$4</span>" "$3" 87 + } 88 + 89 + _output_file() { 90 + while IFS= read -r line 91 + do printf '%s\n' "$line" 92 + done < "$PREFON_FILE" 93 + } 94 + 95 + generate_image() { 96 + fgcolor=${PREFON_COLORS%,*} 97 + bgcolor=${PREFON_COLORS#*,} 98 + 99 + _gen_img "$fgcolor" "$bgcolor" "$PREFON_OUTPUT" "$1" || { 100 + info e failed to generate image 101 + exit 1 102 + } 103 + 104 + [ "$PREFON_INVERSE" != "none" ] && { 105 + inverse="${PREFON_OUTPUT%.*}" 106 + inverse="${inverse}-inverse.${PREFON_OUTPUT##*.}" 107 + 108 + _gen_img "$bgcolor" "$fgcolor" "$inverse" "$1" || { 109 + info e failed to generate image 110 + exit 1 111 + } 112 + 113 + case $PREFON_INVERSE in 114 + horizontal ) convert "$PREFON_OUTPUT" "$inverse" +append "$PREFON_OUTPUT" \ 115 + || { info e failed to generate image; exit 1; } ;; 116 + vertical ) convert "$PREFON_OUTPUT" "$inverse" -append "$PREFON_OUTPUT" \ 117 + || { info e failed to generate image; exit 1; } ;; 118 + * ) info e "${PREFON_INVERSE}: is not a valid value for PREFON_INVERSE" 119 + exit 1 ;; 120 + esac 121 + 122 + rm "$inverse" || info w failed to remove temporary file: "${inverse}" 123 + } 124 + 125 + printf '%s\n' "$PREFON_OUTPUT" 126 + } 127 + 128 + read_input() { 129 + input="$(_output_file)" 130 + generate_image "$input" 131 + } 132 + 133 + case $PREFON_ACTION in 134 + file ) 135 + [ -e "$PREFON_FILE" ] || { info e "'$PREFON_FILE' does not exist"; exit 1; } 136 + read_input 137 + ;; 138 + stdin ) 139 + [ -e /dev/stdin ] || { info e "/dev/stdin does not exist"; exit 1; } 140 + read_input 141 + ;; 142 + text ) 143 + [ "$PREFON_TEXT" ] || { info e "string not provided"; exit 1; } 144 + generate_image "$PREFON_TEXT" 145 + ;; 146 + * ) info e invalid action: $PREFON_ACTION; exit 1 ;; 147 + esac
+59 -23
scritps/scr
··· 1 1 #!/bin/sh 2 - # shellcheck disable=SC1090,SC2154 2 + # shellcheck disable=SC1090,SC1091,SC2154 3 3 4 4 # SC1090 & SC2154 5 5 # The files sourced are user generated files that should contain the needed ··· 24 24 25 25 # Source the configuration file 26 26 # A sample configuration can be found in my dotfiles at: 27 - # https://github.com/yemouu/setup/blob/master/root/home/cfg/scr/config.sh 28 - . "$SCR_CFG_DIR/config.sh" || \ 29 - { printf '%s\n' "${0##*/}: failed to source $SCR_CONFIG_DIR/config.sh" 1>&2; exit 1; } 27 + # https://github.com/yemouu/setup/blob/master/home/cfg/scr/config.sh 28 + # TODO: put an example cofiguration in this repo 29 + . "$SCR_CFG_DIR/config.sh" || { 30 + printf '%s\n' "${0##*/}: failed to source $SCR_CFG_DIR/config.sh" 1>&2; exit 1 31 + } 30 32 31 33 # Usage statement for the script 32 34 usage() { 33 - printf '%s\n' "usage: ${0##*/} action [options]" \ 35 + printf '%b\n' "usage: ${0##*/} action [options]" \ 34 36 "actions:" \ 35 - " aud - audio" \ 36 - " pic - picture" \ 37 - " rec - record" \ 37 + "\taud - audio" \ 38 + "\tpic - picture" \ 39 + "\trec - record" \ 38 40 "options:" \ 39 - " -a - record desktop audio" \ 40 - " -c - copy image to clipboard" \ 41 - " -h - display this message" \ 42 - " -m - record microphone audio" 41 + "\t-a - record desktop audio (aud,rec)" \ 42 + "\t-c - copy image to clipboard (pic)" \ 43 + "\t-h - display this message" \ 44 + "\t-m - record microphone audio (aud,rec)" \ 45 + "\t-o - output to use (pic,rec)" \ 46 + "\t-d - all displays (pic)" 43 47 } 44 48 45 49 # Determine the action to run ··· 53 57 shift 54 58 55 59 # Determine options to run with based on arguments 60 + # (I need to stop) 56 61 for flag in "$@" 57 62 do 58 63 # Make sure arguments start with '-' and are atleast 2 characters long ··· 64 69 esac 65 70 66 71 # Split arguments to be 1 character long and determine options to use 67 - flag=${flag#-} 68 - while [ "$flag" ] 72 + args=${flag#-} 73 + 74 + while [ "$args" ] 69 75 do 70 - a=${flag%${flag#?}} 76 + a=${args%"${args#?}"} 77 + 71 78 case $a in 72 79 a ) desktop_audio=true ;; 73 80 c ) copy_clipboard=true ;; 81 + d ) output=all ;; # Kinda redundent lol 74 82 h ) usage; exit 0 ;; 75 83 m ) microphone=true ;; 84 + o ) aargs=$* 85 + output=${aargs##*"${flag}"}; output=${output#\ }; output=${output%%\ *} 86 + [ "${output}" ] || printf '%s\n' "${0##*/}: -o: missing output" 1>&2 ;; 76 87 * ) printf '%s\n' "${0##*/}: -$a: invalid argument" 1>&2 77 88 usage 1>&2; exit 1 ;; 78 89 esac 79 - flag=${flag#?} 90 + 91 + args=${args#?} 80 92 done 81 93 done 82 94 unset args arg ··· 110 122 [ "$microphone" ] && [ "$desktop_audio" ] && \ 111 123 { args="$args -filter_complex amix=inputs=2"; } 112 124 113 - # Pressing Ctrl+C will exit the script instead of just wf-recorder. 114 - # Intercept Ctrl+C and exit wf-recorder instead of the script 115 - trap 'kill -2 $aud_pid' INT 125 + # Pressing Ctrl+C will exit the script instead of just ffmpeg. 126 + # Intercept Ctrl+C and do nothing. 127 + trap '' INT 116 128 117 129 # shellcheck disable=SC2086 118 130 # Word splitting is favorable here ··· 139 151 140 152 filename="$scr_pic_dir/$pic_filename" 141 153 142 - # Get the geometry of the screenshot from the user and take the screenshot 143 - grim -g "$(slurp)" "$filename" > "$SCR_CACHE_DIR/pic.log" 2>&1 154 + if [ "$output" = "all" ] 155 + then 156 + # Grim will screenshot all monitors by default 157 + grim "$filename" > "$SCR_CACHE_DIR/pic.log" 2>&1 158 + else 159 + # Get the geometry of the screenshot from the user and take the screenshot 160 + # shellcheck disable=SC2086 161 + if [ "$output" ]; then set -- -o "$output"; else set -- -g "$(slurp ${SLURP_ARGS})"; fi 162 + grim "$@" "$filename" > "$SCR_CACHE_DIR/pic.log" 2>&1 163 + fi 144 164 145 165 # Copy the image to the system clipboard 146 166 $copy_clipboard && { wl-copy <"$filename" > "$SCR_CACHE_DIR/copy.log" 2>&1; } ··· 176 196 177 197 # Pressing Ctrl+C will exit the script instead of just wf-recorder. 178 198 # Intercept Ctrl+C and exit wf-recorder instead of the script 179 - trap 'kill -2 $rec_pid' INT 199 + trap '' INT 180 200 201 + # shellcheck disable=SC2086 202 + if [ "$output" ]; then set -- -o "$output"; else set -- -g "$(slurp ${SLURP_ARGS})"; fi 181 203 # Word splitting is favorable here 182 204 # shellcheck disable=SC2086 183 - wf-recorder $args -g "$(slurp)" -f "$filename" > "$SCR_CACHE_DIR/rec.log" 2>&1 & 205 + wf-recorder $args $rec_extraflags "$@" -f "$filename" > "$SCR_CACHE_DIR/rec.log" 2>&1 & 184 206 rec_pid=$! 185 207 printf '%s' "Press Ctrl+C to stop recording. " 1>&2 186 208 wait $rec_pid ··· 199 221 } 200 222 201 223 $action 224 + 225 + # Run post scripts 226 + # Scripts in the directory `$SCR_CFG_DIR/scripts` will 227 + # take in `$action` as `$1` and `$filename` as `$2`. 228 + # Sample scripts can be found in my dotfiles at: 229 + # https://github.com/yemouu/setup/blob/master/home/cfg/scr/scripts 230 + for i in "$SCR_CFG_DIR/scripts/"* 231 + do 232 + [ -x "$i" ] && { 233 + printf '%s\n' "# $i --- START" >> "$SCR_CACHE_DIR/scripts.log" 234 + $i "$action" "$filename" > "$SCR_CACHE_DIR/scripts.log" 2>&1 235 + printf '%s\n' "# $i --- END" >> "$SCR_CACHE_DIR/scripts.log" 236 + } 237 + done
+57 -4
scritps/thm
··· 12 12 hex_r=${hex%????} 13 13 hex_g=${hex#??}; hex_g=${hex_g%??} 14 14 hex_b=${hex#????} 15 + 15 16 printf '%d,%d,%d' "0x$hex_r" "0x$hex_g" "0x$hex_b" 16 17 } 17 18 ··· 19 20 [ "$THM_CONFIG_DIR" ] \ 20 21 && conf_dir="$THM_CONFIG_DIR" \ 21 22 || conf_dir="${XDG_CONFIG_HOME:-$HOME/.config}/thm" 23 + 22 24 [ "$THM_DEST_DIR" ] \ 23 25 && dest_dir="$THM_DEST_DIR" \ 24 - || dest_dir="${XDG_CACHE_HOME:-$HOME/.cache}/thm" 26 + || dest_dir="${XDG_STATE_HOME:-$HOME/.local/state}/thm" 25 27 26 28 err() { 27 29 [ "$*" ] && err_msg="$*" || err_msg="error" ··· 59 61 color15_rgb="$(hex2rgb "$color15")" 60 62 61 63 # Make sure the dest_dir and dest_dir/thm_old exist 62 - [ -d "$dest_dir/thm_old" ] || { mkdir -p "$dest_dir/thm_old" || err "failed to create $dest_dir/thm_old"; } 64 + [ -d "$dest_dir/thm_old" ] || mkdir -p "$dest_dir/thm_old" 63 65 64 66 # Try and empty the dest_dir before populating it 65 67 mv "$dest_dir/"* "$dest_dir/thm_old" 2> /dev/null ··· 113 115 " "$t" > "${dest_dir}/${file_name}" 114 116 done 115 117 118 + # This allows for different configuration for different color schemes. 119 + # Configuration for one theme may not work very well for another theme. To use 120 + # this set theme_type in the theme file to any string and place theme specific 121 + # configuration in `${XDG_CONFIG_HOME:-$HOME/.config}/thm/templates/$theme_type`. 122 + # If not specified, only templates in the base template directory will be generated. 123 + # This will overwrite previously generated template files. 124 + [ "$theme_type" ] && [ -d "${conf_dir}/templates/$theme_type" ] && \ 125 + for t in "${conf_dir}/templates/$theme_type/"*".template" 126 + do 127 + file_name=${t##*/} 128 + file_name=${file_name%.template} 129 + 130 + sed " 131 + s/{bg_color}/$bg_color/g 132 + s/{fg_color}/$fg_color/g 133 + s/{color0}/$color0/g 134 + s/{color1}/$color1/g 135 + s/{color2}/$color2/g 136 + s/{color3}/$color3/g 137 + s/{color4}/$color4/g 138 + s/{color5}/$color5/g 139 + s/{color6}/$color6/g 140 + s/{color7}/$color7/g 141 + s/{color8}/$color8/g 142 + s/{color9}/$color9/g 143 + s/{color10}/$color10/g 144 + s/{color11}/$color11/g 145 + s/{color12}/$color12/g 146 + s/{color13}/$color13/g 147 + s/{color14}/$color14/g 148 + s/{color15}/$color15/g 149 + s/{bg_color.rgb}/$bg_color_rgb/g 150 + s/{fg_color.rgb}/$fg_color_rgb/g 151 + s/{color0.rgb}/$color0_rgb/g 152 + s/{color1.rgb}/$color1_rgb/g 153 + s/{color2.rgb}/$color2_rgb/g 154 + s/{color3.rgb}/$color3_rgb/g 155 + s/{color4.rgb}/$color4_rgb/g 156 + s/{color5.rgb}/$color5_rgb/g 157 + s/{color6.rgb}/$color6_rgb/g 158 + s/{color7.rgb}/$color7_rgb/g 159 + s/{color8.rgb}/$color8_rgb/g 160 + s/{color9.rgb}/$color9_rgb/g 161 + s/{color10.rgb}/$color10_rgb/g 162 + s/{color11.rgb}/$color11_rgb/g 163 + s/{color12.rgb}/$color12_rgb/g 164 + s/{color13.rgb}/$color13_rgb/g 165 + s/{color14.rgb}/$color14_rgb/g 166 + s/{color15.rgb}/$color15_rgb/g 167 + " "$t" > "${dest_dir}/${file_name}" 168 + done 169 + 116 170 # Run extra user scripts 117 171 [ -d "$conf_dir/scripts" ] || exit 0 118 172 for i in "$conf_dir/scripts/"* 119 - do 120 - [ -x "$i" ] && $i > /dev/null 2>&1 & 173 + do [ -x "$i" ] && $i > /dev/null 2>&1 & 121 174 done