From b7ef29a8886a57aadb787807a7c6cf74c1f0ed3a Mon Sep 17 00:00:00 2001 From: anand Date: Wed, 17 Dec 2025 15:57:55 +0530 Subject: Nixos --- spectrwm/background.sh | 1 + spectrwm/baraction.sh | 94 +++++++++++++++++ spectrwm/screenshot.sh | 18 ++++ spectrwm/spectrwm.conf | 275 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 388 insertions(+) create mode 100755 spectrwm/background.sh create mode 100755 spectrwm/baraction.sh create mode 100755 spectrwm/screenshot.sh create mode 100755 spectrwm/spectrwm.conf (limited to 'spectrwm') diff --git a/spectrwm/background.sh b/spectrwm/background.sh new file mode 100755 index 0000000..5b3fe15 --- /dev/null +++ b/spectrwm/background.sh @@ -0,0 +1 @@ +feh --bg-fill /home/anand/dots/walls/wallpaper.jpg diff --git a/spectrwm/baraction.sh b/spectrwm/baraction.sh new file mode 100755 index 0000000..fa26087 --- /dev/null +++ b/spectrwm/baraction.sh @@ -0,0 +1,94 @@ +#!/bin/sh +# Example Bar Action Script for Linux. +# Requires: acpi, iostat. +# Tested on: Debian 10, Fedora 31. +# + +print_date() { + # The date is printed to the status bar by default. + # To print the date through this script, set clock_enabled to 0 + # in spectrwm.conf. Uncomment "print_date" below. + FORMAT="%a %b %d %R %Z %Y" + DATE=`date "+${FORMAT}"` + echo -n "${DATE} " +} + +print_mem() { + MEM=`/usr/bin/free -m | grep ^Mem: | sed -E 's/ +/ /g' | cut -d ' ' -f4` + echo -n "Free mem: ${MEM}M " +} + +_print_cpu() { + printf "CPU: %3d%%" $1 +} + +print_cpu() { + OUT="" + # Remove the decimal part from all the percentages. + while [ "${1}x" != "x" ]; do + OUT="$OUT `echo "${1}" | cut -d '.' -f1`" + shift; + done + _print_cpu $OUT +} + +print_bat() { + AC_STATUS="$3" + BAT_STATUS="$6" + # Most battery statuses fit into a single word, except "Not charging" + # for which we need to have special handling. + if [ "$BAT_STATUS" = "Not" ]; then + BAT_STATUS="$BAT_STATUS $7" + shift + fi + BAT_LEVEL="`echo "$7" | tr -d ','`" + + if [ "$AC_STATUS" != "" -o "$BAT_STATUS" != "" ]; then + if [ "$BAT_STATUS" = "Discharging," ]; then + echo -n " on battery ($BAT_LEVEL)" + else + case "$AC_STATUS" in + on-line) + AC_STRING="on AC: " + ;; + *) + AC_STRING="" + ;; + esac + case "$BAT_STATUS" in + "") + BAT_STRING="(no battery)" + ;; + *harging,|Full,) + BAT_STRING="(battery $BAT_LEVEL)" + ;; + *) + BAT_STRING="(battery unknown)" + ;; + esac + + FULL="${AC_STRING}${BAT_STRING}" + if [ "$FULL" != "" ]; then + echo -n "$FULL" + fi + fi + fi +} + +# Cache the output of acpi(8), no need to call that every second. +ACPI_DATA="" +I=0 +while :; do + IOSTAT_DATA=`/usr/bin/iostat -c | grep '[0-9]$'` + if [ $I -eq 0 ]; then + ACPI_DATA=`/usr/bin/acpi -a 2>/dev/null; /usr/bin/acpi -b 2>/dev/null` + fi + # print_date + print_mem + print_cpu $IOSTAT_DATA + print_cpuspeed + print_bat $ACPI_DATA + echo "" + I=$(( ( ${I} + 1 ) % 11 )) + sleep 1 +done diff --git a/spectrwm/screenshot.sh b/spectrwm/screenshot.sh new file mode 100755 index 0000000..3a684ea --- /dev/null +++ b/spectrwm/screenshot.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# + +screenshot() { + case $1 in + full) + scrot -m + ;; + window) + sleep 1 + scrot -s + ;; + *) + ;; + esac; +} + +screenshot $1 diff --git a/spectrwm/spectrwm.conf b/spectrwm/spectrwm.conf new file mode 100755 index 0000000..2ec04b3 --- /dev/null +++ b/spectrwm/spectrwm.conf @@ -0,0 +1,275 @@ +# +# spectrwm Example Configuration File +# +# PLEASE READ THE MAN PAGE BEFORE EDITING THIS FILE! +# https://htmlpreview.github.io/?https://github.com/conformal/spectrwm/blob/master/spectrwm.html +# +# All example settings in this file are commented out with a '#'. +# See the spectrwm(1) man page for default values. +# +# NOTE: rgb color values are in hexadecimal! See XQueryColor(3) for details. + +workspace_limit = 10 +focus_mode = default +focus_close = previous +#focus_close_wrap = 1 +#focus_default = last +spawn_position = next +#workspace_autorotate = 1 +#workspace_clamp = 1 +#warp_focus = 1 +#warp_pointer = 1 +click_to_raise = 1 + +# Include mapped workspaces when switching with any of the ws next/prev actions. +#cycle_visible = 1 + +# Sequence of layouts used by the cycle_layout action. +#layout_order = vertical,horizontal,max,floating + +# Window Decoration +border_width = 2 +color_focus = red +color_focus_maximized = yellow +color_unfocus = rgb:88/88/88 +color_unfocus_maximized = rgb:88/88/00 +color_urgent = rgb:ff/a5/00 +color_urgent_maximized = rgb:ff/a5/00 +color_focus_free = cyan +color_focus_maximized_free = magenta +color_unfocus_free = rgb:00/88/88 +color_unfocus_maximized_free = rgb:88/00/88 +color_urgent_free = rgb:b8/86/0b +color_urgent_maximized_free = rgb:b8/86/0b +region_padding = 0 +tile_gap = 0 + +# Region containment +# Distance window must be dragged/resized beyond the region edge before it is +# allowed outside the region. +boundary_width = 50 + +# Remove window border when bar is disabled and there is only one window in workspace +disable_border = 1 +bar_enabled = 0 + +# Dialog box size ratio when using TRANSSZ quirk; 0.3 < dialog_ratio <= 1.0 +#dialog_ratio = 0.6 + +# Split a non-RandR dual head setup into one region per monitor +# (non-standard driver-based multihead is not seen by spectrwm) +#region = screen[1]:1280x1024+0+0 +#region = screen[1]:1280x1024+1280+0 + +# Customize workspace layout at start +layout = ws[1]:0:0:0:0:vertical +#layout = ws[2]:0:0:0:0:horizontal +#layout = ws[3]:0:0:0:0:max +#layout = ws[4]:4:0:0:0:vertical_flip +#layout = ws[5]:0:0:0:0:horizontal_flip +#layout = ws[6]:0:0:0:0:floating + +# Set workspace name at start +# name = ws[1]:Term +# name = ws[2]:Browse +# name = ws[3]:Extra + +# Change the modifier to use when specifying 'MOD' in bindings. +# This should come before configuring bindings, not after. +# (Mod1: Alt key, Mod4: Windows key, Mod2: Apple key on OSX) +modkey = Mod4 + +# This allows you to include pre-defined key bindings for your keyboard layout. +# All key bindings are cleared before loading bindings in the specified file. +keyboard_mapping = /dev/null + +# PROGRAMS + +# Set the default spawn flags for 'autorun' and 'program' entries. +# Note that this does not affect existing entries, including defaults. +spawn_flags = nospawnws + +# A regex search pattern can be specified to change existing entries: +#spawn_flags[menu|term] += nospawnws + +# Change spawn flags on all existing entries, including defaults: +#spawn_flags[.*] += nospawnws + +# Launch applications in a workspace of choice. +# Note that the specified workspace is ignored when 'nospawnws' is set. +# autorun = ws[1]:trayer --edge bottom --align right --distancefrom right --transparent true --padding 25 --iconspacing 10 --alpha 256 # --SetDockTpe true +autorun = ws[1]:polybar +autorun = ws[1]:nm-applet +autorun = ws[1]:copyq +autorun = ws[1]:lxpolkit +autorun = ws[1]:flameshot +autorun = ws[1]:/home/anand/.config/spectrwm/background.sh +autorun = ws[1]:dunst +autorun = ws[1]:/usr/lib/xdg-desktop-portal-gtk +autorun = ws[1]:/usr/lib/xdg-desktop-portal + +#autorun = ws[2]:xombrero http://www.openbsd.org + +# Validated default program entries: +program[lock] = xlock -mode pipes +program[term] = wezterm +# program[menu] = dmenu_run $dmenu_bottom -fn $bar_font -nb $bar_color -nf $bar_font_color -sb $bar_color_selected -sf $bar_font_color_selected +# program[menu] = rofi -show drun +program[menu] = rofi -show drun +program[menu2] = dmenu_run +program[search] = dmenu $dmenu_bottom -i -fn $bar_font -nb $bar_color -nf $bar_font_color -sb $bar_color_selected -sf $bar_font_color_selected +program[name_workspace] = dmenu $dmenu_bottom -p Workspace -fn $bar_font -nb $bar_color -nf $bar_font_color -sb $bar_color_selected -sf $bar_font_color_selected + +# Validation of the above can be disabled by setting the 'optional' spawn flag. +# Note that these entries are required for included features. Instead of +# disabling validation, it is recommended to resolve these dependencies or +# override the entries with suitable alternatives. +#spawn_flags[lock|term|menu|search|name_workspace] += optional + +# Alternatively, free the respective binding(s): +#bind[] = MOD+Shift+Delete # disable lock +#bind[] = MOD+Shift+Return # disable term +#bind[] = MOD+p # disable menu + +# Default programs with the 'optional' spawn flag: +program[screenshot] = flameshot gui +#program[initscr] = initscreen.sh + +# EXAMPLE: Define 'firefox' action and bind to key. +program[firefox] = qutebrowser +bind[firefox] = MOD+b + +program[thunar] = thunar +bind[thunar] = MOD+e + +program[passwords] = passmenu +bind[passwords] = MOD+p + +# Volume +program[raise_volume] = amixer -q -D pulse sset Master 5%+ +bind[raise_volume] = XF86AudioRaiseVolume +program[lower_volume] = amixer -q -D pulse sset Master 5%- +bind[lower_volume] = XF86AudioLowerVolume +program[mute_volume] = amixer -q -D pulse sset Master toggle +bind[mute_volume] = XF86AudioMute + +program[raise_brightness] = brillo -qA 5 +program[lower_brightness] = brillo -qU 5 +bind[raise_brightness] = XF86MonBrightnessUp +bind[lower_brightness] = XF86MonBrightnessDown + +# QUIRKS +# Default quirks, remove with: quirk[class:name] = NONE +quirk[tint2:tint2] = FLOAT + ANYWHERE + NOFOCUSCYCLE + NOFOCUSONMAP + OBEYAPPFOCUSREQ +quirk[.*:.*:.*:splash,dialog] = FLOAT +quirk[.*:.*:.*:toolbar,utility] = FLOAT + ANYWHERE +quirk[.*:.*:.*:notification] = FLOAT + ANYWHERE + MINIMALBORDER + NOFOCUSONMAP +quirk[Xfce4-appfinder] = FLOAT +quirk[MPlayer:xv] = FLOAT + FULLSCREEN + FOCUSPREV +quirk[OpenOffice.org 2.4:VCLSalFrame] = FLOAT +quirk[OpenOffice.org 3.0:VCLSalFrame] = FLOAT +quirk[OpenOffice.org 3.1:VCLSalFrame] = FLOAT +quirk[Firefox-bin:firefox-bin] = TRANSSZ +quirk[Firefox:Dialog] = FLOAT +quirk[Gimp:gimp] = FLOAT + ANYWHERE +quirk[xine:Xine Window] = FLOAT + ANYWHERE +quirk[Xitk:Xitk Combo] = FLOAT + ANYWHERE +quirk[xine:xine Panel] = FLOAT + ANYWHERE +quirk[Xitk:Xine Window] = FLOAT + ANYWHERE +quirk[xine:xine Video Fullscreen Window] = FULLSCREEN + FLOAT +quirk[pcb:pcb] = FLOAT +bind[below_toggle] = MOD+Shift+t +bind[button2] = MOD+v +bind[cycle_layout] = MOD+n +bind[flip_layout] = MOD+Shift+backslash +bind[float_toggle] = MOD+t +bind[focus_free] = MOD+grave +bind[focus_next] = MOD+j +bind[focus_next] = MOD+Tab +bind[focus_prev] = MOD+k +bind[focus_prev] = MOD+Shift+Tab +bind[focus_prior] = MOD+Shift+a +bind[focus_urgent] = MOD+u +bind[free_toggle] = MOD+Shift+grave +# bind[fullscreen_toggle] = MOD+Shift+e +bind[height_grow] = MOD+Shift+equal +bind[height_shrink] = MOD+Shift+minus +bind[iconify] = MOD+w +bind[initscr] = MOD+Shift+i +bind[lock] = MOD+Shift+Delete +bind[master_add] = MOD+comma +bind[master_del] = MOD+period +bind[master_grow] = MOD+l +bind[master_shrink] = MOD+h +bind[maximize_toggle] = MOD+m +bind[menu] = MOD+space +bind[move_down] = MOD+Shift+bracketright +bind[move_left] = MOD+bracketleft +bind[move_right] = MOD+bracketright +bind[move_up] = MOD+Shift+bracketleft +bind[mvrg_1] = MOD+Shift+KP_End +bind[mvrg_2] = MOD+Shift+KP_Down +bind[mvrg_3] = MOD+Shift+KP_Next +bind[mvrg_4] = MOD+Shift+KP_Left +bind[mvrg_5] = MOD+Shift+KP_Begin +bind[mvrg_6] = MOD+Shift+KP_Right +bind[mvrg_7] = MOD+Shift+KP_Home +bind[mvrg_8] = MOD+Shift+KP_Up +bind[mvrg_9] = MOD+Shift+KP_Prior +bind[mvws_1] = MOD+Shift+1 +bind[mvws_2] = MOD+Shift+2 +bind[mvws_3] = MOD+Shift+3 +bind[mvws_4] = MOD+Shift+4 +bind[mvws_5] = MOD+Shift+5 +bind[mvws_6] = MOD+Shift+6 +bind[mvws_7] = MOD+Shift+7 +bind[mvws_8] = MOD+Shift+8 +bind[mvws_9] = MOD+Shift+9 +bind[mvws_10] = MOD+Shift+0 +bind[name_workspace] = MOD+Shift+slash +bind[quit] = MOD+Shift+e +bind[menu2] = MOD+Shift+space +bind[restart] = MOD+Shift+c +bind[rg_1] = MOD+KP_End +bind[rg_2] = MOD+KP_Down +bind[rg_3] = MOD+KP_Next +bind[rg_4] = MOD+KP_Left +bind[rg_5] = MOD+KP_Begin +bind[rg_6] = MOD+KP_Right +bind[rg_7] = MOD+KP_Home +bind[rg_8] = MOD+KP_Up +bind[rg_9] = MOD+KP_Prior +bind[rg_next] = MOD+Shift+Right +bind[rg_prev] = MOD+Shift+Left +bind[screenshot] = MOD+Shift+s +bind[search_win] = MOD+f +bind[search_workspace] = MOD+slash +bind[stack_dec] = MOD+Shift+period +bind[stack_inc] = MOD+Shift+comma +bind[stack_reset] = MOD+Shift+space +bind[swap_next] = MOD+Shift+j +bind[swap_prev] = MOD+Shift+k +bind[term] = MOD+Return +bind[width_grow] = MOD+equal +bind[width_shrink] = MOD+minus +bind[wind_del] = MOD+q +bind[wind_kill] = MOD+Shift+q +bind[ws_1] = MOD+1 +bind[ws_2] = MOD+2 +bind[ws_3] = MOD+3 +bind[ws_4] = MOD+4 +bind[ws_5] = MOD+5 +bind[ws_6] = MOD+6 +bind[ws_7] = MOD+7 +bind[ws_8] = MOD+8 +bind[ws_9] = MOD+9 +bind[ws_10] = MOD+0 +bind[ws_next] = MOD+Right +bind[ws_next_all] = MOD+Up +bind[ws_next_move] = MOD+Shift+Up +bind[ws_prev] = MOD+Left +bind[ws_prev_all] = MOD+Down +bind[ws_prev_move] = MOD+Shift+Down +bind[ws_prior] = MOD+a +bind[debug_toggle] = MOD+d +bind[dumpwins] = MOD+Shift+d -- cgit v1.2.3