diff --git a/install.sh b/install.sh index 565208f..45f3cea 100755 --- a/install.sh +++ b/install.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -stow nix git x +stow nix git x pentadactyl diff --git a/pentadactyl/pentadactylrc.symlink b/pentadactyl/.pentadactylrc similarity index 55% rename from pentadactyl/pentadactylrc.symlink rename to pentadactyl/.pentadactylrc index df0dd42..5693662 100644 --- a/pentadactyl/pentadactylrc.symlink +++ b/pentadactyl/.pentadactylrc @@ -4,6 +4,7 @@ colorscheme solarized-dark set go+=N +source ~/dotfiles/pentadactyl/user.css " feedly: group -description 'Feedly' -locations=feedly.com feedly @@ -20,3 +21,9 @@ set passkeys+=github.com:"r?jks" " reddit: set passkeys+=reddit.com:"jk[]azp?.srfF" + +com -d "Delete duplicate tabs" tabcloseduplicates,tabclosed -js let seen={},vtabs=tabs.visibleTabs,i=vtabs.length;while(i--){let loc=vtabs[i].linkedBrowser.contentDocument.location.href||"";if(Object.prototype.hasOwnProperty.call(seen, loc)){config.tabbrowser.removeTab(vtabs[i]);}else{seen[loc]=true;}} + + +" Open the current URL as an argument to mpv. +nmap -e :launchv diff --git a/pentadactyl/.stow-local-ignore b/pentadactyl/.stow-local-ignore new file mode 100644 index 0000000..6be1705 --- /dev/null +++ b/pentadactyl/.stow-local-ignore @@ -0,0 +1,3 @@ +external +plugins +user.css diff --git a/pentadactyl/dot.json b/pentadactyl/dot.json deleted file mode 100644 index f32c2b5..0000000 --- a/pentadactyl/dot.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "symlinks": [ - { - "source": "pentadactylrc.symlink", - "target": "~/.pentadactylrc" - } - ] -} \ No newline at end of file diff --git a/pentadactyl/plugins/launchv.js b/pentadactyl/plugins/launchv.js new file mode 100644 index 0000000..a6303de --- /dev/null +++ b/pentadactyl/plugins/launchv.js @@ -0,0 +1,47 @@ +/* ~/.config/pentadactyl/plugins/launchv.js + + From Earnestly. + + Quick function to help reduce duplication in my config, thanks mostly to + holomorph who started pretty much all of this. + + Requires: livestreamer, mpv, youtube-dl. + + Command: + * :launchv Attempts to start the current buffer URL as a video. + + Hint: + * ;q Likewise but for the selected hint. +*/ + +function launchv(target){ + // Escape anything which could be used to inject shell commands before + // passing it to the commands. + var uri = target.replace(/([$`"\\])/g, "\\$1"); + var mpv = "mpv --loop-file --cache-file=TMP"; + + function exec(launcher, uri){ + // If we're using pentadactyl then echo the action as io.system won't. + if(typeof dactyl !== "undefined") + dactyl.echomsg("Executing: " + launcher + " \"" + uri + "\""); + + return io.system(launcher + ' "' + uri + '" &'); + } + + // Filter certain urls to more appropriate programs + if(uri.match(/twitch\.tv\/.*\/[bc]\/[0-9]+/)) + exec(mpv, uri); + + else if(uri.match(/hitbox\.tv\/video\/[0-9]+/)) + exec(mpv, uri); + + else if(uri.match(/(hitbox|twitch)\.tv/)) + exec("livestreamer", uri); + + // For everything else. + else + exec(mpv, uri); +} + +hints.addMode("q", "Launch video from hint", function(elem, loc) launchv(loc)); +commands.add(["launchv", "lv"], "Launches current buffer video", function(args){launchv(buffer.URL);}); diff --git a/pentadactyl/user.css b/pentadactyl/user.css new file mode 100644 index 0000000..4783875 --- /dev/null +++ b/pentadactyl/user.css @@ -0,0 +1,91 @@ +@-moz-document url-prefix(about:blank) {*{background-color:#002b36;}} + +@-moz-document url-prefix("http://www.reddit.com/"), url-prefix("https://www.reddit.com/") { + +body { + /*position: relative;*/ + overflow-y: hidden; +} + +html { + overflow-x: hidden; +} +.content { + z-index: -1 !important; +} +.side { + padding-left: 3px; + padding-bottom: 3px; + border-left: 1px solid rgb(230, 230, 230); + border-bottom: 1px solid rgb(230, 230, 230); + border-bottom-left-radius: 6px; + +} + +body>.content, body { + /* This MUST apply to prevent showing stuff through the side bar */ + position: relative !important; +} + +.res-nightmode .side { + border-left-color: rgb(102, 102, 102); + border-bottom-color: rgb(102, 102, 102); + +} + +.side { + margin-left: 0px !important; + + margin-right: -280px !important; + + z-index: 5; + + + + opacity: 0.6; + transition: opacity 0.5s, margin 0.5s; + + transition-delay: 1s; + + transition-timing-function: ease-in-out; + +} + +.side:hover, .side:focus { + transition: opacity 0.2s, margin 0.2s; + /* Apply a negative margin to the left to prevent the content from + being shuffled around by the side bar */ + margin-left: -280px !important; + margin-right: 0px !important; + opacity: 1; + transition-delay: 0s; + +} + +.content { + margin-right: 40px !important; +} + +} + +@-moz-document url-prefix("https://news.ycombinator.com") { + html,#hnmain { + background-color: #002b36 !important; + } + + #hnmain > tbody > tr:first-child > td { + background-color: #073642 !important; + } + + * { + color: #839496 !important; + font-family: "Source Code Pro"; + font-weight: 9pt; + } + + textarea,input { + background-color: #002b36 !important; + color: #839496; + border: 1pt solid #586e75; + } +} \ No newline at end of file