diff --git a/.config/cmus/autosave b/.config/cmus/autosave deleted file mode 100644 index b7e6369..0000000 --- a/.config/cmus/autosave +++ /dev/null @@ -1,200 +0,0 @@ -set aaa_mode=all -set altformat_current= %F -set altformat_playlist= %f%= %d -set altformat_title=%f -set altformat_trackwin= %f%= %d -set auto_expand_albums_follow=true -set auto_expand_albums_search=true -set auto_expand_albums_selcur=true -set auto_reshuffle=true -set buffer_seconds=10 -set color_cmdline_attr=default -set color_cmdline_bg=default -set color_cmdline_fg=default -set color_cur_sel_attr=default -set color_error=lightred -set color_info=lightyellow -set color_separator=blue -set color_statusline_attr=default -set color_statusline_bg=gray -set color_statusline_fg=black -set color_titleline_attr=default -set color_titleline_bg=blue -set color_titleline_fg=white -set color_trackwin_album_attr=bold -set color_trackwin_album_bg=default -set color_trackwin_album_fg=default -set color_win_attr=default -set color_win_bg=default -set color_win_cur=lightyellow -set color_win_cur_attr=default -set color_win_cur_sel_attr=default -set color_win_cur_sel_bg=blue -set color_win_cur_sel_fg=lightyellow -set color_win_dir=lightblue -set color_win_fg=default -set color_win_inactive_cur_sel_attr=default -set color_win_inactive_cur_sel_bg=gray -set color_win_inactive_cur_sel_fg=lightyellow -set color_win_inactive_sel_attr=default -set color_win_inactive_sel_bg=gray -set color_win_inactive_sel_fg=black -set color_win_sel_attr=default -set color_win_sel_bg=blue -set color_win_sel_fg=white -set color_win_title_attr=default -set color_win_title_bg=blue -set color_win_title_fg=white -set confirm_run=true -set continue=true -set device=/dev/cdrom -set display_artist_sort_name=false -set dsp.alsa.device= -set dsp.jack.server_name= -set follow=false -set format_current= %a - %l -%3n. %t%= %y -set format_playlist= %-21%a %3n. %t%= %y %d %{?X!=0?%3X ? } -set format_playlist_va= %-21%A %3n. %t (%a)%= %y %d %{?X!=0?%3X ? } -set format_statusline= %{status} %{?show_playback_position?%{position} %{?duration?/ %{duration} }?%{?duration?%{duration} }}- %{total} %{?bpm>0?at %{bpm} BPM }%{?volume>=0?vol: %{?lvolume!=rvolume?%{lvolume},%{rvolume} ?%{volume} }}%{?stream?buf: %{buffer} }%{?show_current_bitrate & bitrate>=0? %{bitrate} kbps }%=%{?repeat_current?repeat current?%{?play_library?%{playlist_mode} from %{?play_sorted?sorted }library?playlist}} | %1{continue}%1{follow}%1{repeat}%1{shuffle} -set format_title=%a - %l - %t (%y) -set format_trackwin=%3n. %t%= %y %d -set format_trackwin_album= %l %= %{albumduration} -set format_trackwin_va=%3n. %t (%a)%= %y %d -set format_treewin= %l -set format_treewin_artist=%a -set icecast_default_charset=ISO-8859-1 -set id3_default_charset=ISO-8859-1 -set input.aac.priority=50 -set input.ffmpeg.priority=30 -set input.flac.priority=50 -set input.mad.priority=55 -set input.mp4.priority=50 -set input.opus.priority=50 -set input.vorbis.priority=50 -set input.wav.priority=50 -set input.wavpack.priority=50 -set lib_add_filter= -set lib_sort=albumartist date album discnumber tracknumber title filename play_count -set mixer.alsa.channel= -set mixer.alsa.device= -set mixer.pulse.restore_volume=1 -set mouse=false -set mpris=true -set output_plugin=pulse -set passwd=venirapormi -set pl_sort= -set play_library=true -set play_sorted=true -set repeat=false -set repeat_current=false -set replaygain=disabled -set replaygain_limit=true -set replaygain_preamp=0.000000 -set resume=false -set rewind_offset=5 -set scroll_offset=2 -set set_term_title=true -set show_all_tracks=true -set show_current_bitrate=false -set show_hidden=false -set show_playback_position=true -set show_remaining_time=true -set shuffle=true -set skip_track_info=false -set smart_artist_sort=true -set softvol=false -set softvol_state=0 0 -set start_view=tree -set status_display_program= -set time_show_leading_zero=true -set wrap_search=true -bind browser backspace browser-up -bind browser i toggle show_hidden -bind browser space win-activate -bind browser u win-update -bind common ! push shell -bind common + vol +10% -bind common , seek -1m -bind common - vol -10% -bind common . seek +1m -bind common / search-start -bind common 1 view tree -bind common 2 view sorted -bind common 3 view playlist -bind common 4 view queue -bind common 5 view browser -bind common 6 view filters -bind common 7 view settings -bind common = vol +10% -bind common ? search-b-start -bind common C toggle continue -bind common D win-remove -bind common E win-add-Q -bind common F push filter -bind common G win-bottom -bind common I echo {} -bind common L push live-filter -bind common M toggle play_library -bind common N search-prev -bind common P win-mv-before -bind common U win-update-cache -bind common [ vol +1% +0 -bind common ] vol +0 +1% -bind common ^B win-page-up -bind common ^C echo Type :quit to exit cmus. -bind common ^D win-half-page-down -bind common ^E win-scroll-down -bind common ^F win-page-down -bind common ^L refresh -bind common ^R toggle repeat_current -bind common ^U win-half-page-up -bind common ^Y win-scroll-up -bind common a win-add-l -bind common b player-next -bind common c player-pause -bind common delete win-remove -bind common down win-down -bind common e win-add-q -bind common end win-bottom -bind common enter win-activate -bind common f toggle follow -bind common g win-top -bind common h seek -5 -bind common home win-top -bind common i win-sel-cur -bind common j win-down -bind common k win-up -bind common l seek +5 -bind common left seek -5 -bind common m toggle aaa_mode -bind common mlb_click_selected win-activate -bind common mouse_scroll_down win-down -bind common mouse_scroll_up win-up -bind common n search-next -bind common o toggle play_sorted -bind common p win-mv-after -bind common page_down win-page-down -bind common page_up win-page-up -bind common q quit -i -bind common r toggle repeat -bind common right seek +5 -bind common s toggle shuffle -bind common space win-toggle -bind common t toggle show_remaining_time -bind common tab win-next -bind common u update-cache -bind common up win-up -bind common v player-stop -bind common x player-play -bind common y win-add-p -bind common z player-prev -bind common { vol -1% -0 -bind common } vol -0 -1% -fset 90s=date>=1990&date<2000 -fset classical=genre="Classical" -fset missing-tag=!stream&(artist=""|album=""|title=""|tracknumber=-1|date=-1) -fset mp3=filename="*.mp3" -fset ogg=filename="*.ogg" -fset ogg-or-mp3=ogg|mp3 -fset unheard=play_count=0 -factivate diff --git a/.config/cmus/cache b/.config/cmus/cache deleted file mode 100644 index 50a59ff..0000000 Binary files a/.config/cmus/cache and /dev/null differ diff --git a/.config/cmus/command-history b/.config/cmus/command-history deleted file mode 100644 index 7ae52d6..0000000 --- a/.config/cmus/command-history +++ /dev/null @@ -1,35 +0,0 @@ -q -view -clear -player-next -pl -filter -toggle shuffle -shuffle -add ~/Music/music/ -player-pause-playback -bind common player-pause-playback -clear -player-stop -player-next -player-stop -player-play -bind common add -bind common bindk -player-play -add The Best of Beethoven (152kbit_Opus).ogg -filter The -win-add-Q -win-add-Q -help -source The Best of Beethoven (152kbit_Opus).ogg -clean -live-filter L -live-filter L -live-filter -delete -refr -start -set passwd=venirapormi -set passwd=@ -set passwd=1234 diff --git a/.config/cmus/lib.pl b/.config/cmus/lib.pl deleted file mode 100644 index e5a9020..0000000 --- a/.config/cmus/lib.pl +++ /dev/null @@ -1,531 +0,0 @@ -/home/initega/Music/music/26 - Gioacchino Rossini - Guillaume Tell (1829) - Galop (Chailly).mp3 -/home/initega/Music/music/Abba - Dancing Queen.mp3 -/home/initega/Music/music/ACDC - Back In Black.mp3 -/home/initega/Music/music/ACDC - Highway to Hell.mp3 -/home/initega/Music/music/ACDC - Thunderstruck.mp3 -/home/initega/Music/music/A Fearsome Foe (HQ) - Dragon Ball Super _ Norihito Sumitomo-aOajeHAZpQg.opus -/home/initega/Music/music/A Ha - Take On Me REMO Radio Edit Music Official.mp3 -/home/initega/Music/music/Alessia Cara - How Far Ill Go (Official Video).mp3 -/home/initega/Music/music/[AMV] Tribute To Dagon Ball Z_GT (Goku's Story) Dan Dan Kokoro Hikareteku - Soundtrack【HD 720p】-UNas6o7CdX8.opus -/home/initega/Music/music/A Secret Plan with Ones Life on the Line - Dragon Ball Super _ Norihito Sumitomo-RcM7h8peXYU.opus -/home/initega/Music/music/Athletic Theme - New Super Mario Bros. (160kbit_Opus).ogg -/home/initega/Music/music/Avengers Suite (Theme)-FOabQZHT4qY.ogg -/home/initega/Music/music/Ay ho cavar, cavar - Profesores OT.mp3 -/home/initega/Music/music/Beverly Hills cop.mp3 -/home/initega/Music/music/BGM M1216-IeBElS3jz-0.ogg -/home/initega/Music/music/Biggie Smalls feat. Thomas the Tank Engine.mp3 -/home/initega/Music/music/Bill Haley & His Comets- Rock Around The Clock (152kbit_Opus).ogg -/home/initega/Music/music/Billy Joel - Uptown Girl.mp3 -/home/initega/Music/music/Bobby McFerrin - Don't Worry Be Happy.mp3 -/home/initega/Music/music/Boney M - Rasputin (Bassflow 4.0 Mix) - Fast.mp3 -/home/initega/Music/music/BSO Tiburon.mp3 -/home/initega/Music/music/cancion La banda del patio.mp3 -/home/initega/Music/music/Castle Theme - New Super Mario Bros. (152kbit_Opus).ogg -/home/initega/Music/music/Celine Dion- My Heart Will Go On (Banda sonora de la pelicula Titanic).mp3 -/home/initega/Music/music/Chicco - Modjadji.mp3 -/home/initega/Music/music/Chicken Techno by Oli Chang.mp3 -/home/initega/Music/music/Christmas Carols - The Nutcracker.mp3 -/home/initega/Music/music/Coldplay - Viva La Vida.mp3 -/home/initega/Music/music/Colonna Sonora Mission Impossible.mp3 -/home/initega/Music/music/Community Collab - DeLUX Jam (LuxMix).mp3 -/home/initega/Music/music/Cyndi Lauper - Girls Just Want To Have Fun.mp3 -/home/initega/Music/music/David Guetta - Dangerous (Lyric Video) ft Sam Martin.mp3 -/home/initega/Music/music/David Guetta - Hey Mama (Official Video) ft Nicki Minaj, Bebe Rexha & Afrojack.mp3 -/home/initega/Music/music/[DBZ full OST] Ma ni Ae!! Nanatsu No Doragon Bōru (reach the seven dragon balls in time!!)-VatdUmXsrBw.ogg -/home/initega/Music/music/Denzel Curry - ULTIMATE.mp3 -/home/initega/Music/music/Depeche Mode - Just Can't Get Enough (Remastered Video).mp3 -/home/initega/Music/music/Desert Overworld - New Super Mario Bros. (160kbit_Opus).ogg -/home/initega/Music/music/Die Woodys - Fichtls Lied.mp3 -/home/initega/Music/music/♪ Diggy Diggy Hole-ytWz0qVvBZ0.ogg -/home/initega/Music/music/Dragon Ball GT _ BGM #11-XNIBIwNDYu4.ogg -/home/initega/Music/music/Dragon Ball GT _ BGM #38-9-161mMSFg0.ogg -/home/initega/Music/music/Dragon Ball GT Genkidama Soundtrack-xkcUFEfbrQc.opus -/home/initega/Music/music/Dragon Ball GT - Soundtrack Baby 2-B6nYFWI0FeY.opus -/home/initega/Music/music/Dragon Ball GT - Soundtrack Baby-m5m6FSpRRHQ.ogg -/home/initega/Music/music/Dragon Ball OST CD5 Gekitotsu!! 100 Oku Powaa No-3FiRVax2XNU.ogg -/home/initega/Music/music/Dragon ball sondtrack 19-fR9u1EcB3Dk.ogg -/home/initega/Music/music/Dragon ball soundtrack 10-O3YtxNvQdJ4.ogg -/home/initega/Music/music/Dragon ball soundtrack 11-w4eCI2_imso.ogg -/home/initega/Music/music/Dragon ball soundtrack 12-Apf249LjPg8.ogg -/home/initega/Music/music/Dragon ball soundtrack 13-Ke8-rChRvec.ogg -/home/initega/Music/music/Dragon ball soundtrack 14-7x5PfS3PyQI.ogg -/home/initega/Music/music/Dragon ball soundtrack 1-4mjzugW81i0.opus -/home/initega/Music/music/Dragon ball soundtrack 15-F8wOe1W2PQU.ogg -/home/initega/Music/music/Dragon ball soundtrack 16-ulVTfdbIoLY.ogg -/home/initega/Music/music/Dragon ball soundtrack 17-dxNCa7e3BIE.ogg -/home/initega/Music/music/Dragon ball soundtrack 20-YX5jNg88B8U.opus -/home/initega/Music/music/Dragon ball soundtrack 21-LN4Td8npjRI.ogg -/home/initega/Music/music/Dragon ball soundtrack 22-GJwNiRAhZTo.ogg -/home/initega/Music/music/Dragon ball soundtrack 23.-2ipws67QbXs.ogg -/home/initega/Music/music/Dragon ball soundtrack 24-WjGqbx6R9s8.opus -/home/initega/Music/music/Dragon ball soundtrack 25-4Sn0LMdjXgU.ogg -/home/initega/Music/music/Dragon ball soundtrack 26-LAyR30MRL3c.ogg -/home/initega/Music/music/Dragon ball soundtrack 27-HH1d_1JvF-4.ogg -/home/initega/Music/music/Dragon ball soundtrack 2-AMgzYLOGOX4.opus -/home/initega/Music/music/Dragon ball soundtrack 3-ZeaD71fISVs.opus -/home/initega/Music/music/Dragon ball soundtrack 4-6995upmiavg.opus -/home/initega/Music/music/Dragon ball soundtrack 5-MzNeFUMQZ5E.opus -/home/initega/Music/music/dragon ball soundtrack 6-nLtKocLdLDQ.opus -/home/initega/Music/music/Dragon ball soundtrack 7-3_hFpr3FvuI.opus -/home/initega/Music/music/Dragon ball soundtrack 8-QOXefULKY-4.ogg -/home/initega/Music/music/Dragon ball soundtrack 9-2oEf6kkvBaU.ogg -/home/initega/Music/music/Dragon ball sountrack 18-RIEpJp5oPFw.ogg -/home/initega/Music/music/Dragon Ball Super - Limit Break x Survivor (Instrumental Type B) Original Soundtrack-bfxU3uPhdxE.opus -/home/initega/Music/music/Dragon Ball Super OST 2- Limit-Break x Survivor (Instrumental Type A)-Y7G6Wf_AAbg.ogg -/home/initega/Music/music/Dragon Ball Super OST - Dream Tag Match (Original CD) [HD]-aFee61209rk.ogg -/home/initega/Music/music/Dragon Ball Super OST - Jiren's Tremendous Power (Original CD)-vlOsP4N8iso.opus -/home/initega/Music/music/Dragon Ball Super OST - Limit-Break x Survivor (Instrumental Type C)-5mqT164tdg4.ogg -/home/initega/Music/music/Dragon Ball Super OST - Official Clash Of Gods_The Final Death-Match-kfIl70TPX28.ogg -/home/initega/Music/music/Dragon Ball Super OST - Our Hero, Son Goku-xprx15VfzO4.ogg -/home/initega/Music/music/Dragon Ball Z BGM - M1311 'Goku Moves In To Tear Off Coola's Arm'-3dFJz7kmNK8.ogg -/home/initega/Music/music/Dragon Ball Z BGM - M711 'Piccolo's Bell Theme'-5IDz1plBfoQ.ogg -/home/initega/Music/music/DRAGON BALL Z OST 1 SHI WO YOBU CELL GAMES-o86oEGyNqpA.opus -/home/initega/Music/music/DRAGON BALL Z OST 5 KYOUFU NO GINYU TOKUSENTAI-O95Tx_6wMjQ.ogg -/home/initega/Music/music/Dragon Ball Z OST BGM M-1405-889loGD1ThA.opus -/home/initega/Music/music/Dragon Ball Z - Seigi wo aisuru mono! - Theme-V8E3howh4tk.opus -/home/initega/Music/music/Dragon Ball Z Soundtrack - M1308-gPVbyykGZBw.ogg -/home/initega/Music/music/Dragon Ball Z Soundtrack - M1522-2MWlrcsimt4.ogg -/home/initega/Music/music/Dragon Ball Z Soundtrack - M1711-DhKOLm5l47k.ogg -/home/initega/Music/music/Dragon Ball Z Soundtrack - M710-gYLtsuamk_E.ogg -/home/initega/Music/music/Dragon Ball Z Soundtrack - M727-TCkYe5ZZSFM.ogg -/home/initega/Music/music/Dragon Ball Z Soundtrack - M737-1ss6n0fnZSg.ogg -/home/initega/Music/music/Dragon Ball Z Soundtrack - M740-KQkJ7iAZHZ8.ogg -/home/initega/Music/music/Dragon Ball Z Soundtrack - M741-yfxcy2lXYiM.ogg -/home/initega/Music/music/Dragon Ball Z Soundtrack - M811-QY1h1ZLUlBI.ogg -/home/initega/Music/music/Dr_Dre_-_Still_DRE_ft_Snoop_Dogg[www.MP3Fiber.com].mp3 -/home/initega/Music/music/Dr_Dre_-_The_Next_Episode_ft_Snoop_Dogg_Kurupt_Nate_Dogg[www.MP3Fiber.com].mp3 -/home/initega/Music/music/Dwayne Johnson - Youre Welcome (From Moana).mp3 -/home/initega/Music/music/Edith Piaf - Non Je ne regrette rien.mp3 -/home/initega/Music/music/Eiffel 65 - Blue (Da Ba Dee) [Gabry Ponte Ice Pop Mix] (Original Video with subtitles) (152kbit_Opus).ogg -/home/initega/Music/music/El libro de la selva- Busca lo más vital.mp3 -/home/initega/Music/music/El Rey León 3 - Elogiemos al gran Timón.mp3 -/home/initega/Music/music/el rey leon 3 suricatos cava un tunel.mp3 -/home/initega/Music/music/El Rey León - Hakuna Matata [ES-España] [HD].mp3 -/home/initega/Music/music/El vuelo del moscardón - NICOLÁS RIMSKY-KÓRSAKOV - Piano.mp3 -/home/initega/Music/music/Eminem - Rap God (Explicit).mp3 -/home/initega/Music/music/Eminem - Till I Collapse [HD].mp3 -/home/initega/Music/music/Entry Of The Gladiators - Julius Fucik (152kbit_Opus).ogg -/home/initega/Music/music/Epic Sax Guy [Original] HD.mp3 -/home/initega/Music/music/Eskutitza. HEMENDIK AT!.mp3 -/home/initega/Music/music/E.T. Soundtrack.mp3 -/home/initega/Music/music/Eurythmics - Sweet Dreams (Are Made Of This).mp3 -/home/initega/Music/music/Fernando Esteso - La Ramona (128kbit_Opus).ogg -/home/initega/Music/music/Fierce Battle Against A Mighty Foe (HQ) - Dragon Ball Super _ Norihito Sumitomo-vH65j2kwR2U.opus -/home/initega/Music/music/Fleur East - Sax (Official Video).mp3 -/home/initega/Music/music/Franzl Lang - Einen Jodler hör i gern.mp3 -/home/initega/Music/music/George Michael - Careless Whisper (Lyrics).mp3 -/home/initega/Music/music/George Michael - Careless Whisper.mp3 -/home/initega/Music/music/Georges Bizet - Carmen Suite # 1- Les Toreadors.mp3 -/home/initega/Music/music/George Thorogood & The Destroyers - Bad to the Bone (With Lyrics).mp3 -/home/initega/Music/music/Greatest Battle Music Of All Times - Luffy Moukou (Extended version)-xUeaLmNDpG8.ogg -/home/initega/Music/music/드래곤볼 GT 마지막 엔딩(OST Edit) - Dan Dan Kokoro Hikareteku(Last Ending)-o6Mt4DKX8fI.ogg -/home/initega/Music/music/드래곤볼 GT 마지막 엔딩(OST Edit) - Dan Dan Kokoro Hikareteku(Last Ending)-o6Mt4DKX8fI.opus -/home/initega/Music/music/Guns N' Roses - Sweet Child O' Mine.mp3 -/home/initega/Music/music/Gunther - Ding Dong Song Gunther Video (You Touch My Tralala).mp3 -/home/initega/Music/music/Hatsune Miku - Ievan Polkka (HD).mp3 -/home/initega/Music/music/Hawaii Five-O - Theme Song [Full Version] (152kbit_Vorbis).ogg -/home/initega/Music/music/[HD] Passionate Duelist Theme - Yu-Gi-Oh! [Extended]-b7t6rZUZmfE.ogg -/home/initega/Music/music/He's a pirate - orchestra.mp3 -/home/initega/Music/music/HEYYEYAAEYAAAEYAEYAA.mp3 -/home/initega/Music/music/ikusi mendizaleak - OSKORRI.mp3 -/home/initega/Music/music/Imagine Dragons - On Top Of The World.mp3 -/home/initega/Music/music/Im Shipping Up To Boston - Dropkick Murphys.mp3 -/home/initega/Music/music/incredibles theme song (152kbit_Opus).ogg -/home/initega/Music/music/In the Hall of the Mountain King (Peer Gynt) by Edvard Grieg.mp3 -/home/initega/Music/music/Itsasontzi baten (Kaxiano) Gaurkotua.mp3 -/home/initega/Music/music/I Will Survive.mp3 -/home/initega/Music/music/Jason Derulo - Get Ugly (Official Music Video).mp3 -/home/initega/Music/music/Jason Derulo - Talk Dirty feat. 2 Chainz (Official HD Music Video).mp3 -/home/initega/Music/music/Jason Derulo - Want To Want Me (Official Video).mp3 -/home/initega/Music/music/Jason Derulo - Whatcha Say (Video).mp3 -/home/initega/Music/music/Jason Derulo - Wiggle feat. Snoop Dogg (Official HD Music Video).mp3 -/home/initega/Music/music/John Lennon - Imagine HD.mp3 -/home/initega/Music/music/Jurassic Park theme song..mp3 -/home/initega/Music/music/K-391 - Everybody [NCS Release].mp3 -/home/initega/Music/music/Katrina & The Waves - Walking On Sunshine.mp3 -/home/initega/Music/music/Kill Bill soundtrack Twisted Nerve.mp3 -/home/initega/Music/music/Konosuba_2_-_Red_Battle_Megumin_vs_Yunyun_RAP_BATTLE_ENG_SUB_improved_ver[www.MP3Fiber.com].mp3 -/home/initega/Music/music/Kool The Gang - Celebration.mp3 -/home/initega/Music/music/Kyodai Yôsai, Hasshin One Piece OST-6PJH71GjBcc.opus -/home/initega/Music/music/La sirenita - Bajo el mar (español de españa).mp3 -/home/initega/Music/music/Lau teilatu (Itoiz).mp3 -/home/initega/Music/music/Lazy Town We are Number One Music Video.mp3 -/home/initega/Music/music/Lipps Inc_ - Funky Town [HD] 1979.mp3 -/home/initega/Music/music/Mark Ronson - Uptown Funk ft. Bruno Mars.mp3 -/home/initega/Music/music/Martin Garrix & Bebe Rexha - In The Name Of Love.mp3 -/home/initega/Music/music/Martin Solveig & GTA - Intoxicated [Offical].mp3 -/home/initega/Music/music/MC Hammer - U Can-'t Touch This.mp3 -/home/initega/Music/music/Meme Song (The March of the Troll Face).mp3 -/home/initega/Music/music/Michael Jackson - Smooth Criminal (Michael Jackson's Vision).mp3 -/home/initega/Music/music/Michael Myers Theme Song (152kbit_Opus).ogg -/home/initega/Music/music/Mission Impossible Theme(full theme).mp3 -/home/initega/Music/music/Mitch Miller - The River Kwai March - Colonel Bogey March.mp3 -/home/initega/Music/music/Monsters Inc theme (full) (152kbit_Opus).ogg -/home/initega/Music/music/Mugiwara Kaizokudan, Hangeki Kaishi One Piece OST-KuZwthMXadM.ogg -/home/initega/Music/music/Mugiwara Kaizokudan, Hangeki Kaishi One Piece OST-KuZwthMXadM.opus -/home/initega/Music/music/Naruto OST 1 - Bad Situation (152kbit_Opus).ogg -/home/initega/Music/music/Naruto OST 1 - Glued State (152kbit_Opus).ogg -/home/initega/Music/music/Naruto OST - Grief And Sorrow (152kbit_Opus).ogg -/home/initega/Music/music/Naruto Shippuden OST Original Soundtrack 03 - Homecoming (152kbit_Vorbis).ogg -/home/initega/Music/music/Naruto Shippuden OST Original Soundtrack 04 - Experienced Many Battles (152kbit_Vorbis).ogg -/home/initega/Music/music/Naruto Shippuuden Sountrack (Man of the world) (152kbit_Opus).ogg -/home/initega/Music/music/Naruto Soundtrack - Heavy Violence. (152kbit_Opus).ogg -/home/initega/Music/music/Nere herriko neskatxa maite karaokean.mp3 -/home/initega/Music/music/Nightcore - Mi Mi Mi.mp3 -/home/initega/Music/music/NOMA - Brain Power.mp3 -/home/initega/Music/music/Nyan Cat [original].mp3 -/home/initega/Music/music/Oasis - Wonderwall.mp3 -/home/initega/Music/music/OFFICIAL Somewhere over the Rainbow - Israel IZ Kamakawiwo-ole.mp3 -/home/initega/Music/music/Oliver y Benji (Campeones) Canción Completa [Español].mp3 -/home/initega/Music/music/One Piece - Karakuri Defense System, Deploy [Long Edit]-Gn5idEi7gtc.opus -/home/initega/Music/music/One Piece - Lets Battle [Extended Version]-UBiAA6BMxbU.ogg -/home/initega/Music/music/One Piece Luffy Vs Ratchet Round 1 Extended-3P7Ee85Z32Y.ogg -/home/initega/Music/music/One Piece Original SoundTrack - After Eating,Grand Line!--n5f9jLqfGg.opus -/home/initega/Music/music/One Piece Original SoundTrack - Difficult-nMbTTpcvEcw.opus -/home/initega/Music/music/One Piece Original Soundtrack Three Towers Movie 5 Extended [HQ]-vas_vlDjkMk.ogg -/home/initega/Music/music/One Piece OST (21) - Sakusenkaishi ~ Osowareru mura ~-4ANaEsE5bdI.opus -/home/initega/Music/music/One Piece Ost - Desperate Situation-6s-Icke6F8M.ogg -/home/initega/Music/music/One Piece OST - Pirate 2-ZwIY5i_T2es.opus -/home/initega/Music/music/One Piece OST - The Fight Continues-F30A4RrNgDs.ogg -/home/initega/Music/music/One Piece OST - The Very Very Very Strongest [extended]-4J7K3yacig4.opus -/home/initega/Music/music/One Piece - Overtaken 720p HD-8A-q3TM8kPk.opus -/home/initega/Music/music/One Piece Soundtrack - Giant Stronghold, Takeoff!-0Y3tmKzNDks.opus -/home/initega/Music/music/One Piece Soundtrack - I'm becoming the Pirate King!-4f6fqLOzjnw.opus -/home/initega/Music/music/One Piece Soundtrack - Karakuri Castle, Transform-5DOrDKVolfI.opus -/home/initega/Music/music/One Piece Soundtrack - To The Grand Line HD-6vsoCQ9j2kg.ogg -/home/initega/Music/music/Orchestral Manoeuvres In The Dark - Enola Gay.mp3 -/home/initega/Music/music/Original GhostBusters Theme Song.mp3 -/home/initega/Music/music/O.T. Genasis - CoCo [Music Video].mp3 -/home/initega/Music/music/Overworld Theme - New Super Mario Bros. (152kbit_Vorbis).ogg -/home/initega/Music/music/Overworld Theme - Super Mario World (152kbit_Vorbis).ogg -/home/initega/Music/music/Panjabi MC - Mundian To Bach Ke (The Dictator Soundtrack).mp3 -/home/initega/Music/music/PINK GUY - STFU.mp3 -/home/initega/Music/music/Pitbull - Feel This Moment ft. Christina Aguilera.mp3 -/home/initega/Music/music/PPAP Pen Pineapple Apple Pen.mp3 -/home/initega/Music/music/PSY - DADDY(feat. CL of 2NE1) M-V.mp3 -/home/initega/Music/music/PSY - 나팔바지(NAPAL BAJI) M-V.mp3 -/home/initega/Music/music/puntaren puntan.mp3 -/home/initega/Music/music/Queen - -'Another One Bites the Dust-'.mp3 -/home/initega/Music/music/Queen - 'Bohemian Rhapsody'.mp3 -/home/initega/Music/music/Queen - 'We Will Rock You'.mp3 -/home/initega/Music/music/Quiero ser como tú - Academia OT.mp3 -/home/initega/Music/music/Recoverd_mp3_file(104).mp3 -/home/initega/Music/music/Recoverd_mp3_file(112).mp3 -/home/initega/Music/music/Recoverd_mp3_file(114).mp3 -/home/initega/Music/music/Recoverd_mp3_file(119).mp3 -/home/initega/Music/music/Recoverd_mp3_file(121).mp3 -/home/initega/Music/music/Recoverd_mp3_file(127).mp3 -/home/initega/Music/music/Recoverd_mp3_file(128).mp3 -/home/initega/Music/music/Recoverd_mp3_file(159).mp3 -/home/initega/Music/music/Recoverd_mp3_file(225).mp3 -/home/initega/Music/music/Recoverd_mp3_file(226).mp3 -/home/initega/Music/music/Recoverd_mp3_file(227).mp3 -/home/initega/Music/music/Recoverd_mp3_file(228).mp3 -/home/initega/Music/music/Recoverd_mp3_file(229).mp3 -/home/initega/Music/music/Recoverd_mp3_file(232).mp3 -/home/initega/Music/music/Recoverd_mp3_file(237).mp3 -/home/initega/Music/music/Recoverd_mp3_file(239).mp3 -/home/initega/Music/music/Recoverd_mp3_file(240).mp3 -/home/initega/Music/music/Recoverd_mp3_file(242).mp3 -/home/initega/Music/music/Recoverd_mp3_file(243).mp3 -/home/initega/Music/music/Recoverd_mp3_file(244).mp3 -/home/initega/Music/music/Recoverd_mp3_file(245).mp3 -/home/initega/Music/music/Recoverd_mp3_file(246).mp3 -/home/initega/Music/music/Recoverd_mp3_file(247).mp3 -/home/initega/Music/music/Recoverd_mp3_file(249).mp3 -/home/initega/Music/music/Recoverd_mp3_file(24).mp3 -/home/initega/Music/music/Recoverd_mp3_file(250).mp3 -/home/initega/Music/music/Recoverd_mp3_file(251).mp3 -/home/initega/Music/music/Recoverd_mp3_file(25).mp3 -/home/initega/Music/music/Recoverd_mp3_file(270).mp3 -/home/initega/Music/music/Recoverd_mp3_file(27).mp3 -/home/initega/Music/music/Recoverd_mp3_file(288).mp3 -/home/initega/Music/music/Recoverd_mp3_file(289).mp3 -/home/initega/Music/music/Recoverd_mp3_file(291).mp3 -/home/initega/Music/music/Recoverd_mp3_file(299).mp3 -/home/initega/Music/music/Recoverd_mp3_file(307).mp3 -/home/initega/Music/music/Recoverd_mp3_file(321).mp3 -/home/initega/Music/music/Recoverd_mp3_file(350).mp3 -/home/initega/Music/music/Recoverd_mp3_file(35).mp3 -/home/initega/Music/music/Recoverd_mp3_file(364).mp3 -/home/initega/Music/music/Recoverd_mp3_file(366).mp3 -/home/initega/Music/music/Recoverd_mp3_file(367).mp3 -/home/initega/Music/music/Recoverd_mp3_file(368).mp3 -/home/initega/Music/music/Recoverd_mp3_file(369).mp3 -/home/initega/Music/music/Recoverd_mp3_file(36).mp3 -/home/initega/Music/music/Recoverd_mp3_file(371).mp3 -/home/initega/Music/music/Recoverd_mp3_file(373).mp3 -/home/initega/Music/music/Recoverd_mp3_file(374).mp3 -/home/initega/Music/music/Recoverd_mp3_file(43).mp3 -/home/initega/Music/music/Recoverd_mp3_file(44).mp3 -/home/initega/Music/music/Recoverd_mp3_file(452).mp3 -/home/initega/Music/music/Recoverd_mp3_file(45).mp3 -/home/initega/Music/music/Recoverd_mp3_file(534).mp3 -/home/initega/Music/music/Recoverd_mp3_file(535).mp3 -/home/initega/Music/music/Recoverd_mp3_file(55).mp3 -/home/initega/Music/music/Recoverd_mp3_file(572).mp3 -/home/initega/Music/music/Recoverd_mp3_file(576).mp3 -/home/initega/Music/music/Recoverd_mp3_file(57).mp3 -/home/initega/Music/music/Recoverd_mp3_file(590).mp3 -/home/initega/Music/music/Recoverd_mp3_file(592).mp3 -/home/initega/Music/music/Recoverd_mp3_file(593).mp3 -/home/initega/Music/music/Recoverd_mp3_file(604).mp3 -/home/initega/Music/music/Recoverd_mp3_file(605).mp3 -/home/initega/Music/music/Recoverd_mp3_file(609).mp3 -/home/initega/Music/music/Recoverd_mp3_file(612).mp3 -/home/initega/Music/music/Recoverd_mp3_file(616).mp3 -/home/initega/Music/music/Recoverd_mp3_file(617).mp3 -/home/initega/Music/music/Recoverd_mp3_file(618).mp3 -/home/initega/Music/music/Recoverd_mp3_file(626).mp3 -/home/initega/Music/music/Recoverd_mp3_file(628).mp3 -/home/initega/Music/music/Recoverd_mp3_file(634).mp3 -/home/initega/Music/music/Recoverd_mp3_file(635).mp3 -/home/initega/Music/music/Recoverd_mp3_file(636).mp3 -/home/initega/Music/music/Recoverd_mp3_file(63).mp3 -/home/initega/Music/music/Recoverd_mp3_file(643).mp3 -/home/initega/Music/music/Recoverd_mp3_file(647).mp3 -/home/initega/Music/music/Recoverd_mp3_file(651).mp3 -/home/initega/Music/music/Recoverd_mp3_file(655).mp3 -/home/initega/Music/music/Recoverd_mp3_file(676).mp3 -/home/initega/Music/music/Recoverd_mp3_file(677).mp3 -/home/initega/Music/music/Recoverd_mp3_file(68).mp3 -/home/initega/Music/music/Recoverd_mp3_file(690).mp3 -/home/initega/Music/music/Recoverd_mp3_file(701).mp3 -/home/initega/Music/music/Recoverd_mp3_file(705).mp3 -/home/initega/Music/music/Recoverd_mp3_file(70).mp3 -/home/initega/Music/music/Recoverd_mp3_file(712).mp3 -/home/initega/Music/music/Recoverd_mp3_file(717).mp3 -/home/initega/Music/music/Recoverd_mp3_file(718).mp3 -/home/initega/Music/music/Recoverd_mp3_file(719).mp3 -/home/initega/Music/music/Recoverd_mp3_file(72).mp3 -/home/initega/Music/music/Recoverd_mp3_file(730).mp3 -/home/initega/Music/music/Recoverd_mp3_file(73).mp3 -/home/initega/Music/music/Recoverd_mp3_file(749).mp3 -/home/initega/Music/music/Recoverd_mp3_file(75).mp3 -/home/initega/Music/music/Recoverd_mp3_file(76).mp3 -/home/initega/Music/music/Recoverd_mp3_file(774).mp3 -/home/initega/Music/music/Recoverd_mp3_file(77).mp3 -/home/initega/Music/music/Recoverd_mp3_file(780).mp3 -/home/initega/Music/music/Recoverd_mp3_file(78).mp3 -/home/initega/Music/music/Recoverd_mp3_file(79).mp3 -/home/initega/Music/music/Recoverd_mp3_file(801).mp3 -/home/initega/Music/music/Recoverd_mp3_file(804).mp3 -/home/initega/Music/music/Recoverd_mp3_file(80).mp3 -/home/initega/Music/music/Recoverd_mp3_file(826).mp3 -/home/initega/Music/music/Recoverd_mp3_file(827).mp3 -/home/initega/Music/music/Recoverd_mp3_file(829).mp3 -/home/initega/Music/music/Recoverd_mp3_file(82).mp3 -/home/initega/Music/music/Recoverd_mp3_file(84).mp3 -/home/initega/Music/music/Recoverd_mp3_file(851).mp3 -/home/initega/Music/music/Recoverd_mp3_file(853).mp3 -/home/initega/Music/music/Recoverd_mp3_file(856).mp3 -/home/initega/Music/music/Recoverd_mp3_file(863).mp3 -/home/initega/Music/music/Recoverd_mp3_file(86).mp3 -/home/initega/Music/music/Recoverd_mp3_file(872).mp3 -/home/initega/Music/music/Recoverd_mp3_file(876).mp3 -/home/initega/Music/music/Recoverd_mp3_file(884).mp3 -/home/initega/Music/music/Recoverd_mp3_file(897).mp3 -/home/initega/Music/music/Recoverd_mp3_file(913).mp3 -/home/initega/Music/music/Recoverd_mp3_file(923).mp3 -/home/initega/Music/music/Recoverd_mp3_file(926).mp3 -/home/initega/Music/music/Recoverd_mp3_file(934).mp3 -/home/initega/Music/music/Recoverd_mp3_file(942).mp3 -/home/initega/Music/music/Recoverd_mp3_file(96).mp3 -/home/initega/Music/music/Rick Astley - Never Gonna Give You Up.mp3 -/home/initega/Music/music/RISE (ft. The Glitch Mob, Mako, and The Word Alive) _ Worlds 2018 - League of Legends (128kbit_Vorbis).ogg -/home/initega/Music/music/Running_in_the_90s[www.MP3Fiber.com].mp3 -/home/initega/Music/music/Sabre Dance - Aram Khachaturian.mp3 -/home/initega/Music/music/Shikamaru Theme Song (152kbit_Opus).ogg -/home/initega/Music/music/Shi o Yobu Seru Gêmu The Cell Game Which Calls Forth Death part 3-mpwYsRsw5vI.ogg -/home/initega/Music/music/Shunsuke Kikuchi - M1525 (Dragon Ball Z OST)-w0ZTP0AB768.opus -/home/initega/Music/music/Smash Mouth - All Star.mp3 -/home/initega/Music/music/Smash Mouth - I'm A Believer.mp3 -/home/initega/Music/music/Snoop Dogg Smoke weed every day (dubstep remix).mp3 -/home/initega/Music/music/SOUNDTRACK DE LA VIDA ES BELLA.mp3 -/home/initega/Music/music/Stand By Me, Ben E King, 1961 (152kbit_Opus).ogg -/home/initega/Music/music/Stereo Sayan 3D.mp3 -/home/initega/Music/music/Stranger_Things_Theme_Song_C418_REMIX[www.MP3Fiber.com].mp3 -/home/initega/Music/music/Superman Theme.mp3 -/home/initega/Music/music/Takeo Ischi - New Bibi Hendl (Chicken Yodeling) 2011.mp3 -/home/initega/Music/music/The_Addams_Family_1991_Suite[www.MP3Fiber.com].mp3 -/home/initega/Music/music/The A-Team Full Theme Tune.mp3 -/home/initega/Music/music/The Batman Theme Song.mp3 -/home/initega/Music/music/The Beatles - Hello, Goodbye.mp3 -/home/initega/Music/music/The Beatles - Here Comes The Sun (Lyrics).mp3 -/home/initega/Music/music/TheFatRat - Infinite Power!.mp3 -/home/initega/Music/music/The Great Escape - Elmer Bernstein.mp3 -/home/initega/Music/music/The Ninja Troll (theme song) ft. KYR SP33DY-A648Tn0pvSk.ogg -/home/initega/Music/music/The_Pink_Panther_Theme_Song_Original_Version[www.MP3Fiber.com].mp3 -/home/initega/Music/music/The Power to Resist - Dragon Ball Super _ Norihito Sumitomo-DSpPFG7RKF4.ogg -/home/initega/Music/music/The Power to Resist - Dragon Ball Super _ Norihito Sumitomo-DSpPFG7RKF4.opus -/home/initega/Music/music/The_Sound_of_Silence_Original_Version_from_1964[www.MP3Fiber.com].mp3 -/home/initega/Music/music/The Turtles - Happy Together - 1967.mp3 -/home/initega/Music/music/The Verve - Bitter Sweet Symphony.mp3 -/home/initega/Music/music/The_White_Stripes_-_Seven_Nation_Army[www.MP3Fiber.com].mp3 -/home/initega/Music/music/Those Who Inherit The Will of Fire - Naruto OST 3 (152kbit_Opus).ogg -/home/initega/Music/music/Title Theme - New Super Mario Bros. (192kbit_Opus).ogg -/home/initega/Music/music/TOY STORY HAY UN AMIGO EN MÍ (CANCIÓN ORIGINAL ESPAÑOL) CON LETRA.mp3 -/home/initega/Music/music/TROLL SONG TROLL CANCION NO COPYRIGHT.mp3 -/home/initega/Music/music/Trololo Sing Along!.mp3 -/home/initega/Music/music/Tunak Tunak Tun Remix - ToDieFor feat. Daler Mehndi - Best of 2016 ft. Daler Mehndi.mp3 -/home/initega/Music/music/twenty one pilots- Heathens (from Suicide Squad- The Album) [OFFICIAL VIDEO].mp3 -/home/initega/Music/music/twenty one pilots- Stressed Out [OFFICIAL VIDEO].mp3 -/home/initega/Music/music/Txoria txori (Mikel Laboa)-.mp3 -/home/initega/Music/music/Undertale - Megalovania-ZcoqR9Bwx1Y.opus -/home/initega/Music/music/Vaiana Videoclip “Qué hay más allá” con María Parrado HD.mp3 -/home/initega/Music/music/Vince The II - Gates (Trick2g).mp3 -/home/initega/Music/music/Warriors - 2014 World Championship.mp3 -/home/initega/Music/music/Weird russian singer - Chum Drum Bedrum.mp3 -/home/initega/Music/music/Wham! - Wake Me Up Before You Go-Go.mp3 -/home/initega/Music/music/Worlds 2016- Zedd - Ignite.mp3 -/home/initega/Music/music/Worlds Collide - 2015 World Championship (ft. Nicki Taylor).mp3 -/home/initega/Music/music/YMCA - The Village People - Full AD Jhin Edition.mp3 -/home/initega/Music/music/Yodelling - Franzl Lang.mp3 -/home/initega/Music/music/You Are a Pirate!.mp3 -/home/initega/Music/music/zarena zarelako -SUGAN- (remix).mp3 -/home/initega/Music/music/ТРИ_ПОЛОСКИ_KOLM_TRIIPU_THREE_STRIPES[www.MP3Fiber.com].mp3 -/home/initega/Music/music/Recoverd_mp3_file(293).mp3 -/home/initega/Music/music/Ra Ra RasPutin animation 720 1080 HD Version slocband paceaudio.mp3 -/home/initega/Music/music/Recoverd_mp3_file(38).mp3 -/home/initega/Music/music/Recoverd_mp3_file(39).mp3 -/home/initega/Music/music/Recoverd_mp3_file(40).mp3 -/home/initega/Music/music/Recoverd_mp3_file(41).mp3 -/home/initega/Music/music/Recoverd_mp3_file(48).mp3 -/home/initega/Music/music/Recoverd_mp3_file(49).mp3 -/home/initega/Music/music/Recoverd_mp3_file(50).mp3 -/home/initega/Music/music/Recoverd_mp3_file(51).mp3 -/home/initega/Music/music/Recoverd_mp3_file(52).mp3 -/home/initega/Music/music/Recoverd_mp3_file(54).mp3 -/home/initega/Music/music/Recoverd_mp3_file(56).mp3 -/home/initega/Music/music/Recoverd_mp3_file(58).mp3 -/home/initega/Music/music/Recoverd_mp3_file(59).mp3 -/home/initega/Music/music/Recoverd_mp3_file(60).mp3 -/home/initega/Music/music/Recoverd_mp3_file(61).mp3 -/home/initega/Music/music/Recoverd_mp3_file(62).mp3 -/home/initega/Music/music/Recoverd_mp3_file(286).mp3 -/home/initega/Music/music/Legends Never Die (ft. Against The Current) [OFFICIAL AUDIO] - Worlds 2017 - League of Legends.mp3 -/home/initega/Music/music/Naruto OST 1 - Naruto Main Theme.mp3 -/home/initega/Music/music/Naruto Shippuden OST - Departure To The Front Lines.mp3 -/home/initega/Music/music/Naruto-Shippuden-Theme.mp3 -/home/initega/Music/music/Naruto Theme - The Raising Fighting Spirit.mp3 -/home/initega/Music/music/Recoverd_mp3_file(91).mp3 -/home/initega/Music/music/Recoverd_mp3_file(64).mp3 -/home/initega/Music/music/Recoverd_mp3_file(955).mp3 -/home/initega/Music/music/Recoverd_mp3_file(162).mp3 -/home/initega/Music/music/Recoverd_mp3_file(348).mp3 -/home/initega/Music/music/Recoverd_mp3_file(71).mp3 -/home/initega/Music/music/Recoverd_mp3_file(292).mp3 -/home/initega/Music/music/Recoverd_mp3_file(302).mp3 -/home/initega/Music/music/Recoverd_mp3_file(236).mp3 -/home/initega/Music/music/Recoverd_mp3_file(304).mp3 -/home/initega/Music/music/Recoverd_mp3_file(657).mp3 -/home/initega/Music/music/Recoverd_mp3_file(42).mp3 -/home/initega/Music/music/Recoverd_mp3_file(46).mp3 -/home/initega/Music/music/Recoverd_mp3_file(47).mp3 -/home/initega/Music/music/Recoverd_mp3_file(53).mp3 -/home/initega/Music/music/Naruto Shippuden OST II - Hyouhaku + Kokuten (128kbit_AAC).ogg -/home/initega/Music/music/Naruto - Sadness And Sorrow (Original) (152kbit_AAC).ogg -/home/initega/Music/music/TombstoneSpookyScarySkeletonsRemix-Final-Extended.mp3 -/home/initega/Music/music/Naruto Shippuden Opening 16 (192kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden Opening 17 (192kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden Opening 19 V3 (English Sub) (192kbit_AAC).ogg -/home/initega/Music/music/Aqua Barbie girl.mp3 -/home/initega/Music/music/Pokémon Theme Song (128kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden Emergence Of Talents_Hyakkaryouran Extended (128kbit_AAC).ogg -/home/initega/Music/music/They're Taking The Hobbits To Isengard - High Definition Remake (192kbit_AAC).ogg -/home/initega/Music/music/Intro Johnny Test Disney Channel España (128kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden Blood Prison OST - 12 - Gold-Brocaded Damask (128kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden OST 1 - Track 02 - Douten ( Heaven Shaking Event ) (128kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden OST 1 - Track 05 - Denkousekka ( Lightning Speed ) (128kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden OST 2 - Track 01 - Shouryuu ( Rising Dragon ) (128kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden OST 2 - Track 02 - Rinkai ( Critical state ) (128kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden OST 2 - Track 03 - Gekiha ( Crushing ) (128kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden OST 2 - Track 13 - Nankou Furaku ( Impregnable ) (128kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden OST 2 - Track 19 - Himoji ( The Scarlet Letter ) (128kbit_AAC).ogg -/home/initega/Music/music/Recoverd_mp3_file(650).mp3 -/home/initega/Music/music/Recoverd_mp3_file(1087).mp3 -/home/initega/Music/music/Mulan _ I'll Make A Man Out Of You _ Disney Sing-Along (192kbit_AAC).ogg -/home/initega/Music/music/Recoverd_mp3_file(262).mp3 -/home/initega/Music/music/Naruto OST - Kakuzu Theme (128kbit_AAC).ogg -/home/initega/Music/music/Enya - Only Time (Official Music Video).mp3 -/home/initega/Music/music/ERA-Ameno.mp3 -/home/initega/Music/music/AUTOBUS MAGIKOA Openinga EUSKARAZ (128kbit_AAC).ogg -/home/initega/Music/music/Super Mario Remix (128kbit_AAC).ogg -/home/initega/Music/music/Sonic Lost World OST[Without Boundaries] - Honeycomb Highway[HQ] (192kbit_AAC).ogg -/home/initega/Music/music/Txanogorritxo (Hemendik at) (128kbit_AAC).ogg -/home/initega/Music/music/Gatibu - Bixotza suten (192kbit_AAC).ogg -/home/initega/Music/music/Pokemon Go (Goblins from Mars Trap Remix) [Launchpad Cover] (192kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden - Opening 3 (Sub-español) (192kbit_AAC).ogg -/home/initega/Music/music/Recoverd_mp3_file(231).mp3 -/home/initega/Music/music/Recoverd_mp3_file(66).mp3 -/home/initega/Music/music/Recoverd_mp3_file(583).mp3 -/home/initega/Music/music/Hawaiian Roller Coaster Ride - Nightcore (192kbit_AAC).ogg -/home/initega/Music/music/The Coconut Song - (Da Coconut Nut) (128kbit_AAC).ogg -/home/initega/Music/music/Recoverd_mp3_file(354).mp3 -/home/initega/Music/music/Recoverd_mp3_file(160).mp3 -/home/initega/Music/music/Recoverd_mp3_file(161).mp3 -/home/initega/Music/music/Naruto shikamaru theme (128kbit_AAC).ogg -/home/initega/Music/music/Status Quo_ Whatever you want (128kbit_AAC).ogg -/home/initega/Music/music/Naruto Opening 2 (192kbit_AAC).ogg -/home/initega/Music/music/Pokemon GO - Map Theme Remix - _Walkin'_ (KyleAB5000) (192kbit_AAC).ogg -/home/initega/Music/music/Danny McCarthy - Silver Scrapes (Dubstep).mp3 -/home/initega/Music/music/Naruto Shippuden opening 1 - Hero's Come Back - Nobodyknows (128kbit_AAC).ogg -/home/initega/Music/music/Mark Van Dale with Enrico - Water Wave (DJ Quicksilver Radio Mix) (152kbit_AAC).ogg -/home/initega/Music/music/LFZ-Echoes_NCS_Release.mp3 -/home/initega/Music/music/Recoverd_mp3_file(94).mp3 -/home/initega/Music/music/Recoverd_mp3_file(23).mp3 -/home/initega/Music/music/Beautiful Green Wild Beast - Naruto OST 3 (128kbit_AAC).ogg -/home/initega/Music/music/Hero - Naruto OST 3 (128kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden OST Original Soundtrack 13 - Loneliness (128kbit_AAC).ogg -/home/initega/Music/music/When U Remix Pokemon Go (LIVE MASHUP) Mashd N Kutcher (192kbit_AAC).ogg -/home/initega/Music/music/Recoverd_mp3_file(358).mp3 -/home/initega/Music/music/Recoverd_mp3_file(359).mp3 -/home/initega/Music/music/Recoverd_mp3_file(163).mp3 -/home/initega/Music/music/Recoverd_mp3_file(92).mp3 -/home/initega/Music/music/Recoverd_mp3_file(95).mp3 -/home/initega/Music/music/Manuel - Gas Gas Gas (192kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuuden OST 2 - Narukami - Screaming god [Full HD] (192kbit_AAC).ogg -/home/initega/Music/music/Naruto Unreleased - Break down _ MINATO vs Tobi [HD] (192kbit_AAC).ogg -/home/initega/Music/music/Recoverd_mp3_file(37).mp3 -/home/initega/Music/music/Naruto Shippuden OP10 NC (192kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden OP4v2 NC (192kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden OP6 NC (192kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden OST - Reverse situation (128kbit_AAC).ogg -/home/initega/Music/music/Naruto OST 1 - Go Go Naruto! (128kbit_AAC).ogg -/home/initega/Music/music/Naruto OST 1 - I Said Im Naruto (128kbit_AAC).ogg -/home/initega/Music/music/Naruto OST 1 - Need To Be Strong (128kbit_AAC).ogg -/home/initega/Music/music/Naruto OST 1 - Strong and Strike (128kbit_AAC).ogg -/home/initega/Music/music/Naruto OST 1 - Turn Over (128kbit_AAC).ogg -/home/initega/Music/music/Naruto OST 1 - Victory (128kbit_AAC).ogg -/home/initega/Music/music/Recoverd_mp3_file(888).mp3 -/home/initega/Music/music/Recoverd_mp3_file(656).mp3 -/home/initega/Music/music/Initial D - Deja Vu (192kbit_AAC).ogg -/home/initega/Music/music/Recoverd_mp3_file(360).mp3 -/home/initega/Music/music/Naruto Shippuden OST - The Guts To Never Give Up (152kbit_AAC).ogg -/home/initega/Music/music/The Fresh Prince Of Bel Air Theme Song (Full) (128kbit_AAC).ogg -/home/initega/Music/music/Recoverd_mp3_file(88).mp3 -/home/initega/Music/music/Naruto Shippuden OST - Jinchuuriki (128kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden OST- My Name (192kbit_AAC).ogg -/home/initega/Music/music/D1ofaquavibe Monkeybiz (128kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden Madara Uchiha Theme Six Paths (192kbit_AAC).ogg -/home/initega/Music/music/[Naruto Shippuuden OST 2] 21 - Beni Soubi (128kbit_AAC).ogg -/home/initega/Music/music/Recoverd_mp3_file(102).mp3 -/home/initega/Music/music/Naruto-The 5th's Fight Theme (192kbit_AAC).ogg -/home/initega/Music/music/Recoverd_mp3_file(562).mp3 -/home/initega/Music/music/Prokofiev - Peter and the Wolf (128kbit_AAC).ogg -/home/initega/Music/music/Naruto Shippuden-Sage Of The Six Paths Death Theme (192kbit_AAC).ogg -/home/initega/Music/music/Recoverd_mp3_file(919).mp3 -/home/initega/Music/music/Naruto Shippuden - Girei (Pain's Theme Song) (192kbit_AAC).ogg -/home/initega/Music/music/Recoverd_mp3_file(349).mp3 -/home/initega/Music/music/Recoverd_mp3_file(353).mp3 -/home/initega/Music/music/Recoverd_mp3_file(134).mp3 -/home/initega/Music/music/Super Mario Bros 2_ Overworld Theme (ThisNameIsAFail Remix) (192kbit_AAC).ogg -/home/initega/Music/music/Naruto OST - Rock Lee's theme_ Beautiful Green Wild Beast [HD] (192kbit_AAC).ogg -/home/initega/Music/music/Recoverd_mp3_file(108).mp3 -/home/initega/Music/music/Van Halen - Jump (128kbit_AAC).ogg -/home/initega/Music/music/Recoverd_mp3_file(103).mp3 -/home/initega/Music/music/Jiraya Theme Song (128kbit_AAC).ogg -/home/initega/Music/music/1aaAlfred Hitchcock Presents TV intro.wmv (96kbit_AAC).ogg -/home/initega/Music/music/Italobrothers - Stamp On The Ground (Official HD Video) (128kbit_AAC).ogg -/home/initega/Music/music/Recoverd_mp3_file(361).mp3 -/home/initega/Music/music/Recoverd_mp3_file(351).mp3 diff --git a/.config/cmus/playlists/default b/.config/cmus/playlists/default deleted file mode 100644 index f4e7203..0000000 --- a/.config/cmus/playlists/default +++ /dev/null @@ -1,5 +0,0 @@ -/home/initega/The Best of Beethoven (152kbit_Opus).ogg -/home/initega/The Best of Beethoven (152kbit_Opus).ogg -/home/initega/The Best of Beethoven (152kbit_Opus).ogg -/home/initega/The Best of Beethoven (152kbit_Opus).ogg -/home/initega/The Best of Beethoven (152kbit_Opus).ogg diff --git a/.config/cmus/search-history b/.config/cmus/search-history deleted file mode 100644 index 36a24d8..0000000 --- a/.config/cmus/search-history +++ /dev/null @@ -1,12 +0,0 @@ -home/initega/Music/music -c -shuffle -pause -toggle -player -prev -play -add -view4 -The -win-add-q diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index d641da9..47c8136 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -34,11 +34,11 @@ XF86Suspend XF86ScreenSaver xscreensaver-command -lock -ctrl + j - mksh $TSCRIPTS/brightness-software.sh -dec 0.1 +/* ctrl + j */ +/* mksh $TSCRIPTS/brightness-software.sh -dec 0.1 */ -ctrl + k - mksh $TSCRIPTS/brightness-software.sh -inc 0.1 +/* ctrl + k */ +/* mksh $TSCRIPTS/brightness-software.sh -inc 0.1 */ Print mksh $SCRIPTS/screenshot-screen.sh diff --git a/.vimrc b/.vimrc index 41bca91..2c3ab6c 100644 --- a/.vimrc +++ b/.vimrc @@ -20,6 +20,7 @@ Plug 'tiagofumo/vim-nerdtree-syntax-highlight' Plug 'scrooloose/nerdtree' Plug 'hdima/python-syntax' Plug 'mileszs/ack.vim' +Plug 'gregsexton/MatchTag' Plug 'xolox/vim-misc' Plug 'xolox/vim-easytags' Plug 'jceb/vim-orgmode' @@ -112,6 +113,15 @@ command! MakeTags !ctags -R . set t_Co=256 let mapleader="," + +" Folds +set foldlevelstart=1 + +" XML/HTML +imap xa +nmap c ax + + ""Use 24-bit (true-color) mode in Vim/Neovim when outside tmux. ""If you're using tmux version 2.2 or later, you can remove the outermost ""$TMUX check and use tmux's 24-bit color support diff --git a/bin/x b/bin/x index 1b3e01c..b4436cb 100755 --- a/bin/x +++ b/bin/x @@ -1,3 +1,9 @@ #!/bin/dash +orig="$(pwd)" + +cd "$HOME" + startx -- vt1 + +cd "$orig" diff --git a/dmenu/dmenu-4.9.tar.gz b/dmenu/dmenu-4.9.tar.gz new file mode 100644 index 0000000..da7255d Binary files /dev/null and b/dmenu/dmenu-4.9.tar.gz differ diff --git a/dmenu/dmenu-4.9/LICENSE b/dmenu/dmenu-4.9/LICENSE new file mode 100644 index 0000000..6ed8ad3 --- /dev/null +++ b/dmenu/dmenu-4.9/LICENSE @@ -0,0 +1,30 @@ +MIT/X Consortium License + +© 2006-2019 Anselm R Garbe +© 2006-2008 Sander van Dijk +© 2006-2007 Michał Janeczek +© 2007 Kris Maglione +© 2009 Gottox +© 2009 Markus Schnalke +© 2009 Evan Gates +© 2010-2012 Connor Lane Smith +© 2014-2019 Hiltjo Posthuma +© 2015-2018 Quentin Rameau + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/dmenu/dmenu-4.9/Makefile b/dmenu/dmenu-4.9/Makefile new file mode 100644 index 0000000..a03a95c --- /dev/null +++ b/dmenu/dmenu-4.9/Makefile @@ -0,0 +1,64 @@ +# dmenu - dynamic menu +# See LICENSE file for copyright and license details. + +include config.mk + +SRC = drw.c dmenu.c stest.c util.c +OBJ = $(SRC:.c=.o) + +all: options dmenu stest + +options: + @echo dmenu build options: + @echo "CFLAGS = $(CFLAGS)" + @echo "LDFLAGS = $(LDFLAGS)" + @echo "CC = $(CC)" + +.c.o: + $(CC) -c $(CFLAGS) $< + +config.h: + cp config.def.h $@ + +$(OBJ): arg.h config.h config.mk drw.h + +dmenu: dmenu.o drw.o util.o + $(CC) -o $@ dmenu.o drw.o util.o $(LDFLAGS) + +stest: stest.o + $(CC) -o $@ stest.o $(LDFLAGS) + +clean: + rm -f dmenu stest $(OBJ) dmenu-$(VERSION).tar.gz + +dist: clean + mkdir -p dmenu-$(VERSION) + cp LICENSE Makefile README arg.h config.def.h config.mk dmenu.1\ + drw.h util.h dmenu_path dmenu_run stest.1 $(SRC)\ + dmenu-$(VERSION) + tar -cf dmenu-$(VERSION).tar dmenu-$(VERSION) + gzip dmenu-$(VERSION).tar + rm -rf dmenu-$(VERSION) + +install: all + mkdir -p $(DESTDIR)$(PREFIX)/bin + cp -f dmenu dmenu_path dmenu_run stest $(DESTDIR)$(PREFIX)/bin + chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu + chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_path + chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run + chmod 755 $(DESTDIR)$(PREFIX)/bin/stest + mkdir -p $(DESTDIR)$(MANPREFIX)/man1 + sed "s/VERSION/$(VERSION)/g" < dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenu.1 + sed "s/VERSION/$(VERSION)/g" < stest.1 > $(DESTDIR)$(MANPREFIX)/man1/stest.1 + chmod 644 $(DESTDIR)$(MANPREFIX)/man1/dmenu.1 + chmod 644 $(DESTDIR)$(MANPREFIX)/man1/stest.1 + +uninstall: + rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\ + $(DESTDIR)$(PREFIX)/bin/dmenu_path\ + $(DESTDIR)$(PREFIX)/bin/dmenu_run\ + $(DESTDIR)$(PREFIX)/bin/stest\ + $(DESTDIR)$(MANPREFIX)/man1/dmenu.1\ + $(DESTDIR)$(MANPREFIX)/man1/stest.1 + +.PHONY: all options clean dist install uninstall diff --git a/dmenu/dmenu-4.9/README b/dmenu/dmenu-4.9/README new file mode 100644 index 0000000..a8fcdfe --- /dev/null +++ b/dmenu/dmenu-4.9/README @@ -0,0 +1,24 @@ +dmenu - dynamic menu +==================== +dmenu is an efficient dynamic menu for X. + + +Requirements +------------ +In order to build dmenu you need the Xlib header files. + + +Installation +------------ +Edit config.mk to match your local setup (dmenu is installed into +the /usr/local namespace by default). + +Afterwards enter the following command to build and install dmenu +(if necessary as root): + + make clean install + + +Running dmenu +------------- +See the man page for details. diff --git a/dmenu/dmenu-4.9/arg.h b/dmenu/dmenu-4.9/arg.h new file mode 100644 index 0000000..e94e02b --- /dev/null +++ b/dmenu/dmenu-4.9/arg.h @@ -0,0 +1,49 @@ +/* + * Copy me if you can. + * by 20h + */ + +#ifndef ARG_H__ +#define ARG_H__ + +extern char *argv0; + +/* use main(int argc, char *argv[]) */ +#define ARGBEGIN for (argv0 = *argv, argv++, argc--;\ + argv[0] && argv[0][0] == '-'\ + && argv[0][1];\ + argc--, argv++) {\ + char argc_;\ + char **argv_;\ + int brk_;\ + if (argv[0][1] == '-' && argv[0][2] == '\0') {\ + argv++;\ + argc--;\ + break;\ + }\ + for (brk_ = 0, argv[0]++, argv_ = argv;\ + argv[0][0] && !brk_;\ + argv[0]++) {\ + if (argv_ != argv)\ + break;\ + argc_ = argv[0][0];\ + switch (argc_) + +#define ARGEND }\ + } + +#define ARGC() argc_ + +#define EARGF(x) ((argv[0][1] == '\0' && argv[1] == NULL)?\ + ((x), abort(), (char *)0) :\ + (brk_ = 1, (argv[0][1] != '\0')?\ + (&argv[0][1]) :\ + (argc--, argv++, argv[0]))) + +#define ARGF() ((argv[0][1] == '\0' && argv[1] == NULL)?\ + (char *)0 :\ + (brk_ = 1, (argv[0][1] != '\0')?\ + (&argv[0][1]) :\ + (argc--, argv++, argv[0]))) + +#endif diff --git a/dmenu/dmenu-4.9/config.def.h b/dmenu/dmenu-4.9/config.def.h new file mode 100644 index 0000000..51612b9 --- /dev/null +++ b/dmenu/dmenu-4.9/config.def.h @@ -0,0 +1,24 @@ +/* See LICENSE file for copyright and license details. */ +/* Default settings; can be overriden by command line. */ + +static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ +static int fuzzy = 1; /* -F option; if 0, dmenu doesn't use fuzzy matching */ +/* -fn option overrides fonts[0]; default X11 font or font set */ +static const char *fonts[] = { + "monospace:size=10" +}; +static const char *prompt = NULL; /* -p option; prompt to the left of input field */ +static const char *colors[SchemeLast][2] = { + /* fg bg */ + [SchemeNorm] = { "#bbbbbb", "#222222" }, + [SchemeSel] = { "#eeeeee", "#005577" }, + [SchemeOut] = { "#000000", "#00ffff" }, +}; +/* -l option; if nonzero, dmenu uses vertical list with given number of lines */ +static unsigned int lines = 0; + +/* + * Characters not considered part of a word while deleting words + * for example: " /?\"&[]" + */ +static const char worddelimiters[] = " "; diff --git a/dmenu/dmenu-4.9/config.h b/dmenu/dmenu-4.9/config.h new file mode 100644 index 0000000..51612b9 --- /dev/null +++ b/dmenu/dmenu-4.9/config.h @@ -0,0 +1,24 @@ +/* See LICENSE file for copyright and license details. */ +/* Default settings; can be overriden by command line. */ + +static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ +static int fuzzy = 1; /* -F option; if 0, dmenu doesn't use fuzzy matching */ +/* -fn option overrides fonts[0]; default X11 font or font set */ +static const char *fonts[] = { + "monospace:size=10" +}; +static const char *prompt = NULL; /* -p option; prompt to the left of input field */ +static const char *colors[SchemeLast][2] = { + /* fg bg */ + [SchemeNorm] = { "#bbbbbb", "#222222" }, + [SchemeSel] = { "#eeeeee", "#005577" }, + [SchemeOut] = { "#000000", "#00ffff" }, +}; +/* -l option; if nonzero, dmenu uses vertical list with given number of lines */ +static unsigned int lines = 0; + +/* + * Characters not considered part of a word while deleting words + * for example: " /?\"&[]" + */ +static const char worddelimiters[] = " "; diff --git a/dmenu/dmenu-4.9/config.mk b/dmenu/dmenu-4.9/config.mk new file mode 100644 index 0000000..d14309a --- /dev/null +++ b/dmenu/dmenu-4.9/config.mk @@ -0,0 +1,31 @@ +# dmenu version +VERSION = 4.9 + +# paths +PREFIX = /usr/local +MANPREFIX = $(PREFIX)/share/man + +X11INC = /usr/X11R6/include +X11LIB = /usr/X11R6/lib + +# Xinerama, comment if you don't want it +XINERAMALIBS = -lXinerama +XINERAMAFLAGS = -DXINERAMA + +# freetype +FREETYPELIBS = -lfontconfig -lXft +FREETYPEINC = /usr/include/freetype2 +# OpenBSD (uncomment) +#FREETYPEINC = $(X11INC)/freetype2 + +# includes and libs +INCS = -I$(X11INC) -I$(FREETYPEINC) +LIBS = -L$(X11LIB) -lX11 $(XINERAMALIBS) $(FREETYPELIBS) -lm + +# flags +CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XINERAMAFLAGS) +CFLAGS = -std=c99 -pedantic -Wall -Os $(INCS) $(CPPFLAGS) +LDFLAGS = $(LIBS) + +# compiler and linker +CC = cc diff --git a/dmenu/dmenu-4.9/dmenu b/dmenu/dmenu-4.9/dmenu new file mode 100755 index 0000000..57a06c5 Binary files /dev/null and b/dmenu/dmenu-4.9/dmenu differ diff --git a/dmenu/dmenu-4.9/dmenu-fuzzymatch-4.9.diff b/dmenu/dmenu-4.9/dmenu-fuzzymatch-4.9.diff new file mode 100644 index 0000000..9fd206d --- /dev/null +++ b/dmenu/dmenu-4.9/dmenu-fuzzymatch-4.9.diff @@ -0,0 +1,163 @@ +From 94353eb52055927d9079f3d9e33da1c954abf386 Mon Sep 17 00:00:00 2001 +From: aleks +Date: Wed, 26 Jun 2019 13:25:10 +0200 +Subject: [PATCH] Add support for fuzzy-matching + +--- + config.def.h | 1 + + config.mk | 2 +- + dmenu.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 91 insertions(+), 1 deletion(-) + +diff --git a/config.def.h b/config.def.h +index 1edb647..51612b9 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -2,6 +2,7 @@ + /* Default settings; can be overriden by command line. */ + + static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ ++static int fuzzy = 1; /* -F option; if 0, dmenu doesn't use fuzzy matching */ + /* -fn option overrides fonts[0]; default X11 font or font set */ + static const char *fonts[] = { + "monospace:size=10" +diff --git a/config.mk b/config.mk +index 0929b4a..d14309a 100644 +--- a/config.mk ++++ b/config.mk +@@ -20,7 +20,7 @@ FREETYPEINC = /usr/include/freetype2 + + # includes and libs + INCS = -I$(X11INC) -I$(FREETYPEINC) +-LIBS = -L$(X11LIB) -lX11 $(XINERAMALIBS) $(FREETYPELIBS) ++LIBS = -L$(X11LIB) -lX11 $(XINERAMALIBS) $(FREETYPELIBS) -lm + + # flags + CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XINERAMAFLAGS) +diff --git a/dmenu.c b/dmenu.c +index 6b8f51b..96ddc98 100644 +--- a/dmenu.c ++++ b/dmenu.c +@@ -1,6 +1,7 @@ + /* See LICENSE file for copyright and license details. */ + #include + #include ++#include + #include + #include + #include +@@ -32,6 +33,7 @@ struct item { + char *text; + struct item *left, *right; + int out; ++ double distance; + }; + + static char text[BUFSIZ] = ""; +@@ -210,9 +212,94 @@ grabkeyboard(void) + die("cannot grab keyboard"); + } + ++int ++compare_distance(const void *a, const void *b) ++{ ++ struct item *da = *(struct item **) a; ++ struct item *db = *(struct item **) b; ++ ++ if (!db) ++ return 1; ++ if (!da) ++ return -1; ++ ++ return da->distance == db->distance ? 0 : da->distance < db->distance ? -1 : 1; ++} ++ ++void ++fuzzymatch(void) ++{ ++ /* bang - we have so much memory */ ++ struct item *it; ++ struct item **fuzzymatches = NULL; ++ char c; ++ int number_of_matches = 0, i, pidx, sidx, eidx; ++ int text_len = strlen(text), itext_len; ++ ++ matches = matchend = NULL; ++ ++ /* walk through all items */ ++ for (it = items; it && it->text; it++) { ++ if (text_len) { ++ itext_len = strlen(it->text); ++ pidx = 0; /* pointer */ ++ sidx = eidx = -1; /* start of match, end of match */ ++ /* walk through item text */ ++ for (i = 0; i < itext_len && (c = it->text[i]); i++) { ++ /* fuzzy match pattern */ ++ if (!fstrncmp(&text[pidx], &c, 1)) { ++ if(sidx == -1) ++ sidx = i; ++ pidx++; ++ if (pidx == text_len) { ++ eidx = i; ++ break; ++ } ++ } ++ } ++ /* build list of matches */ ++ if (eidx != -1) { ++ /* compute distance */ ++ /* add penalty if match starts late (log(sidx+2)) ++ * add penalty for long a match without many matching characters */ ++ it->distance = log(sidx + 2) + (double)(eidx - sidx - text_len); ++ /* fprintf(stderr, "distance %s %f\n", it->text, it->distance); */ ++ appenditem(it, &matches, &matchend); ++ number_of_matches++; ++ } ++ } else { ++ appenditem(it, &matches, &matchend); ++ } ++ } ++ ++ if (number_of_matches) { ++ /* initialize array with matches */ ++ if (!(fuzzymatches = realloc(fuzzymatches, number_of_matches * sizeof(struct item*)))) ++ die("cannot realloc %u bytes:", number_of_matches * sizeof(struct item*)); ++ for (i = 0, it = matches; it && i < number_of_matches; i++, it = it->right) { ++ fuzzymatches[i] = it; ++ } ++ /* sort matches according to distance */ ++ qsort(fuzzymatches, number_of_matches, sizeof(struct item*), compare_distance); ++ /* rebuild list of matches */ ++ matches = matchend = NULL; ++ for (i = 0, it = fuzzymatches[i]; i < number_of_matches && it && \ ++ it->text; i++, it = fuzzymatches[i]) { ++ appenditem(it, &matches, &matchend); ++ } ++ free(fuzzymatches); ++ } ++ curr = sel = matches; ++ calcoffsets(); ++} ++ + static void + match(void) + { ++ if (fuzzy) { ++ fuzzymatch(); ++ return; ++ } + static char **tokv = NULL; + static int tokn = 0; + +@@ -702,6 +789,8 @@ main(int argc, char *argv[]) + topbar = 0; + else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */ + fast = 1; ++ else if (!strcmp(argv[i], "-F")) /* grabs keyboard before reading stdin */ ++ fuzzy = 0; + else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ + fstrncmp = strncasecmp; + fstrstr = cistrstr; +-- +2.22.0 + diff --git a/dmenu/dmenu-4.9/dmenu.1 b/dmenu/dmenu-4.9/dmenu.1 new file mode 100644 index 0000000..323f93c --- /dev/null +++ b/dmenu/dmenu-4.9/dmenu.1 @@ -0,0 +1,194 @@ +.TH DMENU 1 dmenu\-VERSION +.SH NAME +dmenu \- dynamic menu +.SH SYNOPSIS +.B dmenu +.RB [ \-bfiv ] +.RB [ \-l +.IR lines ] +.RB [ \-m +.IR monitor ] +.RB [ \-p +.IR prompt ] +.RB [ \-fn +.IR font ] +.RB [ \-nb +.IR color ] +.RB [ \-nf +.IR color ] +.RB [ \-sb +.IR color ] +.RB [ \-sf +.IR color ] +.RB [ \-w +.IR windowid ] +.P +.BR dmenu_run " ..." +.SH DESCRIPTION +.B dmenu +is a dynamic menu for X, which reads a list of newline\-separated items from +stdin. When the user selects an item and presses Return, their choice is printed +to stdout and dmenu terminates. Entering text will narrow the items to those +matching the tokens in the input. +.P +.B dmenu_run +is a script used by +.IR dwm (1) +which lists programs in the user's $PATH and runs the result in their $SHELL. +.SH OPTIONS +.TP +.B \-b +dmenu appears at the bottom of the screen. +.TP +.B \-f +dmenu grabs the keyboard before reading stdin if not reading from a tty. This +is faster, but will lock up X until stdin reaches end\-of\-file. +.TP +.B \-i +dmenu matches menu items case insensitively. +.TP +.BI \-l " lines" +dmenu lists items vertically, with the given number of lines. +.TP +.BI \-m " monitor" +dmenu is displayed on the monitor number supplied. Monitor numbers are starting +from 0. +.TP +.BI \-p " prompt" +defines the prompt to be displayed to the left of the input field. +.TP +.BI \-fn " font" +defines the font or font set used. +.TP +.BI \-nb " color" +defines the normal background color. +.IR #RGB , +.IR #RRGGBB , +and X color names are supported. +.TP +.BI \-nf " color" +defines the normal foreground color. +.TP +.BI \-sb " color" +defines the selected background color. +.TP +.BI \-sf " color" +defines the selected foreground color. +.TP +.B \-v +prints version information to stdout, then exits. +.TP +.BI \-w " windowid" +embed into windowid. +.SH USAGE +dmenu is completely controlled by the keyboard. Items are selected using the +arrow keys, page up, page down, home, and end. +.TP +.B Tab +Copy the selected item to the input field. +.TP +.B Return +Confirm selection. Prints the selected item to stdout and exits, returning +success. +.TP +.B Ctrl-Return +Confirm selection. Prints the selected item to stdout and continues. +.TP +.B Shift\-Return +Confirm input. Prints the input text to stdout and exits, returning success. +.TP +.B Escape +Exit without selecting an item, returning failure. +.TP +.B Ctrl-Left +Move cursor to the start of the current word +.TP +.B Ctrl-Right +Move cursor to the end of the current word +.TP +.B C\-a +Home +.TP +.B C\-b +Left +.TP +.B C\-c +Escape +.TP +.B C\-d +Delete +.TP +.B C\-e +End +.TP +.B C\-f +Right +.TP +.B C\-g +Escape +.TP +.B C\-h +Backspace +.TP +.B C\-i +Tab +.TP +.B C\-j +Return +.TP +.B C\-J +Shift-Return +.TP +.B C\-k +Delete line right +.TP +.B C\-m +Return +.TP +.B C\-M +Shift-Return +.TP +.B C\-n +Down +.TP +.B C\-p +Up +.TP +.B C\-u +Delete line left +.TP +.B C\-w +Delete word left +.TP +.B C\-y +Paste from primary X selection +.TP +.B C\-Y +Paste from X clipboard +.TP +.B M\-b +Move cursor to the start of the current word +.TP +.B M\-f +Move cursor to the end of the current word +.TP +.B M\-g +Home +.TP +.B M\-G +End +.TP +.B M\-h +Up +.TP +.B M\-j +Page down +.TP +.B M\-k +Page up +.TP +.B M\-l +Down +.SH SEE ALSO +.IR dwm (1), +.IR stest (1) diff --git a/dmenu/dmenu-4.9/dmenu.c b/dmenu/dmenu-4.9/dmenu.c new file mode 100644 index 0000000..96ddc98 --- /dev/null +++ b/dmenu/dmenu-4.9/dmenu.c @@ -0,0 +1,855 @@ +/* See LICENSE file for copyright and license details. */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#ifdef XINERAMA +#include +#endif +#include + +#include "drw.h" +#include "util.h" + +/* macros */ +#define INTERSECT(x,y,w,h,r) (MAX(0, MIN((x)+(w),(r).x_org+(r).width) - MAX((x),(r).x_org)) \ + * MAX(0, MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org))) +#define LENGTH(X) (sizeof X / sizeof X[0]) +#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) + +/* enums */ +enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */ + +struct item { + char *text; + struct item *left, *right; + int out; + double distance; +}; + +static char text[BUFSIZ] = ""; +static char *embed; +static int bh, mw, mh; +static int inputw = 0, promptw; +static int lrpad; /* sum of left and right padding */ +static size_t cursor; +static struct item *items = NULL; +static struct item *matches, *matchend; +static struct item *prev, *curr, *next, *sel; +static int mon = -1, screen; + +static Atom clip, utf8; +static Display *dpy; +static Window root, parentwin, win; +static XIC xic; + +static Drw *drw; +static Clr *scheme[SchemeLast]; + +#include "config.h" + +static int (*fstrncmp)(const char *, const char *, size_t) = strncmp; +static char *(*fstrstr)(const char *, const char *) = strstr; + +static void +appenditem(struct item *item, struct item **list, struct item **last) +{ + if (*last) + (*last)->right = item; + else + *list = item; + + item->left = *last; + item->right = NULL; + *last = item; +} + +static void +calcoffsets(void) +{ + int i, n; + + if (lines > 0) + n = lines * bh; + else + n = mw - (promptw + inputw + TEXTW("<") + TEXTW(">")); + /* calculate which items will begin the next page and previous page */ + for (i = 0, next = curr; next; next = next->right) + if ((i += (lines > 0) ? bh : MIN(TEXTW(next->text), n)) > n) + break; + for (i = 0, prev = curr; prev && prev->left; prev = prev->left) + if ((i += (lines > 0) ? bh : MIN(TEXTW(prev->left->text), n)) > n) + break; +} + +static void +cleanup(void) +{ + size_t i; + + XUngrabKey(dpy, AnyKey, AnyModifier, root); + for (i = 0; i < SchemeLast; i++) + free(scheme[i]); + drw_free(drw); + XSync(dpy, False); + XCloseDisplay(dpy); +} + +static char * +cistrstr(const char *s, const char *sub) +{ + size_t len; + + for (len = strlen(sub); *s; s++) + if (!strncasecmp(s, sub, len)) + return (char *)s; + return NULL; +} + +static int +drawitem(struct item *item, int x, int y, int w) +{ + if (item == sel) + drw_setscheme(drw, scheme[SchemeSel]); + else if (item->out) + drw_setscheme(drw, scheme[SchemeOut]); + else + drw_setscheme(drw, scheme[SchemeNorm]); + + return drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0); +} + +static void +drawmenu(void) +{ + unsigned int curpos; + struct item *item; + int x = 0, y = 0, w; + + drw_setscheme(drw, scheme[SchemeNorm]); + drw_rect(drw, 0, 0, mw, mh, 1, 1); + + if (prompt && *prompt) { + drw_setscheme(drw, scheme[SchemeSel]); + x = drw_text(drw, x, 0, promptw, bh, lrpad / 2, prompt, 0); + } + /* draw input field */ + w = (lines > 0 || !matches) ? mw - x : inputw; + drw_setscheme(drw, scheme[SchemeNorm]); + drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0); + + curpos = TEXTW(text) - TEXTW(&text[cursor]); + if ((curpos += lrpad / 2 - 1) < w) { + drw_setscheme(drw, scheme[SchemeNorm]); + drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0); + } + + if (lines > 0) { + /* draw vertical list */ + for (item = curr; item != next; item = item->right) + drawitem(item, x, y += bh, mw - x); + } else if (matches) { + /* draw horizontal list */ + x += inputw; + w = TEXTW("<"); + if (curr->left) { + drw_setscheme(drw, scheme[SchemeNorm]); + drw_text(drw, x, 0, w, bh, lrpad / 2, "<", 0); + } + x += w; + for (item = curr; item != next; item = item->right) + x = drawitem(item, x, 0, MIN(TEXTW(item->text), mw - x - TEXTW(">"))); + if (next) { + w = TEXTW(">"); + drw_setscheme(drw, scheme[SchemeNorm]); + drw_text(drw, mw - w, 0, w, bh, lrpad / 2, ">", 0); + } + } + drw_map(drw, win, 0, 0, mw, mh); +} + +static void +grabfocus(void) +{ + struct timespec ts = { .tv_sec = 0, .tv_nsec = 10000000 }; + Window focuswin; + int i, revertwin; + + for (i = 0; i < 100; ++i) { + XGetInputFocus(dpy, &focuswin, &revertwin); + if (focuswin == win) + return; + XSetInputFocus(dpy, win, RevertToParent, CurrentTime); + nanosleep(&ts, NULL); + } + die("cannot grab focus"); +} + +static void +grabkeyboard(void) +{ + struct timespec ts = { .tv_sec = 0, .tv_nsec = 1000000 }; + int i; + + if (embed) + return; + /* try to grab keyboard, we may have to wait for another process to ungrab */ + for (i = 0; i < 1000; i++) { + if (XGrabKeyboard(dpy, DefaultRootWindow(dpy), True, GrabModeAsync, + GrabModeAsync, CurrentTime) == GrabSuccess) + return; + nanosleep(&ts, NULL); + } + die("cannot grab keyboard"); +} + +int +compare_distance(const void *a, const void *b) +{ + struct item *da = *(struct item **) a; + struct item *db = *(struct item **) b; + + if (!db) + return 1; + if (!da) + return -1; + + return da->distance == db->distance ? 0 : da->distance < db->distance ? -1 : 1; +} + +void +fuzzymatch(void) +{ + /* bang - we have so much memory */ + struct item *it; + struct item **fuzzymatches = NULL; + char c; + int number_of_matches = 0, i, pidx, sidx, eidx; + int text_len = strlen(text), itext_len; + + matches = matchend = NULL; + + /* walk through all items */ + for (it = items; it && it->text; it++) { + if (text_len) { + itext_len = strlen(it->text); + pidx = 0; /* pointer */ + sidx = eidx = -1; /* start of match, end of match */ + /* walk through item text */ + for (i = 0; i < itext_len && (c = it->text[i]); i++) { + /* fuzzy match pattern */ + if (!fstrncmp(&text[pidx], &c, 1)) { + if(sidx == -1) + sidx = i; + pidx++; + if (pidx == text_len) { + eidx = i; + break; + } + } + } + /* build list of matches */ + if (eidx != -1) { + /* compute distance */ + /* add penalty if match starts late (log(sidx+2)) + * add penalty for long a match without many matching characters */ + it->distance = log(sidx + 2) + (double)(eidx - sidx - text_len); + /* fprintf(stderr, "distance %s %f\n", it->text, it->distance); */ + appenditem(it, &matches, &matchend); + number_of_matches++; + } + } else { + appenditem(it, &matches, &matchend); + } + } + + if (number_of_matches) { + /* initialize array with matches */ + if (!(fuzzymatches = realloc(fuzzymatches, number_of_matches * sizeof(struct item*)))) + die("cannot realloc %u bytes:", number_of_matches * sizeof(struct item*)); + for (i = 0, it = matches; it && i < number_of_matches; i++, it = it->right) { + fuzzymatches[i] = it; + } + /* sort matches according to distance */ + qsort(fuzzymatches, number_of_matches, sizeof(struct item*), compare_distance); + /* rebuild list of matches */ + matches = matchend = NULL; + for (i = 0, it = fuzzymatches[i]; i < number_of_matches && it && \ + it->text; i++, it = fuzzymatches[i]) { + appenditem(it, &matches, &matchend); + } + free(fuzzymatches); + } + curr = sel = matches; + calcoffsets(); +} + +static void +match(void) +{ + if (fuzzy) { + fuzzymatch(); + return; + } + static char **tokv = NULL; + static int tokn = 0; + + char buf[sizeof text], *s; + int i, tokc = 0; + size_t len, textsize; + struct item *item, *lprefix, *lsubstr, *prefixend, *substrend; + + strcpy(buf, text); + /* separate input text into tokens to be matched individually */ + for (s = strtok(buf, " "); s; tokv[tokc - 1] = s, s = strtok(NULL, " ")) + if (++tokc > tokn && !(tokv = realloc(tokv, ++tokn * sizeof *tokv))) + die("cannot realloc %u bytes:", tokn * sizeof *tokv); + len = tokc ? strlen(tokv[0]) : 0; + + matches = lprefix = lsubstr = matchend = prefixend = substrend = NULL; + textsize = strlen(text) + 1; + for (item = items; item && item->text; item++) { + for (i = 0; i < tokc; i++) + if (!fstrstr(item->text, tokv[i])) + break; + if (i != tokc) /* not all tokens match */ + continue; + /* exact matches go first, then prefixes, then substrings */ + if (!tokc || !fstrncmp(text, item->text, textsize)) + appenditem(item, &matches, &matchend); + else if (!fstrncmp(tokv[0], item->text, len)) + appenditem(item, &lprefix, &prefixend); + else + appenditem(item, &lsubstr, &substrend); + } + if (lprefix) { + if (matches) { + matchend->right = lprefix; + lprefix->left = matchend; + } else + matches = lprefix; + matchend = prefixend; + } + if (lsubstr) { + if (matches) { + matchend->right = lsubstr; + lsubstr->left = matchend; + } else + matches = lsubstr; + matchend = substrend; + } + curr = sel = matches; + calcoffsets(); +} + +static void +insert(const char *str, ssize_t n) +{ + if (strlen(text) + n > sizeof text - 1) + return; + /* move existing text out of the way, insert new text, and update cursor */ + memmove(&text[cursor + n], &text[cursor], sizeof text - cursor - MAX(n, 0)); + if (n > 0) + memcpy(&text[cursor], str, n); + cursor += n; + match(); +} + +static size_t +nextrune(int inc) +{ + ssize_t n; + + /* return location of next utf8 rune in the given direction (+1 or -1) */ + for (n = cursor + inc; n + inc >= 0 && (text[n] & 0xc0) == 0x80; n += inc) + ; + return n; +} + +static void +movewordedge(int dir) +{ + if (dir < 0) { /* move cursor to the start of the word*/ + while (cursor > 0 && strchr(worddelimiters, text[nextrune(-1)])) + cursor = nextrune(-1); + while (cursor > 0 && !strchr(worddelimiters, text[nextrune(-1)])) + cursor = nextrune(-1); + } else { /* move cursor to the end of the word */ + while (text[cursor] && strchr(worddelimiters, text[cursor])) + cursor = nextrune(+1); + while (text[cursor] && !strchr(worddelimiters, text[cursor])) + cursor = nextrune(+1); + } +} + +static void +keypress(XKeyEvent *ev) +{ + char buf[32]; + int len; + KeySym ksym; + Status status; + + len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status); + switch (status) { + default: /* XLookupNone, XBufferOverflow */ + return; + case XLookupChars: + goto insert; + case XLookupKeySym: + case XLookupBoth: + break; + } + + if (ev->state & ControlMask) { + switch(ksym) { + case XK_a: ksym = XK_Home; break; + case XK_b: ksym = XK_Left; break; + case XK_c: ksym = XK_Escape; break; + case XK_d: ksym = XK_Delete; break; + case XK_e: ksym = XK_End; break; + case XK_f: ksym = XK_Right; break; + case XK_g: ksym = XK_Escape; break; + case XK_h: ksym = XK_BackSpace; break; + case XK_i: ksym = XK_Tab; break; + case XK_j: /* fallthrough */ + case XK_J: /* fallthrough */ + case XK_m: /* fallthrough */ + case XK_M: ksym = XK_Return; ev->state &= ~ControlMask; break; + case XK_n: ksym = XK_Down; break; + case XK_p: ksym = XK_Up; break; + + case XK_k: /* delete right */ + text[cursor] = '\0'; + match(); + break; + case XK_u: /* delete left */ + insert(NULL, 0 - cursor); + break; + case XK_w: /* delete word */ + while (cursor > 0 && strchr(worddelimiters, text[nextrune(-1)])) + insert(NULL, nextrune(-1) - cursor); + while (cursor > 0 && !strchr(worddelimiters, text[nextrune(-1)])) + insert(NULL, nextrune(-1) - cursor); + break; + case XK_y: /* paste selection */ + case XK_Y: + XConvertSelection(dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY, + utf8, utf8, win, CurrentTime); + return; + case XK_Left: + movewordedge(-1); + goto draw; + case XK_Right: + movewordedge(+1); + goto draw; + case XK_Return: + case XK_KP_Enter: + break; + case XK_bracketleft: + cleanup(); + exit(1); + default: + return; + } + } else if (ev->state & Mod1Mask) { + switch(ksym) { + case XK_b: + movewordedge(-1); + goto draw; + case XK_f: + movewordedge(+1); + goto draw; + case XK_g: ksym = XK_Home; break; + case XK_G: ksym = XK_End; break; + case XK_h: ksym = XK_Up; break; + case XK_j: ksym = XK_Next; break; + case XK_k: ksym = XK_Prior; break; + case XK_l: ksym = XK_Down; break; + default: + return; + } + } + + switch(ksym) { + default: +insert: + if (!iscntrl(*buf)) + insert(buf, len); + break; + case XK_Delete: + if (text[cursor] == '\0') + return; + cursor = nextrune(+1); + /* fallthrough */ + case XK_BackSpace: + if (cursor == 0) + return; + insert(NULL, nextrune(-1) - cursor); + break; + case XK_End: + if (text[cursor] != '\0') { + cursor = strlen(text); + break; + } + if (next) { + /* jump to end of list and position items in reverse */ + curr = matchend; + calcoffsets(); + curr = prev; + calcoffsets(); + while (next && (curr = curr->right)) + calcoffsets(); + } + sel = matchend; + break; + case XK_Escape: + cleanup(); + exit(1); + case XK_Home: + if (sel == matches) { + cursor = 0; + break; + } + sel = curr = matches; + calcoffsets(); + break; + case XK_Left: + if (cursor > 0 && (!sel || !sel->left || lines > 0)) { + cursor = nextrune(-1); + break; + } + if (lines > 0) + return; + /* fallthrough */ + case XK_Up: + if (sel && sel->left && (sel = sel->left)->right == curr) { + curr = prev; + calcoffsets(); + } + break; + case XK_Next: + if (!next) + return; + sel = curr = next; + calcoffsets(); + break; + case XK_Prior: + if (!prev) + return; + sel = curr = prev; + calcoffsets(); + break; + case XK_Return: + case XK_KP_Enter: + puts((sel && !(ev->state & ShiftMask)) ? sel->text : text); + if (!(ev->state & ControlMask)) { + cleanup(); + exit(0); + } + if (sel) + sel->out = 1; + break; + case XK_Right: + if (text[cursor] != '\0') { + cursor = nextrune(+1); + break; + } + if (lines > 0) + return; + /* fallthrough */ + case XK_Down: + if (sel && sel->right && (sel = sel->right) == next) { + curr = next; + calcoffsets(); + } + break; + case XK_Tab: + if (!sel) + return; + strncpy(text, sel->text, sizeof text - 1); + text[sizeof text - 1] = '\0'; + cursor = strlen(text); + match(); + break; + } + +draw: + drawmenu(); +} + +static void +paste(void) +{ + char *p, *q; + int di; + unsigned long dl; + Atom da; + + /* we have been given the current selection, now insert it into input */ + if (XGetWindowProperty(dpy, win, utf8, 0, (sizeof text / 4) + 1, False, + utf8, &da, &di, &dl, &dl, (unsigned char **)&p) + == Success && p) { + insert(p, (q = strchr(p, '\n')) ? q - p : (ssize_t)strlen(p)); + XFree(p); + } + drawmenu(); +} + +static void +readstdin(void) +{ + char buf[sizeof text], *p; + size_t i, imax = 0, size = 0; + unsigned int tmpmax = 0; + + /* read each line from stdin and add it to the item list */ + for (i = 0; fgets(buf, sizeof buf, stdin); i++) { + if (i + 1 >= size / sizeof *items) + if (!(items = realloc(items, (size += BUFSIZ)))) + die("cannot realloc %u bytes:", size); + if ((p = strchr(buf, '\n'))) + *p = '\0'; + if (!(items[i].text = strdup(buf))) + die("cannot strdup %u bytes:", strlen(buf) + 1); + items[i].out = 0; + drw_font_getexts(drw->fonts, buf, strlen(buf), &tmpmax, NULL); + if (tmpmax > inputw) { + inputw = tmpmax; + imax = i; + } + } + if (items) + items[i].text = NULL; + inputw = items ? TEXTW(items[imax].text) : 0; + lines = MIN(lines, i); +} + +static void +run(void) +{ + XEvent ev; + + while (!XNextEvent(dpy, &ev)) { + if (XFilterEvent(&ev, None)) + continue; + switch(ev.type) { + case Expose: + if (ev.xexpose.count == 0) + drw_map(drw, win, 0, 0, mw, mh); + break; + case FocusIn: + /* regrab focus from parent window */ + if (ev.xfocus.window != win) + grabfocus(); + break; + case KeyPress: + keypress(&ev.xkey); + break; + case SelectionNotify: + if (ev.xselection.property == utf8) + paste(); + break; + case VisibilityNotify: + if (ev.xvisibility.state != VisibilityUnobscured) + XRaiseWindow(dpy, win); + break; + } + } +} + +static void +setup(void) +{ + int x, y, i, j; + unsigned int du; + XSetWindowAttributes swa; + XIM xim; + Window w, dw, *dws; + XWindowAttributes wa; + XClassHint ch = {"dmenu", "dmenu"}; +#ifdef XINERAMA + XineramaScreenInfo *info; + Window pw; + int a, di, n, area = 0; +#endif + /* init appearance */ + for (j = 0; j < SchemeLast; j++) + scheme[j] = drw_scm_create(drw, colors[j], 2); + + clip = XInternAtom(dpy, "CLIPBOARD", False); + utf8 = XInternAtom(dpy, "UTF8_STRING", False); + + /* calculate menu geometry */ + bh = drw->fonts->h + 2; + lines = MAX(lines, 0); + mh = (lines + 1) * bh; +#ifdef XINERAMA + i = 0; + if (parentwin == root && (info = XineramaQueryScreens(dpy, &n))) { + XGetInputFocus(dpy, &w, &di); + if (mon >= 0 && mon < n) + i = mon; + else if (w != root && w != PointerRoot && w != None) { + /* find top-level window containing current input focus */ + do { + if (XQueryTree(dpy, (pw = w), &dw, &w, &dws, &du) && dws) + XFree(dws); + } while (w != root && w != pw); + /* find xinerama screen with which the window intersects most */ + if (XGetWindowAttributes(dpy, pw, &wa)) + for (j = 0; j < n; j++) + if ((a = INTERSECT(wa.x, wa.y, wa.width, wa.height, info[j])) > area) { + area = a; + i = j; + } + } + /* no focused window is on screen, so use pointer location instead */ + if (mon < 0 && !area && XQueryPointer(dpy, root, &dw, &dw, &x, &y, &di, &di, &du)) + for (i = 0; i < n; i++) + if (INTERSECT(x, y, 1, 1, info[i])) + break; + + x = info[i].x_org; + y = info[i].y_org + (topbar ? 0 : info[i].height - mh); + mw = info[i].width; + XFree(info); + } else +#endif + { + if (!XGetWindowAttributes(dpy, parentwin, &wa)) + die("could not get embedding window attributes: 0x%lx", + parentwin); + x = 0; + y = topbar ? 0 : wa.height - mh; + mw = wa.width; + } + promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; + inputw = MIN(inputw, mw/3); + match(); + + /* create menu window */ + swa.override_redirect = True; + swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; + swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; + win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0, + CopyFromParent, CopyFromParent, CopyFromParent, + CWOverrideRedirect | CWBackPixel | CWEventMask, &swa); + XSetClassHint(dpy, win, &ch); + + /* open input methods */ + xim = XOpenIM(dpy, NULL, NULL, NULL); + xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, + XNClientWindow, win, XNFocusWindow, win, NULL); + + XMapRaised(dpy, win); + XSetInputFocus(dpy, win, RevertToParent, CurrentTime); + if (embed) { + XSelectInput(dpy, parentwin, FocusChangeMask); + if (XQueryTree(dpy, parentwin, &dw, &w, &dws, &du) && dws) { + for (i = 0; i < du && dws[i] != win; ++i) + XSelectInput(dpy, dws[i], FocusChangeMask); + XFree(dws); + } + grabfocus(); + } + drw_resize(drw, mw, mh); + drawmenu(); +} + +static void +usage(void) +{ + fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n" + " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr); + exit(1); +} + +int +main(int argc, char *argv[]) +{ + XWindowAttributes wa; + int i, fast = 0; + + for (i = 1; i < argc; i++) + /* these options take no arguments */ + if (!strcmp(argv[i], "-v")) { /* prints version information */ + puts("dmenu-"VERSION); + exit(0); + } else if (!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */ + topbar = 0; + else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */ + fast = 1; + else if (!strcmp(argv[i], "-F")) /* grabs keyboard before reading stdin */ + fuzzy = 0; + else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ + fstrncmp = strncasecmp; + fstrstr = cistrstr; + } else if (i + 1 == argc) + usage(); + /* these options take one argument */ + else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */ + lines = atoi(argv[++i]); + else if (!strcmp(argv[i], "-m")) + mon = atoi(argv[++i]); + else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */ + prompt = argv[++i]; + else if (!strcmp(argv[i], "-fn")) /* font or font set */ + fonts[0] = argv[++i]; + else if (!strcmp(argv[i], "-nb")) /* normal background color */ + colors[SchemeNorm][ColBg] = argv[++i]; + else if (!strcmp(argv[i], "-nf")) /* normal foreground color */ + colors[SchemeNorm][ColFg] = argv[++i]; + else if (!strcmp(argv[i], "-sb")) /* selected background color */ + colors[SchemeSel][ColBg] = argv[++i]; + else if (!strcmp(argv[i], "-sf")) /* selected foreground color */ + colors[SchemeSel][ColFg] = argv[++i]; + else if (!strcmp(argv[i], "-w")) /* embedding window id */ + embed = argv[++i]; + else + usage(); + + if (!setlocale(LC_CTYPE, "") || !XSupportsLocale()) + fputs("warning: no locale support\n", stderr); + if (!XSetLocaleModifiers("")) + fputs("warning: no locale modifiers support\n", stderr); + if (!(dpy = XOpenDisplay(NULL))) + die("cannot open display"); + screen = DefaultScreen(dpy); + root = RootWindow(dpy, screen); + if (!embed || !(parentwin = strtol(embed, NULL, 0))) + parentwin = root; + if (!XGetWindowAttributes(dpy, parentwin, &wa)) + die("could not get embedding window attributes: 0x%lx", + parentwin); + drw = drw_create(dpy, screen, root, wa.width, wa.height); + if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) + die("no fonts could be loaded."); + lrpad = drw->fonts->h; + +#ifdef __OpenBSD__ + if (pledge("stdio rpath", NULL) == -1) + die("pledge"); +#endif + + if (fast && !isatty(0)) { + grabkeyboard(); + readstdin(); + } else { + readstdin(); + grabkeyboard(); + } + setup(); + run(); + + return 1; /* unreachable */ +} diff --git a/dmenu/dmenu-4.9/dmenu.o b/dmenu/dmenu-4.9/dmenu.o new file mode 100644 index 0000000..3801e39 Binary files /dev/null and b/dmenu/dmenu-4.9/dmenu.o differ diff --git a/dmenu/dmenu-4.9/dmenu_path b/dmenu/dmenu-4.9/dmenu_path new file mode 100644 index 0000000..3a7cda7 --- /dev/null +++ b/dmenu/dmenu-4.9/dmenu_path @@ -0,0 +1,13 @@ +#!/bin/sh + +cachedir="${XDG_CACHE_HOME:-"$HOME/.cache"}" +cache="$cachedir/dmenu_run" + +[ ! -e "$cachedir" ] && mkdir -p "$cachedir" + +IFS=: +if stest -dqr -n "$cache" $PATH; then + stest -flx $PATH | sort -u | tee "$cache" +else + cat "$cache" +fi diff --git a/dmenu/dmenu-4.9/dmenu_run b/dmenu/dmenu-4.9/dmenu_run new file mode 100755 index 0000000..834ede5 --- /dev/null +++ b/dmenu/dmenu-4.9/dmenu_run @@ -0,0 +1,2 @@ +#!/bin/sh +dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} & diff --git a/dmenu/dmenu-4.9/drw.c b/dmenu/dmenu-4.9/drw.c new file mode 100644 index 0000000..8fd1ca4 --- /dev/null +++ b/dmenu/dmenu-4.9/drw.c @@ -0,0 +1,435 @@ +/* See LICENSE file for copyright and license details. */ +#include +#include +#include +#include +#include + +#include "drw.h" +#include "util.h" + +#define UTF_INVALID 0xFFFD +#define UTF_SIZ 4 + +static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; +static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; +static const long utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000}; +static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF}; + +static long +utf8decodebyte(const char c, size_t *i) +{ + for (*i = 0; *i < (UTF_SIZ + 1); ++(*i)) + if (((unsigned char)c & utfmask[*i]) == utfbyte[*i]) + return (unsigned char)c & ~utfmask[*i]; + return 0; +} + +static size_t +utf8validate(long *u, size_t i) +{ + if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF)) + *u = UTF_INVALID; + for (i = 1; *u > utfmax[i]; ++i) + ; + return i; +} + +static size_t +utf8decode(const char *c, long *u, size_t clen) +{ + size_t i, j, len, type; + long udecoded; + + *u = UTF_INVALID; + if (!clen) + return 0; + udecoded = utf8decodebyte(c[0], &len); + if (!BETWEEN(len, 1, UTF_SIZ)) + return 1; + for (i = 1, j = 1; i < clen && j < len; ++i, ++j) { + udecoded = (udecoded << 6) | utf8decodebyte(c[i], &type); + if (type) + return j; + } + if (j < len) + return 0; + *u = udecoded; + utf8validate(u, len); + + return len; +} + +Drw * +drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h) +{ + Drw *drw = ecalloc(1, sizeof(Drw)); + + drw->dpy = dpy; + drw->screen = screen; + drw->root = root; + drw->w = w; + drw->h = h; + drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen)); + drw->gc = XCreateGC(dpy, root, 0, NULL); + XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter); + + return drw; +} + +void +drw_resize(Drw *drw, unsigned int w, unsigned int h) +{ + if (!drw) + return; + + drw->w = w; + drw->h = h; + if (drw->drawable) + XFreePixmap(drw->dpy, drw->drawable); + drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen)); +} + +void +drw_free(Drw *drw) +{ + XFreePixmap(drw->dpy, drw->drawable); + XFreeGC(drw->dpy, drw->gc); + free(drw); +} + +/* This function is an implementation detail. Library users should use + * drw_fontset_create instead. + */ +static Fnt * +xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern) +{ + Fnt *font; + XftFont *xfont = NULL; + FcPattern *pattern = NULL; + + if (fontname) { + /* Using the pattern found at font->xfont->pattern does not yield the + * same substitution results as using the pattern returned by + * FcNameParse; using the latter results in the desired fallback + * behaviour whereas the former just results in missing-character + * rectangles being drawn, at least with some fonts. */ + if (!(xfont = XftFontOpenName(drw->dpy, drw->screen, fontname))) { + fprintf(stderr, "error, cannot load font from name: '%s'\n", fontname); + return NULL; + } + if (!(pattern = FcNameParse((FcChar8 *) fontname))) { + fprintf(stderr, "error, cannot parse font name to pattern: '%s'\n", fontname); + XftFontClose(drw->dpy, xfont); + return NULL; + } + } else if (fontpattern) { + if (!(xfont = XftFontOpenPattern(drw->dpy, fontpattern))) { + fprintf(stderr, "error, cannot load font from pattern.\n"); + return NULL; + } + } else { + die("no font specified."); + } + + /* Do not allow using color fonts. This is a workaround for a BadLength + * error from Xft with color glyphs. Modelled on the Xterm workaround. See + * https://bugzilla.redhat.com/show_bug.cgi?id=1498269 + * https://lists.suckless.org/dev/1701/30932.html + * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349 + * and lots more all over the internet. + */ + FcBool iscol; + if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) { + XftFontClose(drw->dpy, xfont); + return NULL; + } + + font = ecalloc(1, sizeof(Fnt)); + font->xfont = xfont; + font->pattern = pattern; + font->h = xfont->ascent + xfont->descent; + font->dpy = drw->dpy; + + return font; +} + +static void +xfont_free(Fnt *font) +{ + if (!font) + return; + if (font->pattern) + FcPatternDestroy(font->pattern); + XftFontClose(font->dpy, font->xfont); + free(font); +} + +Fnt* +drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount) +{ + Fnt *cur, *ret = NULL; + size_t i; + + if (!drw || !fonts) + return NULL; + + for (i = 1; i <= fontcount; i++) { + if ((cur = xfont_create(drw, fonts[fontcount - i], NULL))) { + cur->next = ret; + ret = cur; + } + } + return (drw->fonts = ret); +} + +void +drw_fontset_free(Fnt *font) +{ + if (font) { + drw_fontset_free(font->next); + xfont_free(font); + } +} + +void +drw_clr_create(Drw *drw, Clr *dest, const char *clrname) +{ + if (!drw || !dest || !clrname) + return; + + if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen), + DefaultColormap(drw->dpy, drw->screen), + clrname, dest)) + die("error, cannot allocate color '%s'", clrname); +} + +/* Wrapper to create color schemes. The caller has to call free(3) on the + * returned color scheme when done using it. */ +Clr * +drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) +{ + size_t i; + Clr *ret; + + /* need at least two colors for a scheme */ + if (!drw || !clrnames || clrcount < 2 || !(ret = ecalloc(clrcount, sizeof(XftColor)))) + return NULL; + + for (i = 0; i < clrcount; i++) + drw_clr_create(drw, &ret[i], clrnames[i]); + return ret; +} + +void +drw_setfontset(Drw *drw, Fnt *set) +{ + if (drw) + drw->fonts = set; +} + +void +drw_setscheme(Drw *drw, Clr *scm) +{ + if (drw) + drw->scheme = scm; +} + +void +drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert) +{ + if (!drw || !drw->scheme) + return; + XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme[ColBg].pixel : drw->scheme[ColFg].pixel); + if (filled) + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); + else + XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1); +} + +int +drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert) +{ + char buf[1024]; + int ty; + unsigned int ew; + XftDraw *d = NULL; + Fnt *usedfont, *curfont, *nextfont; + size_t i, len; + int utf8strlen, utf8charlen, render = x || y || w || h; + long utf8codepoint = 0; + const char *utf8str; + FcCharSet *fccharset; + FcPattern *fcpattern; + FcPattern *match; + XftResult result; + int charexists = 0; + + if (!drw || (render && !drw->scheme) || !text || !drw->fonts) + return 0; + + if (!render) { + w = ~w; + } else { + XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel); + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); + d = XftDrawCreate(drw->dpy, drw->drawable, + DefaultVisual(drw->dpy, drw->screen), + DefaultColormap(drw->dpy, drw->screen)); + x += lpad; + w -= lpad; + } + + usedfont = drw->fonts; + while (1) { + utf8strlen = 0; + utf8str = text; + nextfont = NULL; + while (*text) { + utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ); + for (curfont = drw->fonts; curfont; curfont = curfont->next) { + charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint); + if (charexists) { + if (curfont == usedfont) { + utf8strlen += utf8charlen; + text += utf8charlen; + } else { + nextfont = curfont; + } + break; + } + } + + if (!charexists || nextfont) + break; + else + charexists = 0; + } + + if (utf8strlen) { + drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL); + /* shorten text if necessary */ + for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--) + drw_font_getexts(usedfont, utf8str, len, &ew, NULL); + + if (len) { + memcpy(buf, utf8str, len); + buf[len] = '\0'; + if (len < utf8strlen) + for (i = len; i && i > len - 3; buf[--i] = '.') + ; /* NOP */ + + if (render) { + ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent; + XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg], + usedfont->xfont, x, ty, (XftChar8 *)buf, len); + } + x += ew; + w -= ew; + } + } + + if (!*text) { + break; + } else if (nextfont) { + charexists = 0; + usedfont = nextfont; + } else { + /* Regardless of whether or not a fallback font is found, the + * character must be drawn. */ + charexists = 1; + + fccharset = FcCharSetCreate(); + FcCharSetAddChar(fccharset, utf8codepoint); + + if (!drw->fonts->pattern) { + /* Refer to the comment in xfont_create for more information. */ + die("the first font in the cache must be loaded from a font string."); + } + + fcpattern = FcPatternDuplicate(drw->fonts->pattern); + FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset); + FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue); + FcPatternAddBool(fcpattern, FC_COLOR, FcFalse); + + FcConfigSubstitute(NULL, fcpattern, FcMatchPattern); + FcDefaultSubstitute(fcpattern); + match = XftFontMatch(drw->dpy, drw->screen, fcpattern, &result); + + FcCharSetDestroy(fccharset); + FcPatternDestroy(fcpattern); + + if (match) { + usedfont = xfont_create(drw, NULL, match); + if (usedfont && XftCharExists(drw->dpy, usedfont->xfont, utf8codepoint)) { + for (curfont = drw->fonts; curfont->next; curfont = curfont->next) + ; /* NOP */ + curfont->next = usedfont; + } else { + xfont_free(usedfont); + usedfont = drw->fonts; + } + } + } + } + if (d) + XftDrawDestroy(d); + + return x + (render ? w : 0); +} + +void +drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h) +{ + if (!drw) + return; + + XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y); + XSync(drw->dpy, False); +} + +unsigned int +drw_fontset_getwidth(Drw *drw, const char *text) +{ + if (!drw || !drw->fonts || !text) + return 0; + return drw_text(drw, 0, 0, 0, 0, 0, text, 0); +} + +void +drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h) +{ + XGlyphInfo ext; + + if (!font || !text) + return; + + XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext); + if (w) + *w = ext.xOff; + if (h) + *h = font->h; +} + +Cur * +drw_cur_create(Drw *drw, int shape) +{ + Cur *cur; + + if (!drw || !(cur = ecalloc(1, sizeof(Cur)))) + return NULL; + + cur->cursor = XCreateFontCursor(drw->dpy, shape); + + return cur; +} + +void +drw_cur_free(Drw *drw, Cur *cursor) +{ + if (!cursor) + return; + + XFreeCursor(drw->dpy, cursor->cursor); + free(cursor); +} diff --git a/dmenu/dmenu-4.9/drw.h b/dmenu/dmenu-4.9/drw.h new file mode 100644 index 0000000..4c67419 --- /dev/null +++ b/dmenu/dmenu-4.9/drw.h @@ -0,0 +1,57 @@ +/* See LICENSE file for copyright and license details. */ + +typedef struct { + Cursor cursor; +} Cur; + +typedef struct Fnt { + Display *dpy; + unsigned int h; + XftFont *xfont; + FcPattern *pattern; + struct Fnt *next; +} Fnt; + +enum { ColFg, ColBg }; /* Clr scheme index */ +typedef XftColor Clr; + +typedef struct { + unsigned int w, h; + Display *dpy; + int screen; + Window root; + Drawable drawable; + GC gc; + Clr *scheme; + Fnt *fonts; +} Drw; + +/* Drawable abstraction */ +Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h); +void drw_resize(Drw *drw, unsigned int w, unsigned int h); +void drw_free(Drw *drw); + +/* Fnt abstraction */ +Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount); +void drw_fontset_free(Fnt* set); +unsigned int drw_fontset_getwidth(Drw *drw, const char *text); +void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h); + +/* Colorscheme abstraction */ +void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); +Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); + +/* Cursor abstraction */ +Cur *drw_cur_create(Drw *drw, int shape); +void drw_cur_free(Drw *drw, Cur *cursor); + +/* Drawing context manipulation */ +void drw_setfontset(Drw *drw, Fnt *set); +void drw_setscheme(Drw *drw, Clr *scm); + +/* Drawing functions */ +void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert); +int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert); + +/* Map functions */ +void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); diff --git a/dmenu/dmenu-4.9/drw.o b/dmenu/dmenu-4.9/drw.o new file mode 100644 index 0000000..19a85eb Binary files /dev/null and b/dmenu/dmenu-4.9/drw.o differ diff --git a/dmenu/dmenu-4.9/stest b/dmenu/dmenu-4.9/stest new file mode 100755 index 0000000..e30cf94 Binary files /dev/null and b/dmenu/dmenu-4.9/stest differ diff --git a/dmenu/dmenu-4.9/stest.1 b/dmenu/dmenu-4.9/stest.1 new file mode 100644 index 0000000..2667d8a --- /dev/null +++ b/dmenu/dmenu-4.9/stest.1 @@ -0,0 +1,90 @@ +.TH STEST 1 dmenu\-VERSION +.SH NAME +stest \- filter a list of files by properties +.SH SYNOPSIS +.B stest +.RB [ -abcdefghlpqrsuwx ] +.RB [ -n +.IR file ] +.RB [ -o +.IR file ] +.RI [ file ...] +.SH DESCRIPTION +.B stest +takes a list of files and filters by the files' properties, analogous to +.IR test (1). +Files which pass all tests are printed to stdout. If no files are given, stest +reads files from stdin. +.SH OPTIONS +.TP +.B \-a +Test hidden files. +.TP +.B \-b +Test that files are block specials. +.TP +.B \-c +Test that files are character specials. +.TP +.B \-d +Test that files are directories. +.TP +.B \-e +Test that files exist. +.TP +.B \-f +Test that files are regular files. +.TP +.B \-g +Test that files have their set-group-ID flag set. +.TP +.B \-h +Test that files are symbolic links. +.TP +.B \-l +Test the contents of a directory given as an argument. +.TP +.BI \-n " file" +Test that files are newer than +.IR file . +.TP +.BI \-o " file" +Test that files are older than +.IR file . +.TP +.B \-p +Test that files are named pipes. +.TP +.B \-q +No files are printed, only the exit status is returned. +.TP +.B \-r +Test that files are readable. +.TP +.B \-s +Test that files are not empty. +.TP +.B \-u +Test that files have their set-user-ID flag set. +.TP +.B \-v +Invert the sense of tests, only failing files pass. +.TP +.B \-w +Test that files are writable. +.TP +.B \-x +Test that files are executable. +.SH EXIT STATUS +.TP +.B 0 +At least one file passed all tests. +.TP +.B 1 +No files passed all tests. +.TP +.B 2 +An error occurred. +.SH SEE ALSO +.IR dmenu (1), +.IR test (1) diff --git a/dmenu/dmenu-4.9/stest.c b/dmenu/dmenu-4.9/stest.c new file mode 100644 index 0000000..7a7b0bc --- /dev/null +++ b/dmenu/dmenu-4.9/stest.c @@ -0,0 +1,109 @@ +/* See LICENSE file for copyright and license details. */ +#include + +#include +#include +#include +#include +#include +#include + +#include "arg.h" +char *argv0; + +#define FLAG(x) (flag[(x)-'a']) + +static void test(const char *, const char *); +static void usage(void); + +static int match = 0; +static int flag[26]; +static struct stat old, new; + +static void +test(const char *path, const char *name) +{ + struct stat st, ln; + + if ((!stat(path, &st) && (FLAG('a') || name[0] != '.') /* hidden files */ + && (!FLAG('b') || S_ISBLK(st.st_mode)) /* block special */ + && (!FLAG('c') || S_ISCHR(st.st_mode)) /* character special */ + && (!FLAG('d') || S_ISDIR(st.st_mode)) /* directory */ + && (!FLAG('e') || access(path, F_OK) == 0) /* exists */ + && (!FLAG('f') || S_ISREG(st.st_mode)) /* regular file */ + && (!FLAG('g') || st.st_mode & S_ISGID) /* set-group-id flag */ + && (!FLAG('h') || (!lstat(path, &ln) && S_ISLNK(ln.st_mode))) /* symbolic link */ + && (!FLAG('n') || st.st_mtime > new.st_mtime) /* newer than file */ + && (!FLAG('o') || st.st_mtime < old.st_mtime) /* older than file */ + && (!FLAG('p') || S_ISFIFO(st.st_mode)) /* named pipe */ + && (!FLAG('r') || access(path, R_OK) == 0) /* readable */ + && (!FLAG('s') || st.st_size > 0) /* not empty */ + && (!FLAG('u') || st.st_mode & S_ISUID) /* set-user-id flag */ + && (!FLAG('w') || access(path, W_OK) == 0) /* writable */ + && (!FLAG('x') || access(path, X_OK) == 0)) != FLAG('v')) { /* executable */ + if (FLAG('q')) + exit(0); + match = 1; + puts(name); + } +} + +static void +usage(void) +{ + fprintf(stderr, "usage: %s [-abcdefghlpqrsuvwx] " + "[-n file] [-o file] [file...]\n", argv0); + exit(2); /* like test(1) return > 1 on error */ +} + +int +main(int argc, char *argv[]) +{ + struct dirent *d; + char path[PATH_MAX], *line = NULL, *file; + size_t linesiz = 0; + ssize_t n; + DIR *dir; + int r; + + ARGBEGIN { + case 'n': /* newer than file */ + case 'o': /* older than file */ + file = EARGF(usage()); + if (!(FLAG(ARGC()) = !stat(file, (ARGC() == 'n' ? &new : &old)))) + perror(file); + break; + default: + /* miscellaneous operators */ + if (strchr("abcdefghlpqrsuvwx", ARGC())) + FLAG(ARGC()) = 1; + else + usage(); /* unknown flag */ + } ARGEND; + + if (!argc) { + /* read list from stdin */ + while ((n = getline(&line, &linesiz, stdin)) > 0) { + if (n && line[n - 1] == '\n') + line[n - 1] = '\0'; + test(line, line); + } + free(line); + } else { + for (; argc; argc--, argv++) { + if (FLAG('l') && (dir = opendir(*argv))) { + /* test directory contents */ + while ((d = readdir(dir))) { + r = snprintf(path, sizeof path, "%s/%s", + *argv, d->d_name); + if (r >= 0 && (size_t)r < sizeof path) + test(path, d->d_name); + } + closedir(dir); + } else { + test(*argv, *argv); + } + } + } + return match ? 0 : 1; +} diff --git a/dmenu/dmenu-4.9/stest.o b/dmenu/dmenu-4.9/stest.o new file mode 100644 index 0000000..571e735 Binary files /dev/null and b/dmenu/dmenu-4.9/stest.o differ diff --git a/dmenu/dmenu-4.9/util.c b/dmenu/dmenu-4.9/util.c new file mode 100644 index 0000000..fe044fc --- /dev/null +++ b/dmenu/dmenu-4.9/util.c @@ -0,0 +1,35 @@ +/* See LICENSE file for copyright and license details. */ +#include +#include +#include +#include + +#include "util.h" + +void * +ecalloc(size_t nmemb, size_t size) +{ + void *p; + + if (!(p = calloc(nmemb, size))) + die("calloc:"); + return p; +} + +void +die(const char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + + if (fmt[0] && fmt[strlen(fmt)-1] == ':') { + fputc(' ', stderr); + perror(NULL); + } else { + fputc('\n', stderr); + } + + exit(1); +} diff --git a/dmenu/dmenu-4.9/util.h b/dmenu/dmenu-4.9/util.h new file mode 100644 index 0000000..f633b51 --- /dev/null +++ b/dmenu/dmenu-4.9/util.h @@ -0,0 +1,8 @@ +/* See LICENSE file for copyright and license details. */ + +#define MAX(A, B) ((A) > (B) ? (A) : (B)) +#define MIN(A, B) ((A) < (B) ? (A) : (B)) +#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B)) + +void die(const char *fmt, ...); +void *ecalloc(size_t nmemb, size_t size); diff --git a/dmenu/dmenu-4.9/util.o b/dmenu/dmenu-4.9/util.o new file mode 100644 index 0000000..a7fcc8c Binary files /dev/null and b/dmenu/dmenu-4.9/util.o differ diff --git a/dwm/dwm-6.2 b/dwm/dwm-6.2-config similarity index 100% rename from dwm/dwm-6.2 rename to dwm/dwm-6.2-config diff --git a/dwm/dwm-6.2.tar.gz b/dwm/dwm-6.2.tar.gz new file mode 100644 index 0000000..3c06a96 Binary files /dev/null and b/dwm/dwm-6.2.tar.gz differ diff --git a/dwm/01-dwm-vanitygaps-20190508-6.2.patch b/dwm/dwm-6.2/01-dwm-vanitygaps-20190508-6.2.patch similarity index 100% rename from dwm/01-dwm-vanitygaps-20190508-6.2.patch rename to dwm/dwm-6.2/01-dwm-vanitygaps-20190508-6.2.patch diff --git a/dwm/dwm-6.2/LICENSE b/dwm/dwm-6.2/LICENSE new file mode 100644 index 0000000..d221f09 --- /dev/null +++ b/dwm/dwm-6.2/LICENSE @@ -0,0 +1,37 @@ +MIT/X Consortium License + +© 2006-2019 Anselm R Garbe +© 2006-2009 Jukka Salmi +© 2006-2007 Sander van Dijk +© 2007-2011 Peter Hartlich +© 2007-2009 Szabolcs Nagy +© 2007-2009 Christof Musik +© 2007-2009 Premysl Hruby +© 2007-2008 Enno Gottox Boland +© 2008 Martin Hurton +© 2008 Neale Pickett +© 2009 Mate Nagy +© 2010-2016 Hiltjo Posthuma +© 2010-2012 Connor Lane Smith +© 2011 Christoph Lohmann <20h@r-36.net> +© 2015-2016 Quentin Rameau +© 2015-2016 Eric Pruitt +© 2016-2017 Markus Teich + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/dwm/dwm-6.2/Makefile b/dwm/dwm-6.2/Makefile new file mode 100644 index 0000000..77bcbc0 --- /dev/null +++ b/dwm/dwm-6.2/Makefile @@ -0,0 +1,51 @@ +# dwm - dynamic window manager +# See LICENSE file for copyright and license details. + +include config.mk + +SRC = drw.c dwm.c util.c +OBJ = ${SRC:.c=.o} + +all: options dwm + +options: + @echo dwm build options: + @echo "CFLAGS = ${CFLAGS}" + @echo "LDFLAGS = ${LDFLAGS}" + @echo "CC = ${CC}" + +.c.o: + ${CC} -c ${CFLAGS} $< + +${OBJ}: config.h config.mk + +config.h: + cp config.def.h $@ + +dwm: ${OBJ} + ${CC} -o $@ ${OBJ} ${LDFLAGS} + +clean: + rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz + +dist: clean + mkdir -p dwm-${VERSION} + cp -R LICENSE Makefile README config.def.h config.mk\ + dwm.1 drw.h util.h ${SRC} dwm.png transient.c dwm-${VERSION} + tar -cf dwm-${VERSION}.tar dwm-${VERSION} + gzip dwm-${VERSION}.tar + rm -rf dwm-${VERSION} + +install: all + mkdir -p ${DESTDIR}${PREFIX}/bin + cp -f dwm ${DESTDIR}${PREFIX}/bin + chmod 755 ${DESTDIR}${PREFIX}/bin/dwm + mkdir -p ${DESTDIR}${MANPREFIX}/man1 + sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1 + chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1 + +uninstall: + rm -f ${DESTDIR}${PREFIX}/bin/dwm\ + ${DESTDIR}${MANPREFIX}/man1/dwm.1 + +.PHONY: all options clean dist install uninstall diff --git a/dwm/dwm-6.2/README b/dwm/dwm-6.2/README new file mode 100644 index 0000000..95d4fd0 --- /dev/null +++ b/dwm/dwm-6.2/README @@ -0,0 +1,48 @@ +dwm - dynamic window manager +============================ +dwm is an extremely fast, small, and dynamic window manager for X. + + +Requirements +------------ +In order to build dwm you need the Xlib header files. + + +Installation +------------ +Edit config.mk to match your local setup (dwm is installed into +the /usr/local namespace by default). + +Afterwards enter the following command to build and install dwm (if +necessary as root): + + make clean install + + +Running dwm +----------- +Add the following line to your .xinitrc to start dwm using startx: + + exec dwm + +In order to connect dwm to a specific display, make sure that +the DISPLAY environment variable is set correctly, e.g.: + + DISPLAY=foo.bar:1 exec dwm + +(This will start dwm on display :1 of the host foo.bar.) + +In order to display status info in the bar, you can do something +like this in your .xinitrc: + + while xsetroot -name "`date` `uptime | sed 's/.*,//'`" + do + sleep 1 + done & + exec dwm + + +Configuration +------------- +The configuration of dwm is done by creating a custom config.h +and (re)compiling the source code. diff --git a/dwm/dwm-6.2/config.def.h b/dwm/dwm-6.2/config.def.h new file mode 100644 index 0000000..7d76aef --- /dev/null +++ b/dwm/dwm-6.2/config.def.h @@ -0,0 +1,139 @@ +/* See LICENSE file for copyright and license details. */ + +/* appearance */ +static const unsigned int borderpx = 2; /* border pixel of windows */ +static const unsigned int snap = 32; /* snap pixel */ +static const unsigned int gappih = 6; /* horiz inner gap between windows */ +static const unsigned int gappiv = 6; /* vert inner gap between windows */ +static const unsigned int gappoh = 6; /* horiz outer gap between windows and screen edge */ +static const unsigned int gappov = 6; /* vert outer gap between windows and screen edge */ +static const int smartgaps = 1; /* 1 means no outer gap when there is only one window */ +static const int showbar = 1; /* 0 means no bar */ +static const int topbar = 1; /* 0 means bottom bar */ +static const char *fonts[] = { "monospace:size=10" }; +static const char dmenufont[] = "monospace:size=10"; +static const char col_gray1[] = "#222222"; +static const char col_gray2[] = "#444444"; +static const char col_gray3[] = "#bbbbbb"; +static const char col_gray4[] = "#eeeeee"; +static const char col_cyan[] = "#005577"; +static const char col_green[] = "#28ef36"; +static const char *colors[][3] = { + /* fg bg border */ + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, + [SchemeSel] = { col_gray4, col_cyan, col_cyan }, +}; + +/* tagging */ +static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; + +static const Rule rules[] = { + /* xprop(1): + * WM_CLASS(STRING) = instance, class + * WM_NAME(STRING) = title + */ + /* class instance title tags mask isfloating monitor */ + { "Gimp", NULL, NULL, 0, 1, -1 }, + { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, +{ "TelegramDesktop", NULL, NULL, 1 << 6, 0, -1 }, + { "Workrave", NULL, NULL, ~0, 1, -1 }, +}; + +/* layout(s) */ +static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static const int nmaster = 1; /* number of clients in master area */ +static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ + +static const Layout layouts[] = { + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, +}; + +/* key definitions */ +#define MODKEY Mod1Mask +#define TAGKEYS(KEY,TAG) \ + { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ + { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, + +/* helper for spawning shell commands in the pre dwm-5.0 fashion */ +#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } + +/* commands */ +static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ +static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; +static const char *termcmd[] = { "st", NULL }; + +static Key keys[] = { + /* modifier key function argument */ + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_k, focusstack, {.i = -1 } }, + { MODKEY, XK_i, incnmaster, {.i = +1 } }, + { MODKEY, XK_d, incnmaster, {.i = -1 } }, + { MODKEY, XK_h, setmfact, {.f = -0.05} }, + { MODKEY, XK_l, setmfact, {.f = +0.05} }, + { MODKEY|Mod4Mask, XK_h, incrgaps, {.i = +1 } }, + { MODKEY|Mod4Mask, XK_l, incrgaps, {.i = -1 } }, + { MODKEY|Mod4Mask|ShiftMask, XK_h, incrogaps, {.i = +1 } }, + { MODKEY|Mod4Mask|ShiftMask, XK_l, incrogaps, {.i = -1 } }, + { MODKEY|Mod4Mask|ControlMask, XK_h, incrigaps, {.i = +1 } }, + { MODKEY|Mod4Mask|ControlMask, XK_l, incrigaps, {.i = -1 } }, + { MODKEY|Mod4Mask, XK_0, togglegaps, {0} }, + { MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} }, + { MODKEY, XK_y, incrihgaps, {.i = +1 } }, + { MODKEY, XK_o, incrihgaps, {.i = -1 } }, + { MODKEY|ControlMask, XK_y, incrivgaps, {.i = +1 } }, + { MODKEY|ControlMask, XK_o, incrivgaps, {.i = -1 } }, + { MODKEY|Mod4Mask, XK_y, incrohgaps, {.i = +1 } }, + { MODKEY|Mod4Mask, XK_o, incrohgaps, {.i = -1 } }, + { MODKEY|ShiftMask, XK_y, incrovgaps, {.i = +1 } }, + { MODKEY|ShiftMask, XK_o, incrovgaps, {.i = -1 } }, + { MODKEY, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_comma, focusmon, {.i = -1 } }, + { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) + TAGKEYS( XK_5, 4) + TAGKEYS( XK_6, 5) + TAGKEYS( XK_7, 6) + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) + { MODKEY|ShiftMask, XK_q, quit, {0} }, +}; + +/* button definitions */ +/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ +static Button buttons[] = { + /* click event mask button function argument */ + { ClkLtSymbol, 0, Button1, setlayout, {0} }, + { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, + { ClkWinTitle, 0, Button2, zoom, {0} }, + { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, + { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, + { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, + { ClkTagBar, 0, Button1, view, {0} }, + { ClkTagBar, 0, Button3, toggleview, {0} }, + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, +}; + diff --git a/dwm/dwm-6.2/config.h b/dwm/dwm-6.2/config.h new file mode 100644 index 0000000..7d76aef --- /dev/null +++ b/dwm/dwm-6.2/config.h @@ -0,0 +1,139 @@ +/* See LICENSE file for copyright and license details. */ + +/* appearance */ +static const unsigned int borderpx = 2; /* border pixel of windows */ +static const unsigned int snap = 32; /* snap pixel */ +static const unsigned int gappih = 6; /* horiz inner gap between windows */ +static const unsigned int gappiv = 6; /* vert inner gap between windows */ +static const unsigned int gappoh = 6; /* horiz outer gap between windows and screen edge */ +static const unsigned int gappov = 6; /* vert outer gap between windows and screen edge */ +static const int smartgaps = 1; /* 1 means no outer gap when there is only one window */ +static const int showbar = 1; /* 0 means no bar */ +static const int topbar = 1; /* 0 means bottom bar */ +static const char *fonts[] = { "monospace:size=10" }; +static const char dmenufont[] = "monospace:size=10"; +static const char col_gray1[] = "#222222"; +static const char col_gray2[] = "#444444"; +static const char col_gray3[] = "#bbbbbb"; +static const char col_gray4[] = "#eeeeee"; +static const char col_cyan[] = "#005577"; +static const char col_green[] = "#28ef36"; +static const char *colors[][3] = { + /* fg bg border */ + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, + [SchemeSel] = { col_gray4, col_cyan, col_cyan }, +}; + +/* tagging */ +static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; + +static const Rule rules[] = { + /* xprop(1): + * WM_CLASS(STRING) = instance, class + * WM_NAME(STRING) = title + */ + /* class instance title tags mask isfloating monitor */ + { "Gimp", NULL, NULL, 0, 1, -1 }, + { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, +{ "TelegramDesktop", NULL, NULL, 1 << 6, 0, -1 }, + { "Workrave", NULL, NULL, ~0, 1, -1 }, +}; + +/* layout(s) */ +static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static const int nmaster = 1; /* number of clients in master area */ +static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ + +static const Layout layouts[] = { + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, +}; + +/* key definitions */ +#define MODKEY Mod1Mask +#define TAGKEYS(KEY,TAG) \ + { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ + { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, + +/* helper for spawning shell commands in the pre dwm-5.0 fashion */ +#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } + +/* commands */ +static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ +static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; +static const char *termcmd[] = { "st", NULL }; + +static Key keys[] = { + /* modifier key function argument */ + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_k, focusstack, {.i = -1 } }, + { MODKEY, XK_i, incnmaster, {.i = +1 } }, + { MODKEY, XK_d, incnmaster, {.i = -1 } }, + { MODKEY, XK_h, setmfact, {.f = -0.05} }, + { MODKEY, XK_l, setmfact, {.f = +0.05} }, + { MODKEY|Mod4Mask, XK_h, incrgaps, {.i = +1 } }, + { MODKEY|Mod4Mask, XK_l, incrgaps, {.i = -1 } }, + { MODKEY|Mod4Mask|ShiftMask, XK_h, incrogaps, {.i = +1 } }, + { MODKEY|Mod4Mask|ShiftMask, XK_l, incrogaps, {.i = -1 } }, + { MODKEY|Mod4Mask|ControlMask, XK_h, incrigaps, {.i = +1 } }, + { MODKEY|Mod4Mask|ControlMask, XK_l, incrigaps, {.i = -1 } }, + { MODKEY|Mod4Mask, XK_0, togglegaps, {0} }, + { MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} }, + { MODKEY, XK_y, incrihgaps, {.i = +1 } }, + { MODKEY, XK_o, incrihgaps, {.i = -1 } }, + { MODKEY|ControlMask, XK_y, incrivgaps, {.i = +1 } }, + { MODKEY|ControlMask, XK_o, incrivgaps, {.i = -1 } }, + { MODKEY|Mod4Mask, XK_y, incrohgaps, {.i = +1 } }, + { MODKEY|Mod4Mask, XK_o, incrohgaps, {.i = -1 } }, + { MODKEY|ShiftMask, XK_y, incrovgaps, {.i = +1 } }, + { MODKEY|ShiftMask, XK_o, incrovgaps, {.i = -1 } }, + { MODKEY, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_comma, focusmon, {.i = -1 } }, + { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) + TAGKEYS( XK_5, 4) + TAGKEYS( XK_6, 5) + TAGKEYS( XK_7, 6) + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) + { MODKEY|ShiftMask, XK_q, quit, {0} }, +}; + +/* button definitions */ +/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ +static Button buttons[] = { + /* click event mask button function argument */ + { ClkLtSymbol, 0, Button1, setlayout, {0} }, + { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, + { ClkWinTitle, 0, Button2, zoom, {0} }, + { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, + { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, + { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, + { ClkTagBar, 0, Button1, view, {0} }, + { ClkTagBar, 0, Button3, toggleview, {0} }, + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, +}; + diff --git a/dwm/dwm-6.2/config.mk b/dwm/dwm-6.2/config.mk new file mode 100644 index 0000000..6d36cb7 --- /dev/null +++ b/dwm/dwm-6.2/config.mk @@ -0,0 +1,38 @@ +# dwm version +VERSION = 6.2 + +# Customize below to fit your system + +# paths +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/share/man + +X11INC = /usr/X11R6/include +X11LIB = /usr/X11R6/lib + +# Xinerama, comment if you don't want it +XINERAMALIBS = -lXinerama +XINERAMAFLAGS = -DXINERAMA + +# freetype +FREETYPELIBS = -lfontconfig -lXft +FREETYPEINC = /usr/include/freetype2 +# OpenBSD (uncomment) +#FREETYPEINC = ${X11INC}/freetype2 + +# includes and libs +INCS = -I${X11INC} -I${FREETYPEINC} +LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} + +# flags +CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} +#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} +CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS} +LDFLAGS = ${LIBS} + +# Solaris +#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" +#LDFLAGS = ${LIBS} + +# compiler and linker +CC = cc diff --git a/dwm/dwm-6.2/drw.c b/dwm/dwm-6.2/drw.c new file mode 100644 index 0000000..8fd1ca4 --- /dev/null +++ b/dwm/dwm-6.2/drw.c @@ -0,0 +1,435 @@ +/* See LICENSE file for copyright and license details. */ +#include +#include +#include +#include +#include + +#include "drw.h" +#include "util.h" + +#define UTF_INVALID 0xFFFD +#define UTF_SIZ 4 + +static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; +static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; +static const long utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000}; +static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF}; + +static long +utf8decodebyte(const char c, size_t *i) +{ + for (*i = 0; *i < (UTF_SIZ + 1); ++(*i)) + if (((unsigned char)c & utfmask[*i]) == utfbyte[*i]) + return (unsigned char)c & ~utfmask[*i]; + return 0; +} + +static size_t +utf8validate(long *u, size_t i) +{ + if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF)) + *u = UTF_INVALID; + for (i = 1; *u > utfmax[i]; ++i) + ; + return i; +} + +static size_t +utf8decode(const char *c, long *u, size_t clen) +{ + size_t i, j, len, type; + long udecoded; + + *u = UTF_INVALID; + if (!clen) + return 0; + udecoded = utf8decodebyte(c[0], &len); + if (!BETWEEN(len, 1, UTF_SIZ)) + return 1; + for (i = 1, j = 1; i < clen && j < len; ++i, ++j) { + udecoded = (udecoded << 6) | utf8decodebyte(c[i], &type); + if (type) + return j; + } + if (j < len) + return 0; + *u = udecoded; + utf8validate(u, len); + + return len; +} + +Drw * +drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h) +{ + Drw *drw = ecalloc(1, sizeof(Drw)); + + drw->dpy = dpy; + drw->screen = screen; + drw->root = root; + drw->w = w; + drw->h = h; + drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen)); + drw->gc = XCreateGC(dpy, root, 0, NULL); + XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter); + + return drw; +} + +void +drw_resize(Drw *drw, unsigned int w, unsigned int h) +{ + if (!drw) + return; + + drw->w = w; + drw->h = h; + if (drw->drawable) + XFreePixmap(drw->dpy, drw->drawable); + drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen)); +} + +void +drw_free(Drw *drw) +{ + XFreePixmap(drw->dpy, drw->drawable); + XFreeGC(drw->dpy, drw->gc); + free(drw); +} + +/* This function is an implementation detail. Library users should use + * drw_fontset_create instead. + */ +static Fnt * +xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern) +{ + Fnt *font; + XftFont *xfont = NULL; + FcPattern *pattern = NULL; + + if (fontname) { + /* Using the pattern found at font->xfont->pattern does not yield the + * same substitution results as using the pattern returned by + * FcNameParse; using the latter results in the desired fallback + * behaviour whereas the former just results in missing-character + * rectangles being drawn, at least with some fonts. */ + if (!(xfont = XftFontOpenName(drw->dpy, drw->screen, fontname))) { + fprintf(stderr, "error, cannot load font from name: '%s'\n", fontname); + return NULL; + } + if (!(pattern = FcNameParse((FcChar8 *) fontname))) { + fprintf(stderr, "error, cannot parse font name to pattern: '%s'\n", fontname); + XftFontClose(drw->dpy, xfont); + return NULL; + } + } else if (fontpattern) { + if (!(xfont = XftFontOpenPattern(drw->dpy, fontpattern))) { + fprintf(stderr, "error, cannot load font from pattern.\n"); + return NULL; + } + } else { + die("no font specified."); + } + + /* Do not allow using color fonts. This is a workaround for a BadLength + * error from Xft with color glyphs. Modelled on the Xterm workaround. See + * https://bugzilla.redhat.com/show_bug.cgi?id=1498269 + * https://lists.suckless.org/dev/1701/30932.html + * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349 + * and lots more all over the internet. + */ + FcBool iscol; + if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) { + XftFontClose(drw->dpy, xfont); + return NULL; + } + + font = ecalloc(1, sizeof(Fnt)); + font->xfont = xfont; + font->pattern = pattern; + font->h = xfont->ascent + xfont->descent; + font->dpy = drw->dpy; + + return font; +} + +static void +xfont_free(Fnt *font) +{ + if (!font) + return; + if (font->pattern) + FcPatternDestroy(font->pattern); + XftFontClose(font->dpy, font->xfont); + free(font); +} + +Fnt* +drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount) +{ + Fnt *cur, *ret = NULL; + size_t i; + + if (!drw || !fonts) + return NULL; + + for (i = 1; i <= fontcount; i++) { + if ((cur = xfont_create(drw, fonts[fontcount - i], NULL))) { + cur->next = ret; + ret = cur; + } + } + return (drw->fonts = ret); +} + +void +drw_fontset_free(Fnt *font) +{ + if (font) { + drw_fontset_free(font->next); + xfont_free(font); + } +} + +void +drw_clr_create(Drw *drw, Clr *dest, const char *clrname) +{ + if (!drw || !dest || !clrname) + return; + + if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen), + DefaultColormap(drw->dpy, drw->screen), + clrname, dest)) + die("error, cannot allocate color '%s'", clrname); +} + +/* Wrapper to create color schemes. The caller has to call free(3) on the + * returned color scheme when done using it. */ +Clr * +drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) +{ + size_t i; + Clr *ret; + + /* need at least two colors for a scheme */ + if (!drw || !clrnames || clrcount < 2 || !(ret = ecalloc(clrcount, sizeof(XftColor)))) + return NULL; + + for (i = 0; i < clrcount; i++) + drw_clr_create(drw, &ret[i], clrnames[i]); + return ret; +} + +void +drw_setfontset(Drw *drw, Fnt *set) +{ + if (drw) + drw->fonts = set; +} + +void +drw_setscheme(Drw *drw, Clr *scm) +{ + if (drw) + drw->scheme = scm; +} + +void +drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert) +{ + if (!drw || !drw->scheme) + return; + XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme[ColBg].pixel : drw->scheme[ColFg].pixel); + if (filled) + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); + else + XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1); +} + +int +drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert) +{ + char buf[1024]; + int ty; + unsigned int ew; + XftDraw *d = NULL; + Fnt *usedfont, *curfont, *nextfont; + size_t i, len; + int utf8strlen, utf8charlen, render = x || y || w || h; + long utf8codepoint = 0; + const char *utf8str; + FcCharSet *fccharset; + FcPattern *fcpattern; + FcPattern *match; + XftResult result; + int charexists = 0; + + if (!drw || (render && !drw->scheme) || !text || !drw->fonts) + return 0; + + if (!render) { + w = ~w; + } else { + XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel); + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); + d = XftDrawCreate(drw->dpy, drw->drawable, + DefaultVisual(drw->dpy, drw->screen), + DefaultColormap(drw->dpy, drw->screen)); + x += lpad; + w -= lpad; + } + + usedfont = drw->fonts; + while (1) { + utf8strlen = 0; + utf8str = text; + nextfont = NULL; + while (*text) { + utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ); + for (curfont = drw->fonts; curfont; curfont = curfont->next) { + charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint); + if (charexists) { + if (curfont == usedfont) { + utf8strlen += utf8charlen; + text += utf8charlen; + } else { + nextfont = curfont; + } + break; + } + } + + if (!charexists || nextfont) + break; + else + charexists = 0; + } + + if (utf8strlen) { + drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL); + /* shorten text if necessary */ + for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--) + drw_font_getexts(usedfont, utf8str, len, &ew, NULL); + + if (len) { + memcpy(buf, utf8str, len); + buf[len] = '\0'; + if (len < utf8strlen) + for (i = len; i && i > len - 3; buf[--i] = '.') + ; /* NOP */ + + if (render) { + ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent; + XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg], + usedfont->xfont, x, ty, (XftChar8 *)buf, len); + } + x += ew; + w -= ew; + } + } + + if (!*text) { + break; + } else if (nextfont) { + charexists = 0; + usedfont = nextfont; + } else { + /* Regardless of whether or not a fallback font is found, the + * character must be drawn. */ + charexists = 1; + + fccharset = FcCharSetCreate(); + FcCharSetAddChar(fccharset, utf8codepoint); + + if (!drw->fonts->pattern) { + /* Refer to the comment in xfont_create for more information. */ + die("the first font in the cache must be loaded from a font string."); + } + + fcpattern = FcPatternDuplicate(drw->fonts->pattern); + FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset); + FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue); + FcPatternAddBool(fcpattern, FC_COLOR, FcFalse); + + FcConfigSubstitute(NULL, fcpattern, FcMatchPattern); + FcDefaultSubstitute(fcpattern); + match = XftFontMatch(drw->dpy, drw->screen, fcpattern, &result); + + FcCharSetDestroy(fccharset); + FcPatternDestroy(fcpattern); + + if (match) { + usedfont = xfont_create(drw, NULL, match); + if (usedfont && XftCharExists(drw->dpy, usedfont->xfont, utf8codepoint)) { + for (curfont = drw->fonts; curfont->next; curfont = curfont->next) + ; /* NOP */ + curfont->next = usedfont; + } else { + xfont_free(usedfont); + usedfont = drw->fonts; + } + } + } + } + if (d) + XftDrawDestroy(d); + + return x + (render ? w : 0); +} + +void +drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h) +{ + if (!drw) + return; + + XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y); + XSync(drw->dpy, False); +} + +unsigned int +drw_fontset_getwidth(Drw *drw, const char *text) +{ + if (!drw || !drw->fonts || !text) + return 0; + return drw_text(drw, 0, 0, 0, 0, 0, text, 0); +} + +void +drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h) +{ + XGlyphInfo ext; + + if (!font || !text) + return; + + XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext); + if (w) + *w = ext.xOff; + if (h) + *h = font->h; +} + +Cur * +drw_cur_create(Drw *drw, int shape) +{ + Cur *cur; + + if (!drw || !(cur = ecalloc(1, sizeof(Cur)))) + return NULL; + + cur->cursor = XCreateFontCursor(drw->dpy, shape); + + return cur; +} + +void +drw_cur_free(Drw *drw, Cur *cursor) +{ + if (!cursor) + return; + + XFreeCursor(drw->dpy, cursor->cursor); + free(cursor); +} diff --git a/dwm/dwm-6.2/drw.h b/dwm/dwm-6.2/drw.h new file mode 100644 index 0000000..4bcd5ad --- /dev/null +++ b/dwm/dwm-6.2/drw.h @@ -0,0 +1,57 @@ +/* See LICENSE file for copyright and license details. */ + +typedef struct { + Cursor cursor; +} Cur; + +typedef struct Fnt { + Display *dpy; + unsigned int h; + XftFont *xfont; + FcPattern *pattern; + struct Fnt *next; +} Fnt; + +enum { ColFg, ColBg, ColBorder }; /* Clr scheme index */ +typedef XftColor Clr; + +typedef struct { + unsigned int w, h; + Display *dpy; + int screen; + Window root; + Drawable drawable; + GC gc; + Clr *scheme; + Fnt *fonts; +} Drw; + +/* Drawable abstraction */ +Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h); +void drw_resize(Drw *drw, unsigned int w, unsigned int h); +void drw_free(Drw *drw); + +/* Fnt abstraction */ +Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount); +void drw_fontset_free(Fnt* set); +unsigned int drw_fontset_getwidth(Drw *drw, const char *text); +void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h); + +/* Colorscheme abstraction */ +void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); +Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); + +/* Cursor abstraction */ +Cur *drw_cur_create(Drw *drw, int shape); +void drw_cur_free(Drw *drw, Cur *cursor); + +/* Drawing context manipulation */ +void drw_setfontset(Drw *drw, Fnt *set); +void drw_setscheme(Drw *drw, Clr *scm); + +/* Drawing functions */ +void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert); +int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert); + +/* Map functions */ +void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); diff --git a/dwm/dwm-6.2/drw.o b/dwm/dwm-6.2/drw.o new file mode 100644 index 0000000..19a85eb Binary files /dev/null and b/dwm/dwm-6.2/drw.o differ diff --git a/dwm/dwm-6.2/dwm b/dwm/dwm-6.2/dwm new file mode 100755 index 0000000..8579847 Binary files /dev/null and b/dwm/dwm-6.2/dwm differ diff --git a/dwm/dwm-6.2/dwm-6.2-config b/dwm/dwm-6.2/dwm-6.2-config new file mode 100644 index 0000000..7d76aef --- /dev/null +++ b/dwm/dwm-6.2/dwm-6.2-config @@ -0,0 +1,139 @@ +/* See LICENSE file for copyright and license details. */ + +/* appearance */ +static const unsigned int borderpx = 2; /* border pixel of windows */ +static const unsigned int snap = 32; /* snap pixel */ +static const unsigned int gappih = 6; /* horiz inner gap between windows */ +static const unsigned int gappiv = 6; /* vert inner gap between windows */ +static const unsigned int gappoh = 6; /* horiz outer gap between windows and screen edge */ +static const unsigned int gappov = 6; /* vert outer gap between windows and screen edge */ +static const int smartgaps = 1; /* 1 means no outer gap when there is only one window */ +static const int showbar = 1; /* 0 means no bar */ +static const int topbar = 1; /* 0 means bottom bar */ +static const char *fonts[] = { "monospace:size=10" }; +static const char dmenufont[] = "monospace:size=10"; +static const char col_gray1[] = "#222222"; +static const char col_gray2[] = "#444444"; +static const char col_gray3[] = "#bbbbbb"; +static const char col_gray4[] = "#eeeeee"; +static const char col_cyan[] = "#005577"; +static const char col_green[] = "#28ef36"; +static const char *colors[][3] = { + /* fg bg border */ + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, + [SchemeSel] = { col_gray4, col_cyan, col_cyan }, +}; + +/* tagging */ +static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; + +static const Rule rules[] = { + /* xprop(1): + * WM_CLASS(STRING) = instance, class + * WM_NAME(STRING) = title + */ + /* class instance title tags mask isfloating monitor */ + { "Gimp", NULL, NULL, 0, 1, -1 }, + { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, +{ "TelegramDesktop", NULL, NULL, 1 << 6, 0, -1 }, + { "Workrave", NULL, NULL, ~0, 1, -1 }, +}; + +/* layout(s) */ +static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static const int nmaster = 1; /* number of clients in master area */ +static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ + +static const Layout layouts[] = { + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, +}; + +/* key definitions */ +#define MODKEY Mod1Mask +#define TAGKEYS(KEY,TAG) \ + { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ + { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, + +/* helper for spawning shell commands in the pre dwm-5.0 fashion */ +#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } + +/* commands */ +static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ +static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; +static const char *termcmd[] = { "st", NULL }; + +static Key keys[] = { + /* modifier key function argument */ + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_k, focusstack, {.i = -1 } }, + { MODKEY, XK_i, incnmaster, {.i = +1 } }, + { MODKEY, XK_d, incnmaster, {.i = -1 } }, + { MODKEY, XK_h, setmfact, {.f = -0.05} }, + { MODKEY, XK_l, setmfact, {.f = +0.05} }, + { MODKEY|Mod4Mask, XK_h, incrgaps, {.i = +1 } }, + { MODKEY|Mod4Mask, XK_l, incrgaps, {.i = -1 } }, + { MODKEY|Mod4Mask|ShiftMask, XK_h, incrogaps, {.i = +1 } }, + { MODKEY|Mod4Mask|ShiftMask, XK_l, incrogaps, {.i = -1 } }, + { MODKEY|Mod4Mask|ControlMask, XK_h, incrigaps, {.i = +1 } }, + { MODKEY|Mod4Mask|ControlMask, XK_l, incrigaps, {.i = -1 } }, + { MODKEY|Mod4Mask, XK_0, togglegaps, {0} }, + { MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} }, + { MODKEY, XK_y, incrihgaps, {.i = +1 } }, + { MODKEY, XK_o, incrihgaps, {.i = -1 } }, + { MODKEY|ControlMask, XK_y, incrivgaps, {.i = +1 } }, + { MODKEY|ControlMask, XK_o, incrivgaps, {.i = -1 } }, + { MODKEY|Mod4Mask, XK_y, incrohgaps, {.i = +1 } }, + { MODKEY|Mod4Mask, XK_o, incrohgaps, {.i = -1 } }, + { MODKEY|ShiftMask, XK_y, incrovgaps, {.i = +1 } }, + { MODKEY|ShiftMask, XK_o, incrovgaps, {.i = -1 } }, + { MODKEY, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_comma, focusmon, {.i = -1 } }, + { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) + TAGKEYS( XK_5, 4) + TAGKEYS( XK_6, 5) + TAGKEYS( XK_7, 6) + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) + { MODKEY|ShiftMask, XK_q, quit, {0} }, +}; + +/* button definitions */ +/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ +static Button buttons[] = { + /* click event mask button function argument */ + { ClkLtSymbol, 0, Button1, setlayout, {0} }, + { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, + { ClkWinTitle, 0, Button2, zoom, {0} }, + { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, + { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, + { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, + { ClkTagBar, 0, Button1, view, {0} }, + { ClkTagBar, 0, Button3, toggleview, {0} }, + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, +}; + diff --git a/dwm/dwm-6.2/dwm.1 b/dwm/dwm-6.2/dwm.1 new file mode 100644 index 0000000..13b3729 --- /dev/null +++ b/dwm/dwm-6.2/dwm.1 @@ -0,0 +1,176 @@ +.TH DWM 1 dwm\-VERSION +.SH NAME +dwm \- dynamic window manager +.SH SYNOPSIS +.B dwm +.RB [ \-v ] +.SH DESCRIPTION +dwm is a dynamic window manager for X. It manages windows in tiled, monocle +and floating layouts. Either layout can be applied dynamically, optimising the +environment for the application in use and the task performed. +.P +In tiled layouts windows are managed in a master and stacking area. The master +area on the left contains one window by default, and the stacking area on the +right contains all other windows. The number of master area windows can be +adjusted from zero to an arbitrary number. In monocle layout all windows are +maximised to the screen size. In floating layout windows can be resized and +moved freely. Dialog windows are always managed floating, regardless of the +layout applied. +.P +Windows are grouped by tags. Each window can be tagged with one or multiple +tags. Selecting certain tags displays all windows with these tags. +.P +Each screen contains a small status bar which displays all available tags, the +layout, the title of the focused window, and the text read from the root window +name property, if the screen is focused. A floating window is indicated with an +empty square and a maximised floating window is indicated with a filled square +before the windows title. The selected tags are indicated with a different +color. The tags of the focused window are indicated with a filled square in the +top left corner. The tags which are applied to one or more windows are +indicated with an empty square in the top left corner. +.P +dwm draws a small border around windows to indicate the focus state. +.SH OPTIONS +.TP +.B \-v +prints version information to standard output, then exits. +.SH USAGE +.SS Status bar +.TP +.B X root window name +is read and displayed in the status text area. It can be set with the +.BR xsetroot (1) +command. +.TP +.B Button1 +click on a tag label to display all windows with that tag, click on the layout +label toggles between tiled and floating layout. +.TP +.B Button3 +click on a tag label adds/removes all windows with that tag to/from the view. +.TP +.B Mod1\-Button1 +click on a tag label applies that tag to the focused window. +.TP +.B Mod1\-Button3 +click on a tag label adds/removes that tag to/from the focused window. +.SS Keyboard commands +.TP +.B Mod1\-Shift\-Return +Start +.BR st(1). +.TP +.B Mod1\-p +Spawn +.BR dmenu(1) +for launching other programs. +.TP +.B Mod1\-, +Focus previous screen, if any. +.TP +.B Mod1\-. +Focus next screen, if any. +.TP +.B Mod1\-Shift\-, +Send focused window to previous screen, if any. +.TP +.B Mod1\-Shift\-. +Send focused window to next screen, if any. +.TP +.B Mod1\-b +Toggles bar on and off. +.TP +.B Mod1\-t +Sets tiled layout. +.TP +.B Mod1\-f +Sets floating layout. +.TP +.B Mod1\-m +Sets monocle layout. +.TP +.B Mod1\-space +Toggles between current and previous layout. +.TP +.B Mod1\-j +Focus next window. +.TP +.B Mod1\-k +Focus previous window. +.TP +.B Mod1\-i +Increase number of windows in master area. +.TP +.B Mod1\-d +Decrease number of windows in master area. +.TP +.B Mod1\-l +Increase master area size. +.TP +.B Mod1\-h +Decrease master area size. +.TP +.B Mod1\-Return +Zooms/cycles focused window to/from master area (tiled layouts only). +.TP +.B Mod1\-Shift\-c +Close focused window. +.TP +.B Mod1\-Shift\-space +Toggle focused window between tiled and floating state. +.TP +.B Mod1\-Tab +Toggles to the previously selected tags. +.TP +.B Mod1\-Shift\-[1..n] +Apply nth tag to focused window. +.TP +.B Mod1\-Shift\-0 +Apply all tags to focused window. +.TP +.B Mod1\-Control\-Shift\-[1..n] +Add/remove nth tag to/from focused window. +.TP +.B Mod1\-[1..n] +View all windows with nth tag. +.TP +.B Mod1\-0 +View all windows with any tag. +.TP +.B Mod1\-Control\-[1..n] +Add/remove all windows with nth tag to/from the view. +.TP +.B Mod1\-Shift\-q +Quit dwm. +.SS Mouse commands +.TP +.B Mod1\-Button1 +Move focused window while dragging. Tiled windows will be toggled to the floating state. +.TP +.B Mod1\-Button2 +Toggles focused window between floating and tiled state. +.TP +.B Mod1\-Button3 +Resize focused window while dragging. Tiled windows will be toggled to the floating state. +.SH CUSTOMIZATION +dwm is customized by creating a custom config.h and (re)compiling the source +code. This keeps it fast, secure and simple. +.SH SEE ALSO +.BR dmenu (1), +.BR st (1) +.SH ISSUES +Java applications which use the XToolkit/XAWT backend may draw grey windows +only. The XToolkit/XAWT backend breaks ICCCM-compliance in recent JDK 1.5 and early +JDK 1.6 versions, because it assumes a reparenting window manager. Possible workarounds +are using JDK 1.4 (which doesn't contain the XToolkit/XAWT backend) or setting the +environment variable +.BR AWT_TOOLKIT=MToolkit +(to use the older Motif backend instead) or running +.B xprop -root -f _NET_WM_NAME 32a -set _NET_WM_NAME LG3D +or +.B wmname LG3D +(to pretend that a non-reparenting window manager is running that the +XToolkit/XAWT backend can recognize) or when using OpenJDK setting the environment variable +.BR _JAVA_AWT_WM_NONREPARENTING=1 . +.SH BUGS +Send all bug reports with a patch to hackers@suckless.org. diff --git a/dwm/dwm-6.2/dwm.c b/dwm/dwm-6.2/dwm.c new file mode 100644 index 0000000..88f3e04 --- /dev/null +++ b/dwm/dwm-6.2/dwm.c @@ -0,0 +1,2279 @@ +/* See LICENSE file for copyright and license details. + * + * dynamic window manager is designed like any other X client as well. It is + * driven through handling X events. In contrast to other X clients, a window + * manager selects for SubstructureRedirectMask on the root window, to receive + * events about window (dis-)appearance. Only one X connection at a time is + * allowed to select for this event mask. + * + * The event handlers of dwm are organized in an array which is accessed + * whenever a new event has been fetched. This allows event dispatching + * in O(1) time. + * + * Each child of the root window is called a client, except windows which have + * set the override_redirect flag. Clients are organized in a linked client + * list on each monitor, the focus history is remembered through a stack list + * on each monitor. Each client contains a bit array to indicate the tags of a + * client. + * + * Keys and tagging rules are organized as arrays and defined in config.h. + * + * To understand everything else, start reading main(). + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef XINERAMA +#include +#endif /* XINERAMA */ +#include + +#include "drw.h" +#include "util.h" + +/* macros */ +#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) +#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) +#define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \ + * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) +#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) +#define LENGTH(X) (sizeof X / sizeof X[0]) +#define MOUSEMASK (BUTTONMASK|PointerMotionMask) +#define WIDTH(X) ((X)->w + 2 * (X)->bw) +#define HEIGHT(X) ((X)->h + 2 * (X)->bw) +#define TAGMASK ((1 << LENGTH(tags)) - 1) +#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) + +/* enums */ +enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ +enum { SchemeNorm, SchemeSel }; /* color schemes */ +enum { NetSupported, NetWMName, NetWMState, NetWMCheck, + NetWMFullscreen, NetActiveWindow, NetWMWindowType, + NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ +enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ +enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, + ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ + +typedef union { + int i; + unsigned int ui; + float f; + const void *v; +} Arg; + +typedef struct { + unsigned int click; + unsigned int mask; + unsigned int button; + void (*func)(const Arg *arg); + const Arg arg; +} Button; + +typedef struct Monitor Monitor; +typedef struct Client Client; +struct Client { + char name[256]; + float mina, maxa; + int x, y, w, h; + int oldx, oldy, oldw, oldh; + int basew, baseh, incw, inch, maxw, maxh, minw, minh; + int bw, oldbw; + unsigned int tags; + int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; + Client *next; + Client *snext; + Monitor *mon; + Window win; +}; + +typedef struct { + unsigned int mod; + KeySym keysym; + void (*func)(const Arg *); + const Arg arg; +} Key; + +typedef struct { + const char *symbol; + void (*arrange)(Monitor *); +} Layout; + +struct Monitor { + char ltsymbol[16]; + float mfact; + int nmaster; + int num; + int by; /* bar geometry */ + int mx, my, mw, mh; /* screen size */ + int wx, wy, ww, wh; /* window area */ + int gappih; /* horizontal gap between windows */ + int gappiv; /* vertical gap between windows */ + int gappoh; /* horizontal outer gaps */ + int gappov; /* vertical outer gaps */ + unsigned int seltags; + unsigned int sellt; + unsigned int tagset[2]; + int showbar; + int topbar; + Client *clients; + Client *sel; + Client *stack; + Monitor *next; + Window barwin; + const Layout *lt[2]; +}; + +typedef struct { + const char *class; + const char *instance; + const char *title; + unsigned int tags; + int isfloating; + int monitor; +} Rule; + +/* function declarations */ +static void applyrules(Client *c); +static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact); +static void arrange(Monitor *m); +static void arrangemon(Monitor *m); +static void attach(Client *c); +static void attachstack(Client *c); +static void buttonpress(XEvent *e); +static void checkotherwm(void); +static void cleanup(void); +static void cleanupmon(Monitor *mon); +static void clientmessage(XEvent *e); +static void configure(Client *c); +static void configurenotify(XEvent *e); +static void configurerequest(XEvent *e); +static Monitor *createmon(void); +static void destroynotify(XEvent *e); +static void detach(Client *c); +static void detachstack(Client *c); +static Monitor *dirtomon(int dir); +static void drawbar(Monitor *m); +static void drawbars(void); +static void enternotify(XEvent *e); +static void expose(XEvent *e); +static void focus(Client *c); +static void focusin(XEvent *e); +static void focusmon(const Arg *arg); +static void focusstack(const Arg *arg); +static int getrootptr(int *x, int *y); +static long getstate(Window w); +static int gettextprop(Window w, Atom atom, char *text, unsigned int size); +static void grabbuttons(Client *c, int focused); +static void grabkeys(void); +static void incnmaster(const Arg *arg); +static void keypress(XEvent *e); +static void killclient(const Arg *arg); +static void manage(Window w, XWindowAttributes *wa); +static void mappingnotify(XEvent *e); +static void maprequest(XEvent *e); +static void monocle(Monitor *m); +static void motionnotify(XEvent *e); +static void movemouse(const Arg *arg); +static Client *nexttiled(Client *c); +static void pop(Client *); +static void propertynotify(XEvent *e); +static void quit(const Arg *arg); +static Monitor *recttomon(int x, int y, int w, int h); +static void resize(Client *c, int x, int y, int w, int h, int interact); +static void resizeclient(Client *c, int x, int y, int w, int h); +static void resizemouse(const Arg *arg); +static void restack(Monitor *m); +static void run(void); +static void scan(void); +static int sendevent(Client *c, Atom proto); +static void sendmon(Client *c, Monitor *m); +static void setclientstate(Client *c, long state); +static void setfocus(Client *c); +static void setfullscreen(Client *c, int fullscreen); +static void setgaps(int oh, int ov, int ih, int iv); +static void incrgaps(const Arg *arg); +static void incrigaps(const Arg *arg); +static void incrogaps(const Arg *arg); +static void incrohgaps(const Arg *arg); +static void incrovgaps(const Arg *arg); +static void incrihgaps(const Arg *arg); +static void incrivgaps(const Arg *arg); +static void togglegaps(const Arg *arg); +static void defaultgaps(const Arg *arg); +static void setlayout(const Arg *arg); +static void setmfact(const Arg *arg); +static void setup(void); +static void seturgent(Client *c, int urg); +static void showhide(Client *c); +static void sigchld(int unused); +static void spawn(const Arg *arg); +static void tag(const Arg *arg); +static void tagmon(const Arg *arg); +static void tile(Monitor *); +static void togglebar(const Arg *arg); +static void togglefloating(const Arg *arg); +static void toggletag(const Arg *arg); +static void toggleview(const Arg *arg); +static void unfocus(Client *c, int setfocus); +static void unmanage(Client *c, int destroyed); +static void unmapnotify(XEvent *e); +static void updatebarpos(Monitor *m); +static void updatebars(void); +static void updateclientlist(void); +static int updategeom(void); +static void updatenumlockmask(void); +static void updatesizehints(Client *c); +static void updatestatus(void); +static void updatetitle(Client *c); +static void updatewindowtype(Client *c); +static void updatewmhints(Client *c); +static void view(const Arg *arg); +static Client *wintoclient(Window w); +static Monitor *wintomon(Window w); +static int xerror(Display *dpy, XErrorEvent *ee); +static int xerrordummy(Display *dpy, XErrorEvent *ee); +static int xerrorstart(Display *dpy, XErrorEvent *ee); +static void zoom(const Arg *arg); + +/* variables */ +static const char broken[] = "broken"; +static char stext[256]; +static int screen; +static int sw, sh; /* X display screen geometry width, height */ +static int bh, blw = 0; /* bar geometry */ +static int enablegaps = 1; /* enables gaps, used by togglegaps */ +static int lrpad; /* sum of left and right padding for text */ +static int (*xerrorxlib)(Display *, XErrorEvent *); +static unsigned int numlockmask = 0; +static void (*handler[LASTEvent]) (XEvent *) = { + [ButtonPress] = buttonpress, + [ClientMessage] = clientmessage, + [ConfigureRequest] = configurerequest, + [ConfigureNotify] = configurenotify, + [DestroyNotify] = destroynotify, + [EnterNotify] = enternotify, + [Expose] = expose, + [FocusIn] = focusin, + [KeyPress] = keypress, + [MappingNotify] = mappingnotify, + [MapRequest] = maprequest, + [MotionNotify] = motionnotify, + [PropertyNotify] = propertynotify, + [UnmapNotify] = unmapnotify +}; +static Atom wmatom[WMLast], netatom[NetLast]; +static int running = 1; +static Cur *cursor[CurLast]; +static Clr **scheme; +static Display *dpy; +static Drw *drw; +static Monitor *mons, *selmon; +static Window root, wmcheckwin; + +/* configuration, allows nested code to access above variables */ +#include "config.h" + +/* compile-time check if all tags fit into an unsigned int bit array. */ +struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; + +/* function implementations */ +void +applyrules(Client *c) +{ + const char *class, *instance; + unsigned int i; + const Rule *r; + Monitor *m; + XClassHint ch = { NULL, NULL }; + + /* rule matching */ + c->isfloating = 0; + c->tags = 0; + XGetClassHint(dpy, c->win, &ch); + class = ch.res_class ? ch.res_class : broken; + instance = ch.res_name ? ch.res_name : broken; + + for (i = 0; i < LENGTH(rules); i++) { + r = &rules[i]; + if ((!r->title || strstr(c->name, r->title)) + && (!r->class || strstr(class, r->class)) + && (!r->instance || strstr(instance, r->instance))) + { + c->isfloating = r->isfloating; + c->tags |= r->tags; + for (m = mons; m && m->num != r->monitor; m = m->next); + if (m) + c->mon = m; + } + } + if (ch.res_class) + XFree(ch.res_class); + if (ch.res_name) + XFree(ch.res_name); + c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags]; +} + +int +applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact) +{ + int baseismin; + Monitor *m = c->mon; + + /* set minimum possible */ + *w = MAX(1, *w); + *h = MAX(1, *h); + if (interact) { + if (*x > sw) + *x = sw - WIDTH(c); + if (*y > sh) + *y = sh - HEIGHT(c); + if (*x + *w + 2 * c->bw < 0) + *x = 0; + if (*y + *h + 2 * c->bw < 0) + *y = 0; + } else { + if (*x >= m->wx + m->ww) + *x = m->wx + m->ww - WIDTH(c); + if (*y >= m->wy + m->wh) + *y = m->wy + m->wh - HEIGHT(c); + if (*x + *w + 2 * c->bw <= m->wx) + *x = m->wx; + if (*y + *h + 2 * c->bw <= m->wy) + *y = m->wy; + } + if (*h < bh) + *h = bh; + if (*w < bh) + *w = bh; + if (resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) { + /* see last two sentences in ICCCM 4.1.2.3 */ + baseismin = c->basew == c->minw && c->baseh == c->minh; + if (!baseismin) { /* temporarily remove base dimensions */ + *w -= c->basew; + *h -= c->baseh; + } + /* adjust for aspect limits */ + if (c->mina > 0 && c->maxa > 0) { + if (c->maxa < (float)*w / *h) + *w = *h * c->maxa + 0.5; + else if (c->mina < (float)*h / *w) + *h = *w * c->mina + 0.5; + } + if (baseismin) { /* increment calculation requires this */ + *w -= c->basew; + *h -= c->baseh; + } + /* adjust for increment value */ + if (c->incw) + *w -= *w % c->incw; + if (c->inch) + *h -= *h % c->inch; + /* restore base dimensions */ + *w = MAX(*w + c->basew, c->minw); + *h = MAX(*h + c->baseh, c->minh); + if (c->maxw) + *w = MIN(*w, c->maxw); + if (c->maxh) + *h = MIN(*h, c->maxh); + } + return *x != c->x || *y != c->y || *w != c->w || *h != c->h; +} + +void +arrange(Monitor *m) +{ + if (m) + showhide(m->stack); + else for (m = mons; m; m = m->next) + showhide(m->stack); + if (m) { + arrangemon(m); + restack(m); + } else for (m = mons; m; m = m->next) + arrangemon(m); +} + +void +arrangemon(Monitor *m) +{ + strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol); + if (m->lt[m->sellt]->arrange) + m->lt[m->sellt]->arrange(m); +} + +void +attach(Client *c) +{ + c->next = c->mon->clients; + c->mon->clients = c; +} + +void +attachstack(Client *c) +{ + c->snext = c->mon->stack; + c->mon->stack = c; +} + +void +buttonpress(XEvent *e) +{ + unsigned int i, x, click; + Arg arg = {0}; + Client *c; + Monitor *m; + XButtonPressedEvent *ev = &e->xbutton; + + click = ClkRootWin; + /* focus monitor if necessary */ + if ((m = wintomon(ev->window)) && m != selmon) { + unfocus(selmon->sel, 1); + selmon = m; + focus(NULL); + } + if (ev->window == selmon->barwin) { + i = x = 0; + do + x += TEXTW(tags[i]); + while (ev->x >= x && ++i < LENGTH(tags)); + if (i < LENGTH(tags)) { + click = ClkTagBar; + arg.ui = 1 << i; + } else if (ev->x < x + blw) + click = ClkLtSymbol; + else if (ev->x > selmon->ww - TEXTW(stext)) + click = ClkStatusText; + else + click = ClkWinTitle; + } else if ((c = wintoclient(ev->window))) { + focus(c); + restack(selmon); + XAllowEvents(dpy, ReplayPointer, CurrentTime); + click = ClkClientWin; + } + for (i = 0; i < LENGTH(buttons); i++) + if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button + && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) + buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg); +} + +void +checkotherwm(void) +{ + xerrorxlib = XSetErrorHandler(xerrorstart); + /* this causes an error if some other window manager is running */ + XSelectInput(dpy, DefaultRootWindow(dpy), SubstructureRedirectMask); + XSync(dpy, False); + XSetErrorHandler(xerror); + XSync(dpy, False); +} + +void +cleanup(void) +{ + Arg a = {.ui = ~0}; + Layout foo = { "", NULL }; + Monitor *m; + size_t i; + + view(&a); + selmon->lt[selmon->sellt] = &foo; + for (m = mons; m; m = m->next) + while (m->stack) + unmanage(m->stack, 0); + XUngrabKey(dpy, AnyKey, AnyModifier, root); + while (mons) + cleanupmon(mons); + for (i = 0; i < CurLast; i++) + drw_cur_free(drw, cursor[i]); + for (i = 0; i < LENGTH(colors); i++) + free(scheme[i]); + XDestroyWindow(dpy, wmcheckwin); + drw_free(drw); + XSync(dpy, False); + XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); + XDeleteProperty(dpy, root, netatom[NetActiveWindow]); +} + +void +cleanupmon(Monitor *mon) +{ + Monitor *m; + + if (mon == mons) + mons = mons->next; + else { + for (m = mons; m && m->next != mon; m = m->next); + m->next = mon->next; + } + XUnmapWindow(dpy, mon->barwin); + XDestroyWindow(dpy, mon->barwin); + free(mon); +} + +void +clientmessage(XEvent *e) +{ + XClientMessageEvent *cme = &e->xclient; + Client *c = wintoclient(cme->window); + + if (!c) + return; + if (cme->message_type == netatom[NetWMState]) { + if (cme->data.l[1] == netatom[NetWMFullscreen] + || cme->data.l[2] == netatom[NetWMFullscreen]) + setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ + || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); + } else if (cme->message_type == netatom[NetActiveWindow]) { + if (c != selmon->sel && !c->isurgent) + seturgent(c, 1); + } +} + +void +configure(Client *c) +{ + XConfigureEvent ce; + + ce.type = ConfigureNotify; + ce.display = dpy; + ce.event = c->win; + ce.window = c->win; + ce.x = c->x; + ce.y = c->y; + ce.width = c->w; + ce.height = c->h; + ce.border_width = c->bw; + ce.above = None; + ce.override_redirect = False; + XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce); +} + +void +configurenotify(XEvent *e) +{ + Monitor *m; + Client *c; + XConfigureEvent *ev = &e->xconfigure; + int dirty; + + /* TODO: updategeom handling sucks, needs to be simplified */ + if (ev->window == root) { + dirty = (sw != ev->width || sh != ev->height); + sw = ev->width; + sh = ev->height; + if (updategeom() || dirty) { + drw_resize(drw, sw, bh); + updatebars(); + for (m = mons; m; m = m->next) { + for (c = m->clients; c; c = c->next) + if (c->isfullscreen) + resizeclient(c, m->mx, m->my, m->mw, m->mh); + XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh); + } + focus(NULL); + arrange(NULL); + } + } +} + +void +configurerequest(XEvent *e) +{ + Client *c; + Monitor *m; + XConfigureRequestEvent *ev = &e->xconfigurerequest; + XWindowChanges wc; + + if ((c = wintoclient(ev->window))) { + if (ev->value_mask & CWBorderWidth) + c->bw = ev->border_width; + else if (c->isfloating || !selmon->lt[selmon->sellt]->arrange) { + m = c->mon; + if (ev->value_mask & CWX) { + c->oldx = c->x; + c->x = m->mx + ev->x; + } + if (ev->value_mask & CWY) { + c->oldy = c->y; + c->y = m->my + ev->y; + } + if (ev->value_mask & CWWidth) { + c->oldw = c->w; + c->w = ev->width; + } + if (ev->value_mask & CWHeight) { + c->oldh = c->h; + c->h = ev->height; + } + if ((c->x + c->w) > m->mx + m->mw && c->isfloating) + c->x = m->mx + (m->mw / 2 - WIDTH(c) / 2); /* center in x direction */ + if ((c->y + c->h) > m->my + m->mh && c->isfloating) + c->y = m->my + (m->mh / 2 - HEIGHT(c) / 2); /* center in y direction */ + if ((ev->value_mask & (CWX|CWY)) && !(ev->value_mask & (CWWidth|CWHeight))) + configure(c); + if (ISVISIBLE(c)) + XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); + } else + configure(c); + } else { + wc.x = ev->x; + wc.y = ev->y; + wc.width = ev->width; + wc.height = ev->height; + wc.border_width = ev->border_width; + wc.sibling = ev->above; + wc.stack_mode = ev->detail; + XConfigureWindow(dpy, ev->window, ev->value_mask, &wc); + } + XSync(dpy, False); +} + +Monitor * +createmon(void) +{ + Monitor *m; + + m = ecalloc(1, sizeof(Monitor)); + m->tagset[0] = m->tagset[1] = 1; + m->mfact = mfact; + m->nmaster = nmaster; + m->showbar = showbar; + m->topbar = topbar; + m->gappih = gappih; + m->gappiv = gappiv; + m->gappoh = gappoh; + m->gappov = gappov; + m->lt[0] = &layouts[0]; + m->lt[1] = &layouts[1 % LENGTH(layouts)]; + strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); + return m; +} + +void +destroynotify(XEvent *e) +{ + Client *c; + XDestroyWindowEvent *ev = &e->xdestroywindow; + + if ((c = wintoclient(ev->window))) + unmanage(c, 1); +} + +void +detach(Client *c) +{ + Client **tc; + + for (tc = &c->mon->clients; *tc && *tc != c; tc = &(*tc)->next); + *tc = c->next; +} + +void +detachstack(Client *c) +{ + Client **tc, *t; + + for (tc = &c->mon->stack; *tc && *tc != c; tc = &(*tc)->snext); + *tc = c->snext; + + if (c == c->mon->sel) { + for (t = c->mon->stack; t && !ISVISIBLE(t); t = t->snext); + c->mon->sel = t; + } +} + +Monitor * +dirtomon(int dir) +{ + Monitor *m = NULL; + + if (dir > 0) { + if (!(m = selmon->next)) + m = mons; + } else if (selmon == mons) + for (m = mons; m->next; m = m->next); + else + for (m = mons; m->next != selmon; m = m->next); + return m; +} + +void +drawbar(Monitor *m) +{ + int x, w, sw = 0; + int boxs = drw->fonts->h / 9; + int boxw = drw->fonts->h / 6 + 2; + unsigned int i, occ = 0, urg = 0; + Client *c; + + /* draw status first so it can be overdrawn by tags later */ + if (m == selmon) { /* status is only drawn on selected monitor */ + drw_setscheme(drw, scheme[SchemeNorm]); + sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ + drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0); + } + + for (c = m->clients; c; c = c->next) { + occ |= c->tags; + if (c->isurgent) + urg |= c->tags; + } + x = 0; + for (i = 0; i < LENGTH(tags); i++) { + w = TEXTW(tags[i]); + drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); + drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); + if (occ & 1 << i) + drw_rect(drw, x + boxs, boxs, boxw, boxw, + m == selmon && selmon->sel && selmon->sel->tags & 1 << i, + urg & 1 << i); + x += w; + } + w = blw = TEXTW(m->ltsymbol); + drw_setscheme(drw, scheme[SchemeNorm]); + x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); + + if ((w = m->ww - sw - x) > bh) { + if (m->sel) { + drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); + drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); + if (m->sel->isfloating) + drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); + } else { + drw_setscheme(drw, scheme[SchemeNorm]); + drw_rect(drw, x, 0, w, bh, 1, 1); + } + } + drw_map(drw, m->barwin, 0, 0, m->ww, bh); +} + +void +drawbars(void) +{ + Monitor *m; + + for (m = mons; m; m = m->next) + drawbar(m); +} + +void +enternotify(XEvent *e) +{ + Client *c; + Monitor *m; + XCrossingEvent *ev = &e->xcrossing; + + if ((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root) + return; + c = wintoclient(ev->window); + m = c ? c->mon : wintomon(ev->window); + if (m != selmon) { + unfocus(selmon->sel, 1); + selmon = m; + } else if (!c || c == selmon->sel) + return; + focus(c); +} + +void +expose(XEvent *e) +{ + Monitor *m; + XExposeEvent *ev = &e->xexpose; + + if (ev->count == 0 && (m = wintomon(ev->window))) + drawbar(m); +} + +void +focus(Client *c) +{ + if (!c || !ISVISIBLE(c)) + for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext); + if (selmon->sel && selmon->sel != c) + unfocus(selmon->sel, 0); + if (c) { + if (c->mon != selmon) + selmon = c->mon; + if (c->isurgent) + seturgent(c, 0); + detachstack(c); + attachstack(c); + grabbuttons(c, 1); + XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); + setfocus(c); + } else { + XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + XDeleteProperty(dpy, root, netatom[NetActiveWindow]); + } + selmon->sel = c; + drawbars(); +} + +/* there are some broken focus acquiring clients needing extra handling */ +void +focusin(XEvent *e) +{ + XFocusChangeEvent *ev = &e->xfocus; + + if (selmon->sel && ev->window != selmon->sel->win) + setfocus(selmon->sel); +} + +void +focusmon(const Arg *arg) +{ + Monitor *m; + + if (!mons->next) + return; + if ((m = dirtomon(arg->i)) == selmon) + return; + unfocus(selmon->sel, 0); + selmon = m; + focus(NULL); +} + +void +focusstack(const Arg *arg) +{ + Client *c = NULL, *i; + + if (!selmon->sel) + return; + if (arg->i > 0) { + for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next); + if (!c) + for (c = selmon->clients; c && !ISVISIBLE(c); c = c->next); + } else { + for (i = selmon->clients; i != selmon->sel; i = i->next) + if (ISVISIBLE(i)) + c = i; + if (!c) + for (; i; i = i->next) + if (ISVISIBLE(i)) + c = i; + } + if (c) { + focus(c); + restack(selmon); + } +} + +Atom +getatomprop(Client *c, Atom prop) +{ + int di; + unsigned long dl; + unsigned char *p = NULL; + Atom da, atom = None; + + if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, XA_ATOM, + &da, &di, &dl, &dl, &p) == Success && p) { + atom = *(Atom *)p; + XFree(p); + } + return atom; +} + +int +getrootptr(int *x, int *y) +{ + int di; + unsigned int dui; + Window dummy; + + return XQueryPointer(dpy, root, &dummy, &dummy, x, y, &di, &di, &dui); +} + +long +getstate(Window w) +{ + int format; + long result = -1; + unsigned char *p = NULL; + unsigned long n, extra; + Atom real; + + if (XGetWindowProperty(dpy, w, wmatom[WMState], 0L, 2L, False, wmatom[WMState], + &real, &format, &n, &extra, (unsigned char **)&p) != Success) + return -1; + if (n != 0) + result = *p; + XFree(p); + return result; +} + +int +gettextprop(Window w, Atom atom, char *text, unsigned int size) +{ + char **list = NULL; + int n; + XTextProperty name; + + if (!text || size == 0) + return 0; + text[0] = '\0'; + if (!XGetTextProperty(dpy, w, &name, atom) || !name.nitems) + return 0; + if (name.encoding == XA_STRING) + strncpy(text, (char *)name.value, size - 1); + else { + if (XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success && n > 0 && *list) { + strncpy(text, *list, size - 1); + XFreeStringList(list); + } + } + text[size - 1] = '\0'; + XFree(name.value); + return 1; +} + +void +grabbuttons(Client *c, int focused) +{ + updatenumlockmask(); + { + unsigned int i, j; + unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask }; + XUngrabButton(dpy, AnyButton, AnyModifier, c->win); + if (!focused) + XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, + BUTTONMASK, GrabModeSync, GrabModeSync, None, None); + for (i = 0; i < LENGTH(buttons); i++) + if (buttons[i].click == ClkClientWin) + for (j = 0; j < LENGTH(modifiers); j++) + XGrabButton(dpy, buttons[i].button, + buttons[i].mask | modifiers[j], + c->win, False, BUTTONMASK, + GrabModeAsync, GrabModeSync, None, None); + } +} + +void +grabkeys(void) +{ + updatenumlockmask(); + { + unsigned int i, j; + unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask }; + KeyCode code; + + XUngrabKey(dpy, AnyKey, AnyModifier, root); + for (i = 0; i < LENGTH(keys); i++) + if ((code = XKeysymToKeycode(dpy, keys[i].keysym))) + for (j = 0; j < LENGTH(modifiers); j++) + XGrabKey(dpy, code, keys[i].mod | modifiers[j], root, + True, GrabModeAsync, GrabModeAsync); + } +} + +void +incnmaster(const Arg *arg) +{ + selmon->nmaster = MAX(selmon->nmaster + arg->i, 0); + arrange(selmon); +} + +#ifdef XINERAMA +static int +isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info) +{ + while (n--) + if (unique[n].x_org == info->x_org && unique[n].y_org == info->y_org + && unique[n].width == info->width && unique[n].height == info->height) + return 0; + return 1; +} +#endif /* XINERAMA */ + +void +keypress(XEvent *e) +{ + unsigned int i; + KeySym keysym; + XKeyEvent *ev; + + ev = &e->xkey; + keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); + for (i = 0; i < LENGTH(keys); i++) + if (keysym == keys[i].keysym + && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state) + && keys[i].func) + keys[i].func(&(keys[i].arg)); +} + +void +killclient(const Arg *arg) +{ + if (!selmon->sel) + return; + if (!sendevent(selmon->sel, wmatom[WMDelete])) { + XGrabServer(dpy); + XSetErrorHandler(xerrordummy); + XSetCloseDownMode(dpy, DestroyAll); + XKillClient(dpy, selmon->sel->win); + XSync(dpy, False); + XSetErrorHandler(xerror); + XUngrabServer(dpy); + } +} + +void +manage(Window w, XWindowAttributes *wa) +{ + Client *c, *t = NULL; + Window trans = None; + XWindowChanges wc; + + c = ecalloc(1, sizeof(Client)); + c->win = w; + /* geometry */ + c->x = c->oldx = wa->x; + c->y = c->oldy = wa->y; + c->w = c->oldw = wa->width; + c->h = c->oldh = wa->height; + c->oldbw = wa->border_width; + + updatetitle(c); + if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) { + c->mon = t->mon; + c->tags = t->tags; + } else { + c->mon = selmon; + applyrules(c); + } + + if (c->x + WIDTH(c) > c->mon->mx + c->mon->mw) + c->x = c->mon->mx + c->mon->mw - WIDTH(c); + if (c->y + HEIGHT(c) > c->mon->my + c->mon->mh) + c->y = c->mon->my + c->mon->mh - HEIGHT(c); + c->x = MAX(c->x, c->mon->mx); + /* only fix client y-offset, if the client center might cover the bar */ + c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx) + && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); + c->bw = borderpx; + + wc.border_width = c->bw; + XConfigureWindow(dpy, w, CWBorderWidth, &wc); + XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); + configure(c); /* propagates border_width, if size doesn't change */ + updatewindowtype(c); + updatesizehints(c); + updatewmhints(c); + XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); + grabbuttons(c, 0); + if (!c->isfloating) + c->isfloating = c->oldstate = trans != None || c->isfixed; + if (c->isfloating) + XRaiseWindow(dpy, c->win); + attach(c); + attachstack(c); + XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, + (unsigned char *) &(c->win), 1); + XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */ + setclientstate(c, NormalState); + if (c->mon == selmon) + unfocus(selmon->sel, 0); + c->mon->sel = c; + arrange(c->mon); + XMapWindow(dpy, c->win); + focus(NULL); +} + +void +mappingnotify(XEvent *e) +{ + XMappingEvent *ev = &e->xmapping; + + XRefreshKeyboardMapping(ev); + if (ev->request == MappingKeyboard) + grabkeys(); +} + +void +maprequest(XEvent *e) +{ + static XWindowAttributes wa; + XMapRequestEvent *ev = &e->xmaprequest; + + if (!XGetWindowAttributes(dpy, ev->window, &wa)) + return; + if (wa.override_redirect) + return; + if (!wintoclient(ev->window)) + manage(ev->window, &wa); +} + +void +monocle(Monitor *m) +{ + unsigned int n = 0; + Client *c; + + for (c = m->clients; c; c = c->next) + if (ISVISIBLE(c)) + n++; + if (n > 0) /* override layout symbol */ + snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n); + for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) + resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0); +} + +void +motionnotify(XEvent *e) +{ + static Monitor *mon = NULL; + Monitor *m; + XMotionEvent *ev = &e->xmotion; + + if (ev->window != root) + return; + if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) { + unfocus(selmon->sel, 1); + selmon = m; + focus(NULL); + } + mon = m; +} + +void +movemouse(const Arg *arg) +{ + int x, y, ocx, ocy, nx, ny; + Client *c; + Monitor *m; + XEvent ev; + Time lasttime = 0; + + if (!(c = selmon->sel)) + return; + if (c->isfullscreen) /* no support moving fullscreen windows by mouse */ + return; + restack(selmon); + ocx = c->x; + ocy = c->y; + if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, + None, cursor[CurMove]->cursor, CurrentTime) != GrabSuccess) + return; + if (!getrootptr(&x, &y)) + return; + do { + XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); + switch(ev.type) { + case ConfigureRequest: + case Expose: + case MapRequest: + handler[ev.type](&ev); + break; + case MotionNotify: + if ((ev.xmotion.time - lasttime) <= (1000 / 60)) + continue; + lasttime = ev.xmotion.time; + + nx = ocx + (ev.xmotion.x - x); + ny = ocy + (ev.xmotion.y - y); + if (abs(selmon->wx - nx) < snap) + nx = selmon->wx; + else if (abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap) + nx = selmon->wx + selmon->ww - WIDTH(c); + if (abs(selmon->wy - ny) < snap) + ny = selmon->wy; + else if (abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap) + ny = selmon->wy + selmon->wh - HEIGHT(c); + if (!c->isfloating && selmon->lt[selmon->sellt]->arrange + && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) + togglefloating(NULL); + if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) + resize(c, nx, ny, c->w, c->h, 1); + break; + } + } while (ev.type != ButtonRelease); + XUngrabPointer(dpy, CurrentTime); + if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { + sendmon(c, m); + selmon = m; + focus(NULL); + } +} + +Client * +nexttiled(Client *c) +{ + for (; c && (c->isfloating || !ISVISIBLE(c)); c = c->next); + return c; +} + +void +pop(Client *c) +{ + detach(c); + attach(c); + focus(c); + arrange(c->mon); +} + +void +propertynotify(XEvent *e) +{ + Client *c; + Window trans; + XPropertyEvent *ev = &e->xproperty; + + if ((ev->window == root) && (ev->atom == XA_WM_NAME)) + updatestatus(); + else if (ev->state == PropertyDelete) + return; /* ignore */ + else if ((c = wintoclient(ev->window))) { + switch(ev->atom) { + default: break; + case XA_WM_TRANSIENT_FOR: + if (!c->isfloating && (XGetTransientForHint(dpy, c->win, &trans)) && + (c->isfloating = (wintoclient(trans)) != NULL)) + arrange(c->mon); + break; + case XA_WM_NORMAL_HINTS: + updatesizehints(c); + break; + case XA_WM_HINTS: + updatewmhints(c); + drawbars(); + break; + } + if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { + updatetitle(c); + if (c == c->mon->sel) + drawbar(c->mon); + } + if (ev->atom == netatom[NetWMWindowType]) + updatewindowtype(c); + } +} + +void +quit(const Arg *arg) +{ + running = 0; +} + +Monitor * +recttomon(int x, int y, int w, int h) +{ + Monitor *m, *r = selmon; + int a, area = 0; + + for (m = mons; m; m = m->next) + if ((a = INTERSECT(x, y, w, h, m)) > area) { + area = a; + r = m; + } + return r; +} + +void +resize(Client *c, int x, int y, int w, int h, int interact) +{ + if (applysizehints(c, &x, &y, &w, &h, interact)) + resizeclient(c, x, y, w, h); +} + +void +resizeclient(Client *c, int x, int y, int w, int h) +{ + XWindowChanges wc; + + c->oldx = c->x; c->x = wc.x = x; + c->oldy = c->y; c->y = wc.y = y; + c->oldw = c->w; c->w = wc.width = w; + c->oldh = c->h; c->h = wc.height = h; + wc.border_width = c->bw; + XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); + configure(c); + XSync(dpy, False); +} + +void +resizemouse(const Arg *arg) +{ + int ocx, ocy, nw, nh; + Client *c; + Monitor *m; + XEvent ev; + Time lasttime = 0; + + if (!(c = selmon->sel)) + return; + if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */ + return; + restack(selmon); + ocx = c->x; + ocy = c->y; + if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, + None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess) + return; + XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); + do { + XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); + switch(ev.type) { + case ConfigureRequest: + case Expose: + case MapRequest: + handler[ev.type](&ev); + break; + case MotionNotify: + if ((ev.xmotion.time - lasttime) <= (1000 / 60)) + continue; + lasttime = ev.xmotion.time; + + nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); + nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); + if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww + && c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh) + { + if (!c->isfloating && selmon->lt[selmon->sellt]->arrange + && (abs(nw - c->w) > snap || abs(nh - c->h) > snap)) + togglefloating(NULL); + } + if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) + resize(c, c->x, c->y, nw, nh, 1); + break; + } + } while (ev.type != ButtonRelease); + XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); + XUngrabPointer(dpy, CurrentTime); + while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); + if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { + sendmon(c, m); + selmon = m; + focus(NULL); + } +} + +void +restack(Monitor *m) +{ + Client *c; + XEvent ev; + XWindowChanges wc; + + drawbar(m); + if (!m->sel) + return; + if (m->sel->isfloating || !m->lt[m->sellt]->arrange) + XRaiseWindow(dpy, m->sel->win); + if (m->lt[m->sellt]->arrange) { + wc.stack_mode = Below; + wc.sibling = m->barwin; + for (c = m->stack; c; c = c->snext) + if (!c->isfloating && ISVISIBLE(c)) { + XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc); + wc.sibling = c->win; + } + } + XSync(dpy, False); + while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); +} + +void +run(void) +{ + XEvent ev; + /* main event loop */ + XSync(dpy, False); + while (running && !XNextEvent(dpy, &ev)) + if (handler[ev.type]) + handler[ev.type](&ev); /* call handler */ +} + +void +scan(void) +{ + unsigned int i, num; + Window d1, d2, *wins = NULL; + XWindowAttributes wa; + + if (XQueryTree(dpy, root, &d1, &d2, &wins, &num)) { + for (i = 0; i < num; i++) { + if (!XGetWindowAttributes(dpy, wins[i], &wa) + || wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1)) + continue; + if (wa.map_state == IsViewable || getstate(wins[i]) == IconicState) + manage(wins[i], &wa); + } + for (i = 0; i < num; i++) { /* now the transients */ + if (!XGetWindowAttributes(dpy, wins[i], &wa)) + continue; + if (XGetTransientForHint(dpy, wins[i], &d1) + && (wa.map_state == IsViewable || getstate(wins[i]) == IconicState)) + manage(wins[i], &wa); + } + if (wins) + XFree(wins); + } +} + +void +sendmon(Client *c, Monitor *m) +{ + if (c->mon == m) + return; + unfocus(c, 1); + detach(c); + detachstack(c); + c->mon = m; + c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ + attach(c); + attachstack(c); + focus(NULL); + arrange(NULL); +} + +void +setclientstate(Client *c, long state) +{ + long data[] = { state, None }; + + XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32, + PropModeReplace, (unsigned char *)data, 2); +} + +int +sendevent(Client *c, Atom proto) +{ + int n; + Atom *protocols; + int exists = 0; + XEvent ev; + + if (XGetWMProtocols(dpy, c->win, &protocols, &n)) { + while (!exists && n--) + exists = protocols[n] == proto; + XFree(protocols); + } + if (exists) { + ev.type = ClientMessage; + ev.xclient.window = c->win; + ev.xclient.message_type = wmatom[WMProtocols]; + ev.xclient.format = 32; + ev.xclient.data.l[0] = proto; + ev.xclient.data.l[1] = CurrentTime; + XSendEvent(dpy, c->win, False, NoEventMask, &ev); + } + return exists; +} + +void +setfocus(Client *c) +{ + if (!c->neverfocus) { + XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); + XChangeProperty(dpy, root, netatom[NetActiveWindow], + XA_WINDOW, 32, PropModeReplace, + (unsigned char *) &(c->win), 1); + } + sendevent(c, wmatom[WMTakeFocus]); +} + +void +setfullscreen(Client *c, int fullscreen) +{ + if (fullscreen && !c->isfullscreen) { + XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, + PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); + c->isfullscreen = 1; + c->oldstate = c->isfloating; + c->oldbw = c->bw; + c->bw = 0; + c->isfloating = 1; + resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh); + XRaiseWindow(dpy, c->win); + } else if (!fullscreen && c->isfullscreen){ + XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, + PropModeReplace, (unsigned char*)0, 0); + c->isfullscreen = 0; + c->isfloating = c->oldstate; + c->bw = c->oldbw; + c->x = c->oldx; + c->y = c->oldy; + c->w = c->oldw; + c->h = c->oldh; + resizeclient(c, c->x, c->y, c->w, c->h); + arrange(c->mon); + } +} + +void +setgaps(int oh, int ov, int ih, int iv) +{ + if (oh < 0) oh = 0; + if (ov < 0) ov = 0; + if (ih < 0) ih = 0; + if (iv < 0) iv = 0; + + selmon->gappoh = oh; + selmon->gappov = ov; + selmon->gappih = ih; + selmon->gappiv = iv; + arrange(selmon); +} + +void +togglegaps(const Arg *arg) +{ + enablegaps = !enablegaps; + arrange(selmon); +} + +void +defaultgaps(const Arg *arg) +{ + setgaps(gappoh, gappov, gappih, gappiv); +} + +void +incrgaps(const Arg *arg) +{ + setgaps( + selmon->gappoh + arg->i, + selmon->gappov + arg->i, + selmon->gappih + arg->i, + selmon->gappiv + arg->i + ); +} + +void +incrigaps(const Arg *arg) +{ + setgaps( + selmon->gappoh, + selmon->gappov, + selmon->gappih + arg->i, + selmon->gappiv + arg->i + ); +} + +void +incrogaps(const Arg *arg) +{ + setgaps( + selmon->gappoh + arg->i, + selmon->gappov + arg->i, + selmon->gappih, + selmon->gappiv + ); +} + +void +incrohgaps(const Arg *arg) +{ + setgaps( + selmon->gappoh + arg->i, + selmon->gappov, + selmon->gappih, + selmon->gappiv + ); +} + +void +incrovgaps(const Arg *arg) +{ + setgaps( + selmon->gappoh, + selmon->gappov + arg->i, + selmon->gappih, + selmon->gappiv + ); +} + +void +incrihgaps(const Arg *arg) +{ + setgaps( + selmon->gappoh, + selmon->gappov, + selmon->gappih + arg->i, + selmon->gappiv + ); +} + +void +incrivgaps(const Arg *arg) +{ + setgaps( + selmon->gappoh, + selmon->gappov, + selmon->gappih, + selmon->gappiv + arg->i + ); +} + +void +setlayout(const Arg *arg) +{ + if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) + selmon->sellt ^= 1; + if (arg && arg->v) + selmon->lt[selmon->sellt] = (Layout *)arg->v; + strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); + if (selmon->sel) + arrange(selmon); + else + drawbar(selmon); +} + +/* arg > 1.0 will set mfact absolutely */ +void +setmfact(const Arg *arg) +{ + float f; + + if (!arg || !selmon->lt[selmon->sellt]->arrange) + return; + f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0; + if (f < 0.1 || f > 0.9) + return; + selmon->mfact = f; + arrange(selmon); +} + +void +setup(void) +{ + int i; + XSetWindowAttributes wa; + Atom utf8string; + + /* clean up any zombies immediately */ + sigchld(0); + + /* init screen */ + screen = DefaultScreen(dpy); + sw = DisplayWidth(dpy, screen); + sh = DisplayHeight(dpy, screen); + root = RootWindow(dpy, screen); + drw = drw_create(dpy, screen, root, sw, sh); + if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) + die("no fonts could be loaded."); + lrpad = drw->fonts->h; + bh = drw->fonts->h + 2; + updategeom(); + /* init atoms */ + utf8string = XInternAtom(dpy, "UTF8_STRING", False); + wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); + wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); + wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); + wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False); + netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False); + netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); + netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); + netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); + netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False); + netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); + netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); + netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); + netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); + /* init cursors */ + cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); + cursor[CurResize] = drw_cur_create(drw, XC_sizing); + cursor[CurMove] = drw_cur_create(drw, XC_fleur); + /* init appearance */ + scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); + for (i = 0; i < LENGTH(colors); i++) + scheme[i] = drw_scm_create(drw, colors[i], 3); + /* init bars */ + updatebars(); + updatestatus(); + /* supporting window for NetWMCheck */ + wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0); + XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32, + PropModeReplace, (unsigned char *) &wmcheckwin, 1); + XChangeProperty(dpy, wmcheckwin, netatom[NetWMName], utf8string, 8, + PropModeReplace, (unsigned char *) "dwm", 3); + XChangeProperty(dpy, root, netatom[NetWMCheck], XA_WINDOW, 32, + PropModeReplace, (unsigned char *) &wmcheckwin, 1); + /* EWMH support per view */ + XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, + PropModeReplace, (unsigned char *) netatom, NetLast); + XDeleteProperty(dpy, root, netatom[NetClientList]); + /* select events */ + wa.cursor = cursor[CurNormal]->cursor; + wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask + |ButtonPressMask|PointerMotionMask|EnterWindowMask + |LeaveWindowMask|StructureNotifyMask|PropertyChangeMask; + XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa); + XSelectInput(dpy, root, wa.event_mask); + grabkeys(); + focus(NULL); +} + + +void +seturgent(Client *c, int urg) +{ + XWMHints *wmh; + + c->isurgent = urg; + if (!(wmh = XGetWMHints(dpy, c->win))) + return; + wmh->flags = urg ? (wmh->flags | XUrgencyHint) : (wmh->flags & ~XUrgencyHint); + XSetWMHints(dpy, c->win, wmh); + XFree(wmh); +} + +void +showhide(Client *c) +{ + if (!c) + return; + if (ISVISIBLE(c)) { + /* show clients top down */ + XMoveWindow(dpy, c->win, c->x, c->y); + if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen) + resize(c, c->x, c->y, c->w, c->h, 0); + showhide(c->snext); + } else { + /* hide clients bottom up */ + showhide(c->snext); + XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y); + } +} + +void +sigchld(int unused) +{ + if (signal(SIGCHLD, sigchld) == SIG_ERR) + die("can't install SIGCHLD handler:"); + while (0 < waitpid(-1, NULL, WNOHANG)); +} + +void +spawn(const Arg *arg) +{ + if (arg->v == dmenucmd) + dmenumon[0] = '0' + selmon->num; + if (fork() == 0) { + if (dpy) + close(ConnectionNumber(dpy)); + setsid(); + execvp(((char **)arg->v)[0], (char **)arg->v); + fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]); + perror(" failed"); + exit(EXIT_SUCCESS); + } +} + +void +tag(const Arg *arg) +{ + if (selmon->sel && arg->ui & TAGMASK) { + selmon->sel->tags = arg->ui & TAGMASK; + focus(NULL); + arrange(selmon); + } +} + +void +tagmon(const Arg *arg) +{ + if (!selmon->sel || !mons->next) + return; + sendmon(selmon->sel, dirtomon(arg->i)); +} + +void +tile(Monitor *m) +{ + unsigned int i, n, h, r, oe = enablegaps, ie = enablegaps, mw, my, ty; + Client *c; + + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); + if (n == 0) + return; + + if (smartgaps == n) { + oe = 0; // outer gaps disabled + } + + if (n > m->nmaster) + mw = m->nmaster ? (m->ww + m->gappiv*ie) * m->mfact : 0; + else + mw = m->ww - 2*m->gappov*oe + m->gappiv*ie; + for (i = 0, my = ty = m->gappoh*oe, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) + if (i < m->nmaster) { + r = MIN(n, m->nmaster) - i; + h = (m->wh - my - m->gappoh*oe - m->gappih*ie * (r - 1)) / r; + resize(c, m->wx + m->gappov*oe, m->wy + my, mw - (2*c->bw) - m->gappiv*ie, h - (2*c->bw), 0); + my += HEIGHT(c) + m->gappih*ie; + } else { + r = n - i; + h = (m->wh - ty - m->gappoh*oe - m->gappih*ie * (r - 1)) / r; + resize(c, m->wx + mw + m->gappov*oe, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappov*oe, h - (2*c->bw), 0); + ty += HEIGHT(c) + m->gappih*ie; + } +} + +void +togglebar(const Arg *arg) +{ + selmon->showbar = !selmon->showbar; + updatebarpos(selmon); + XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh); + arrange(selmon); +} + +void +togglefloating(const Arg *arg) +{ + if (!selmon->sel) + return; + if (selmon->sel->isfullscreen) /* no support for fullscreen windows */ + return; + selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed; + if (selmon->sel->isfloating) + resize(selmon->sel, selmon->sel->x, selmon->sel->y, + selmon->sel->w, selmon->sel->h, 0); + arrange(selmon); +} + +void +toggletag(const Arg *arg) +{ + unsigned int newtags; + + if (!selmon->sel) + return; + newtags = selmon->sel->tags ^ (arg->ui & TAGMASK); + if (newtags) { + selmon->sel->tags = newtags; + focus(NULL); + arrange(selmon); + } +} + +void +toggleview(const Arg *arg) +{ + unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK); + + if (newtagset) { + selmon->tagset[selmon->seltags] = newtagset; + focus(NULL); + arrange(selmon); + } +} + +void +unfocus(Client *c, int setfocus) +{ + if (!c) + return; + grabbuttons(c, 0); + XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel); + if (setfocus) { + XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + XDeleteProperty(dpy, root, netatom[NetActiveWindow]); + } +} + +void +unmanage(Client *c, int destroyed) +{ + Monitor *m = c->mon; + XWindowChanges wc; + + detach(c); + detachstack(c); + if (!destroyed) { + wc.border_width = c->oldbw; + XGrabServer(dpy); /* avoid race conditions */ + XSetErrorHandler(xerrordummy); + XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */ + XUngrabButton(dpy, AnyButton, AnyModifier, c->win); + setclientstate(c, WithdrawnState); + XSync(dpy, False); + XSetErrorHandler(xerror); + XUngrabServer(dpy); + } + free(c); + focus(NULL); + updateclientlist(); + arrange(m); +} + +void +unmapnotify(XEvent *e) +{ + Client *c; + XUnmapEvent *ev = &e->xunmap; + + if ((c = wintoclient(ev->window))) { + if (ev->send_event) + setclientstate(c, WithdrawnState); + else + unmanage(c, 0); + } +} + +void +updatebars(void) +{ + Monitor *m; + XSetWindowAttributes wa = { + .override_redirect = True, + .background_pixmap = ParentRelative, + .event_mask = ButtonPressMask|ExposureMask + }; + XClassHint ch = {"dwm", "dwm"}; + for (m = mons; m; m = m->next) { + if (m->barwin) + continue; + m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen), + CopyFromParent, DefaultVisual(dpy, screen), + CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); + XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor); + XMapRaised(dpy, m->barwin); + XSetClassHint(dpy, m->barwin, &ch); + } +} + +void +updatebarpos(Monitor *m) +{ + m->wy = m->my; + m->wh = m->mh; + if (m->showbar) { + m->wh -= bh; + m->by = m->topbar ? m->wy : m->wy + m->wh; + m->wy = m->topbar ? m->wy + bh : m->wy; + } else + m->by = -bh; +} + +void +updateclientlist() +{ + Client *c; + Monitor *m; + + XDeleteProperty(dpy, root, netatom[NetClientList]); + for (m = mons; m; m = m->next) + for (c = m->clients; c; c = c->next) + XChangeProperty(dpy, root, netatom[NetClientList], + XA_WINDOW, 32, PropModeAppend, + (unsigned char *) &(c->win), 1); +} + +int +updategeom(void) +{ + int dirty = 0; + +#ifdef XINERAMA + if (XineramaIsActive(dpy)) { + int i, j, n, nn; + Client *c; + Monitor *m; + XineramaScreenInfo *info = XineramaQueryScreens(dpy, &nn); + XineramaScreenInfo *unique = NULL; + + for (n = 0, m = mons; m; m = m->next, n++); + /* only consider unique geometries as separate screens */ + unique = ecalloc(nn, sizeof(XineramaScreenInfo)); + for (i = 0, j = 0; i < nn; i++) + if (isuniquegeom(unique, j, &info[i])) + memcpy(&unique[j++], &info[i], sizeof(XineramaScreenInfo)); + XFree(info); + nn = j; + if (n <= nn) { /* new monitors available */ + for (i = 0; i < (nn - n); i++) { + for (m = mons; m && m->next; m = m->next); + if (m) + m->next = createmon(); + else + mons = createmon(); + } + for (i = 0, m = mons; i < nn && m; m = m->next, i++) + if (i >= n + || unique[i].x_org != m->mx || unique[i].y_org != m->my + || unique[i].width != m->mw || unique[i].height != m->mh) + { + dirty = 1; + m->num = i; + m->mx = m->wx = unique[i].x_org; + m->my = m->wy = unique[i].y_org; + m->mw = m->ww = unique[i].width; + m->mh = m->wh = unique[i].height; + updatebarpos(m); + } + } else { /* less monitors available nn < n */ + for (i = nn; i < n; i++) { + for (m = mons; m && m->next; m = m->next); + while ((c = m->clients)) { + dirty = 1; + m->clients = c->next; + detachstack(c); + c->mon = mons; + attach(c); + attachstack(c); + } + if (m == selmon) + selmon = mons; + cleanupmon(m); + } + } + free(unique); + } else +#endif /* XINERAMA */ + { /* default monitor setup */ + if (!mons) + mons = createmon(); + if (mons->mw != sw || mons->mh != sh) { + dirty = 1; + mons->mw = mons->ww = sw; + mons->mh = mons->wh = sh; + updatebarpos(mons); + } + } + if (dirty) { + selmon = mons; + selmon = wintomon(root); + } + return dirty; +} + +void +updatenumlockmask(void) +{ + unsigned int i, j; + XModifierKeymap *modmap; + + numlockmask = 0; + modmap = XGetModifierMapping(dpy); + for (i = 0; i < 8; i++) + for (j = 0; j < modmap->max_keypermod; j++) + if (modmap->modifiermap[i * modmap->max_keypermod + j] + == XKeysymToKeycode(dpy, XK_Num_Lock)) + numlockmask = (1 << i); + XFreeModifiermap(modmap); +} + +void +updatesizehints(Client *c) +{ + long msize; + XSizeHints size; + + if (!XGetWMNormalHints(dpy, c->win, &size, &msize)) + /* size is uninitialized, ensure that size.flags aren't used */ + size.flags = PSize; + if (size.flags & PBaseSize) { + c->basew = size.base_width; + c->baseh = size.base_height; + } else if (size.flags & PMinSize) { + c->basew = size.min_width; + c->baseh = size.min_height; + } else + c->basew = c->baseh = 0; + if (size.flags & PResizeInc) { + c->incw = size.width_inc; + c->inch = size.height_inc; + } else + c->incw = c->inch = 0; + if (size.flags & PMaxSize) { + c->maxw = size.max_width; + c->maxh = size.max_height; + } else + c->maxw = c->maxh = 0; + if (size.flags & PMinSize) { + c->minw = size.min_width; + c->minh = size.min_height; + } else if (size.flags & PBaseSize) { + c->minw = size.base_width; + c->minh = size.base_height; + } else + c->minw = c->minh = 0; + if (size.flags & PAspect) { + c->mina = (float)size.min_aspect.y / size.min_aspect.x; + c->maxa = (float)size.max_aspect.x / size.max_aspect.y; + } else + c->maxa = c->mina = 0.0; + c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh); +} + +void +updatestatus(void) +{ + if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) + strcpy(stext, "dwm-"VERSION); + drawbar(selmon); +} + +void +updatetitle(Client *c) +{ + if (!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name)) + gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name); + if (c->name[0] == '\0') /* hack to mark broken clients */ + strcpy(c->name, broken); +} + +void +updatewindowtype(Client *c) +{ + Atom state = getatomprop(c, netatom[NetWMState]); + Atom wtype = getatomprop(c, netatom[NetWMWindowType]); + + if (state == netatom[NetWMFullscreen]) + setfullscreen(c, 1); + if (wtype == netatom[NetWMWindowTypeDialog]) + c->isfloating = 1; +} + +void +updatewmhints(Client *c) +{ + XWMHints *wmh; + + if ((wmh = XGetWMHints(dpy, c->win))) { + if (c == selmon->sel && wmh->flags & XUrgencyHint) { + wmh->flags &= ~XUrgencyHint; + XSetWMHints(dpy, c->win, wmh); + } else + c->isurgent = (wmh->flags & XUrgencyHint) ? 1 : 0; + if (wmh->flags & InputHint) + c->neverfocus = !wmh->input; + else + c->neverfocus = 0; + XFree(wmh); + } +} + +void +view(const Arg *arg) +{ + if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) + return; + selmon->seltags ^= 1; /* toggle sel tagset */ + if (arg->ui & TAGMASK) + selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; + focus(NULL); + arrange(selmon); +} + +Client * +wintoclient(Window w) +{ + Client *c; + Monitor *m; + + for (m = mons; m; m = m->next) + for (c = m->clients; c; c = c->next) + if (c->win == w) + return c; + return NULL; +} + +Monitor * +wintomon(Window w) +{ + int x, y; + Client *c; + Monitor *m; + + if (w == root && getrootptr(&x, &y)) + return recttomon(x, y, 1, 1); + for (m = mons; m; m = m->next) + if (w == m->barwin) + return m; + if ((c = wintoclient(w))) + return c->mon; + return selmon; +} + +/* There's no way to check accesses to destroyed windows, thus those cases are + * ignored (especially on UnmapNotify's). Other types of errors call Xlibs + * default error handler, which may call exit. */ +int +xerror(Display *dpy, XErrorEvent *ee) +{ + if (ee->error_code == BadWindow + || (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch) + || (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable) + || (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable) + || (ee->request_code == X_PolySegment && ee->error_code == BadDrawable) + || (ee->request_code == X_ConfigureWindow && ee->error_code == BadMatch) + || (ee->request_code == X_GrabButton && ee->error_code == BadAccess) + || (ee->request_code == X_GrabKey && ee->error_code == BadAccess) + || (ee->request_code == X_CopyArea && ee->error_code == BadDrawable)) + return 0; + fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n", + ee->request_code, ee->error_code); + return xerrorxlib(dpy, ee); /* may call exit */ +} + +int +xerrordummy(Display *dpy, XErrorEvent *ee) +{ + return 0; +} + +/* Startup Error handler to check if another window manager + * is already running. */ +int +xerrorstart(Display *dpy, XErrorEvent *ee) +{ + die("dwm: another window manager is already running"); + return -1; +} + +void +zoom(const Arg *arg) +{ + Client *c = selmon->sel; + + if (!selmon->lt[selmon->sellt]->arrange + || (selmon->sel && selmon->sel->isfloating)) + return; + if (c == nexttiled(selmon->clients)) + if (!c || !(c = nexttiled(c->next))) + return; + pop(c); +} + +int +main(int argc, char *argv[]) +{ + if (argc == 2 && !strcmp("-v", argv[1])) + die("dwm-"VERSION); + else if (argc != 1) + die("usage: dwm [-v]"); + if (!setlocale(LC_CTYPE, "") || !XSupportsLocale()) + fputs("warning: no locale support\n", stderr); + if (!(dpy = XOpenDisplay(NULL))) + die("dwm: cannot open display"); + checkotherwm(); + setup(); +#ifdef __OpenBSD__ + if (pledge("stdio rpath proc exec", NULL) == -1) + die("pledge"); +#endif /* __OpenBSD__ */ + scan(); + run(); + cleanup(); + XCloseDisplay(dpy); + return EXIT_SUCCESS; +} diff --git a/dwm/dwm-6.2/dwm.o b/dwm/dwm-6.2/dwm.o new file mode 100644 index 0000000..a7668a1 Binary files /dev/null and b/dwm/dwm-6.2/dwm.o differ diff --git a/dwm/dwm-6.2/dwm.png b/dwm/dwm-6.2/dwm.png new file mode 100644 index 0000000..b1f9ba7 Binary files /dev/null and b/dwm/dwm-6.2/dwm.png differ diff --git a/dwm/dwm-6.2/transient.c b/dwm/dwm-6.2/transient.c new file mode 100644 index 0000000..040adb5 --- /dev/null +++ b/dwm/dwm-6.2/transient.c @@ -0,0 +1,42 @@ +/* cc transient.c -o transient -lX11 */ + +#include +#include +#include +#include + +int main(void) { + Display *d; + Window r, f, t = None; + XSizeHints h; + XEvent e; + + d = XOpenDisplay(NULL); + if (!d) + exit(1); + r = DefaultRootWindow(d); + + f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0); + h.min_width = h.max_width = h.min_height = h.max_height = 400; + h.flags = PMinSize | PMaxSize; + XSetWMNormalHints(d, f, &h); + XStoreName(d, f, "floating"); + XMapWindow(d, f); + + XSelectInput(d, f, ExposureMask); + while (1) { + XNextEvent(d, &e); + + if (t == None) { + sleep(5); + t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0); + XSetTransientForHint(d, t, f); + XStoreName(d, t, "transient"); + XMapWindow(d, t); + XSelectInput(d, t, ExposureMask); + } + } + + XCloseDisplay(d); + exit(0); +} diff --git a/dwm/dwm-6.2/util.c b/dwm/dwm-6.2/util.c new file mode 100644 index 0000000..fe044fc --- /dev/null +++ b/dwm/dwm-6.2/util.c @@ -0,0 +1,35 @@ +/* See LICENSE file for copyright and license details. */ +#include +#include +#include +#include + +#include "util.h" + +void * +ecalloc(size_t nmemb, size_t size) +{ + void *p; + + if (!(p = calloc(nmemb, size))) + die("calloc:"); + return p; +} + +void +die(const char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + + if (fmt[0] && fmt[strlen(fmt)-1] == ':') { + fputc(' ', stderr); + perror(NULL); + } else { + fputc('\n', stderr); + } + + exit(1); +} diff --git a/dwm/dwm-6.2/util.h b/dwm/dwm-6.2/util.h new file mode 100644 index 0000000..f633b51 --- /dev/null +++ b/dwm/dwm-6.2/util.h @@ -0,0 +1,8 @@ +/* See LICENSE file for copyright and license details. */ + +#define MAX(A, B) ((A) > (B) ? (A) : (B)) +#define MIN(A, B) ((A) < (B) ? (A) : (B)) +#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B)) + +void die(const char *fmt, ...); +void *ecalloc(size_t nmemb, size_t size); diff --git a/dwm/dwm-6.2/util.o b/dwm/dwm-6.2/util.o new file mode 100644 index 0000000..a7fcc8c Binary files /dev/null and b/dwm/dwm-6.2/util.o differ diff --git a/scripts/select-videos-to-watch.sh b/scripts/select-videos-to-watch.sh new file mode 100644 index 0000000..7a17c0a --- /dev/null +++ b/scripts/select-videos-to-watch.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +echo "" | xclip -i + +stop_file="/tmp/stop-select-videos-to-watch" +touch $stop_file + +# Get the first one +while [ -z $link ] +do + sleep 0.5 + link="$(xclip -o)" + [ -n $link ] && links=$link && durations="$(youtube-dl --get-duration $link)" +done + +# While doesnt say to stop, continue +videos=1 +while [ -f $stop_file ] +do + sleep 0.5 + link="$(xclip -o)" + if [ -n "$link" ]; then + duration="$(youtube-dl --get-duration $link)" + # Sort + for i in `seq 1 $videos` + do + i_duration="$(echo "$links" | sed "${i}q;d")" + if [ $duration < $i_duration ]; then + left="$(echo "$links" | head -n $(( $i - 1 )))" + right="$(echo "$links" | tail -n +$i)" + links="$left\n$link\n$right" + + left_d="$(echo "$durations" | head -n $(( $i - 1 )))" + right_d="$(echo "$durations" | tail -n +$i)" + durations="$left_d\n$durations\n$right_d" + else + left="$(echo "$links" | head -n $i)" + right="$(echo "$links" | tail -n +$(( $i + 1 )))" + links="$left\n$link\n$right" + + left_d="$(echo "$durations" | head -n $i)" + right_d="$(echo "$durations" | tail -n +$(( $i + 1 )))" + durations="$left_d\n$durations\n$right_d" + fi + done + videos=$(( $videos + 1 )) + fi +done + +# Get first link and download +videos_file="/tmp/selected-videos-to-watch$(date +%s)" +link="$(printf "$links" | head -n 1)" + +[ -n "$link" ] && dash $TSCRIPTS/download-video.sh "$link" >> $videos_file +links="$(printf "$links" | tail -n +2)" +link="$(printf "$links" | head -n 1)" + +# Make mpv start playing videos from the file +[ ! -f $stop_file ] && dash $TSCRIPTS/play-videos-from-file.sh $videos_file & + +# Dowload videos and place them on the file to be played by above +while [ -n "$link" ] +do + dash $TSCRIPTS/download-video.sh "$link" >> $videos_file + links="$(printf "$links" | tail -n +2)" + link="$(printf "$links" | head -n 1)" +done diff --git a/scripts/stop-select-videos-to-watch.sh b/scripts/stop-select-videos-to-watch.sh new file mode 100644 index 0000000..66c70e4 --- /dev/null +++ b/scripts/stop-select-videos-to-watch.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +stop_file="/tmp/stop-select-videos-to-watch" + +rm $stop_file diff --git a/scripts/tube.sh b/scripts/tube.sh index 0a197ec..65eb450 100644 --- a/scripts/tube.sh +++ b/scripts/tube.sh @@ -12,16 +12,9 @@ origin="$(pwd)" cd /tmp { - # Get the filename - filename="$(youtube-dl --merge-output-format mkv --get-filename "$url")" + filename="$(dash $TSCRIPTS/download-video.sh "$url")" - # If file already exists, just play it - [ -f "$filename" ] && mpv "$filename" && exit 0 - - # Download the file - youtube-dl --merge-output-format mkv "$url" - - mpv "$filename" + [ -n "$filename" ] && mpv "$filename" } && { # PLAY cd $origin diff --git a/scripts/update-youtube-dl.sh b/scripts/update-youtube-dl.sh new file mode 100644 index 0000000..88259e8 --- /dev/null +++ b/scripts/update-youtube-dl.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +pip install --upgrade youtube-dl --user diff --git a/termscripts/cpu-freq-hook.sh b/termscripts/cpu-freq-hook.sh new file mode 100644 index 0000000..bcd8fd8 --- /dev/null +++ b/termscripts/cpu-freq-hook.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +freq="$(cat /tmp/cpu-freq)" + +echo "$freq > 5" | bc -l +while [ $freq -gt 5 ]; +do + sleep 5 + freq="$(cat /tmp/cpu-freq)" +done + +echo "done" +sleep 10m diff --git a/termscripts/download-video.sh b/termscripts/download-video.sh new file mode 100644 index 0000000..33da690 --- /dev/null +++ b/termscripts/download-video.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +[ -z "$1" ] && exit 1 + +# Get the filename +filename="$(dash $TSCRIPTS/get-youtube-filename.sh "$1")" + +if [ ! -f "$filename" ]; then + # Download the file + # echo "youtube-dl --merge-output-format mkv $1" + youtube-dl --merge-output-format mkv "$1" +fi + + +echo "$filename" diff --git a/termscripts/get-youtube-filename.sh b/termscripts/get-youtube-filename.sh new file mode 100644 index 0000000..695819f --- /dev/null +++ b/termscripts/get-youtube-filename.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +youtube-dl --merge-output-format mkv --get-filename "$1" diff --git a/termscripts/play-videos-from-file.sh b/termscripts/play-videos-from-file.sh new file mode 100644 index 0000000..3a8b92b --- /dev/null +++ b/termscripts/play-videos-from-file.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +[ -z "$1" ] && exit 1 + +length="$(cat "$1" | wc -l)" + +while [ $length -ne 0 ] +do + video="$(cat "$1" | head -n 1)" + cat "$1" | tail -n +2 > "$1" + length="$(cat "$1" | wc -l)" + mpv "$video" + if [ $length -eq 0 ]; then + sleep 5m + fi +done diff --git a/termscripts/to-seconds.sh b/termscripts/to-seconds.sh new file mode 100644 index 0000000..0f3b71c --- /dev/null +++ b/termscripts/to-seconds.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +[ -z "$1" ] && exit 1 + +columns="$(echo "${1}" | awk -F ":" '{print NF-1}')" + +first="$(echo "$1" | cut -d ":" -f 1)" +second="$(echo "$1" | cut -d ":" -f 2)" +third="$(echo "$1" | cut -d ":" -f 3)" + +case $columns in + 1) seconds=$(( $first*60 + $second )) + ;; + 2) seconds=$(( $first*60*60 + $second*60 + $third )) + ;; + *) exit 1 + ;; +esac + +echo "$seconds"