summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2023-07-11 15:28:11 +0100
committerdavidovski <david@davidovski.xyz>2023-07-11 15:28:11 +0100
commitb85872dfc933ff3bd2e95303d8327c357c8b9ca6 (patch)
tree377f7f3425091ea5edeca9286bb37e94c935693b /scripts
parentafda5cf53f9fc181514f6b69fbf5fb5cbb80ef13 (diff)
Move to sx instead of startx
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ddc-switch-inputs2
-rwxr-xr-xscripts/iommu.sh8
-rw-r--r--scripts/kaomoji453
-rwxr-xr-xscripts/start-mpd2
-rwxr-xr-xscripts/vfetch288
5 files changed, 751 insertions, 2 deletions
diff --git a/scripts/ddc-switch-inputs b/scripts/ddc-switch-inputs
index 9bd3682..8f10c65 100755
--- a/scripts/ddc-switch-inputs
+++ b/scripts/ddc-switch-inputs
@@ -15,5 +15,5 @@ case $1 in
;;
esac
-ddcutil --bus=12 setvcp 60 ${OUT[0]} &
+ddcutil --bus=13 setvcp 60 ${OUT[0]} &
wait
diff --git a/scripts/iommu.sh b/scripts/iommu.sh
new file mode 100755
index 0000000..d971665
--- /dev/null
+++ b/scripts/iommu.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+shopt -s nullglob
+for g in $(find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V); do
+ echo "IOMMU Group ${g##*/}:"
+ for d in $g/devices/*; do
+ echo -e "\t$(lspci $@ -nns ${d##*/})"
+ done;
+done;
diff --git a/scripts/kaomoji b/scripts/kaomoji
new file mode 100644
index 0000000..6c8d1d3
--- /dev/null
+++ b/scripts/kaomoji
@@ -0,0 +1,453 @@
+ʕ•ₒ•ʔ Bear Shocked
+ʕ•ᴥ•ʔ Bear
+ʕ ·ᴥ·ʔ RBear
+ʕ·ᴥ· ʔ LBear
+ʕ ꈍᴥꈍʔ Bear Sob
+ʕ – ᴥ – ʔ Bear Sleep
+ ʕノ•ᴥ•ʔノ ︵ ┻━┻ Bear Flip
+ʕ╮•ᴥ•ʔ╮┳━━┳ Bear Unflip
+ʕ; •`ᴥ•´ʔ Bear Angry
+ʕ♡˙ᴥ˙♡ʔ Bear Love
+ʕ•ᴥ•ʔ?? Bear Confused
+(◕‿◕) Happy (1)
+(^▽^) Joy (2)
+(¬‿¬) Smug Happy
+(´・ᴗ・`) Joy (4)
+(⌒‿⌒) Joy (5)
+(^‿^) Joy (6)
+(☆▽☆) Joy (7)
+(❛ᴗ❛) Joy (8)
+(´♡‿♡`) Love (1)
+(◕‿◕)♡ Love (2)
+(─‿‿─)♡ Love (3)
+(⌒_⌒;) Ashamed
+(--_--) Unimpressed
+((╬◣﹏◢)) Angry (1)
+(#`Д´) Angry (2)
+(◕︵◕) Sad (1)
+(-_-) Sad (2)
+(╥_╥) Cry (1)
+(╥﹏╥) Cry (2)
+(×﹏×) Dead
+(;;;o_o) Fear
+┐( ̄ヘ ̄)┌ Shrug (1)
+╮(︶︿︶)╭ Shrug (2)
+┐(︶▽︶)┌ Shrug
+┐( ˘_˘ )┌ Shrug Small
+ᕕ( ᐛ )ᕗ Joyful March
+(•ิ_•ิ)? Confused
+(¬_¬) Doubt
+(⊙_⊙) Shock Raw
+(°▽°)/ Greet (1)
+(^-^*)/ Greet (2)
+( ̄▽ ̄)/ Greet (3)
+ヾ(・ω・*) Greet (4)
+ʕ•ᴥ•ʔ/ Bear Greet
+(^_<) Wink (1)
+(-_・) Wink (2)
+( ̄ハ ̄*) Nosebleed
+┬┴┬┴┤( ͡° ͜ʖ├┬┴┬┴ Hiding
+ε===(っ≧ω≦)っ Fart
+(-_-)zzZ Sleep
+╰( ͡° ͜ʖ ͡°)つ──☆*:・゚ Magic
+(˘ɜ˘)♬♪♫ Whistle
+(〜 ̄▽ ̄)〜 Dance R
+〜( ̄▽ ̄〜) Dance L
+( ͡° ͜ʖ ͡°) LNeutral
+( ͡°ʖ̯ ͡°) LSad
+( ͠° ͟ʖ ͡°) LConcern
+( ͡ᵔ ͜ʖ ͡ᵔ) LJoy
+(⌐■_■) Cool
+( ^▽^)っ✂╰⋃╯ NoMoreWilly
+(╯°益°)╯彡┻━┻ TableRage
+( ╯°□°)╯ ┻━━┻ Flip
+(╮°-°)╮┳━━┳ Unflip
+(◕ω◕) owo (1)
+𝕠𝕨𝕠 owo (2)
+ʕ•w•ʔ Bear owo
+(ノ≧ ヮ ≦)ノ︵ ┻┻ CuteFlip
+ಠ_ಠ Disaproval
+(◕ᴗ◕✿) Flower Happy (1)
+(◕ ω ◕✿) Flower owo
+(◕∇◕✿) Flower Happy (2)
+(◕ᱛ ◕✿) Flower Shocked
+(◕︿◕✿) Flower Sad
+(◕ﬦ ◕✿) Flower Disapointed
+(◕‸ ◕✿) *pout* Flower Pout
+(≖ ︿ ≖ ✿)ꐦꐦ Flower Angry
+(╯✿◕益◕)╯︵ ┻━┻ Flower Flip
+🗡⊂(ʘ‿ʘ✿) Flower Yandere
+(´∀`) Laughing
+ ( ՞ ڡ ՞ ) Yum
+(▀̿Ĺ̯▀̿ ̿) Boss
+(/-(エ)-\) Scared Cowering 1
+(ΟΔΟ;;) Fear Shock Scared
+(⊃д⊂) Scared 2
+(/_\) Scared Cowering
+^•-•^ cat derp
+(>‿<) squint happy closed eyes
+♡ heart
+♫ music
+.‿. smol happy
+^_^ Overjoyed (2)
+(╯°□°)╯︵ ┻━┻ Flipping Table (3)
+ლ(ಠ益ಠლ) But At What Cost
+(//_^) Emo (5)
+ʕ •ᴥ•ʔ Koala (3)
+(っ^‿^)っ Kirby (5)
+[¬º-°]¬ Zombie (2)
+(●∈∋●) Bird (5)
+ಠ_ಠ Disapproval
+T.T Sad (2)
+◤◡ᴥ◡◥  Dog (4)
+(∩`-´)⊃━☆゚.*・。゚ Wizard
+^-^ Happy (7)
+ᕦ(ò_óˇ)ᕤ Flexing (3)
+♪┏(・o・)┛♪ Dancing (8)
+( ͡° ͜ʖ ͡°) Smiling (2)
+/人◕ ‿‿ ◕人\ Kyubey
+༼ ༎ຶ ෴ ༎ຶ༽ Distraught
+ᒄ₍⁽ˆ⁰ˆ⁾₎ᒃ♪♬ Frosty the Snowman (2)
+(╯°□°)╯︵ ┻━┻ Flipping table (2)
+<(^oo^)> Pig (3)
+¯\_(ツ)_/¯ Shrugging (2)
+U=・ x ・=U Rabbit (2)
+⊂((・▽・))⊃ Hug me (2)
+V●ᴥ●V Doggy (2)
+(=^_^=) Bunny (3)
+<コ:彡 Squid (2)
+-_-; Anime Sweat Drop (2)
+(°̥̥̥̥̥̥̥̥ᴗ°̥̥̥̥̥̥̥̥) Happy crying
+(=^・ェ・^=) Kitty (2)
+(((༼•̫͡•༽))) Ghost (2)
+(-‸ლ) Whoops
+(=^ェ^=) Cat (4)
+( ´-ω・)︻┻┳══━一 Sniper
+⊆☉ᴥ☉⊇ Bear (7)
+༼ つ ◕_◕ ༽つ Take my energy
+(  ̄┏_┓ ̄) Mustache (2)
+(;´Д`) Giving Up
+( ͡° ʖ̯ ͡°) Disgruntled
+✌(◕‿-)✌ Peace (3)
+ಠ_ರೃ Monocle (2)
+T^T Crying (5)
+ᘛ⁐̤ᕐᐷ Chameleon
+༼ つ ◕_◕ ༽つ Gimme
+ლ(ಠ益ಠ)ლ Anger
+(ง •̀_•́)ง Feisty
+(っ⌒‿⌒)っ Hug (3)
+ϵ( 'Θ' )϶ Fish (3)
+(^▽^) Laughing (5)
+¯\(°_o)/¯ Confused (4)
+̿’̿’\̵͇̿̿\З=( ͠° ͟ʖ ͡°)=Ε/̵͇̿̿/’̿̿ ̿ ̿ ̿ ̿ ̿ Outlaw
+o(^▽^)o Pumped (2)
+.∵・(゚Д゚) Scared (2)
+(*☉౪ ⊙。)ノ Imbecile (2)
+d-(^.^)z Thumbs Up (2)
+(>_<) Painful
+(¬_¬") Annoyed (4)
+(´╹〽╹`) Worried (4)
+(o^-^o) Pikachu (2)
+(▀̿Ĺ̯▀̿ ̿) Deal with it
+(∩`-´)⊃━☆゚.*・。゚ Magic Attack
+꒡ᘦ̲꒡ Sleeping (5)
+(‾ʖ̫‾) Lethargic
+^_^; Guilty
+ヽ(`⌒´メ)ノ Angry (8)
+^^ Blissful
+^_^/ High Five (2)
+ʕ•͡ᴥ•ʔ Polar bear
+❆❅❉ Snowing
+ヽ(★ω★)ノ Excited
+U^ェ^U Puppy
+⊂(^(工)^)⊃ Teddy bear
+(≧∇≦)/ Joyful (2)
+◦°˚\☺/˚°◦ Playing in the snow
+(╯°□°)╯︵  ʞooqǝɔɐɟ Flipping Facebook
+(;-_-)ノ Giving up
+⊙▂⊙ Shocked
+|∴め ϖ め∴| SpongeBob SquarePants
+◔̯◔ Rolling Eyes
+⊂(◜ᴥ◝)つ Teddy Bear
+ε=(☉_☉) Accidental farting
+(ಥ﹏ಥ) Devastated (2)
+(•͡.•͡) Skeptical
+ε=┏( >_<)┛ Running (5)
+┬─┬︵/(.□.)╯ Table Flips You
+〠_〠 Tired (3)
+∊ಠ_ಠ∍ Distressed
+V=(° °)=V Crab (2)
+ᶘ ᵒᴥᵒᶅ Seal (2)
+Ƹ̵̡Ӝ̵̨̄Ʒ Butterfly
+(- o - ) zzZ ☽ Sleepy
+◯0o。(ー。ー)y Smoking (4)
+(。々°) Herp Derp
+-_-* Frustrated (3)
+(+[__]∙:∙) PlayStation Portable
+(V) (°,,,,°) (V) Zoidberg
+/|\( ;,; )/|\ Bat
+◖㈠ ω ㈠◗ Panda
+\m/d(^_^)b\m/ Rocking Out
+ヽ(゚Д゚)ノ Freak Out (2)
+(ノ゚0゚)ノ~ Yoo-Hoo
+¤\( `⌂´ )/¤ Lifting weights
+(ò_ó) Furious
+( ˘ ³˘)♥ Kiss me
+(^▽^) Cheerful (3)
+(⌒ ͜ʖ⌒)b Attentive
+ᕦ❍ᴗ❍ᕤ Muscular Person
+(´>_●)メ(●_<`) Sword Fighting
+:-Þ Teasing
+=( ^o^)ノ___o Bowling
+(#×_×) Dead (2)
+(。・_・)ノ”【】 Painting
+(/。\) Shy (5)
+⎰≀.☮-☮≀⎰ John Lennon
+─=≡Σ(([ ⊐•̀⌂•́]⊐ Superhero
+(¬з¬)σ Pointing (2)
+(・д・)} On The Phone (3)
+㐈⦁ཽし⦁ཽ㐈  Larry David
+⨌⨀_⨀⨌ Benjamin Franklin
+(☄ฺ◣д◢)☄ฺ Scaring
+ƪ(˘▽˘ƪ) Worshiping
+[•.•ิ] Huh
+(◐‿◑) Crazy
+\(-_- ) Thank You
+(_ε_) Kiss my butt
+(⊃‿⊂) Anticipation
+(* ̄m ̄) Dissatisfied
+Q('.'Q) Put Em Up
+\(^o)(^0^)(o^)/ Caroling
+( ̄~ ̄) Unimpressed
+༼ঢ_༽ঢ༽ Perplexed
+(。♥‿♥。) Smitten
+( ̄□ ̄;) Surprised
+(^o^) Singing (3)
+(:3 っ)っ Walrus
+( `_)乂(_' ) Arm wrestle
+(ง •̀ゝ•́)ง Fighting (2)
+uwu Happy Anime Face
+└(^o^ )X( ^o^)┘ Best buddies
+d^_^b DJ
+( --)/ ==卍 Ninja Star
+C:。ミ Octopus
+(´・ω・`) Snubbing (2)
+♪(●′▽`)ノ Good Night
+(#^.^#) Embarrassed (3)
+ಥ_ಥ Bawling (3)
+†_(゚ー゚*)β Exorcism
+੯ू•́ू ໒꒱⁼³₌₃ Sonic the Hedgehog
+(^‿◕) Winking (3)
+(″・ิ_・ิ)っ Wait (3)
+。◕‿◕。 Gleeful
+ヽ( ★ω★)ノ Pumped up
+_〆(。。) Writing (2)
+(∿°○°)∿ ︵ ǝʌol Heartbroken
+^;;^ Spider
+(⓪益⓪) Staring (2)
+( ̄┏∞┓ ̄) Fu Manchu Man
+( • ∀•)っθΘʘ Hiding Easter eggs
+_φ( °-°)/ Doing Homework
+◖ර◞ʖ◟ර◗ Grandma
+¬.¬ Whatever (3)
+⫷ °⧭° ⫸ Clown
+(♥_♥) In Love
+>.< Upset (2)
+( ◢д◣) Depressed (4)
+ᕕ( ᐛ )ᕗ Celebrating
+(¬‿¬) Cunning
+└(^o^)┐ Grooving (3)
+~゜・_・゜~ Raving
+ᕦ◉▿◉ᕤ Owl (2)
+\(^O^)/ Celebrate
+(*’(OO)’*) Piggy (2)
+˃ʍ˂ Enraged (2)
+(ू˃̣̣̣̣̣̣︿˂̣̣̣̣̣̣ ू) Sobbing (3)
+( ^^)人(^^ ) Best Buds
+└@(・ェ・)@┐ Beefcake
+(☉__☉”) Yikes
+(╯˘ -˘ )╯ Praying (2)
+ε=┌( ≧▽)┘ Elated
+( •_•)O °Q(•_• ) Playing Ping Pong
+∋(°O°)∈ Blowfish
+(;一_一) Ashamed (4)
+{♥‿♥} Lovestruck
+๏-) Cyclops
+(o ̄∇ ̄)=◯)`ν゜)・ Punching (6)
+┬─┬ノ( º _ ºノ) Putting Table Back (2)
+(~_(]=--Z(◡˘) Pie Fight
+((((((^_^;) Evading
+(/o^)/°⊥\(^o\) Volleyball
+-{'''|'''|'''|''']=[] Syringe
+[^._.^]ノ彡 Nyan Cat
+---(o_ _)o Tripping (2)
+┬┴┬┴┤(・_├┬┴┬┴ Snooper
+(ㆆ_ㆆ) Unamused
+(✿◠‿◠)  Hippie
+ヾ(* ̄O ̄)ツ Yelling
+(ɔ◔‿◔)ɔ ♥ Loving
+(ノ-o-)ノ 中 Olympic Hammer Throw
+(/ω・\) Peering
+(´・ω・)っ由 Gift
+[-_-]~ Ninja
+(シ_ _)シ Apology (2)
+∋∞(●゚v゚)∞∈ Pigtails
+‎(>o<)ρミ┳┷┳゜ Table Tennis
+(^̮^) Pleased (2)
+♪~( ̄ε ̄;) Whistling
+( ̄▼ ̄) Big Grin
+⋟^≏^⋞ Kitty Cat
+( ̄へ ̄) Discontent
+(*・_・)ノ⌒* Throwing Away
+(*@_*#) Beaten Up
+(p_-) Thinking
+(。_°)☆ Punched
+♥‿♥ Enamored
+ε-(´・`) フ Phew
+༼ঢ_㇁ঢ༽ Bad hair day
+(づ ̄ ³ ̄)づ Smooch (3)
+O(<>'<>)O Aang
+(_ _)..ooOO Dreaming
+┳┻┳° Ping Pong table
+^o^ Mog
+(゚皿゚)r┏┳-* Shooting (2)
+m( ゚皿゚)m★━━ Laser
+٩◔̯◔۶ Eye Roll With Hands Up
+ヽ(´Д`ヽミノ´Д`)ノ Frantic (2)
+(-ε- ) Pucker up (3)
+ヽ(⌐■_■)ノ♪♬ Boogie down
+「(°ヘ°) Puzzled
+d(^_^)b Listening to Music
+( -_-)旦~ Drinking
+<_< Looking (4)
+(( _ _)☆ ≡〇 Header
+^)_(^ Chubby
+(๑´•.̫ • `๑) Blushing
+(。▼皿▼) Darth Vader
+(╬☉Д⊙ฺ) Cyborg
+(ʘ‿ʘ) Smile
+ε=ε=ε=┌(๑ʘ∀ʘ)┘ Sprinting
+ƪ(˘⌣˘)ʃ Raise the roof
+( ˘︹˘ ) Smug
+(▰˘◡˘▰) Satisfied
+(¬、¬) Shifty
+¯(°_o)/¯ Confused shrug
+✖‿✖ Dead person
+(。_°☆\(- – ) Punch
+(ɔˆ ³(ˆ⌣ˆc) Loving couple
+(*▿▿* ƪ) Vampire
+o(^^o)(o^^)o Hopeful
+___ψ(‥ ) Studying
+_φ(°-°=) Doing homework
+@( o・ω・)@ Monkey
+(╭ರ_•́) Inquisitive
+੯ू‵ू ໒꒱ Poodle
+(*^^)^*) Kiss (5)
+(^~^) Meh
+(/。\) Frightened
+:þ Playful
+(>^_^)><(^o^<) Hugging
+(-_ゞ Groggy
+(*^o^)人(^o^*) Buddies
+(●´ノω`)コ Whispering (2)
+o(´^`)o Reluctant
+( つ Д `) Wiping Tears
+(o´・Υ・)ノ・ Help (2)
+(。・ˇдˇ・。) Pompous
+(´∪`*) Friendly
+ヘ(。□°)ヘ Psycho
+(人’∀’) Precious
+(っ˘ڡ˘ς) Yummy
+┗(・ω・;)┛ How Should I Know
+(о^ω^о) Giggling
+(´ー`)┌フッ Golf Clap
+\\(<.<|>.>)// Panicking
+^(#`∀´)_Ψ Demon
+(╯‵Д′)╯ Scary
+:-{  -__-: Stinky
+ಠᴗಠ Scheming
+<(; ̄ ・ ̄) Scratching
+\(^ ^)/ Glad
+(╯_╰) Bummed out
+┗( ●-﹏ `。)づ Hurt (2)
+(-_-)# Girl
+8(>_<)8 Jealous
+(*°∀°)=3 Infatuated (3)
+( ^_^)/ Waving
+o(^_-)O Boxer
+{{|└(>o< )┘|}} Up In Arms
+(^^)// Applause (2)
+( `_)?(_' ) Dueling
+(´~`) Weary
+v(^_^)v Victory (3)
+(ノ_ _)ノ Surrender
+<( ・ェ-)<} Bow and Arrow
+( `o´)_θ☆ Kicking
+(-□-)︵* Blowing a Kiss
+|д・) Hiding (4)
+(´Д゜)/゜⌒。 Discarding
+ʕʔ Bread
+(ɔ˘з˘)ɔ Romantic
+ʕ •́؈•̀) Winnie the Pooh
+(ó ì_í)=óò=(ì_í ò) Bro Pound
+ヾ(`ε´)ノ Booing
+|̲̅̅●̲̅̅|̲̅̅=̲̅̅|̲̅̅●̲̅̅| Stereo
+ʘ‿ʘ Eager
+:(¦) Frog
+( ^)/占~~~ Banksy
+(;´༎ຶД༎ຶ`) Weeping (2)
+⊂ •͡˘∠•͡˘ ⊃ Suspicious
+( ° ᴗ°)~ð  Proposal
+(๑╹ڡ╹๑) Tasty
+(¬_¬ ) Neglected
+ʕु•̫͡•ʔु Bear cub (2)
+┌|°з°|┘ Cutting a rug
+(⊙_◎) Crazed
+(✖╭╮✖) Deceased
+←~(o `▽´ )oΨ Satan
+˙ ͜ʟ˙ Content
+( ˇ෴ˇ ) Hipster
+♫.(◠౪◠).♫ Jamming to music
+∊♡_ᴥ_♡∍ Puppy Love
+L(´□`L) Oh No! (2)
+(;´ρ`) Yawning
+(╯ნ_㇁ნ)╯ Defeated
+(.〜◍`皿′◍〜.) Livid (2)
+ᡊ|◔じ◔|ᡊ  Woody Allen
+✌(გ_㇁გ)✌ Ringo Starr
+╹﹏╹ Cold
+☉ϖ☉ Lobster
+(๑≖ิิ益≖ิ๑) Evil Laugh
+(((☎))) Phone
+(○`д´)ノシ Σ(っ゚Д゚)っ Chasing
+o(>< )o⌒* Mad (3)
+ლ(´ڡ`ლ) Licking
+⪿ ↂ ˒̫̮ ↂ ⫀ Elton John
+(•ᴥ• )́`́'́`́'́⻍ Porcupine
+且_(゚◇゚;)ノ゙ Waiter
+◖⎚∠⎚◗ Geek Nerd
+-ˆ ω ˆ- Kitten
+•:_:• Nagato
+ε=┌(^-^)┘ Skipping
+(+.+)(-.-)(_ _) Falling Asleep
+[ ± _ ± ] Sick
+〜〜(/ ̄▽)/ 〜ф Chasing A Butterfly
+\(`0´)/ Fed Up
+¥[*.*]¥ Robot
+(*・)σσ(*゜O゜) Poking
+( ̄ー ̄(_ _( Nodding
+▼o・_・o▼ Hello
+(`_^) Wink
+/( _0_) ̄θ☆≡≡○ Scissor Kick
+ヽ(´ー`)┌ Mellow
+(^ _ ^)/~~ Goodbye
+(*・)「」「」 Magic Casting
+( `皿´)。ミ/ Hitting
+[]゛7(∀゜*) Dialing
+(((((^_^) Teleporting
+( ̄ー ̄)//”” Clapping
+(。。;)\(-_-) Comforting
+(*  ̄)( ̄ *)  Kissing
+(;^_^)ッ☆( ゜o゜) Slapping
+\(~O~)/ Good Morning
+\_(´▽`)♪_/ Bathtub
diff --git a/scripts/start-mpd b/scripts/start-mpd
index 33f6ad5..7b4f9a2 100755
--- a/scripts/start-mpd
+++ b/scripts/start-mpd
@@ -1,4 +1,4 @@
#!/bin/sh
-[ ! -s ~/.config/mpd/pid ] && mpd .config/mpd/mpd.conf
+pidof mpd || mpd .config/mpd/mpd.conf
pidof mpdscribble || mpdscribble --conf .config/mpdscribble/mpdscribble.conf
pidof mpd-rpc || mpd-rpc --no-idle --fork
diff --git a/scripts/vfetch b/scripts/vfetch
new file mode 100755
index 0000000..e0018e3
--- /dev/null
+++ b/scripts/vfetch
@@ -0,0 +1,288 @@
+#!/usr/bin/env python3
+
+from xdg.BaseDirectory import xdg_config_home
+from enum import Enum
+import subprocess
+import platform
+import distro
+import json
+import re
+import os
+import wmctrl
+
+colors = [
+ # Regular colors.
+ "\u001b[30m",
+ "\u001b[31m",
+ "\u001b[32m",
+ "\u001b[33m",
+ "\u001b[34m",
+ "\u001b[35m",
+ "\u001b[36m",
+ "\u001b[37m",
+
+ # Bright colors.
+ "\u001b[30;1m",
+ "\u001b[31;1m",
+ "\u001b[32;1m",
+ "\u001b[33;1m",
+ "\u001b[34;1m",
+ "\u001b[35;1m",
+ "\u001b[36;1m",
+ "\u001b[37;1m",
+
+ # Reset.
+ "\u001b[0m"
+]
+
+decorations = [
+ "\u001b[1m", # Bold.
+ "\u001b[4m", # Underline.
+ "\u001b[7m" # Reversed.
+]
+
+# Creates a copy of the specified string with color and decorations added.
+def colored(string, colorIndex, decorationIndices=[]):
+ newString = colors[colorIndex]
+ for decorationIndex in decorationIndices:
+ newString += decorations[decorationIndex]
+ newString += string + colors[len(colors)-1]
+ return newString
+
+# Enum for the different data types.
+class Type(str, Enum):
+ os = 'os'
+ kernel = 'kernel'
+ wm = 'wm'
+ packages = 'packages'
+ uptime = 'uptime'
+
+# Enum for the different align modes.
+class AlignMode(str, Enum):
+ spaces = 'spaces'
+ center = 'center'
+
+# Loads the settings from the configuration file.
+# First checks for a configuration file in ~/.config/vfetch/vfetch.conf,
+# else it defaults to the configuration file in the same folder as the script.
+def loadSettings():
+ try:
+ file = open(xdg_config_home + '/vfetch/vfetch.conf', 'r')
+ except FileNotFoundError:
+ file = open(os.path.dirname(os.path.realpath(__file__)) + '/vfetch.conf', 'r')
+ content = file.read()
+ settings = json.loads(content)
+ file.close()
+ return settings
+
+# Prints string without ending with a new line.
+def printn(string):
+ print(string, end="")
+
+# Prints string at a specified position.
+def printAt(string, *position):
+ if len(position) == 1:
+ x = position[0][0]
+ y = position[0][1]
+ else:
+ x = position[0]
+ y = position[1]
+ printn("\x1b7\x1b[%d;%df%s\x1b8" % (y+1, x+1, string))
+
+# Prints the data lines.
+def printLines(lines, colorIndex, offsetX, offsetY, alignMode, alignSpace):
+ longestName = 0
+ dataPosition = 0
+
+ if alignMode is AlignMode.spaces:
+ for line in lines:
+ position = len(line[0]) + alignSpace
+ if position > dataPosition:
+ dataPosition = position
+ else:
+ # Finds the length of the longest name.
+ longestName = len(max(lines, key = lambda data: len(data[0]))[0])
+
+ y = 0
+ x = offsetX
+ # Prints the lines and formats them accordingly.
+ for line in lines:
+ if alignMode is AlignMode.spaces:
+ printAt(line[1], x + dataPosition, y+offsetY)
+ elif alignMode is AlignMode.center:
+ line[0] = ' ' * (longestName - len(line[0])) + line[0]
+
+ printAt(colored(line[0], colorIndex, [0]), x, y+offsetY)
+ if alignMode is AlignMode.center:
+ printAt(' ~ ' + line[1], x+len(line[0]), y+offsetY)
+ y += 1
+
+# Sets the cursor position.
+def setCursorPosition(*position, newLine=False):
+ if len(position) == 1:
+ x = position[0][0]
+ y = position[0][1]
+ else:
+ x = position[0]
+ y = position[1]
+ string = '\033[%d;%dH' % (y, x)
+ if newLine:
+ print(string)
+ else:
+ printn(string)
+
+# Runs the specified terminal command.
+def termRun(command, arguments):
+ output = subprocess.run([command, arguments], text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ return output.stdout
+
+# Prints ascii image.
+def printAscii(position, asciiImage):
+ setCursorPosition(position)
+ lines = asciiImage.split('\n')
+ for line in lines:
+ print(line)
+
+# Gets the operating system.
+def getOS(architecture=False, removeLinux=False):
+ os = distro.linux_distribution()[0]
+ if removeLinux:
+ os = re.sub('linux', '', os, flags=re.IGNORECASE)
+ os = os.rstrip()
+ if architecture:
+ os += ' ' + platform.machine()
+ return os
+
+# Gets the kernel.
+def getKernel(fullName=True):
+ kernel = platform.release()
+ if not fullName:
+ kernel = kernel.split('-')[0]
+ return kernel
+
+# Gets the window manager.
+def getWM():
+ try:
+ return wmctrl.os.environ.get('DESKTOP_SESSION')
+ except:
+ pass
+ try:
+ return wmctrl.os.environ.get('XDG_SESSION_DESKTOP')
+ except:
+ return None
+
+# Gets the number of packages.
+def getPackages(displayPackageManager=False):
+ try:
+ packages = termRun('pacman', '-Qq')
+ string = str(len(packages.split('\n')))
+ if displayPackageManager:
+ string += ' (pacman)'
+ return string
+ except:
+ return None
+
+# Gets the machine uptime.
+def getUptime():
+ with open('/proc/uptime', 'r') as f:
+ uptime_seconds = float(f.readline().split()[0])
+ hours = uptime_seconds / 3600
+ minutes = (hours - int(hours)) * 60
+ hours = int(hours)
+ minutes = int(minutes)
+ string = ''
+ if hours != 0:
+ string += str(hours) + 'h '
+ if minutes != 0 or hours == 0:
+ string += str(minutes) + 'm'
+ return string
+
+# Gets the data for the specified data type.
+def getData(type, settings):
+ data = {
+ Type.os: getOS(settings['displayArchitecture'], settings['removeLinux']),
+ Type.kernel: getKernel(settings['kernelFullName']),
+ Type.wm: getWM(),
+ Type.packages: getPackages(settings['displayPackageManager']),
+ Type.uptime: getUptime()
+ }.get(type, None)
+
+ if data is None:
+ return None
+
+ name = {
+ Type.os: [ 'OS', '' ],
+ Type.kernel: [ 'Kernel', '' ],
+ Type.wm: [ 'WM', '缾' ],
+ Type.packages: [ 'Packages', '' ],
+ Type.uptime: [ 'Uptime', '' ]
+ }.get(type, None)[int(settings['iconMode'])]
+
+ if settings['lowercase']:
+ name = name.lower()
+ data = data.lower()
+
+ return [name, data]
+
+# Gets the size of the specified ascii image.
+def asciiSize(asciiImage):
+ x = 0
+ split = asciiImage.split('\n')
+ for line in split:
+ if len(line) > x:
+ x = len(line)
+ return [x, len(split)]
+
+# Trims the specified ascii image of empty lines and trailing whitespaces.
+def trimAscii(asciiImage):
+ lines = asciiImage.split('\n')
+ string = ''
+ for line in lines:
+ trimmedString = line.rstrip()
+ if len(trimmedString) != 0:
+ string += trimmedString + '\n'
+ string = string[:-1] # Removes last newline.
+ return string
+
+# Loads the ascii image at the specified path.
+def loadAsciiImage(path):
+ file = open(path, 'r')
+ asciiImage = trimAscii(file.read())
+ file.close()
+ return asciiImage
+
+settings = loadSettings()
+
+displayAscii = settings['displayAscii']
+offset = settings['offset']
+
+# Loads the data lines. If the data is invalid (None) it does not get added.
+lines = []
+for dataType in settings['data']:
+ data = getData(dataType, settings)
+ if data is not None:
+ lines.append(data)
+
+# Loads the ascii image if the option is set for it.
+if displayAscii:
+ asciiImage = loadAsciiImage(settings['asciiImage'])
+ size = asciiSize(asciiImage)
+ offset[0] += size[0]
+ finalPosition = [0, size[1]]
+else:
+ finalPosition = [0, len(lines)+offset[1]]
+
+# Makes the prompt after the script finishes have a blank line before it.
+finalPosition[1] += 1
+
+os.system('clear')
+
+if displayAscii:
+ printAscii([0,0], asciiImage)
+
+alignMode = AlignMode(settings['alignMode'])
+
+printLines(lines, settings['colorIndex'], offset[0], offset[1], alignMode, settings['alignSpace'])
+
+# Sets the final cursor position for the prompt to end up at.
+setCursorPosition(finalPosition, newLine=True)