From c27a826eb0594961c2b5f5f0e676bfb95f12fb4d Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Wed, 18 Aug 2021 17:05:04 -0500 Subject: [PATCH 1/2] making more widgets and better spacing --- alacritty/alacritty.yml | 2 +- awesome/init.fnl | 116 +++++++++++++++++++++++++++----------- awesome/keybindings.fnl | 2 +- awesome/notifications.fnl | 3 +- awesome/theme.lua | 7 ++- dunst/dunstrc | 8 +-- rofi/config.rasi | 2 +- scripts/fm6000 | 2 +- scripts/mem | 4 +- scripts/rofi-rbw | 76 ++++++++++++------------- 10 files changed, 139 insertions(+), 83 deletions(-) diff --git a/alacritty/alacritty.yml b/alacritty/alacritty.yml index 59e6ce7..93b7a61 100644 --- a/alacritty/alacritty.yml +++ b/alacritty/alacritty.yml @@ -318,7 +318,7 @@ colors: # # Window opacity as a floating point number from `0.0` to `1.0`. # The value `0.0` is completely transparent and `1.0` is opaque. -background_opacity: 0.95 +background_opacity: 0.75 #selection: #semantic_escape_chars: ",│`|:\"' ()[]{}<>\t" diff --git a/awesome/init.fnl b/awesome/init.fnl index 7ca2365..5789a9b 100644 --- a/awesome/init.fnl +++ b/awesome/init.fnl @@ -28,8 +28,8 @@ ;; another config (This code will only ever execute for the fallback config) (when awesome.startup_errors (naughty.notify {:preset naughty.config.presets.critical - :title "Oops, there were errors during startup!" - :text awesome.startup_errors})) + :title "Oops, there were errors during startup!" + :text awesome.startup_errors})) ;; Handle runtime errors after startup (do @@ -83,9 +83,9 @@ ;; Table of layouts to cover with awful.layout.inc, order matters. (set awful.layout.layouts [ - bling.layout.mstab awful.layout.suit.tile - ;;bling.layout.centered + bling.layout.mstab + bling.layout.centered awful.layout.suit.floating ;; awful.layout.suit.tile.left ;; awful.layout.suit.tile.bottom @@ -354,13 +354,13 @@ :layout wibox.layout.fixed.horizontal }) :widget wibox.container.margin - :left (dpi 10)} + :left (dpi 5)} :widget wibox.container.background :shape gears.shape.rounded_bar :bg beautiful.bg_normal :fg beautiful.base09} :widget wibox.container.margin - :right (dpi 10)}) + :right (dpi 5)}) (set s.batterytext (awful.widget.watch "cat /sys/class/power_supply/BAT1/capacity" 30)) (set s.batterytext2 (awful.widget.watch "cat /sys/class/power_supply/BAT2/capacity" 30)) @@ -376,16 +376,16 @@ 6 s.batteryspace :layout wibox.layout.fixed.horizontal}) :widget wibox.container.margin - :left (dpi 10)} + :left (dpi 5)} :widget wibox.container.background :shape gears.shape.rounded_bar :bg beautiful.bg_normal :fg beautiful.base0C} :widget wibox.container.margin - :right (dpi 10)}) + :right (dpi 5)}) (set s.cputext (awful.widget.watch "cpu" 5)) - (set s.cpuicon (wibox.widget.textbox " ")) + (set s.cpuicon (wibox.widget.textbox " ")) (set s.cpuspace (wibox.widget.textbox " ")) (set s.cpuwidget { 1 { 1 { 1 (wibox.widget { @@ -395,13 +395,51 @@ :layout wibox.layout.fixed.horizontal }) :widget wibox.container.margin - :left (dpi 9)} + :left (dpi 5)} :widget wibox.container.background :shape gears.shape.rounded_bar :bg beautiful.bg_normal :fg beautiful.base0A} :widget wibox.container.margin - :right (dpi 10)}) + :right (dpi 5)}) + + (set s.memtext (awful.widget.watch "mem" 2)) + (set s.memicon (wibox.widget.textbox " ")) + (set s.memspace (wibox.widget.textbox " ")) + + (set s.memwidget { 1 { 1 { 1 (wibox.widget { + 1 s.memicon + 2 s.memtext + 3 s.memspace + :layout wibox.layout.fixed.horizontal + }) + :widget wibox.container.margin + :left (dpi 5)} + :widget wibox.container.background + :shape gears.shape.rounded_bar + :bg beautiful.bg_normal + :fg beautiful.base0E} + :widget wibox.container.margin + :right (dpi 5)}) + + (set s.nettext (awful.widget.watch "netwidget" 10)) + (set s.neticon (wibox.widget.textbox " ")) + (set s.netspace (wibox.widget.textbox " ")) + + (set s.netwidget { 1 { 1 { 1 (wibox.widget { + ;; 1 s.neticon + 2 s.nettext + 3 s.netspace + :layout wibox.layout.fixed.horizontal + }) + :widget wibox.container.margin + :left (dpi 5)} + :widget wibox.container.background + :shape gears.shape.rounded_bar + :bg beautiful.bg_normal + :fg beautiful.base08} + :widget wibox.container.margin + :right (dpi 5)}) (set s.mailtext (awful.widget.watch "muunread" 360)) (set s.mailicon (wibox.widget.textbox " ")) @@ -414,13 +452,13 @@ :layout wibox.layout.fixed.horizontal }) :widget wibox.container.margin - :left (dpi 9)} + :left (dpi 5)} :widget wibox.container.background :shape gears.shape.rounded_bar :bg beautiful.bg_normal - :fg beautiful.base0C} + :fg beautiful.base0D} :widget wibox.container.margin - :right (dpi 10)}) + :right (dpi 5)}) (set s.wttrtext (awful.widget.watch "wttr" 1200)) (set s.wttrspace (wibox.widget.textbox " ")) @@ -442,10 +480,10 @@ (set s.mysystray { 1 { 1 { 1 (wibox.widget.systray) :widget wibox.container.margin - :right (dpi 10) + :right (dpi 2) :top (dpi 2) :bottom (dpi 2) - :left (dpi 10)} + :left (dpi 2)} :widget wibox.container.background :shape gears.shape.rounded_bar :bg beautiful.bg_normal @@ -456,13 +494,14 @@ (set s.myrightwidgets { 1 { :layout wibox.layout.fixed.horizontal - ;; 1 s.wttrwidget + 1 s.netwidget 2 s.mailwidget - 3 s.cpuwidget - 4 s.volumewidget - 5 (if laptop s.batterywidget s.myemptywidget) - 6 (if (= s.index 1) s.mysystray) - 7 s.mylayoutbox + 3 s.memwidget + 4 s.cpuwidget + 5 s.volumewidget + 6 (if laptop s.batterywidget s.myemptywidget) + 7 (if (= s.index 1) s.mysystray) + 8 s.mylayoutbox } :widget wibox.container.background }) @@ -486,7 +525,7 @@ :opacity 0.95 :screen s })) - (: s.mywibox :struts { :bottom (dpi 45) }) + (: s.mywibox :struts { :bottom (dpi 40) }) ;; Add widgets to the wibox (: s.mywibox :setup { @@ -575,10 +614,19 @@ ;; Rules (ruled.client.append_rules clientrules) + (ruled.notification.connect_signal "request::rules" (fn [] - (ruled.notification.append_rules notifications))) + (ruled.notification.append_rules notifications + ;; { + ;; :rule { } + ;; :properties { + ;; :border-width 0 + ;; :border_color "#000000" + ;; :opacity 0.9 + ;; :shape gears.shape.rounded_rect}} + ))) ;; Signals ;; Signal function to execute when a new client appears. @@ -595,21 +643,25 @@ ;; Prevent clients from being unreachable after screen count changes. (awful.placement.no_offscreen c)) ;; MPV wasn't centering right - (when (= c.class "mpv") (awful.placement.centered c)) + ;; (when (= c.class "mpv") (awful.placement.centered c)) (awful.client.focus.byidx 1) (: c :activate []))) +(client.connect_signal "property::fullscreen" + (fn [c] + (set c.shape (fn [cr w h] + (gears.shape.rectangle cr w h))))) (client.connect_signal "manage" - (fn [c] - ;; Rounded windows done right - (when (not c.fullscreen) - (set c.shape (fn [cr w h] - (gears.shape.rounded_rect cr w h (dpi 15))))))) + (fn [c] + ;; Rounded windows done right + (when (not c.fullscreen) + (set c.shape (fn [cr w h] + (gears.shape.rounded_rect cr w h (dpi 15))))))) (client.connect_signal "focus" (fn [c] (set c.border_color beautiful.border_focus))) (client.connect_signal "unfocus" (fn [c] (set c.border_color beautiful.border_normal))) -(client.connect_signal "request::manage" (fn [c] (if c.floating (set c.placement awful.placement.centered)))) +(client.connect_signal "request::manage" (fn [c] (if c.floating (set c.placement (+ awful.placement.centered awful.placement.no_offscreen))))) (awful.screen.focus 1) @@ -620,5 +672,5 @@ (awful.spawn "libinput-gestures-setup start") (awful.spawn "bluetoothctl power on") (awful.spawn "nextcloud --background") -(awful.spawn "rbw-agent") +;; (awful.spawn "rbw-agent") (awful.spawn "xset r rate 220 90") diff --git a/awesome/keybindings.fnl b/awesome/keybindings.fnl index b3a9c08..ccb38ca 100644 --- a/awesome/keybindings.fnl +++ b/awesome/keybindings.fnl @@ -145,7 +145,7 @@ {:description "launch eshell in new emacs frame" :group "apps" }) (awful.key [ modkey ] "e" (fn [] (awful.spawn "emacsclient -c -a 'emacs'")) {:description "launch new emacs frame" :group "apps" }) - (awful.key [ modkey ] "p" (fn [] (awful.spawn "rofi-pass")) + (awful.key [ modkey ] "p" (fn [] (awful.spawn "rofi-rbw")) {:description "select pass" :group "apps" }) (awful.key [ modkey shift ] "w" (fn [] (awful.spawn "libreoffice --writer")) {:description "Open Writer" :group "apps" }) diff --git a/awesome/notifications.fnl b/awesome/notifications.fnl index fac3ff4..cea0812 100644 --- a/awesome/notifications.fnl +++ b/awesome/notifications.fnl @@ -13,8 +13,9 @@ :propertites { :border-width beautiful.border_width :border_color "#000000" - :opacity 0.1 + :opacity 0.9 :shape gears.shape.rounded_rect + :position "bottom_middle" } } ]) diff --git a/awesome/theme.lua b/awesome/theme.lua index 7497894..cd82d91 100644 --- a/awesome/theme.lua +++ b/awesome/theme.lua @@ -94,8 +94,9 @@ theme.tasklist_bg = theme.red -- notification_[bg|fg] -- notification_[width|height|margin] theme.notification_margin = dpi(10) -theme.notification_border_width = dpi(0) +theme.notification_border_width = 0 theme.notification_shape = gears.shape.rounded_rect +theme.notification_position = "bottom_middle" -- notification_[border_color|border_width|shape|opacity] -- Variables set for theming the menu: @@ -119,8 +120,8 @@ theme.mstab_bar_padding = "default" -- how much padding there should be -- by default it will adjust based on your useless gaps. -- If you want a custom value. Set it to the number of pixels (int) -theme.mstab_bar_height = 100 -theme.mstab_border_radius = 10 -- border radius of the tabbar +theme.mstab_tabbar_height = dpi(100) +theme.mstab_border_radius = dpi(5) -- border radius of the tabbar theme.mstab_tabbar_position = "top" -- position of the tabbar (mstab currently does not support left,right) theme.mstab_tabbar_style = "default" -- style of the tabbar ("default", "boxes" or "modern") diff --git a/dunst/dunstrc b/dunst/dunstrc index 3da55d3..25979b9 100644 --- a/dunst/dunstrc +++ b/dunst/dunstrc @@ -29,7 +29,7 @@ # the top and down respectively. # The width can be negative. In this case the actual width is the # screen width minus the width defined in within the geometry option. - geometry = "250x5-50+50" + geometry = "500-1300+1700" # Show how many messages are currently hidden (because of geometry). indicate_hidden = yes @@ -41,7 +41,7 @@ # The transparency of the window. Range: [0; 100]. # This option will only work if a compositing window manager is # present (e.g. xcompmgr, compiz, etc.). - transparency = 30 + transparency = 1 # The height of the entire notification. If the height is smaller # than the font height and padding combined, it will be raised @@ -61,7 +61,7 @@ # Defines width in pixels of frame around the notification window. # Set to 0 to disable. - frame_width = 3 + frame_width = 0 # Defines color of the frame around the notification window. frame_color = "#282a36" @@ -265,7 +265,7 @@ # dunst will attempt to calculate an appropriate dpi value for each monitor # using the resolution and physical size. This might be useful in setups # where there are multiple screens with very different dpi values. - per_monitor_dpi = false + per_monitor_dpi = true [shortcuts] diff --git a/rofi/config.rasi b/rofi/config.rasi index 469b42f..c911358 100644 --- a/rofi/config.rasi +++ b/rofi/config.rasi @@ -10,4 +10,4 @@ configuration { run-command: "fish -c {cmd}"; run-list-command: "fish -c functions"; } -@import "/home/chris/.dotfiles/rofi/launchers-git/desktop.rasi" +@import "/home/chris/.dotfiles/rofi/launchers-git/laptop.rasi" diff --git a/scripts/fm6000 b/scripts/fm6000 index 55fdef2..bec67c5 100755 --- a/scripts/fm6000 +++ b/scripts/fm6000 @@ -45,7 +45,7 @@ sub get_de { unless ($de) { $de = $ENV{XDG_SESSION_DESKTOP} }; unless ($de) { $de = $ENV{DESKTOP_SESSION} }; # return $de; - return "river"; + return "awesome"; } sub shell { diff --git a/scripts/mem b/scripts/mem index 6904f2c..4db3e58 100755 --- a/scripts/mem +++ b/scripts/mem @@ -6,4 +6,6 @@ percent=$(bc -l <<< "100 * $total / $used") mem=$(awk -v u=$used -v t=$total -v p=$percent 'BEGIN {printf "%sMi/%sMi %.1f% ", t, u, p}') -echo $mem +memperc=$(echo $mem | awk '{print $2}') + +echo $memperc diff --git a/scripts/rofi-rbw b/scripts/rofi-rbw index 8601367..3aa5b81 100755 --- a/scripts/rofi-rbw +++ b/scripts/rofi-rbw @@ -11,48 +11,48 @@ list_passwords() { } prompt='search for passwords...' -SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu --no-lazy-grab) +SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu) # Ask whether pass, user or both are required -# options=("Password" \ - # "User" \ - # "User and password" \ - # "QR-Code" \ - # "OTP") +options=("Password" \ + "User" \ + "User and password" \ + "QR-Code" \ + "OTP") -# option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -width 400 -lines 4 -prompt="...") +option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -width 400 -lines 4 -prompt="...") -# echo $option +echo $option -# case ${option} in -# Password ) -# echo "${SECRET}" -# xdotool type $(rbw get "${SECRET}") -# ;; -# User ) -# xdotool type $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}') -# ;; -# "User and password" ) -# xdotool type $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}') -# xdotool key Tab -# xdotool type $(rbw get "${SECRET}") -# ;; -# "QR-Code" ) -# if [[ $SECRET =~ wifi$ ]]; then -# # Produce a valid wifi QR-code -# WIFISSID=$(pass get_user ${SECRET}) -# WIFIPASS=$(pass get_pass ${SECRET}) -# WIFIQR="WIFI:T:WPA;S:${WIFISSID};P:${WIFIPASS};;" -# qrencode -s 8 -o - $WIFIQR | feh --title "pass: QR-WIFI" - -# else -# # Only password -# pass show -q1 ${SECRET} -# fi -# ;; -# "OTP" ) -# xdotool type $(rbw code ${SECRET}) -# ;; -# esac +case ${option} in + Password ) + echo "${SECRET}" + xdotool type $(rbw get "${SECRET}") + ;; + User ) + xdotool type $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}') + ;; + "User and password" ) + xdotool type $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}') + xdotool key Tab + xdotool type $(rbw get "${SECRET}") + ;; + "QR-Code" ) + if [[ $SECRET =~ wifi$ ]]; then + # Produce a valid wifi QR-code + WIFISSID=$(pass get_user ${SECRET}) + WIFIPASS=$(pass get_pass ${SECRET}) + WIFIQR="WIFI:T:WPA;S:${WIFISSID};P:${WIFIPASS};;" + qrencode -s 8 -o - $WIFIQR | feh --title "pass: QR-WIFI" - + else + # Only password + pass show -q1 ${SECRET} + fi + ;; + "OTP" ) + xdotool type $(rbw code ${SECRET}) + ;; +esac -# # wl-copy -o -s ${seat} ${PASSWD_PASS} +# wl-copy -o -s ${seat} ${PASSWD_PASS} From 26b21e718c56285da0f3a40a6a214211f70f894e Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Wed, 18 Aug 2021 17:05:49 -0500 Subject: [PATCH 2/2] adding netwidget script --- scripts/netwidget | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 scripts/netwidget diff --git a/scripts/netwidget b/scripts/netwidget new file mode 100755 index 0000000..fbd148e --- /dev/null +++ b/scripts/netwidget @@ -0,0 +1,7 @@ +#!/bin/bash +net=$(nmcli | head -1 | awk '{print $4}') +if [[ $net == "Wired" ]]; then + echo " $net" +else + echo " $net" +fi