Compare commits

...

5 Commits

Author SHA1 Message Date
6c6320d1f8
[yay] Avoid sudo timeout 2020-12-30 00:12:38 +01:00
ec1169b3b7
[Emacs] Add leader key for evil-lisp-state 2020-12-30 00:12:14 +01:00
842c1253fd
[Emacs] Fix broken Wttr.in package 2020-12-30 00:11:53 +01:00
ac9c34dcf1
[Emacs] Update and fix org capture 2020-12-30 00:11:22 +01:00
6519fa6793
[Bin, Awesome] Add script to read YouTube videos in mpv
New script to read YouTube videos in mpv, with possibility to choose
the video resolution

Also add shortcut in Awesome to invoke this script
2020-12-28 21:06:18 +01:00
4 changed files with 85 additions and 19 deletions

View File

@ -24,7 +24,7 @@
"requestsplitn": 150,
"sortmode": 0,
"completionrefreshtime": 7,
"sudoloop": false,
"sudoloop": true,
"timeupdate": true,
"devel": false,
"cleanAfter": false,

View File

@ -924,7 +924,8 @@ Most of these keybindings are available at root-level of Awesome and will be dec
| u | modkey, meta | shell | rofi-umount | volume unmounting helper | rofi |
| w | modkey, control | shell | wacom-setup | set up my wacom tablet | rofi |
| w | modkey, shift | shell | rofi-wifi-menu | connect to available wifi | rofi |
| y | modkey | shell | rofi-ytdl | download video from web | rofi |
| y | modkey | shell | ytplay | play web video in mpv | rofi |
| y | modkey, shift | shell | rofi-ytdl | download video from web | rofi |
** Awesome
:PROPERTIES:

View File

