From de58295210063ed7088b411d0da8ef37b33cb863 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Fri, 9 Sep 2022 21:11:43 +0530 Subject: switched to lemonbar --- .config/XMonad/lib/Defaults.hs | 22 ++--- .config/glava/bars | 1 + .config/glava/bars.glsl | 33 +++++++ .config/glava/circle | 1 + .config/glava/circle.glsl | 24 +++++ .config/glava/env_KWin.glsl | 8 ++ .config/glava/env_Openbox.glsl | 2 + .config/glava/env_Xfwm4.glsl | 3 + .config/glava/env_awesome.glsl | 1 + .config/glava/env_default.glsl | 1 + .config/glava/env_i3.glsl | 1 + .config/glava/graph | 1 + .config/glava/graph.glsl | 31 +++++++ .config/glava/radial.glsl | 10 +- .config/glava/smooth_parameters.glsl | 78 ++++++++++++++++ .config/glava/util | 1 + .config/glava/wave | 1 + .config/glava/wave.glsl | 14 +++ .config/lemon.go | 173 +++++++++++++++++++++++++++++++++++ .config/zsh/.zshenv | 1 - 20 files changed, 390 insertions(+), 17 deletions(-) create mode 120000 .config/glava/bars create mode 100755 .config/glava/bars.glsl create mode 120000 .config/glava/circle create mode 100755 .config/glava/circle.glsl create mode 100755 .config/glava/env_KWin.glsl create mode 100755 .config/glava/env_Openbox.glsl create mode 100755 .config/glava/env_Xfwm4.glsl create mode 100755 .config/glava/env_awesome.glsl create mode 100755 .config/glava/env_default.glsl create mode 100755 .config/glava/env_i3.glsl create mode 120000 .config/glava/graph create mode 100755 .config/glava/graph.glsl create mode 100755 .config/glava/smooth_parameters.glsl create mode 120000 .config/glava/util create mode 120000 .config/glava/wave create mode 100755 .config/glava/wave.glsl create mode 100644 .config/lemon.go (limited to '.config') diff --git a/.config/XMonad/lib/Defaults.hs b/.config/XMonad/lib/Defaults.hs index 9e9d318..7e0b0a1 100644 --- a/.config/XMonad/lib/Defaults.hs +++ b/.config/XMonad/lib/Defaults.hs @@ -98,7 +98,7 @@ myGSConfig colorizer = (buildDefaultGSConfig myGSColorizer) myGridSelect = myGSConfig myGSColorizer -myLemonbarCmd = "lemonbar -g 445x28+3395+0 -f 'SauceCodePro:style=Regular:size=11' -f 'Source Han Sans JP Normal:size=11' -B '#e6100b13' -F '#9d00ff'" +myLemonbarCmd = "lemon | lemonbar -g 1920x28+1920+0 -o -2 -f 'Source Han Sans JP Normal:size=12' -B '#e6100b13' -F '#9d00ff'" myLemonbarPP = def { ppCurrent = wrap "%{B#ff0aa3} %{F#FFFFFF}" " %{F-}%{B-}" , ppVisible = wrap "%{B#28c78f} %{F#FFFFFF}" " %{F-}%{B-}" @@ -111,13 +111,13 @@ myLemonbarPP = def { } myLemonbarCmd' = "lemonbar -g 343x20+1577+0 -f 'SauceCodePro:style=Regular:size=9' -f 'Source Han Sans JP Normal:size=9' -B '#e6100b13' -F '#9d00ff'" -myLemonbarPP' = def { - ppCurrent = wrap "%{B#28c78f} %{F#FFFFFF}" " %{F-}%{B-}" - , ppVisible = wrap "%{B#ff0aa3} %{F#FFFFFF}" " %{F-}%{B-}" - , ppHidden = wrap "%{B#9b1bed} %{F#FFFFFF}" " %{F-}%{B-}" - , ppHiddenNoWindows = wrap " " " " - --, ppVisibleNoWindows = wrap "%{B#ffffff} %{F#9b1bed}" " %{F-}%{B-}" - , ppWsSep = "" - , ppSep = "" - , ppOrder = \(ws:l:t:ex) -> ["%{r}",ws]++[]++[]++ex - } +myLemonbarPP' = myLemonbarPP -- def { +-- ppCurrent = wrap "%{B#28c78f} %{F#FFFFFF}" " %{F-}%{B-}" +-- , ppVisible = wrap "%{B#ff0aa3} %{F#FFFFFF}" " %{F-}%{B-}" +-- , ppHidden = wrap "%{B#9b1bed} %{F#FFFFFF}" " %{F-}%{B-}" +-- , ppHiddenNoWindows = wrap " " " " +-- --, ppVisibleNoWindows = wrap "%{B#ffffff} %{F#9b1bed}" " %{F-}%{B-}" +-- , ppWsSep = "" +-- , ppSep = "" +-- , ppOrder = \(ws:l:t:ex) -> ["%{r}",ws]++[]++[]++ex +-- } diff --git a/.config/glava/bars b/.config/glava/bars new file mode 120000 index 0000000..09377e3 --- /dev/null +++ b/.config/glava/bars @@ -0,0 +1 @@ +/etc/xdg/glava//bars \ No newline at end of file diff --git a/.config/glava/bars.glsl b/.config/glava/bars.glsl new file mode 100755 index 0000000..6e6a7b0 --- /dev/null +++ b/.config/glava/bars.glsl @@ -0,0 +1,33 @@ + +/* Center line thickness (pixels) */ +#define C_LINE 1 +/* Width (in pixels) of each bar */ +#define BAR_WIDTH 4 +/* Width (in pixels) of each bar gap */ +#define BAR_GAP 2 +/* Outline color */ +#define BAR_OUTLINE #262626 +/* Outline width (in pixels, set to 0 to disable outline drawing) */ +#define BAR_OUTLINE_WIDTH 0 +/* Amplify magnitude of the results each bar displays */ +#define AMPLIFY 300 +/* Whether the current settings use the alpha channel; + enabling this is required for alpha to function + correctly on X11 with `"native"` transparency. */ +#define USE_ALPHA 0 +/* How strong the gradient changes */ +#define GRADIENT_POWER 60 +/* Bar color changes with height */ +#define GRADIENT (d / GRADIENT_POWER + 1) +/* Bar color */ +#define COLOR (#3366b2 * GRADIENT) +/* Direction that the bars are facing, 0 for inward, 1 for outward */ +#define DIRECTION 0 +/* Whether to switch left/right audio buffers */ +#define INVERT 0 +/* Whether to flip the output vertically */ +#define FLIP 0 +/* Whether to mirror output along `Y = X`, causing output to render on the left side of the window */ +/* Use with `FLIP 1` to render on the right side */ +#define MIRROR_YX 0 + diff --git a/.config/glava/circle b/.config/glava/circle new file mode 120000 index 0000000..f53c651 --- /dev/null +++ b/.config/glava/circle @@ -0,0 +1 @@ +/etc/xdg/glava//circle \ No newline at end of file diff --git a/.config/glava/circle.glsl b/.config/glava/circle.glsl new file mode 100755 index 0000000..83b8ad3 --- /dev/null +++ b/.config/glava/circle.glsl @@ -0,0 +1,24 @@ +/* center radius (pixels) */ +#define C_RADIUS 128 +/* center line thickness (pixels) */ +#define C_LINE 1.5 +/* outline color */ +#define OUTLINE #333333 +/* Amplify magnitude of the results each bar displays */ +#define AMPLIFY 150 +/* Angle (in radians) for how much to rotate the visualizer */ +#define ROTATE (PI / 2) +/* Whether to switch left/right audio buffers */ +#define INVERT 0 +/* Whether to fill in the space between the line and inner circle */ +#define C_FILL 0 +/* Whether to apply a post-processing image smoothing effect + 1 to enable, 0 to disable. Only works with `xroot` transparency, + and improves performance if disabled. */ +#define C_SMOOTH 1 + +/* Gravity step, overrude frin `smooth_parameters.glsl` */ +#request setgravitystep 6.0 + +/* Smoothing factor, override from `smooth_parameters.glsl` */ +#request setsmoothfactor 0.01 diff --git a/.config/glava/env_KWin.glsl b/.config/glava/env_KWin.glsl new file mode 100755 index 0000000..aa168ba --- /dev/null +++ b/.config/glava/env_KWin.glsl @@ -0,0 +1,8 @@ +#request setdecorated false +#request setxwintype "normal" +#request addxwinstate "below" +#request addxwinstate "skip_taskbar" +#request addxwinstate "skip_pager" +#request addxwinstate "pinned" +#request setclickthrough true + diff --git a/.config/glava/env_Openbox.glsl b/.config/glava/env_Openbox.glsl new file mode 100755 index 0000000..c95c616 --- /dev/null +++ b/.config/glava/env_Openbox.glsl @@ -0,0 +1,2 @@ +#request setxwintype "desktop" +#request addxwinstate "pinned" diff --git a/.config/glava/env_Xfwm4.glsl b/.config/glava/env_Xfwm4.glsl new file mode 100755 index 0000000..1c20359 --- /dev/null +++ b/.config/glava/env_Xfwm4.glsl @@ -0,0 +1,3 @@ +#request setxwintype "desktop" +#request addxwinstate "pinned" +#request addxwinstate "below" diff --git a/.config/glava/env_awesome.glsl b/.config/glava/env_awesome.glsl new file mode 100755 index 0000000..7f2bba3 --- /dev/null +++ b/.config/glava/env_awesome.glsl @@ -0,0 +1 @@ +#request setxwintype "!-" diff --git a/.config/glava/env_default.glsl b/.config/glava/env_default.glsl new file mode 100755 index 0000000..90336cc --- /dev/null +++ b/.config/glava/env_default.glsl @@ -0,0 +1 @@ +#request setxwintype "desktop" diff --git a/.config/glava/env_i3.glsl b/.config/glava/env_i3.glsl new file mode 100755 index 0000000..7f2bba3 --- /dev/null +++ b/.config/glava/env_i3.glsl @@ -0,0 +1 @@ +#request setxwintype "!-" diff --git a/.config/glava/graph b/.config/glava/graph new file mode 120000 index 0000000..2ad2983 --- /dev/null +++ b/.config/glava/graph @@ -0,0 +1 @@ +/etc/xdg/glava//graph \ No newline at end of file diff --git a/.config/glava/graph.glsl b/.config/glava/graph.glsl new file mode 100755 index 0000000..546d8d4 --- /dev/null +++ b/.config/glava/graph.glsl @@ -0,0 +1,31 @@ + +/* Vertical scale, larger values will amplify output */ +#define VSCALE 300 +/* Rendering direction, either -1 (outwards) or 1 (inwards). */ +#define DIRECTION 1 + +/* Color gradient scale, (optionally) used in `COLOR` macro */ +#define GRADIENT_SCALE 75 +/* Color definition. By default this is a gradient formed by mixing two colors. + `pos` represents the pixel position relative to the visualizer baseline. */ +#define COLOR mix(#802A2A, #4F4F92, clamp(pos / GRADIENT_SCALE, 0, 1)) +/* 1 to draw outline, 0 to disable */ +#define DRAW_OUTLINE 0 +/* 1 to draw edge highlight, 0 to disable */ +#define DRAW_HIGHLIGHT 1 +/* Whether to anti-alias the border of the graph, creating a smoother curve. + This may have a small impact on performance. + Note: requires `xroot` or `none` opacity to be set */ +#define ANTI_ALIAS 0 +/* outline color */ +#define OUTLINE #262626 +/* 1 to join the two channels together in the middle, 0 to clamp both down to zero */ +#define JOIN_CHANNELS 0 +/* 1 to invert (vertically), 0 otherwise */ +#define INVERT 0 + +/* Gravity step, overrude from `smooth_parameters.glsl` */ +#request setgravitystep 2.4 + +/* Smoothing factor, override from `smooth_parameters.glsl` */ +#request setsmoothfactor 0.015 diff --git a/.config/glava/radial.glsl b/.config/glava/radial.glsl index 06431f2..1209c7d 100755 --- a/.config/glava/radial.glsl +++ b/.config/glava/radial.glsl @@ -1,6 +1,6 @@ /* center radius (pixels) */ -#define C_RADIUS 128 +#define C_RADIUS 70 /* center line thickness (pixels) */ #define C_LINE 1 /* outline color */ @@ -28,12 +28,12 @@ #define BAR_ALIAS_FACTOR 100 #define C_ALIAS_FACTOR 1 /* Offset (Y) of the visualization */ -#define CENTER_OFFSET_Y 290 +#define CENTER_OFFSET_Y 190 /* Offset (X) of the visualization */ -#define CENTER_OFFSET_X 690 +#define CENTER_OFFSET_X 590 /* Gravity step, override from `smooth_parameters.glsl` */ -#request setgravitystep 8 +#request setgravitystep 12 /* Smoothing factor, override from `smooth_parameters.glsl` */ -#request setsmoothfactor 0.03 +#request setsmoothfactor 0.02 diff --git a/.config/glava/smooth_parameters.glsl b/.config/glava/smooth_parameters.glsl new file mode 100755 index 0000000..bfea307 --- /dev/null +++ b/.config/glava/smooth_parameters.glsl @@ -0,0 +1,78 @@ + +/* Settings for smoothing functions and transformations commonly + used to display FFT output. + + IMPORTANT: THESE VALUES CAN BE OVERRIDDEN IN MODULE CONFIG + FILES, IF CHANGING VALUES HERE DOES NOT WORK, CHECK + TO MAKE SURE THEY ARE NOT BEING SET ELSEWHERE. +*/ + +/* The type of formula to use for weighting values when smoothing. + Possible values: + + - circular heavily rounded points + - sinusoidal rounded at both low and high weighted values + like a sine wave + - linear not rounded at all; linear distance + */ +#define ROUND_FORMULA sinusoidal + +/* The sampling mode for processing raw FFT input: + + - average averages all the inputs in the sample range for + a given point. Produces smooth output, but peaks + are not well represented + - maximum obtains the best value from the closest peak in + the sample range. Very accurate peaks, but + output is jagged and sporadic. + - hybrid uses the results from both `average` and `maximum` + with the weight provided in `SAMPLE_HYBRID_WEIGHT` */ +#define SAMPLE_MODE average +/* Weight should be provided in the range (0, 1). Higher values favour + averaged results. `hybrid` mode only. */ +#define SAMPLE_HYBRID_WEIGHT 0.65 + +/* Factor used to scale frequencies. Lower values allows lower + frequencies to occupy more space. */ +#define SAMPLE_SCALE 8 + +/* The frequency range to sample. 1.0 would be the entire FFT output, + and lower values reduce the displayed frequencies in a log-like + scale. */ +#define SAMPLE_RANGE 0.9 + +/* Factor for how to scale higher frequencies. Used in a linear equation + which is multiplied by the result of the fft transformation. */ +#request setfftscale 10.2 + +/* Cutoff for the bass end of the audio data when scaling frequencies. + Higher values cause more of the bass frequencies to be skipped when + scaling. */ +#request setfftcutoff 0.3 + +/* How many frames to queue and run through the average function. + Increasing this value will create latency between the audio and the + animation, but will make for much smoother results. */ +#request setavgframes 6 + +/* Whether to window frames ran through the average function (new & old + frames are weighted less). This massively helps smoothing out + spontaneous values in the animation. */ +#request setavgwindow true + +/* Gravity step, higher values means faster drops. The step is applied + in a rate independant method like so: + + val -= (gravitystep) * (seconds per update) */ +#request setgravitystep 4.2 + +/* Smoothing factor. Larger values mean more smoothing in the output, + however high values can be expensive to compute. Values are in + normalized width: [0.0, 1.0) */ +#request setsmoothfactor 0.025 + +/* Whether to use a separate pass for audio data while smoothing. On + most hardware, this will improve performance, but involves doing a + separate render step for each audio texture and will add some driver + (CPU) overhead. */ +#request setsmoothpass true diff --git a/.config/glava/util b/.config/glava/util new file mode 120000 index 0000000..3cbab73 --- /dev/null +++ b/.config/glava/util @@ -0,0 +1 @@ +/etc/xdg/glava//util \ No newline at end of file diff --git a/.config/glava/wave b/.config/glava/wave new file mode 120000 index 0000000..3cba0de --- /dev/null +++ b/.config/glava/wave @@ -0,0 +1 @@ +/etc/xdg/glava//wave \ No newline at end of file diff --git a/.config/glava/wave.glsl b/.config/glava/wave.glsl new file mode 100755 index 0000000..6a59fbe --- /dev/null +++ b/.config/glava/wave.glsl @@ -0,0 +1,14 @@ +/* min (vertical) line thickness */ +#define MIN_THICKNESS 1 + +/* max (vertical) line thickness */ +#define MAX_THICKNESS 6 + +/* base color to use, distance from center will multiply the RGB components */ +#define BASE_COLOR vec4(0.7, 0.2, 0.45, 1) + +/* amplitude */ +#define AMPLIFY 500 + +/* outline color */ +#define OUTLINE vec4(0.15, 0.15, 0.15, 1) diff --git a/.config/lemon.go b/.config/lemon.go new file mode 100644 index 0000000..d242ccb --- /dev/null +++ b/.config/lemon.go @@ -0,0 +1,173 @@ +package main + +import ( + "bufio" + "fmt" + "os" + "time" + "golang.org/x/sys/unix" + "os/exec" + "strconv" + "strings" + "io/ioutil" +) + +var ( + data, connectedWiFi, memPercentage, cpuTemp, cpuPercentage string + text string = "\n" + moduleColor0, moduleColor1 string = "#9b1bed", "#ff0aa3" +) + +func dataLoop() { + for { + data = getData() + time.Sleep(time.Second / 10) + } +} + +func stdinLoop() { + reader := bufio.NewReader(os.Stdin) + for { + text, _ = reader.ReadString('\n') + } +} + +func main() { + go dataLoop() + go stdinLoop() + go cpuUsageLoop() + go connectedWiFiLoop() + go memUsageLoop() + go cpuTempLoop() + + for { + fmt.Print(data + text) + time.Sleep(time.Second / 10) + } +} + +// TODO +// volume +// brightness (new) +// battery + +func getData() string { + time := "%{F" + moduleColor0 + "} " + getTime() + "%{F-} " + wifiName := "%{F" + moduleColor1 + "} WiFI: " + connectedWiFi + "%{F-} " + rootFree := "%{F" + moduleColor0 + "} / " + getDisk("/") + "%%%{F-} " + homeFree := "%{F" + moduleColor1 + "} /home " + getDisk("/home") + "%%%{F-} " + hddFree := "%{F" + moduleColor0 + "} /hdd " + getDisk("/hdd") + "%%%{F-} " + cpuUsage := "%{F" + moduleColor1 + "} CPU: " + cpuPercentage + "%%%{F-} " + cpuTemp := "%{F" + moduleColor0 + "} TEMP: " + cpuTemp + "%%{F-} " + memUsage := "%{F" + moduleColor1 + "} MEM: " + memPercentage + "%%{F-} " + + return time + wifiName + rootFree + homeFree + hddFree + cpuUsage + cpuTemp + memUsage +} + +func getWiFiName() string { + // script located in ~/.scripts/ + // look at github.com/MikunoNaka/dots + cmd := exec.Command("get_wifi_name.sh") + name, _ := cmd.Output() + return string(name) +} + +func connectedWiFiLoop() { + for { + connectedWiFi = getWiFiName() + time.Sleep(time.Second * 15) + } +} + +func getMemUsage() string { + // script located in ~/.scripts/ + // look at github.com/MikunoNaka/dots + cmd := exec.Command("ram_usage.sh") + usage, _ := cmd.Output() + return string(usage) +} + +func memUsageLoop() { + for { + memPercentage = getMemUsage() + time.Sleep(time.Second * 5) + } +} + +func getCPUTemp() string { + // script located in ~/.scripts/ + // look at github.com/MikunoNaka/dots + cmd := exec.Command("cpu_temp.sh") + temp, _ := cmd.Output() + return string(temp) +} + +func cpuTempLoop() { + for { + cpuTemp = getCPUTemp() + time.Sleep(time.Second * 5) + } +} + +// TODO: maybe add dates on click +func getTime() string { + now := time.Now() + return now.Format("3:04 PM") +} + +// TODO: maybe show percentages instead of free space +func getDisk(mountPoint string) string { + var stat unix.Statfs_t + unix.Statfs(mountPoint, &stat) + + // this is witchcraft. I wrote this but I have -10000 idea how AND IF it works + totalSize := float64(stat.Blocks) * float64(stat.Bsize) / 1073741824 + usedSpace := float64(stat.Bfree) * float64(stat.Bsize) / 1073741824 + + return strconv.FormatFloat((100 - (usedSpace / totalSize) * 100), 'f', 0, 64) +} + +func getCPUSample() (idle, total uint64) { + contents, err := ioutil.ReadFile("/proc/stat") + if err != nil { + return + } + lines := strings.Split(string(contents), "\n") + for _, line := range(lines) { + fields := strings.Fields(line) + if fields[0] == "cpu" { + numFields := len(fields) + for i := 1; i < numFields; i++ { + val, err := strconv.ParseUint(fields[i], 10, 64) + if err != nil { + fmt.Println("Error: ", i, fields[i], err) + } + total += val // tally up all the numbers to get total ticks + if i == 4 { // idle is the 5th field in the cpu line + idle = val + } + } + return + } + } + return +} + +func getCPUUsage() { + idle0, total0 := getCPUSample() + time.Sleep(3 * time.Second) + idle1, total1 := getCPUSample() + + idleTicks := float64(idle1 - idle0) + totalTicks := float64(total1 - total0) + cpuUsage := 100 * (totalTicks - idleTicks) / totalTicks + + cpuPercentage = strconv.Itoa(int(cpuUsage)) +} + +func cpuUsageLoop() { + for { + getCPUUsage() + time.Sleep(5 * time.Second) + } +} diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv index 77f8e54..28b7330 100644 --- a/.config/zsh/.zshenv +++ b/.config/zsh/.zshenv @@ -1,7 +1,6 @@ export EDITOR="nvim" export VISUAL="emacs" export TERMINAL="st" -# export BROWSER="librewolf" export BROWSER="librewolf --private-window" export READER="zathura" export COLORTERM="truecolor" -- cgit v1.2.3