aboutsummaryrefslogtreecommitdiff
path: root/extras/HOME
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2021-11-02 20:15:32 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-10-09 12:19:45 -0600
commitb08e88ef0c569cd000cae836f3c86801a661f8cb (patch)
tree35513423208a35a7f45048954f005f91fd94885a /extras/HOME
parentcf47b5282be2a62da2aba1a88c8f9599a333b961 (diff)
downloadrde-b08e88ef0c569cd000cae836f3c86801a661f8cb.tar.gz
rde-b08e88ef0c569cd000cae836f3c86801a661f8cb.tar.bz2
rde-b08e88ef0c569cd000cae836f3c86801a661f8cb.zip
More XMobar sexiness.
Revamped the install script to make it easier to handle the install process.
Diffstat (limited to 'extras/HOME')
-rw-r--r--extras/HOME/.config/compton.conf49
-rwxr-xr-xextras/HOME/.local/.local/bin/spotify-control40
-rwxr-xr-xextras/HOME/.local/.local/bin/vim83
-rwxr-xr-xextras/HOME/.local/bin/bluetooth-select.sh14
-rwxr-xr-xextras/HOME/.local/bin/spotify-control40
-rw-r--r--extras/HOME/.xmobarrc71
-rwxr-xr-xextras/HOME/.xmonad/build17
-rwxr-xr-xextras/HOME/.xmonad/startup38
-rw-r--r--extras/HOME/.xmonad/wallpaper.jpgbin0 -> 767997 bytes
-rwxr-xr-xextras/HOME/.xmonad/xmobar-bluetooth18
-rwxr-xr-xextras/HOME/.xmonad/xmobar-logo9
11 files changed, 379 insertions, 0 deletions
diff --git a/extras/HOME/.config/compton.conf b/extras/HOME/.config/compton.conf
new file mode 100644
index 0000000..2728ce1
--- /dev/null
+++ b/extras/HOME/.config/compton.conf
@@ -0,0 +1,49 @@
+backend = "glx";
+
+### Shadow
+shadow = true;
+no-dnd-shadow = true;
+# no-dock-shadow = true;
+# clear-shadow = true;
+shadow-radius = 7;
+shadow-offset-x = -10;
+shadow-offset-y = -5;
+shadow-opacity = 0.8;
+shadow-red = 0.0;
+shadow-green = 0.0;
+shadow-blue = 0.0;
+
+inactive-dim=0.1
+inactive-opacity=0.99
+
+shadow-exclude = [
+ # From the Ubuntu forums link ('screaminj3sus')
+ # "! name~=''",
+ # "n:e:Notification",
+ # "n:e:Plank",
+ # "n:e:Docky",
+ # "g:e:Synapse",
+ # "g:e:Kupfer",
+ # "g:e:Conky",
+ # "n:w:*Firefox*",
+ # "class_g ?= 'Notify-osd'",
+ # "class_g ?= 'Cairo-dock'",
+ # "class_g ?= 'Xfce4-notifyd'",
+ # "class_g ?= 'Xfce4-power-manager'"
+];
+shadow-ignore-shaped = false;
+
+blur-background = false;
+
+wintypes:
+{
+ tooltip =
+ {
+ fade = true;
+ shadow = false;
+ opacity = 0.85;
+ focus = true;
+ }
+}
+# shadow-exclude-reg = "x10+0+0";
+# xinerama-shadow-crop = true;
diff --git a/extras/HOME/.local/.local/bin/spotify-control b/extras/HOME/.local/.local/bin/spotify-control
new file mode 100755
index 0000000..751f562
--- /dev/null
+++ b/extras/HOME/.local/.local/bin/spotify-control
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+if [ $# -lt 1 ]
+then
+ echo "No command?"
+ exit
+fi
+
+if [ "$(pidof spotify)" = "" ]
+then
+ echo "Spotify is not running"
+ exit
+fi
+
+case $1 in
+ "play")
+ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
+ ;;
+ "next")
+ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next
+ ;;
+ "prev")
+ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous
+ ;;
+ "getTitle")
+ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 1 "title"|egrep -v "title"|cut -b 44-|cut -d '"' -f 1|egrep -v ^$
+ ;;
+ "getArtist")
+ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 2 "artist"|egrep -v "artist"|egrep -v "array"|cut -b 27-|cut -d '"' -f 1|egrep -v ^$
+ ;;
+ "getAlbum")
+ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 2 "album"|egrep -v "album"|egrep -v "array"|cut -b 44-|cut -d '"' -f 1|egrep -v ^$
+ ;;
+ "getStatus")
+ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|grep 'string "[^"]*"'|sed 's/.*"\(.*\)"[^"]*$/\1/'
+ ;;
+ *)
+ echo "Unknown command: " $1
+ ;;
+esac
diff --git a/extras/HOME/.local/.local/bin/vim b/extras/HOME/.local/.local/bin/vim
new file mode 100755
index 0000000..d0aafa5
--- /dev/null
+++ b/extras/HOME/.local/.local/bin/vim
@@ -0,0 +1,83 @@
+#!/usr/bin/python3
+
+import neovim, os, re, sys, time
+
+# Get a list of buffers that haven't been deleted. `nvim.buffers` includes
+# buffers that have had `:bdelete` called on them and aren't in the buffer
+# list, so we have to filter those out.
+def get_listed_buffers(nvim):
+ return set(buf.number for buf in nvim.buffers \
+ if nvim.eval('buflisted(%d)' % buf.number))
+
+
+def resolve_google3(fname):
+ if fname.startswith('//depot/google3'):
+ cwd = os.getcwd()
+ if "/google3" in cwd:
+ depot_dir = cwd[:cwd.find('/google3')]
+ realfname = fname.replace('//depot', depot_dir)
+ return realfname
+ return fname
+
+# For now, treat all arguments that don't start with - or + as filenames. This
+# is good enough to recognize '-f' and `+11`, which is all this script really
+# needs right now.
+filenames = [
+ re.sub(' ', '\ ', os.path.abspath(resolve_google3(arg)))
+ for arg in sys.argv[1:] if not arg[0] in ['-', '+']
+]
+
+try:
+ nvim_socket = os.environ["NVIM_LISTEN_ADDRESS"]
+except KeyError:
+ # If we aren't running inside a `:terminal`, just exec nvim.
+ os.execvp(u'nvim', sys.argv)
+
+nvim = neovim.attach('socket', path=nvim_socket)
+
+existing_buffers = get_listed_buffers(nvim)
+
+nvim.command('split')
+nvim.command('args %s' % ' '.join(filenames))
+
+new_buffers = get_listed_buffers(nvim).difference(existing_buffers)
+
+for arg in sys.argv:
+ if arg[0] == '+':
+ nvim.command(arg[1:])
+
+# The '-f' flag is a signal that we're in a situation like a `git commit`
+# invocation where we need to block until the user is done with the file(s).
+if '-f' in sys.argv and len(new_buffers) > 0:
+ # The rule here is that the user is 'done' with the opened files when none
+ # of them are visible onscreen. This allows for use cases like hitting `:q`
+ # on a `git commit` tempfile. However, we can't just poll to see if they're
+ # visible, because using `nvim.windows`, `nvim.eval()`, or `nvim.call()`
+ # will interrupt any multi-key mappings the user may be inputting. The
+ # solution is to set a buffer-local autocmd on each opened buffer so that
+ # we only check for visibility immediately after the user either closes or
+ # hides one of the buffers.
+ channel_id = nvim.channel_id
+ for buffer in new_buffers:
+ nvim.command((
+ 'autocmd BufDelete,BufHidden <buffer=%d> ' +
+ 'call rpcnotify(%d, "check_buffers")'
+ ) % (buffer, channel_id))
+
+ stay_open = True
+ while stay_open:
+ nvim.next_message() # block until `rpcnotify` is called
+ open_buffers = [window.buffer.number for window in nvim.windows]
+ stay_open = any([buffer in open_buffers for buffer in new_buffers])
+
+ # Now that none of the opened files are visible anymore, we do a few
+ # cleanup steps before ending the script:
+ # * Clear the arg list, since otherwise `:next` would reopen the tempfile
+ # or whatever.
+ # * Clear the autocmds we added, since `bdelete` just hides the buffer and
+ # the autocmds will still be active if the user reopens the file(s).
+ # * Delete each of the buffers we created.
+ nvim.command('argdel *')
+ for buffer in new_buffers:
+ nvim.command('autocmd! BufDelete,BufHidden <buffer=%d>' % buffer)
+ nvim.command('bdelete! %d' % buffer)
diff --git a/extras/HOME/.local/bin/bluetooth-select.sh b/extras/HOME/.local/bin/bluetooth-select.sh
new file mode 100755
index 0000000..a0b8559
--- /dev/null
+++ b/extras/HOME/.local/bin/bluetooth-select.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+devices="$(bluetoothctl -- devices | sed 's#^Device ##')"
+selection="$(
+ echo -e "$devices\nDisconnect" |
+ dmenu -i -nf "#8888ff" -sb "#8888ff" -p "Connect Bluetooth" -l 12)"
+
+macaddr="${selection%% *}"
+
+if [[ "$macaddr" == "Disconnect" ]] ; then
+ exec bluetoothctl -- disconnect
+fi
+
+exec bluetoothctl -- connect "$macaddr"
diff --git a/extras/HOME/.local/bin/spotify-control b/extras/HOME/.local/bin/spotify-control
new file mode 100755
index 0000000..751f562
--- /dev/null
+++ b/extras/HOME/.local/bin/spotify-control
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+if [ $# -lt 1 ]
+then
+ echo "No command?"
+ exit
+fi
+
+if [ "$(pidof spotify)" = "" ]
+then
+ echo "Spotify is not running"
+ exit
+fi
+
+case $1 in
+ "play")
+ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
+ ;;
+ "next")
+ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next
+ ;;
+ "prev")
+ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous
+ ;;
+ "getTitle")
+ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 1 "title"|egrep -v "title"|cut -b 44-|cut -d '"' -f 1|egrep -v ^$
+ ;;
+ "getArtist")
+ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 2 "artist"|egrep -v "artist"|egrep -v "array"|cut -b 27-|cut -d '"' -f 1|egrep -v ^$
+ ;;
+ "getAlbum")
+ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 2 "album"|egrep -v "album"|egrep -v "array"|cut -b 44-|cut -d '"' -f 1|egrep -v ^$
+ ;;
+ "getStatus")
+ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|grep 'string "[^"]*"'|sed 's/.*"\(.*\)"[^"]*$/\1/'
+ ;;
+ *)
+ echo "Unknown command: " $1
+ ;;
+esac
diff --git a/extras/HOME/.xmobarrc b/extras/HOME/.xmobarrc
new file mode 100644
index 0000000..ecf53ed
--- /dev/null
+++ b/extras/HOME/.xmobarrc
@@ -0,0 +1,71 @@
+Config
+ { font = "xft:Monofur Nerd Font:size=15"
+ , additionalFonts = [
+ "xft:Monofur bold Nerd Font:style=bold:size=12",
+ "xft:Monofur Nerd Font:size=9",
+ "xft:Monofur bold Nerd Font:size=9",
+ "xft:Monofur Nerd Font:size=6",
+ "xft:Monofur bold Nerd Font:size=40",
+ "xft:Monofur Nerd Font:style=bold:size=12"
+ ]
+ , borderColor = "black"
+ , border = FullBM -1
+ , borderWidth = 2
+ , bgColor = "#17171b"
+ , fgColor = "white"
+ , alpha = 250 -- default: 255
+ , position = TopSize L 100 40
+ , textOffset = -1 -- default: -1
+ , iconOffset = -1 -- default: -1
+ , lowerOnStart = True
+ , pickBroadest = False -- default: False
+ , persistent = True
+ , hideOnStart = False
+ , iconRoot = "/usr/local/google/home/rahm/.xmonad/resources" -- default: "."
+ , allDesktops = True -- default: True
+ , overrideRedirect = False -- default: True
+ , sepChar = "%"
+ , alignSep = "}{"
+ , template =
+ " %logo% <fc=#a0a0a0><fn=3>%uname%</fn></fc><fc=#404040> │\
+ \</fc><fc=#a0a0a0> %date%</fc><fc=#404040> │ \
+ \</fc>%StdinReader%}<fn=1><fc=#8888ff>%time%</fc></fn>\
+ \{ %cpu% <fc=#404040>\
+ \│</fc> %KLMO% <fc=#404040>│\
+ \</fc> <fc=#a0a0a0>%mpris2%</fc> <fc=#404040>│ \
+ \</fc>%bluetooth%%bat% "
+ , commands = [
+ Run StdinReader,
+ Run Memory ["-t", "<usedbar>"] 10,
+ Run Date "%H:%M:%S" "time" 10,
+ Run Date "<fn=3>%m/%d</fn>" "date" 10,
+ Run Cpu [
+ "-t", "<fn=3><fc=#000000><bar></fc></fn>",
+ "-L", "3",
+ "-H", "50",
+ "-b", "─",
+ "-f", "─",
+ "--normal", "green",
+ "--high", "red"
+ ] 10,
+ Run WeatherX "KLMO"
+ [ ("clear", "<fc=#ddcf04>")
+ , ("sunny", "<fc=#ddcf04>")
+ , ("mostly clear", "<fc=#ddcf04>")
+ , ("mostly sunny", "<fc=#ddcf04>")
+ , ("partly sunny", "<fc=#ddcf04>")
+ , ("fair", "<fc=#a0a0a0>🌑")
+ , ("cloudy","<fc=#a0a0a0>摒")
+ , ("overcast","<fc=#808080>")
+ , ("partly cloudy", "<fc=#a0a0a0>杖")
+ , ("mostly cloudy", "<fc=#808080>")
+ , ("considerable cloudiness", "<fc=#a0a0a0>ﭽ")]
+ ["--template", "<skyConditionS></fc><fn=3><fc=#a0a0a0> \
+ \<tempF>°F</fc></fn>"] 360000,
+ Run Mpris2 "spotify" ["-t", "<fc=#1aa54b></fc> <fn=3><title></fn>"] 20,
+ Run Com ".xmonad/xmobar-logo" [] "logo" 0,
+ Run Com "uname" ["-r"] "uname" 0,
+ Run Com ".xmonad/xmobar-bluetooth" [] "bluetooth" 50,
+ Run Com ".xmonad/xmobar-battery" [] "bat" 20
+ ]
+ }
diff --git a/extras/HOME/.xmonad/build b/extras/HOME/.xmonad/build
new file mode 100755
index 0000000..72b6310
--- /dev/null
+++ b/extras/HOME/.xmonad/build
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+actual_bin=$(readlink -f "$0")
+proj_dir="$(dirname $actual_bin)"
+olddir="$(pwd)"
+
+cd "$proj_dir"
+stack install
+
+ec="$?"
+if [ "$ec" -ne 0 ] ; then
+ exit "$ec"
+fi
+
+cd "$olddir"
+
+ln -sf "$HOME/.local/bin/jrahm-xmonad" "$1"
diff --git a/extras/HOME/.xmonad/startup b/extras/HOME/.xmonad/startup
new file mode 100755
index 0000000..dc302b7
--- /dev/null
+++ b/extras/HOME/.xmonad/startup
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+common() {
+ # Startup commands common to all the hosts.
+ xsetroot -cursor_name left_ptr
+ xset r rate 200 60
+}
+
+hostname_rahm1() {
+ # Startup commands specific to my worktop.
+ xinput set-prop "TPPS/2 Elan TrackPoint" "Coordinate Transformation Matrix" 3 0 0 0 3 0 0 0 1
+ xinput set-prop "SYNA8004:00 06CB:CD8B Touchpad" "Coordinate Transformation Matrix" 3 0 0 0 3 0 0 0 1
+
+ if [ -z "$(ps aux | grep compton | grep -v grep)" ] ; then
+ __GL_SYNC_TO_VBLANK=1 nohup compton --backend=glx &>/dev/null &
+ fi
+
+ feh --bg-scale "$HOME/wp.jpg"
+}
+
+hostname_photon() {
+ # Startup commands specific to my desktop.
+
+ if [ -z "$(ps aux | grep compton | grep -v grep)" ] ; then
+ __GL_SYNC_TO_VBLANK=1 nohup compton --backend=glx &>/dev/null &
+ fi
+ xrandr --output DVI-I-1 --right-of DP-5 --mode 2560x1440
+ feh --bg-scale "/home/rahm/.xmonad/wallpaper.jpg"
+}
+
+
+common
+
+hostname_fn="hostname_$(hostname)"
+
+if [[ "$(type -t "$hostname_fn")" == function ]] ; then
+ "$hostname_fn"
+fi
diff --git a/extras/HOME/.xmonad/wallpaper.jpg b/extras/HOME/.xmonad/wallpaper.jpg
new file mode 100644
index 0000000..4976715
--- /dev/null
+++ b/extras/HOME/.xmonad/wallpaper.jpg
Binary files differ
diff --git a/extras/HOME/.xmonad/xmobar-bluetooth b/extras/HOME/.xmonad/xmobar-bluetooth
new file mode 100755
index 0000000..93caa50
--- /dev/null
+++ b/extras/HOME/.xmonad/xmobar-bluetooth
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+cur=""
+
+bluetoothctl -- info | while read line ; do
+ key=${line%%: *}
+ value=${line//*: }
+
+ if [ "$key" == "Name" ] ; then
+ cur="$value"
+ fi
+
+ if [ "$key" == "Connected" -a "$value" == "yes" ] ; then
+ exec echo "<fc=#4287f5></fc> <fc=#a0a0a0><fn=3>$cur</fn></fc> <fc=#404040>│</fc> "
+ fi
+done
+
+exec echo "<fc=#a0a0a0></fc> <fc=#404040>│</fc>"
diff --git a/extras/HOME/.xmonad/xmobar-logo b/extras/HOME/.xmonad/xmobar-logo
new file mode 100755
index 0000000..848ebd2
--- /dev/null
+++ b/extras/HOME/.xmonad/xmobar-logo
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+case "$(uname -a)" in
+ *-arch-*) exec echo '<fn=5><fc=#1785bd></fc></fn>' ;;
+ *Debian*) exec echo '<fn=5><fc=#c00649></fc></fn>' ;;
+ *Ubuntu*) exec echo '<fn=5><fc=#ff8888></fc></fn>' ;;
+ *Linux*) exec echo '<fn=5><fc=#ffffff></fc></fn>' ;;
+ *BSD*) exec echo '<fn=5><fc=#ff4444></fc></fn>' ;;
+esac