@ -1268,6 +1268,40 @@ A quick and useful script I often use is a ~curl~ request to [[http://v2.wttr.in
end
#+END_SRC
* ytplay
:PROPERTIES:
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/ytplay
:CUSTOM_ID: Weather-4ed00bb0
:END:
~ytplay~ is a simple script Ive written that allows me to play in mpv any YouTube video at the desired resolution. The script relies on ~dmenu~ (or ~rofi~ in dmenu-mode), ~youtube-dl~ and of course ~mpv~ itself.
#+BEGIN_SRC fish
set URL (rofi -dmenu -i -p "Video URL")
if test -n "$URL"
set FORMAT \
(youtube-dl --list-formats "$URL" | \
egrep "webm.*[0-9]+x[0-9]+" | \
awk '{print $3 " " $1}' | \
sort -gu | \
rofi -dmenu -i -p "Resolution" | \
string split " ")
set FCODE $FORMAT[2]
mpv --ytdl-format=$FCODE "$URL"
end
#+END_SRC
Ill even add a ~.desktop~ entry for this script:
#+BEGIN_SRC conf-desktop :tangle ~/.local/share/applications/ytplay.desktop :mkdirp yes
[Desktop Entry]
Type=Application
Version=1.0
Name=ytplay (YouTube in mpv)
Comment=Play YouTube videos in mpv
Exec=/home/phundrak/.local/bin/ytplay
Path=/home/phundrak/.local/bin
Terminal=false
Categories=Media
#+END_SRC
* ytdl - a ~youtube-dl~ wrapper
:PROPERTIES:
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/ytdl

View File

@ -1579,6 +1579,15 @@ Finally, lets enable globally ~diredfl~ so we can get a colourful Dired buffe
(diredfl-global-mode 1)
#+END_SRC
*** Emacs Lisp
:PROPERTIES:
:CUSTOM_ID: User-Configuration-Emacs-builtins-Emacs-Lisp-36d134d8
:END:
This chapter will be really short, as most of the defaults I get with Emacs quite fit my needs. However, I wish to declare a custom leader key chord for evil-lisp-state:
#+BEGIN_SRC emacs-lisp
(evil-lisp-state-leader ", l")
#+END_SRC
*** Eshell
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Eshell-3012e67e
@ -2411,6 +2420,7 @@ Will be exported as if it were the buffer
**** Capture
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Org-mode-Org_capture-f58979cf
:header-args:org: :mkdirp yes
:END:
Org-capture is an amazing feature of Org-mode which allows me to quickly save links, resources, reminders, and notes in neatly organized org files. Here they are described:
#+NAME: org-capture-target-files
@ -2433,7 +2443,7 @@ With Spacemacs, an Org capture can be invoked with the shortcut ~SPC a o c~. It
| ew | Write Email | Emails | file+headline | org-default-notes-file | emails.orgcaptmpl |
| j | Journal | | file+datetree | org-journal-file | journal.orgcaptmpl |
| l | Link | | | | |
| ll | General | | file+headline | org-default-notes-file | |
| ll | General | | file+headline | org-default-notes-file | link.orgcaptmpl |
| ly | YouTube | | file+headline | org-default-notes-file | youtube.orgcaptmpl |
| L | Protocol Link | Link | file+headline | org-default-notes-file | protocol-link.orgcaptmpl |
| n | Notes | | | | |
@ -2450,6 +2460,7 @@ With Spacemacs, an Org capture can be invoked with the shortcut ~SPC a o c~. It
| re | Emacs | | file+headline | org-default-notes-file | resource.orgcaptmpl |
| ri | Informatique | | file+headline | org-default-notes-file | resource.orgcaptmpl |
| rl | Linguistics | | file+headline | org-default-notes-file | resource.orgcaptmpl |
| rL | Linux | | file+headline | org-default-notes-file | resource.orgcaptmpl |
| rw | Worldbuilding | Resource | file+headline | org-wordbuilding-file | resource.orgcaptmpl |
| t | Tasks | | | | |
| tb | Birthday | | file+headline | org-private-agenda-file | birthday.orgcaptmpl |
@ -2479,7 +2490,7 @@ The following code snipped is not tangled into my configuration file, but instea
table "\n "))
#+END_SRC
#+RESULTS[1fec26dc1d0158ebcaf9b282eb997901321593fa]: org-capture-shortcut-gen
#+RESULTS[d5195b883b39aa51a31e7e572d2eaf8b09c434cd]: org-capture-shortcut-gen
#+begin_example
'(("e" "Email")
("ew" "Write Email" entry
@ -2491,7 +2502,7 @@ The following code snipped is not tangled into my configuration file, but instea
("l" "Link")
("ll" "General" entry
(file+headline org-default-notes-file "General")
(file "~/org/capture/"))
(file "~/org/capture/link.orgcaptmpl"))
("ly" "YouTube" entry
(file+headline org-default-notes-file "YouTube")
(file "~/org/capture/youtube.orgcaptmpl"))
@ -2534,6 +2545,9 @@ The following code snipped is not tangled into my configuration file, but instea
("rl" "Linguistics" entry
(file+headline org-default-notes-file "Linguistics")
(file "~/org/capture/resource.orgcaptmpl"))
("rL" "Linux" entry
(file+headline org-default-notes-file "Linux")
(file "~/org/capture/resource.orgcaptmpl"))
("rw" "Worldbuilding" entry
(file+headline org-wordbuilding-file "Resource")
(file "~/org/capture/resource.orgcaptmpl"))
@ -2569,7 +2583,7 @@ In the next sub-sections will be described my org capture templates. These are n
:CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Emails-d87336fe
:END:
This is my template for a new Email:
#+BEGIN_SRC org :mkdirp yes :tangle ~/org/capture/email.orgcaptmpl
#+BEGIN_SRC org :tangle ~/org/capture/email.orgcaptmpl
,** TODO [#A] Write Email
SCHEDULED: %^t
:PROPERTIES:
@ -2595,7 +2609,7 @@ I use it in case my computer is not yet connected to the internet and I need to
:CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Journal-9916f9bf
:END:
This template is quite simple: it creates a new entry with the current timestamp as its title, a brief title of my choosing, and then I can write whatever I wish to write. This is exported to =~/org/capture/journal.orgcaptmpl=.
#+BEGIN_SRC org :mkdirp yes :tangle ~/org/capture/journal.orgcaptmpl
#+BEGIN_SRC org :tangle ~/org/capture/journal.orgcaptmpl
,* %U %^{Title}
%?
#+END_SRC
@ -2605,7 +2619,7 @@ This template is quite simple: it creates a new entry with the current timestamp
:CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Notes-4b4c10aa
:END:
This template is used for taking note about various subjects that can go from conlanging to development. I wrote it so I can know from where this capture was made and when, and it even supports text that was highlighted in Emacs that will be inserted in a quote block. This is exported to =~/org/capture/notes.orgcaptmpl=.
#+BEGIN_SRC org :mkdirp yes :tangle ~/org/capture/notes.orgcaptmpl
#+BEGIN_SRC org :tangle ~/org/capture/notes.orgcaptmpl
,* %^{Title}
:PROPERTIES:
:CAPTURED: %U
@ -2613,7 +2627,7 @@ This template is used for taking note about various subjects that can go from co
%?
#+END_SRC
#+BEGIN_SRC org :mkdirp yes :tangle ~/org/capture/notes-quote.orgcaptmpl
#+BEGIN_SRC org :tangle ~/org/capture/notes-quote.orgcaptmpl
,* %^{Title}
:PROPERTIES:
:CAPTURED: %U
@ -2631,7 +2645,7 @@ This template is used for taking note about various subjects that can go from co
:CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Protocol-ec45ec49
:END:
This capture is used when received through org-protocol, with the Org-protocol Extension for Firefox. It allows me to save in a quote block what Ive highlighted, as well as the link of the webpage on which my saved content was highlighted. This file is exported to =~/org/capture/protocol.orgcaptmpl=.
#+BEGIN_SRC org :mkdirp yes :tangle ~/org/capture/protocol.orgcaptmpl
#+BEGIN_SRC org :tangle ~/org/capture/protocol.orgcaptmpl
,* TODO [#C] %^{Title}
:PROPERTIES:
:CAPTURED: %U
@ -2646,7 +2660,7 @@ This capture is used when received through org-protocol, with the Org-protocol E
#+END_SRC
This next capture template is used only when a link is sent to Emacs and no content was highlighted.
#+BEGIN_SRC org :mkdirp yes :tangle ~/org/capture/protocol-link.orgcaptmpl
#+BEGIN_SRC org :tangle ~/org/capture/protocol-link.orgcaptmpl
,* TODO [#C] Link: %^{Title}
:PROPERTIES:
:CAPTURED: %U
@ -2661,7 +2675,7 @@ This next capture template is used only when a link is sent to Emacs and no cont
:CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Resources-b23bfbd0
:END:
This is the default template for resources, which generally are located on the Internet. By default, I give them the lowest priority, because although this is something for me to remember later, it is not by default important. You can see in the properties I record when the capture happened, and what the link is. The title of the capture is a summary of what this is, while the body of the capture is a more detailed explanation of what I capture, why, and how it could be useful to me.
#+BEGIN_SRC org :mkdirp yes :tangle ~/org/capture/resource.orgcaptmpl
#+BEGIN_SRC org :tangle ~/org/capture/resource.orgcaptmpl
,* TODO [#C] %^{Title}
:PROPERTIES:
:CAPTURED: %U
@ -2679,7 +2693,7 @@ This is the default template for resources, which generally are located on the I
:CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Tasks-Computers_and_stuff-a4eef8e3
:END:
One type of task I often capture is related to my servers or thing about computers in general. With this, I can capture a task for which I will either set a schedule or a deadline.
#+BEGIN_SRC org :mkdirp yes :tangle ~/org/capture/informatique.orgcaptmpl
#+BEGIN_SRC org :tangle ~/org/capture/informatique.orgcaptmpl
,* TODO %^{Title}
%^{Scheduled or Deadline?||SCHEDULED||DEADLINE}: %^t
:PROPERTIES:
@ -2693,7 +2707,7 @@ One type of task I often capture is related to my servers or thing about compute
:CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Tasks-Health-74f8f338
:END:
This capture is rarely used (Im lucky to have a good health), but it can be useful.
#+BEGIN_SRC org :mkdirp yes :tangle ~/org/capture/health.orgcaptmpl
#+BEGIN_SRC org :tangle ~/org/capture/health.orgcaptmpl
,* %^{Title}
SCHEDULED: %^t
@ -2705,7 +2719,7 @@ This capture is rarely used (Im lucky to have a good health), but it can be u
:CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Tasks-Birthdays-ec3b27be
:END:
This capture is used to store new birthdays I have to remember. They are set to be repeated yearly.
#+BEGIN_SRC org :mkdirp yes :tangle ~/org/capture/birthday.orgcaptmpl
#+BEGIN_SRC org :tangle ~/org/capture/birthday.orgcaptmpl
,* %^{Name}
SCHEDULED: %^t
#+END_SRC
@ -2714,7 +2728,7 @@ This capture is used to store new birthdays I have to remember. They are set to
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Tasks-Events-7f0f8dee
:END:
#+BEGIN_SRC org :mkdirp yes :tangle ~/org/capture/event.orgcaptmpl
#+BEGIN_SRC org :tangle ~/org/capture/event.orgcaptmpl
,* %^{Title}
%^{Scheduled or deadline?||SCHEDULED||DEADLINE}: %^t
%?
@ -2728,7 +2742,7 @@ This capture is used to store new birthdays I have to remember. They are set to
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Links-General-1f0732db
:END:
#+BEGIN_SRC org :mkdirp yes :tangle ~/org/capture/link.orgcaptmpl
#+BEGIN_SRC org :tangle ~/org/capture/link.orgcaptmpl
,* TODO [#C] %^{Title}
:PROPERTIES:
:CAPTURED: %U
@ -2741,7 +2755,7 @@ This capture is used to store new birthdays I have to remember. They are set to
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Links-YouTube-b89fe20e
:END:
#+BEGIN_SRC org :mkdirp yes :tangle ~/org/capture/youtube.orgcaptmpl
#+BEGIN_SRC org :tangle ~/org/capture/youtube.orgcaptmpl
,* TODO [#C] %^{Title}
:PROPERTIES:
:CAPTURED: %U
@ -3697,7 +3711,7 @@ Pinentry should use the ~loopback~ mode when communicating with GnuPG. Lets s
(setq epg-pinentry-mode 'loopback)
#+END_SRC
*** Wttr.in cities
*** Wttr.in
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Miscellaneous-Wttr.in_cities-dd24f8c5
:END:
@ -3707,6 +3721,23 @@ Thanks to the wttrin package, I can get the weather forecast in Emacs for a coup
"Saint Agrève"))
#+END_SRC
However, the package is currently broken (it was last updated in 2017): wttr.in now returns by default an HTML page instead of an ASCII result. In order to fix it, a ~?A~ must be added at the end of the request in order to get a nice output. Also, lets use the HTTPS protocol while were at it.
#+BEGIN_SRC emacs-lisp
(defun wttrin-fetch-raw-string (query)
"Get the weather information based on your QUERY."
(let ((url-user-agent "curl"))
(add-to-list 'url-request-extra-headers wttrin-default-accept-language)
(with-current-buffer
(url-retrieve-synchronously
(format "http%s://wttr.in/%s?A"
(if (gnutls-available-p) "s" "")
query)
(lambda (status)
(switch-to-buffer (current-buffer))))
(decode-coding-string (buffer-string)
'utf-8))))
#+END_SRC
** Visual configuration
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Visual_configuration-78e6cafc