diff --git a/bin/bspwm/bspc-focus b/bin/bspwm/bspc-focus deleted file mode 100755 index 9f2d7d79..00000000 --- a/bin/bspwm/bspc-focus +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash - -# bspc-focus -# Jump to the next window in a direction. If -m is supplied, jump to the next -# monitor in that direction. -# -# Makes switching nodes more intuitive. -# -# Usage: bspc-focus [-m] (west|south|north|east) -# Example: -# + bspc-focus south -# + bspc-focus -m west - -set -e - -leap= -if [[ $1 == -m ]]; then - leap=1; shift -fi -dir=$1 -opposite= - -case $dir in - west) opposite=east ;; - east) opposite=west ;; - north) opposite=north ;; - south) opposite=south ;; - *) >&2 echo "Not a valid direction: $dir" - exit 1 -esac - -if [[ -n $leap ]]; then - # jump to monitor in direction - bspc monitor -f "$dir" -else - # jump to window in direction (unless at edge of last monitor) - if ! bspc node -f "$dir.local"; then - if [[ $(bspc query -M -m "$dir") ]]; then - bspc monitor -f "$dir" - # Ensure we start at the edge of the window we arrived from - while bspc node -f "$opposite.local"; do :; done - fi - fi -fi diff --git a/bin/bspwm/focus b/bin/bspwm/focus new file mode 100755 index 00000000..af8b1fb2 --- /dev/null +++ b/bin/bspwm/focus @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +# Script: bspc-focus +# Author: Henrik Lissner +# Usage: +# bspc-focus [-m] (west|south|north|east) +# bspc-focus south +# bspc-focus -m west +# +# Focus the next window in direction. If -m is supplied, jump to the next +# monitor in that direction. +# +# The behavior of the base 'bspc node -f' is odd when crossing screens. It will +# focus the last selected window on that screen, rather than the window on the +# connecting edge, which is unintuitive. + +set -e + +leap= +if [[ $1 == -m ]]; then + leap=1; shift +fi +dir=$1 +opposite= + +case $dir in + west) opposite=east ;; + east) opposite=west ;; + north) opposite=north ;; + south) opposite=south ;; + *) >&2 echo "Not a valid direction: $dir" + exit 1 +esac + +if [[ -n $leap ]]; then + # jump to monitor in direction + bspc monitor -f "$dir" +else + # jump to window in direction (unless at edge of last monitor) + if ! bspc node -f "$dir.local"; then + if [[ $(bspc query -M -m "$dir") ]]; then + bspc monitor -f "$dir" + # Ensure we start at the edge of the window we arrived from + while bspc node -f "$opposite.local"; do :; done + fi + fi +fi diff --git a/bin/bspwm/presel b/bin/bspwm/presel new file mode 100755 index 00000000..d6d8b44f --- /dev/null +++ b/bin/bspwm/presel @@ -0,0 +1,22 @@ +#!/usr/bin/env cached-nix-shell +#! nix-shell -i zsh -p jshon + +# Script: bspc-presel +# Author: Henrik Lissner +# Usage: +# bspc-presel RATIO +# bspc-presel 0.2 +# +# Wrote this to invert the ratio on east/south-bound preselections. In English +# that means bspc node -p 0.2 should resize the preselection to 20%, whether or +# not it's on the west or east side of the window (or north or south side), +# which isn't the case by default. +# +# NOTE: We use zsh for this because bash chokes on float arithmetic. + +shift # nix-shell passes script path as $1 +ratio="$1" +case "$(bspc query -T -n focused | jshon -e presel -e splitDir | tr -d \")" in + west|north) bspc node -o $ratio ;; + east|south) bspc node -o $(( 1.0 - ratio )) ;; +esac diff --git a/bin/bspwm/subtract-presel b/bin/bspwm/subtract-presel new file mode 100755 index 00000000..4b44478a --- /dev/null +++ b/bin/bspwm/subtract-presel @@ -0,0 +1,101 @@ +#!/usr/bin/env cached-nix-shell +#! nix-shell -i zsh -p jshon wmutils-core + +# Script: bspc-subtract-presel +# Author: Henrik Lissner (w/ credit to @Chrysostomus) +# Usage: +# bspc-resize-to-presel +# +# (Adapted from Chrysostomus/bspwm-scripts/bin/resizetopresel.sh) +# +# This script resizes the current window by "subtracting" the bspwm preselection +# on the current node. In English, that means this will reduce the window's +# width by 20%: +# +# bspc node -p east -o 0.2 && bspc-subtract-presel +# +# NOTE: We use zsh for this because bash chokes on float arithmetic. + +# Check if the brother node is a receptacle +if [[ $(bspc query -T -n @brother/ | jshon -e client) = null ]]; then + # Yep, it's a receptacle. Get the real dimensions + eval $(grep "window_gap" ~/.config/bspwm/rc.d/theme | tr -cd [0-9]) + # Get orientation + wattr xywh $(pfw) | read focused_x focused_y focused_width focused_height + receptacle_y=$(bspc query -T -n @brother/ | jshon -e rectangle -e y) + if [[ "$focused_y" -eq "$receptacle_y" ]]; then + receptacle_width=$(bspc query -T -n @brother/ | jshon -e rectangle -e width) + receptacle_x=$(bspc query -T -n @brother/ | jshon -e rectangle -e x) + # receptacle and window have the same height, so they are side by side + if [[ receptacle_x -gt focused_x ]]; then + echo "receptacle is right of the window" + # get the true window dimension + true_dim=$(( receptacle_width + gap )) + # kill the repectacle + for i in $(bspc query -N -n .leaf.!window.local); do bspc node $i -k; done + # resize the window + bspc node @east -r -$true_dim || bspc node @west -r +$true_dim + else + echo "receptacle is left of the window" + # get the true window dimension + true_dim=$(( receptacle_width + gap )) + # kill the repectacle + for i in $(bspc query -N -n .leaf.!window.local); do bspc node $i -k; done + # resize the window + bspc node @west -r +$true_dim || bspc node @east -r -$true_dim + fi + else + receptacle_height=$(bspc query -T -n @brother/ | jshon -e rectangle -e height) + # width is necessarily equal if height is not, because the nodes are + # brothers Window are on the top of each other + if [[ receptacle_y -gt focused_y ]]; then + echo "receptacle is below the window" + # get the true window dimension + true_dim=$(( receptacle_height + gap)) + # kill the repectacle + for i in $(bspc query -N -n .leaf.!window.local); do bspc node $i -k; done + # resize the window + bspc node @south -r -$true_dim || bspc node @north -r +$true_dim + else + echo "receptacle is above the window" + # get the true window dimension + true_dim=$(( receptacle_height + gap)) + # kill the repectacle + for i in $(bspc query -N -n .leaf.!window.local); do bspc node $i -k; done + # resize the window + bspc node @north -r +$true_dim || bspc node @south -r -$true_dim + fi + fi + echo $true_dim + exit 0 +fi + +# If the focused window is not preselected, do nothing +[[ "$(bspc query -T -n focused | jshon -e presel)" == null ]] && exit 0 + +dir=$(bspc query -T -n focused | jshon -e presel -e splitDir | tr -d \") +ratio=$(bspc query -T -n focused | jshon -e presel -e splitRatio) +case "$dir" in + west) + cur=$(bspc query -T -n focused | jshon -e rectangle -e width) + bspc node @west -r +$((${cur}*${ratio})) || \ + bspc node @east -r -$((${cur}*${ratio})) + ;; + east) + cur=$(bspc query -T -n focused | jshon -e rectangle -e width) + bspc node @east -r -$((${cur}*(1.0-${ratio}))) || \ + bspc node @west -r +$((${cur}*${ratio})) + ;; + + north) + cur=$(bspc query -T -n focused | jshon -e rectangle -e height) + bspc node @north -r +$((${cur}*${ratio})) || \ + bspc node @south -r -$((${cur}*${ratio})) + ;; + south) + cur=$(bspc query -T -n focused | jshon -e rectangle -e height) + bspc node @south -r -$(( ${cur} * (1.0 - ${ratio}) )) || \ + bspc node @north -r +$(( ${cur} * ${ratio} )) +esac + +bspc node -p cancel diff --git a/bin/bspwm/bspc-swap b/bin/bspwm/swap similarity index 59% rename from bin/bspwm/bspc-swap rename to bin/bspwm/swap index 86ca3ad9..8dd025f0 100755 --- a/bin/bspwm/bspc-swap +++ b/bin/bspwm/swap @@ -1,15 +1,18 @@ #!/usr/bin/env bash -# bspc-swap -# swaps current window with the next window in a direction. If -m is set, moves -# window to the next monitor in that direction. +# Script: bspc-swap +# Author: Henrik Lissner +# Usage: +# bspc-swap [-m] (west|south|north|east) +# bspc-swap south +# bspc-swap -m west # -# Makes swapping nodes more intuitive. +# Swaps current window with the window in a direction. If -m is set, move window +# to the next monitor in that direction. # -# Usage: bspc-swap (west|south|north|east) (1|0) -# Example: -# + bspc-swap south -# + bspc-swap -m west +# The behavior of the base 'bspc node -s' is odd when crossing screens. It will +# swaps with the last selected window on that screen, rather than the window on +# the connecting edge, which is unintuitive. set -e diff --git a/bin/rofi/rofi-appmenu b/bin/rofi/appmenu similarity index 80% rename from bin/rofi/rofi-appmenu rename to bin/rofi/appmenu index 3a152352..3156c692 100755 --- a/bin/rofi/rofi-appmenu +++ b/bin/rofi/appmenu @@ -1,6 +1,5 @@ #!/usr/bin/env sh rofi -show drun \ -modi drun,run \ - -display-drun apps \ -show-icons \ -theme theme/appmenu.rasi diff --git a/bin/rofi/rofi-browsermenu b/bin/rofi/bookmarkmenu similarity index 67% rename from bin/rofi/rofi-browsermenu rename to bin/rofi/bookmarkmenu index 7a840622..623d3980 100755 --- a/bin/rofi/rofi-browsermenu +++ b/bin/rofi/bookmarkmenu @@ -5,7 +5,7 @@ # # requires: sqlite3 -ROFI_CMD='rofi -dmenu -theme theme/browsermenu.rasi -columns 1 -markup-rows -multi-select -p browser -i' +ROFI_CMD='rofi -dmenu -theme theme/bookmarkmenu.rasi -columns 1 -markup-rows -multi-select -p browser -i' SEP=${1:-'{{::}}'} _do_rofi() { @@ -28,20 +28,20 @@ case ${BROWSER:-firefox} in # The db can be locked from time to time. This is inefficient, but # places.sqlite is usually under 30mb so this should be instant, and # /tmp is cleared at boot so... - # if ! find /tmp/rofi-browsermenu -mmin +60 2>&1 >/dev/null; then + # if ! find /tmp/rofi-bookmarkmenu -mmin +60 2>&1 >/dev/null; then cp "$dir/places.sqlite" "/tmp/places.sqlite" - sqlite3 -separator $SEP "/tmp/places.sqlite" \ - "SELECT DISTINCT title, url FROM moz_places \ - WHERE title IS NOT NULL \ - ORDER BY last_visit_date DESC" >/tmp/rofi-browsermenu + # sqlite3 -separator $SEP "/tmp/places.sqlite" \ + # "SELECT DISTINCT title, url FROM moz_places \ + # WHERE title IS NOT NULL \ + # ORDER BY last_visit_date DESC" >/tmp/rofi-bookmarkmenu sqlite3 -separator $SEP "/tmp/places.sqlite" \ "SELECT DISTINCT mb.title, mp.url FROM moz_bookmarks mb \ INNER JOIN moz_places mp ON mp.id = mb.fk \ WHERE mb.type = 1 AND mb.title IS NOT NULL \ ORDER BY mp.frecency DESC \ - LIMIT 200" >>/tmp/rofi-browsermenu + LIMIT 200" >>/tmp/rofi-bookmarkmenu # fi - cat /tmp/rofi-browsermenu | sed -e 's#&#&#g' -e 's#<#<#g' -e 's#>#>#g' | _do_rofi + cat /tmp/rofi-bookmarkmenu | sed -e 's#&#&#g' -e 's#<#<#g' -e 's#>#>#g' | _do_rofi break fi done @@ -49,11 +49,11 @@ case ${BROWSER:-firefox} in qutebrowser) { sed -e 's/ /{{::}}/' urls | awk -F'{{::}}' '{printf "%s{{::}}%s\n", $2, $1}' - sqlite3 -separator $SEP "$XDG_DATA_HOME/qutebrowser/history.sqlite" \ - "SELECT title, url FROM History \ - WHERE title != '' \ - GROUP BY url \ - ORDER BY atime DESC" + # sqlite3 -separator $SEP "$XDG_DATA_HOME/qutebrowser/history.sqlite" \ + # "SELECT title, url FROM History \ + # WHERE title != '' \ + # GROUP BY url \ + # ORDER BY atime DESC" } | _do_rofi ;; *) rofi -e "No known browser" ;; diff --git a/bin/rofi/rofi-filemenu b/bin/rofi/filemenu similarity index 54% rename from bin/rofi/rofi-filemenu rename to bin/rofi/filemenu index a5ee94ec..f5ee1fba 100755 --- a/bin/rofi/rofi-filemenu +++ b/bin/rofi/filemenu @@ -1,5 +1,6 @@ #!/usr/bin/env sh -DIR="$(fd -L --type d . $HOME | rofi -dmenu -i -p files -columns 1 -theme theme/appmenu.rasi)" +cd $HOME +DIR="$(fd -L -d 4 --type d . | rofi -dmenu -i -p "~/" -theme theme/filemenu.rasi)" if [ -d "$DIR" ]; then cd "$DIR" if [[ $1 == "-x" ]]; then diff --git a/bin/rofi/networkmenu b/bin/rofi/networkmenu new file mode 100644 index 00000000..e69de29b diff --git a/bin/rofi/rofi-passmenu b/bin/rofi/passmenu similarity index 79% rename from bin/rofi/rofi-passmenu rename to bin/rofi/passmenu index fcfdaa61..43755520 100755 --- a/bin/rofi/rofi-passmenu +++ b/bin/rofi/passmenu @@ -6,10 +6,11 @@ # Example: passmenu [RESUME] ROFI_CMD='rofi -dmenu -theme theme/passmenu.rasi' +ROFI_MSG_CMD='rofi -theme theme/passmenu.rasi -markup -e' set -e shopt -s nullglob globstar -for prog in xclip notify-send pass; do +for prog in xclip pass; do if ! command -v "$prog" >/dev/null; then >&2 echo "$prog not installed, aborting" exit 1 @@ -42,11 +43,11 @@ else password_files=( "$prefix"/**/*.gpg ) password_files=( "${password_files[@]#"$prefix"/}" ) password_files=( "${password_files[@]%.gpg}" ) - entry=$(printf "%s\n" "${password_files[@]}" | $ROFI_CMD -p pass -filter "$url") + entry=$(printf "%s\n" "${password_files[@]}" | $ROFI_CMD -p "..." -filter "$url") fi if [[ -z $entry ]]; then - notify-send --urgency=critical "Failed to select $entry" + $ROFI_MSG_CMD "Failed to select $entry" exit 1 fi @@ -54,14 +55,14 @@ echo "$entry" >/tmp/_upm secrets="$(pass show "$entry")" if [[ -n $secrets ]]; then fields=$(awk -F': ' 'NR>1 && !/^otpauth:/ {print $1}' <<<"$secrets") - field=$(printf "password\n%s\notp\n" "${fields[@]}" | $ROFI_CMD -p "pass ($entry) > ") + field=$(printf "password\n%s\notp\n" "${fields[@]}" | $ROFI_CMD -p "$entry") case $field in password) pass -c "$entry" ;; otp) printf "%s" "$(pass otp -c "$entry")" ;; *) printf "%s" "$(awk -v "key=$field:" '$1 == key {print $2}' <<<"$secrets")" | xclip -selection clipboard -in ;; esac - notify-send --urgency=low "$entry/$field" "Copied to clipboard for 45s" + $ROFI_MSG_CMD "Copied $entry/$field to clipboard for 45s" else - notify-send --urgency=critical "Failed to retrieve $entry" + $ROFI_MSG_CMD "Failed to retrieve $entry" exit 2 fi diff --git a/bin/rofi/powermenu b/bin/rofi/powermenu new file mode 100755 index 00000000..daeb1dc7 --- /dev/null +++ b/bin/rofi/powermenu @@ -0,0 +1,31 @@ +#!/usr/bin/env sh + +rofi_command="rofi -theme theme/powermenu.rasi" + +### Options ### +power_off="\tShutdown" +reboot="\tReboot" +lock="\tLock" +suspend="鈴\tSleep" +log_out="\tLogout" +# Variable passed to rofi +options="$power_off\n$reboot\n$lock\n$suspend\n$log_out" + +case "$(echo -e "$options" | $rofi_command -dmenu -selected-row 2)" in + $power_off) + systemctl poweroff + ;; + $reboot) + systemctl reboot + ;; + $lock) + zzz + ;; + $suspend) + dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause + systemctl suspend + ;; + $log_out) + bspc quit + ;; +esac diff --git a/bin/rofi/rofi-windowmenu b/bin/rofi/rofi-windowmenu deleted file mode 100755 index 26f55089..00000000 --- a/bin/rofi/rofi-windowmenu +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env sh -rofi -show window -show-icons -theme theme/windowmenu.rasi diff --git a/bin/rofi/spotifymenu b/bin/rofi/spotifymenu new file mode 100644 index 00000000..e69de29b diff --git a/bin/rofi/windowmenu b/bin/rofi/windowmenu new file mode 100755 index 00000000..a0128aac --- /dev/null +++ b/bin/rofi/windowmenu @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +rofi -show window \ + -show-icons \ + -theme theme/windowmenu.rasi diff --git a/bin/scratch b/bin/scratch index 291f8c29..6eadb17f 100755 --- a/bin/scratch +++ b/bin/scratch @@ -1,7 +1,7 @@ #!/usr/bin/env bash SCRID=scratch -CMD='tmux new-session -A -s scratch -n scratch' +CMD=${1:-'tmux new-session -A -s scratch -n scratch'} focused=$(xdotool getactivewindow) scratch=$(xdotool search --onlyvisible --classname $SCRID) if [[ -n $scratch ]]; then @@ -12,16 +12,13 @@ if [[ -n $scratch ]]; then fi elif command -v alacritty >/dev/null; then alacritty --class $SCRID \ - -d 90 26 \ -e $SHELL -c "$CMD" elif command -v urxvt >/dev/null; then urxvt -name $SCRID \ - -geometry 100x26 \ -e $SHELL -c "$CMD" elif command -v xst >/dev/null; then xst -t $SCRID -n $SCRID -c $SCRID \ -f "$(xrdb -query | grep 'scratch\.font' | cut -f2)" \ - -g 100x26 \ -e $SHELL -c "$CMD" else >&2 echo "No shell to launch the scratch terminal with" diff --git a/config/bspwm/bspwmrc b/config/bspwm/bspwmrc index 8f071920..f1cdab3f 100755 --- a/config/bspwm/bspwmrc +++ b/config/bspwm/bspwmrc @@ -1,11 +1,11 @@ -#!/bin/sh +#!/usr/bin/env bash export MONITOR=$(xrandr -q | grep primary | cut -d' ' -f1) export MONITORS=( $(xrandr -q | grep ' connected' | cut -d' ' -f1) ) MONITOR=${MONITOR:-${MONITORS[0]}} # Only have workspaces for primary monitor -bspc monitor $MONITOR -d {1,2,3,4,5} +bspc monitor $MONITOR -d {1,2,3,4,5,6} bspc config remove_disabled_monitors true bspc config remove_unplugged_monitors true @@ -15,14 +15,12 @@ bspc config remove_unplugged_monitors true bspc rule -r '*' bspc rule -a Pinentry state=floating center=on -bspc rule -a Emacs split_ratio=0.28 state=fullscreen border=off -bspc rule -a xst-256color border=off +bspc rule -a Emacs split_ratio=0.28 state=tiled bspc rule -a Firefox split_ratio=0.32 bspc rule -a feh state=fullscreen bspc rule -a 'Emacs:org*' state=floating bspc rule -a 'Emacs:scratch' state=floating -bspc rule -a '*:scratch' state=floating sticky=on center=on - +bspc rule -a '*:scratch' state=floating sticky=on center=on border=off rectangle=1000x600+0+0 # for file in $XDG_CONFIG_HOME/bspwm/rc.d/*; do diff --git a/config/sxhkd/sxhkdrc b/config/sxhkd/sxhkdrc index 68060a97..124f03df 100644 --- a/config/sxhkd/sxhkdrc +++ b/config/sxhkd/sxhkdrc @@ -10,19 +10,12 @@ super + t super + apostrophe bspc window -s last -# focus/swap the node in the given direction -super + {_,ctrl +}{h,j,k,l} - bspc-focus {_,-m }{west,south,north,east} - -super + shift + {_,ctrl +}{h,j,k,l} - bspc-swap {_,-m }{west,south,north,east} - -super + {_,shift +}{1-9,0} - bspc {desktop -f,node -d} {1-9,10} - super + Return xst -e bash -c "tmux new || tmux attach" +ctrl + super + Return + xst + super + grave scratch @@ -30,13 +23,16 @@ super + shift + grave emacsclient -e '(open-scratch-frame)' super + space - rofi-appmenu + ~/.dotfiles/bin/rofi/appmenu super + Tab - rofi-windowmenu + ~/.dotfiles/bin/rofi/windowmenu super + backslash - rofi-passmenu + ~/.dotfiles/bin/rofi/passmenu + +super + slash + ~/.dotfiles/bin/rofi/filemenu -x super + Escape pkill -USR1 -x sxhkd @@ -48,11 +44,47 @@ super + Escape # ## -# Toggle floating/fullscreen +## Toggle floating/fullscreen super + {_,ctrl + }f bspc node -t ~{floating,fullscreen} +super + {_,ctrl +}{h,j,k,l} + ~/.dotfiles/bin/bspwm/focus {_,-m }{west,south,north,east} + +super + shift + {_,ctrl +}{h,j,k,l} + ~/.dotfiles/bin/bspwm/swap {_,-m }{west,south,north,east} + + +## Resize by preselection +super + alt + {1-9} + ~/.dotfiles/bin/bspwm/presel 0.{1-9} + +super + alt + {h,j,k,l} + bspc node -p {west,south,north,east} + +super + alt + Return + ~/.dotfiles/bin/bspwm/subtract-presel + +super + alt + Delete + bspc node -p cancel + +super + {_,shift +}{1-9,0} + bspc {desktop -f,node -d} {1-9,10}; + +# expand a window by moving one of its side outward +super + {Left,Down,Up,Right} + bspc node -z {left -40 0,bottom 0 40,top 0 -40,right 40 0} + +# contract a window by moving one of its side inward +super + ctrl + {Left,Down,Up,Right} + bspc node -z {right -40 0,top 0 40,bottom 0 -40,left 40 0} + +# move a floating window +super + shift + {Left,Down,Up,Right} + bspc node -v {-40 0,0 40,0 -40,40 0} + + # ## Media keys @@ -61,10 +93,10 @@ Print scrcap # screencast region to mp4 super + Print - scrrec -s ~/shared/$(date +%F-%T).mp4 + scrrec -s ~/recordings/$(date +%F-%T).mp4 # screencast region to gif super + ctrl + Print - scrrec -s ~/shared/$(date +%F-%T).gif + scrrec -s ~/recordings/$(date +%F-%T).gif XF86MonBrightnessUp light -A 5 diff --git a/hosts/kuro/default.nix b/hosts/kuro/default.nix index 310d46df..1905d6bc 100644 --- a/hosts/kuro/default.nix +++ b/hosts/kuro/default.nix @@ -32,7 +32,7 @@ ## Services ## Theme - + ]; networking.networkmanager.enable = true; diff --git a/modules/desktop/apps/rofi.nix b/modules/desktop/apps/rofi.nix index 2591d477..3a22e200 100644 --- a/modules/desktop/apps/rofi.nix +++ b/modules/desktop/apps/rofi.nix @@ -2,7 +2,6 @@ { my = { - env.PATH = [ ]; # link recursively so other modules can link files in its folder home.xdg.configFile."rofi" = { source = ; @@ -17,22 +16,22 @@ # Fake rofi dmenu entries (makeDesktopItem { - name = "rofi-browsermenu"; + name = "rofi-bookmarkmenu"; desktopName = "Open Bookmark in Browser"; icon = "bookmark-new-symbolic"; - exec = "${}/bin/rofi-browsermenu"; + exec = "${}"; }) (makeDesktopItem { name = "rofi-filemenu"; desktopName = "Open Directory in Terminal"; icon = "folder"; - exec = "${}/bin/rofi-filemenu"; + exec = "${}"; }) (makeDesktopItem { name = "rofi-filemenu-scratch"; desktopName = "Open Directory in Scratch Terminal"; icon = "folder"; - exec = "${}/bin/rofi-filemenu -x"; + exec = "${} -x"; }) (makeDesktopItem { diff --git a/modules/desktop/bspwm.nix b/modules/desktop/bspwm.nix index 2d9b4f99..dd38943e 100644 --- a/modules/desktop/bspwm.nix +++ b/modules/desktop/bspwm.nix @@ -25,15 +25,12 @@ }; }; - my = { - env.PATH = [ ]; - home.xdg.configFile = { - "sxhkd".source = ; - # link recursively so other modules can link files in their folders - "bspwm" = { - source = ; - recursive = true; - }; + my.home.xdg.configFile = { + "sxhkd".source = ; + # link recursively so other modules can link files in their folders + "bspwm" = { + source = ; + recursive = true; }; }; } diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 3f53afac..f30265b4 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -5,8 +5,11 @@ ## Desktop apps ./apps/redshift.nix ./apps/rofi.nix # My launcher - ./apps/thunar.nix # I often need a thumbnail browser to show off, peruse - # or organize photos, design work, or digital art. + + # I often need a thumbnail browser to show off, peruse or organize photos, + # design work, or digital art. + # ./apps/nautilus.nix + ./apps/thunar.nix ## Terminal # ./apps/alacritty.nix @@ -28,6 +31,13 @@ xclip xdotool libqalculate # calculator cli w/ currency conversion + (makeDesktopItem { + name = "scratch-calc"; + desktopName = "Calculator"; + icon = "calc"; + exec = "scratch '${tmux}/bin/tmux new-session -s calc -n calc qalc'"; + categories = "Development"; + }) ]; ## Sound @@ -59,8 +69,8 @@ backend = "glx"; vSync = true; opacityRules = [ - "100:class_g = 'Firefox'" - "100:class_g = 'Vivaldi-stable'" + # "100:class_g = 'Firefox'" + # "100:class_g = 'Vivaldi-stable'" "100:class_g = 'VirtualBox Machine'" # Art/image programs where we need fidelity "100:class_g = 'Gimp'" @@ -69,10 +79,18 @@ "100:class_g = 'krita'" "100:class_g = 'feh'" "100:class_g = 'mpv'" + "100:class_g = 'Rofi'" + "100:class_g = 'Peek'" + "99:_NET_WM_STATE@:32a = '_NET_WM_STATE_FULLSCREEN'" + ]; + shadowExclude = [ + # Put shadows on notifications, the scratch popup and rofi only + "! name~='(scratch|Dunst)$'" ]; settings.blur-background-exclude = [ "window_type = 'dock'" "window_type = 'desktop'" + "class_g = 'Rofi'" "_GTK_FRAME_EXTENTS@:c" ]; }; diff --git a/modules/themes/fluorescence/README.md b/modules/themes/fluorescence/README.md new file mode 100644 index 00000000..e69de29b diff --git a/modules/themes/fluorescence/Xresources b/modules/themes/fluorescence/Xresources new file mode 100644 index 00000000..7f52c44e --- /dev/null +++ b/modules/themes/fluorescence/Xresources @@ -0,0 +1,79 @@ +!! Colors +#define blk #1E2029 +#define bblk #282a36 +#define red #ffb86c +#define bred #de935f +#define grn #50fa7b +#define bgrn #0189cc +#define ylw #f0c674 +#define bylw #f9a03f +#define blu #61bfff +#define bblu #8be9fd +#define mag #bd93f9 +#define bmag #ff79c6 +#define cyn #8be9fd +#define bcyn #0189cc +#define wht #f8f8f2 +#define bwht #e2e2dc +#define bg blk +#define fg wht + +*.foreground: fg +*.background: bg +*.cursorColor: mag + +*.color0: blk +*.color8: bblk +*.color1: red +*.color9: bred +*.color2: grn +*.color10: bgrn +*.color3: ylw +*.color11: bylw +*.color4: blu +*.color12: bblu +*.color5: mag +*.color13: bmag +*.color6: cyn +*.color14: bcyn +*.color7: wht +*.color15: bwht + +! greys +*.color234: #1E2029 +*.color235: #282a36 +*.color236: #373844 +*.color237: #44475a +*.color239: #565761 +*.color240: #6272a4 +*.color241: #b6b6b2 + + +!! general +scratch.font: Fira Code:pixelsize=16 + + +!! xst +st.font: Fira Code:pixelsize=12 + + +!! urxvt +URxvt*depth: 32 +URxvt*.background: blk +URxvt*.borderless: 1 +URxvt*.buffered: true +URxvt*.cursorBlink: true +URxvt*.font: xft:Fira Code:pixelsize=12 +URxvt*.internalBorder: 10 +URxvt*.letterSpace: 0 +URxvt*.lineSpace: 0 +URxvt*.loginShell: false +URxvt*.matcher.button: 1 +URxvt*.matcher.rend.0: Uline Bold fg5 +URxvt*.saveLines: 5000 +URxvt*.scrollBar: false +URxvt*.underlineColor: grey +URxvt.clipboard.autocopy: true +URxvt.iso14755: false +URxvt.iso14755_52: false +URxvt.perl-ext-common: default,matcher diff --git a/modules/themes/fluorescence/bspwmrc b/modules/themes/fluorescence/bspwmrc new file mode 100755 index 00000000..cce6cfc8 --- /dev/null +++ b/modules/themes/fluorescence/bspwmrc @@ -0,0 +1,16 @@ +#!/usr/bin/env sh + +bspc config borderless_monocle true +bspc config gapless_monocle true + +bspc config border_width 1 +bspc config window_gap 0 + +bspc config normal_border_color "#181a23" +bspc config active_border_color "#181a23" +bspc config focused_border_color "#bd93f9" +bspc config presel_feedback_color "#bd93f9" + +# Extra padding for polybar +bspc config -m primary top_padding 0 +bspc config -m primary bottom_padding 34 diff --git a/modules/themes/fluorescence/default.nix b/modules/themes/fluorescence/default.nix new file mode 100644 index 00000000..6389270c --- /dev/null +++ b/modules/themes/fluorescence/default.nix @@ -0,0 +1,75 @@ +# modules/themes/aquanaut/default.nix --- a sea-blue linux theme + +{ config, lib, pkgs, ... }: +{ + imports = [ ../. ]; # Load framework for themes + + theme.wallpaper = ./wallpaper.png; + + services.compton = { + fade = true; + fadeDelta = 1; + fadeSteps = [ "0.01" "0.012" ]; + shadow = true; + shadowOffsets = [ (-10) (-10) ]; + shadowOpacity = "0.22"; + # activeOpacity = "1.00"; + # inactiveOpacity = "0.92"; + settings = { + shadow-radius = 12; + # blur-background = true; + # blur-background-frame = true; + # blur-background-fixed = true; + blur-kern = "7x7box"; + blur-strength = 320; + }; + }; + + services.xserver.displayManager.lightdm = { + greeters.mini.extraConfig = '' + text-color = "#ff79c6" + password-background-color = "#1E2029" + window-color = "#181a23" + border-color = "#181a23" + ''; + }; + + fonts.fonts = [ pkgs.nerdfonts ]; + my.packages = with pkgs; [ + my.ant-dracula + paper-icon-theme # for rofi + ]; + my.zsh.rc = lib.readFile ./zsh/prompt.zsh; + my.home.xdg.configFile = { + "bspwm/rc.d/polybar".source = ./polybar/run.sh; + "bspwm/rc.d/theme".source = ./bspwmrc; + "dunst/dunstrc".source = ./dunstrc; + "polybar" = { source = ./polybar; recursive = true; }; + "rofi/theme" = { source = ./rofi; recursive = true; }; + "tmux/theme".source = ./tmux.conf; + "xtheme/90-theme".source = ./Xresources; + # GTK + "gtk-3.0/settings.ini".text = '' + [Settings] + gtk-theme-name=Ant-Dracula + gtk-icon-theme-name=Paper + gtk-fallback-icon-theme=gnome + gtk-application-prefer-dark-theme=true + gtk-cursor-theme-name=Paper + gtk-xft-hinting=1 + gtk-xft-hintstyle=hintfull + gtk-xft-rgba=none + ''; + # GTK2 global theme (widget and icon theme) + "gtk-2.0/gtkrc".text = '' + gtk-theme-name="Ant-Dracula" + gtk-icon-theme-name="Paper-Mono-Dark" + gtk-font-name="Sans 10" + ''; + # QT4/5 global theme + "Trolltech.conf".text = '' + [Qt] + style=Ant-Dracula + ''; + }; +} diff --git a/modules/themes/fluorescence/dunstrc b/modules/themes/fluorescence/dunstrc new file mode 100644 index 00000000..db253ed4 --- /dev/null +++ b/modules/themes/fluorescence/dunstrc @@ -0,0 +1,49 @@ +[global] +alignment = left +bounce_freq = 0 +browser = firefox -new-tab +corner_radius = 2 +dmenu = rofi -dmenu -p dunst: +follow = none +font = Fira Sans 11 +format = "%s\n%b" +frame_color = "#1a1c25" +frame_width = 1 +# geometry [{width}]x{height}][+/-{x}+/-{y}] +geometry = "440x15-22+58" +history_length = 20 +horizontal_padding = 16 +icon_position = right +idle_threshold = 120 +ignore_newline = no +indicate_hidden = yes +line_height = 0 +markup = full +max_icon_size = 64 +monitor = 0 +padding = 20 +separator_color = auto +separator_height = 4 +show_age_threshold = 60 +show_indicators = yes +shrink = no +sort = yes +startup_notification = false +sticky_history = yes +transparency = 5 +word_wrap = yes + +[urgency_low] +background = "#1E2029" +foreground = "#bbc2cf" +timeout = 8 + +[urgency_normal] +background = "#2a2d39" +foreground = "#bbc2cf" +timeout = 14 + +[urgency_critical] +background = "#cc6666" +foreground = "#1E2029" +timeout = 0 diff --git a/modules/themes/fluorescence/polybar/config b/modules/themes/fluorescence/polybar/config new file mode 100644 index 00000000..564fb1d9 --- /dev/null +++ b/modules/themes/fluorescence/polybar/config @@ -0,0 +1,327 @@ +[colors] +black = ${xrdb:color0} +bblack = ${xrdb:color8} +red = ${xrdb:color1} +bred = ${xrdb:color9} +green = ${xrdb:color2} +bgreen = ${xrdb:color10} +yellow = ${xrdb:color3} +byellow = ${xrdb:color11} +blue = ${xrdb:color4} +bblue = ${xrdb:color12} +magenta = ${xrdb:color5} +bmagenta = ${xrdb:color13} +cyan = ${xrdb:color6} +bcyan = ${xrdb:color14} +white = ${xrdb:color7} +bwhite = ${xrdb:color15} + +bg = ${xrdb:background} +fg = ${colors.magenta} +bg-alt = #1E2029 +fg-alt = #373844 +bg-dark = #181a23 + +alert = ${colors.yellow} +accent = #604c7e + + +[global/wm] +margin-top = 0 +margin-bottom = 34 + +[bar/main] +monitor = ${env:MONITOR} +monitor-strict = true +enable-ipc = true +wm-restack = bspwm +# REQUIRED to move the window with hideit.sh +override-redirect = true +fixed-center = true + +background = ${colors.bg} +foreground = ${colors.fg} + +width = 100% +height = 34 +offset-x = 0 +offset-y = 0 +bottom = true + +overline-size = 0 +overline-color = #f00 +underline-size = 0 +underline-color = #00f + +border-bottom-size = 0 +border-top-size = 1 +border-color = ${colors.bg-dark} + +padding-left = 2 +padding-right = 2 +module-margin-left = 0 +module-margin-right = 0 + +font-0 = "Fira Code:pixelsize=9;2" +font-1 = "Wuncon Siji:pixelsize=12;2" +font-2 = "Siji:pixelsize=10;2" + +; modules-left = volume pad cpu memory pad pkg mail +modules-left = pulseaudio pad cpu memory +modules-center = bspwm +modules-right = battery wlan syncthing redshift pad date + +;tray-position = center +;tray-padding = 2 +;tray-transparent = true +;tray-background = #0063ff + +[module/bspwm] +type = internal/bspwm +pin-workspaces = true +enable-click = true + +ws-icon-0 = 1; +ws-icon-1 = 2; +ws-icon-2 = 3; +ws-icon-3 = 4; +ws-icon-4 = 5; +ws-icon-5 = 6; +ws-icon-default = x + +format = +label-padding = 1 + +label-focused = %icon% +label-focused-background = ${colors.bg-dark} +label-focused-foreground = ${colors.fg} +# label-focused-underline = ${colors.magenta} +; label-focused-foreground = ${xrdb:color2} +label-focused-padding = 1 + +label-occupied = %icon% +label-occupied-foreground = ${colors.accent} +label-occupied-padding = 1 + +; label-urgent = %icon% +label-urgent-foreground = ${colors.alert} +; label-urgent-background = ${colors.alert} +label-urgent-padding = 1 + +label-empty = %icon% +label-empty-foreground = ${colors.fg-alt} +label-empty-padding = 1 + +[module/date] +type = internal/date +interval = 5 + +label = %date% %time% +date = %A, %h %d +date-alt = %Y-%m-%d +time = %I:%M %p +time-alt = %H:%M:%S +format-prefix = "" +format-prefix-padding = 1 +; format-prefix-background = ${colors.bg-alt} +format-prefix-foreground = ${colors.accent} +; format-underline = ${xrdb:color4} + +[module/xwindow] +type = internal/xwindow +label = %title:0:80:...% +label-padding-left = 2 + +; [module/mpd] +; type = internal/mpd +; host = /home/hlissner/.config/mpd/mpd.sock +; +; format-online = +; format-padding = 5 +; +; label-song-maxlen = 45 +; label-song-ellipsis = true +; +; icon-prev =  +; icon-seekb =  +; icon-stop =  +; icon-play =  +; icon-pause =  +; icon-next =  +; icon-seekf =  +; +; icon-random =  +; icon-repeat =  +; +; toggle-on-foreground = ${colors.fg} +; toggle-off-foreground = #66 + +[module/cpu] +type = internal/cpu +interval = 2 +format = +format-prefix = "" +format-foreground = ${colors.accent} +; format-underline = #f90000 +; label = %percentage%% +format-padding = 1 + +bar-load-indicator = +bar-load-width = 6 +bar-load-foreground-0 = ${colors.fg} +bar-load-foreground-1 = ${colors.fg} +bar-load-foreground-2 = ${colors.yellow} +bar-load-foreground-3 = ${colors.alert} +bar-load-foreground-4 = ${colors.alert} +bar-load-fill = | +bar-load-empty = ¦ +bar-load-empty-foreground = ${colors.fg-alt} + +[module/memory] +type = internal/memory +interval = 3 +format = +format-prefix = "" +format-prefix-foreground = ${colors.accent} +; format-underline = #4bffdc +; label = %percentage_used%% +format-padding-left = 1 + +; Only applies if is used +bar-used-indicator = +bar-used-width = 6 +bar-used-foreground-0 = ${colors.fg} +bar-used-foreground-1 = ${colors.fg} +bar-used-foreground-2 = ${colors.yellow} +bar-used-foreground-3 = ${colors.alert} +bar-used-foreground-4 = ${colors.alert} +bar-used-fill = | +bar-used-empty = ¦ +bar-used-empty-foreground = ${colors.fg-alt} + +[module/wlan] +type = internal/network +interface = ${env:WLP:wlp3s0} +interval = 3.0 + +format-connected = +format-disconnected = ! +format-disconnected-foreground = ${colors.red} + +; label-connected = +; label-disconnected = ! +; label-disconnected-foreground = ${colors.red} + +ramp-signal-0 =  +ramp-signal-0-foreground = ${colors.yellow} +ramp-signal-1 =  +ramp-signal-1-foreground = ${colors.yellow} +ramp-signal-2 =  +ramp-signal-2-foreground = ${colors.yellow} +ramp-signal-3 =  +ramp-signal-3-foreground = ${colors.accent} +ramp-signal-4 =  +ramp-signal-4-foreground = ${colors.fg} + +; [module/eth] +; type = internal/network +; interface = ${env:ETH:enp2s0} +; interval = 4.0 +; +; ; format-connected-underline = #55aa55 +; ; format-connected-prefix = " " +; format-connected-foreground-foreground = ${colors.fg-alt} +; label-connected = %local_ip% +; +; format-disconnected-underline = ${self.format-connected-underline} +; label-disconnected = %ifname% disconnected +; label-disconnected-foreground = ${colors.fg-alt} + +[module/pulseaudio] +type = internal/pulseaudio + +; format-volume = +format-volume = +; label-volume = " " +label-volume-foreground = ${colors.accent} + +; format-muted-prefix = " " +format-muted-foreground = ${colors.alert} +label-muted =  + +bar-volume-width = 8 +# bar-volume-foreground-0 = ${colors.magenta} +# bar-volume-foreground-1 = ${colors.magenta} +# bar-volume-foreground-2 = ${colors.magenta} +# bar-volume-foreground-3 = ${colors.magenta} +# bar-volume-foreground-4 = ${colors.magenta} +# bar-volume-foreground-5 = ${colors.magenta} +# bar-volume-foreground-6 = ${colors.magenta} +bar-volume-gradient = false +bar-volume-indicator = | +bar-volume-indicator-font = 1 +bar-volume-indicator-foreground = #ff +bar-volume-fill = ─ +bar-volume-fill-font = 1 +bar-volume-empty = ─ +bar-volume-empty-font = 1 +bar-volume-empty-foreground = ${colors.fg-alt} + +; Only applies if is used +ramp-volume-0 =  +ramp-volume-1 =  +ramp-volume-2 =  + +[module/battery] +type = internal/battery +battery = BAT0 +adapter = ADP1 +full-at = 98 + +format-charging = +format-charging-underline = #ffb52a + +format-discharging = +format-discharging-underline = ${self.format-charging-underline} + +format-full-prefix = " " +format-full-prefix-foreground = ${colors.fg-alt} +format-full-underline = ${self.format-charging-underline} + +ramp-capacity-0 =  +ramp-capacity-1 =  +ramp-capacity-2 =  +ramp-capacity-foreground = ${colors.fg-alt} + +animation-charging-0 =  +animation-charging-1 =  +animation-charging-2 =  +animation-charging-foreground = ${colors.fg-alt} +animation-charging-framerate = 750 + + +;===================================================== +; Custom scripts +;===================================================== + +[module/pad] +type = custom/text +content = " " +content-foreground = ${colors.fg-alt} + +[module/redshift] +type = custom/script +exec = ~/.config/polybar/modules/redshift +exec-if = pgrep -x redshift +interval = 60 +format-padding = 1 + +[module/syncthing] +type = custom/script +exec = echo 1 +exec-if = systemctl is-active syncthing +format = "" +format-foreground = ${colors.fg} +interval = 30 + +; vim:ft=dosini diff --git a/modules/themes/fluorescence/polybar/modules/redshift b/modules/themes/fluorescence/polybar/modules/redshift new file mode 100755 index 00000000..7733a7fc --- /dev/null +++ b/modules/themes/fluorescence/polybar/modules/redshift @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# Specifying the icon(s) in the script +# This allows us to change its appearance conditionally +pgrep -x redshift &> /dev/null +if [[ $? -eq 0 ]]; then + temp=$(redshift -p 2>/dev/null | grep temp | cut -d' ' -f3) + temp=${temp//K/} +fi + +# OPTIONAL: Append ' ${temp}K' after $icon +if [[ -z $temp ]]; then + echo "%{F#65737E}$icon" # Greyed out (not running) +elif [[ $temp -ge 5000 ]]; then + echo "%{F#8FA1B3}$icon" # Blue +elif [[ $temp -ge 4000 ]]; then + echo "%{F#EBCB8B}$icon" # Yellow +else + echo "%{F#D08770}$icon" # Orange +fi + diff --git a/modules/themes/fluorescence/polybar/run.sh b/modules/themes/fluorescence/polybar/run.sh new file mode 100755 index 00000000..528a069a --- /dev/null +++ b/modules/themes/fluorescence/polybar/run.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +killall -q polybar +while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done + +polybar main >>$XDG_DATA_HOME/polybar.log 2>&1 & +echo 'Polybar launched...' \ No newline at end of file diff --git a/modules/themes/fluorescence/rofi/appmenu.rasi b/modules/themes/fluorescence/rofi/appmenu.rasi new file mode 100644 index 00000000..0bb1c11a --- /dev/null +++ b/modules/themes/fluorescence/rofi/appmenu.rasi @@ -0,0 +1,10 @@ +/* -*- mode: css; -*- */ +@import "config.rasi" + +textbox-icon { + str: "  "; +} + +prompt { + enabled: false; +} diff --git a/modules/themes/fluorescence/rofi/base.cyclemenu.rasi b/modules/themes/fluorescence/rofi/base.cyclemenu.rasi new file mode 100644 index 00000000..3de4010b --- /dev/null +++ b/modules/themes/fluorescence/rofi/base.cyclemenu.rasi @@ -0,0 +1,21 @@ +/* -*- mode: css; -*- */ +@import "config.rasi" + +window { + y-offset: 0; + children: [ listview ]; + width: 500px; +} + +listview { + scrollbar: false; +} + +element { + padding: 30px; + background-color: @bg-light; +} +element.selected { + background-color: @accent; + text-color: @bg; +} diff --git a/modules/themes/fluorescence/rofi/bookmarkmenu.rasi b/modules/themes/fluorescence/rofi/bookmarkmenu.rasi new file mode 100644 index 00000000..3bd91618 --- /dev/null +++ b/modules/themes/fluorescence/rofi/bookmarkmenu.rasi @@ -0,0 +1,14 @@ +/* -*- mode: css; -*- */ + +@import "config.rasi" + +window { + width: 44%; +} +textbox-icon { + str: " 爵 "; +} + +prompt { + enabled: false; +} diff --git a/modules/themes/fluorescence/rofi/config.rasi b/modules/themes/fluorescence/rofi/config.rasi new file mode 100644 index 00000000..2de73455 --- /dev/null +++ b/modules/themes/fluorescence/rofi/config.rasi @@ -0,0 +1,114 @@ +/* -*- mode: css; -*- */ +configuration { + icon-theme: "Paper"; + cycle: true; + disable-history: false; + monitor: "-4"; +} + +* { + accent: #bd93f9; + bg: #1E2029FA; + bg-light: #1c1c1c; + bg-focus: #282a36; + bg-dark: #181a23; + fg: #bbc2cf; + fg-list: #bbc2cf; + on: #8BD49C; + off: #cc6666; + + magenta: #bd93f9; + blue: #61bfff; + + text-font: "Fira Sans 16"; + text-mono-font: "Fira Code 14"; + icon-font: "Hurmit Nerd Font Mono 26"; + + background-color: transparent; + text-color: @fg-list; + font: @text-font; + border-color: @bg-dark; +} + + +/**** Layout ****/ +window { + width: 34%; + y-offset: -25%; + anchor: north; + location: center; + border: 1px; + border-radius: 6px; + children: [ inputbar, listview ]; +} +listview { + lines: 16; + fixed-height: false; + /* reverse: true; */ + margin: -2px 0 0; + columns: 1; + scrollbar: true; + spacing: 1px; +} +scrollbar { + handle-width: 1px; +} +inputbar { + children: [ textbox-icon, prompt, entry ]; + border: 0 0 1px; +} +textbox-icon, prompt { + padding: 11px; + expand: false; + border: 0 1px 0 0; + margin: 0 -2px 0 0; +} +textbox-icon { + padding: 7px -6px 0; +} +entry, element { + padding: 11px 14px; +} +textbox { + padding: 24px; + margin: 20px; +} + + +/**** Looks ****/ +scrollbar { + background-color: @bg-dark; + handle-color: @accent; + border-color: @bg-dark; +} +listview, inputbar { + background-color: @bg-dark; +} +textbox-icon, prompt, entry { + text-color: @accent; +} +prompt, entry { + background-color: @bg-focus; +} +textbox-icon, prompt { + background-color: #2f313d; +} +prompt { + background-color: @bg-focus; +} +textbox-icon { + font: @icon-font; +} +entry { + font: @text-font-mono; + text-color: @fg; +} + +element { + background-color: @bg; + text-color: @fg; +} +element selected { + background-color: @bg-dark; + text-color: @accent; +} diff --git a/modules/themes/fluorescence/rofi/filemenu.rasi b/modules/themes/fluorescence/rofi/filemenu.rasi new file mode 100644 index 00000000..53a49676 --- /dev/null +++ b/modules/themes/fluorescence/rofi/filemenu.rasi @@ -0,0 +1,11 @@ +/* -*- mode: css; -*- */ + +@import "config.rasi" + +textbox-icon { + str: "  "; +} + +prompt { + enabled: true; +} diff --git a/modules/themes/fluorescence/rofi/passmenu.rasi b/modules/themes/fluorescence/rofi/passmenu.rasi new file mode 100644 index 00000000..c7f3bc77 --- /dev/null +++ b/modules/themes/fluorescence/rofi/passmenu.rasi @@ -0,0 +1,6 @@ +/* -*- mode: css; -*- */ +@import "config.rasi" + +textbox-icon { + str: "  "; +} diff --git a/modules/themes/fluorescence/rofi/powermenu.rasi b/modules/themes/fluorescence/rofi/powermenu.rasi new file mode 100644 index 00000000..83681185 --- /dev/null +++ b/modules/themes/fluorescence/rofi/powermenu.rasi @@ -0,0 +1,23 @@ +/** -*- mode: css; -*- + * This theme is intended for a 5 items wide menu on a 1920x1080 pixels resolution. + * You may have to tweak values such as the window padding if you have a different resolution. + */ +@import "appmenu.rasi" + +window { + children: [ listview ]; + width: 500px; +} + +listview { + scrollbar: false; +} + +element { + padding: 30px; + background-color: @bg-light; +} +element.selected { + background-color: @accent; + text-color: @bg; +} diff --git a/modules/themes/fluorescence/rofi/windowmenu.rasi b/modules/themes/fluorescence/rofi/windowmenu.rasi new file mode 100644 index 00000000..1f432d85 --- /dev/null +++ b/modules/themes/fluorescence/rofi/windowmenu.rasi @@ -0,0 +1,19 @@ +/* -*- mode: css; -*- */ + +@import "config.rasi" + +inputbar { + width: 25%; +} + +textbox-icon { + str: " 缾 "; +} + +prompt { + enabled: false; +} + +element { + font: "Fira Code 12"; +} diff --git a/modules/themes/fluorescence/tmux.conf b/modules/themes/fluorescence/tmux.conf new file mode 100644 index 00000000..2dc3ebb6 --- /dev/null +++ b/modules/themes/fluorescence/tmux.conf @@ -0,0 +1,64 @@ +# -- THEME ------------------------------- + +# The statusbar +set -g status-position bottom +set -g status-justify centre +set -g status-bg default +set -g status-fg colour15 +set -g status-interval 10 +# set -g status-attr dim +# set -g status-left '#[fg=colour236]_________________________' +set -g status-left '#{prefix_highlight}#[fg=colour236]|―――――――――――――――――――|' +# set -g status-left "#[fg=colour236]#{prefix_highlight} #[fg=colour5] #S #[fg=colour236]──" +# set -g status-right '#[fg=colour236]_________________________' +set -g status-right '#[fg=colour236]|―――――――――――――――――――――――――|' +set -g status-right-length 30 +set -g status-left-length 30 + +# The messages +set -g message-style fg=magenta,bg=colour236 +set -g message-command-style fg=blue,bg=black + +# loud or quiet? +set-option -g visual-activity off +set-option -g visual-bell off +set-option -g visual-silence off +set-window-option -g monitor-activity on +set-option -g bell-action none + +# The modes +setw -g clock-mode-colour colour135 +# setw -g mode-attr bold +# setw -g mode-fg colour196 +# setw -g mode-bg colour238 + +# The panes +set -g pane-border-style fg=colour235 +set -g pane-active-border-style fg=colour5 + +# setw -g window-status-current-fg colour2 +# setw -g window-status-current-bg default +# setw -g window-status-current-attr none +# setw -g window-status-current-format ' #W ' + +# setw -g window-status-fg colour236 +# setw -g window-status-bg default +# setw -g window-status-attr none +# setw -g window-status-format '#[fg=colour8] #I #[fg=default]#W ' +setw -g window-status-format ' #W ' + +# setw -g window-status-activity-bg default +# setw -g window-status-activity-fg colour240 +# setw -g window-status-activity-attr none + +# setw -g window-status-bell-attr bold +# setw -g window-status-bell-fg colour255 +# setw -g window-status-bell-bg colour1 + + +# -- PLUGINS ----------------------------- + +# tmux-prefix-highlight +set -g @prefix_highlight_empty_prompt '-----' +set -g @prefix_highlight_prefix_prompt ' C^c #[bg=colour8]' +set -g @prefix_highlight_show_copy_mode 'on' diff --git a/modules/themes/fluorescence/wallpaper.png b/modules/themes/fluorescence/wallpaper.png new file mode 100644 index 00000000..d558bca2 Binary files /dev/null and b/modules/themes/fluorescence/wallpaper.png differ diff --git a/modules/themes/fluorescence/zsh/prompt.zsh b/modules/themes/fluorescence/zsh/prompt.zsh new file mode 100644 index 00000000..ae641e10 --- /dev/null +++ b/modules/themes/fluorescence/zsh/prompt.zsh @@ -0,0 +1,71 @@ +# Loosely based off Pure + +_strlen() { echo ${#${(S%%)1//$~%([BSUbfksu]|([FB]|){*})/}}; } + +# fastest possible way to check if repo is dirty +prompt_git_dirty() { + command -v git >/dev/null || return + + # check if we're in a git repo + [[ "$(command git rev-parse --is-inside-work-tree 2>/dev/null)" == "true" ]] || return + # check if it's dirty + command test -n "$(git status --porcelain --ignore-submodules -unormal)" || return + + local r=$(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null) + local l=$(command git rev-list --left-only --count HEAD...@'{u}' 2>/dev/null) + + (( ${r:-0} > 0 )) && echo -n " %F{red}${r}-" + (( ${l:-0} > 0 )) && echo -n " %F{green}${l}+" + echo -n '%f' +} + +## Hooks ############################### +prompt_hook_precmd() { + vcs_info # get git info + # Newline before prompt, except on init + [[ -n $PROMPT_DONE ]] && print ""; PROMPT_DONE=1 +} + +## Initialization ###################### +prompt_init() { + # prevent percentage showing up + # if output doesn't end with a newline + export PROMPT_EOL_MARK= + + # prompt_opts=(cr subst percent) + setopt promptsubst + autoload -Uz add-zsh-hook + autoload -Uz vcs_info + + add-zsh-hook precmd prompt_hook_precmd + # Updates cursor shape and prompt symbol based on vim mode + zle-keymap-select() { + case $KEYMAP in + vicmd) PROMPT_SYMBOL="%F{green}« " ;; + main|viins) PROMPT_SYMBOL="%(?.%F{magenta}.%F{yellow})λ " ;; + esac + zle reset-prompt + zle -R + } + zle -N zle-keymap-select + zle -A zle-keymap-select zle-line-init + + zstyle ':vcs_info:*' enable git + zstyle ':vcs_info:*' use-simple true + zstyle ':vcs_info:*' max-exports 2 + zstyle ':vcs_info:git*' formats ' %b' + zstyle ':vcs_info:git*' actionformats ' %b (%a)' + + # show username@host if logged in through SSH + if [[ -n $SSH_CONNECTION ]]; then + prompt_username='%m ' + if [[ $(whoami) != hlissner ]]; then + prompt_username="%n.$prompt_username" + fi + fi + + RPROMPT='%F{blue}%~%F{magenta}${vcs_info_msg_0_}$(prompt_git_dirty)%f' + PROMPT='%F{magenta}${prompt_username}%f${PROMPT_SYMBOL:-$ }' +} + +prompt_init "$@" diff --git a/overlays.nix b/overlays.nix index 314dd2cd..2ae8fa80 100644 --- a/overlays.nix +++ b/overlays.nix @@ -8,6 +8,7 @@ (callPackage (builtins.fetchTarball https://github.com/xzfc/cached-nix-shell/archive/master.tar.gz) {}); + ant-dracula = (callPackage ./packages/ant-dracula.nix {}); }; nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") { @@ -16,7 +17,7 @@ # Occasionally, "stable" packages are broken or incomplete, so access to the # bleeding edge is necessary, as a last resort. - unstable = import { inherit config; }; + unstable = import { inherit config; }; }) # emacsGit diff --git a/packages/ant-dracula.nix b/packages/ant-dracula.nix new file mode 100644 index 00000000..8dd7d0f5 --- /dev/null +++ b/packages/ant-dracula.nix @@ -0,0 +1,39 @@ +{ stdenv, fetchurl, gtk-engine-murrine }: + +stdenv.mkDerivation rec { + pname = "ant-dracula-theme"; + version = "1.3.0"; + + src = fetchurl { + url = "https://github.com/EliverLara/Ant-Dracula/releases/download/v${version}/Ant-Dracula.tar"; + sha256 = "00b8w69xapqy8kc7zqwlfz1xpld6hibbh35djvhcnd905gzzymkd"; + }; + + propagatedUserEnvPkgs = [ + gtk-engine-murrine + ]; + + dontBuild = true; + + installPhase = '' + runHook preInstall + mkdir -p $out/share/themes/Ant-Dracula + cp -a * $out/share/themes/Ant-Dracula + rm -r $out/share/themes/Ant-Dracula/{Art,LICENSE,README.md,gtk-2.0/render-assets.sh} + runHook postInstall + ''; + + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + outputHash = "1ns00y1haxm20jak26gjv53yisaw9vsr2dbsgj10zz65rglr1h18"; + + meta = with stdenv.lib; { + description = "A flat and light theme with a modern look"; + homepage = https://github.com/EliverLara/Ant-Dracula; + license = licenses.gpl3; + platforms = platforms.all; + maintainers = [ + maintainers.pbogdan + ]; + }; +}