mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-11-06 03:12:24 +00:00
actually use eww-bar
This commit is contained in:
parent
6e816303c5
commit
d81c401ce6
6 changed files with 138 additions and 14 deletions
|
@ -119,7 +119,10 @@
|
||||||
|
|
||||||
|
|
||||||
(defwidget music-popup []
|
(defwidget music-popup []
|
||||||
(box :class "music-popup" :orientation "h" :space-evenly false :spacing 10
|
(box :class "music-popup"
|
||||||
|
:orientation "h"
|
||||||
|
:space-evenly false
|
||||||
|
:spacing 10
|
||||||
(button :onclick "playerctl previous" "⏮")
|
(button :onclick "playerctl previous" "⏮")
|
||||||
"${music_data.artist} - ${music_data.title}"
|
"${music_data.artist} - ${music_data.title}"
|
||||||
(button :onclick "playerctl next" "⏭"))
|
(button :onclick "playerctl next" "⏭"))
|
||||||
|
|
37
eww-bar/.config/eww-bar/update-workspaces.sh
Executable file
37
eww-bar/.config/eww-bar/update-workspaces.sh
Executable file
|
@ -0,0 +1,37 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
monitor="$1"
|
||||||
|
|
||||||
|
gib_workspace_names() {
|
||||||
|
wmctrl -d \
|
||||||
|
| awk '{ print $1 " " $2 " " $9 }' \
|
||||||
|
| grep -v NSP \
|
||||||
|
| grep "${monitor}_"
|
||||||
|
}
|
||||||
|
|
||||||
|
gib_workspace_yuck() {
|
||||||
|
buffered=""
|
||||||
|
gib_workspace_names | while read -r id active name; do
|
||||||
|
name="${name#*_}"
|
||||||
|
if [ "$active" == '*' ]; then
|
||||||
|
active_class="active"
|
||||||
|
else
|
||||||
|
active_class="inactive"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if wmctrl -l | grep --regexp '.*\s\+'"$id"'\s\+.*' >/dev/null; then
|
||||||
|
button_class="occupied"
|
||||||
|
button_name="◆"
|
||||||
|
else
|
||||||
|
button_class="empty"
|
||||||
|
button_name="◇"
|
||||||
|
fi
|
||||||
|
buffered+="(button :class \"$button_class $active_class\" :onclick \"wmctrl -s $id\" \"$button_name\")"
|
||||||
|
if [ $button_class = "occupied" -o $active_class = "active" ]; then
|
||||||
|
echo -n "$buffered"
|
||||||
|
buffered=""
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '(box :orientation "v" :class "workspaces" :space-evenly true :halign "center" :valign "center" :vexpand true '"$(gib_workspace_yuck)"')'
|
|
@ -112,6 +112,10 @@ in
|
||||||
"Xft.lcdfilter" = "lcddefault";
|
"Xft.lcdfilter" = "lcddefault";
|
||||||
|
|
||||||
"st.font" = "Terminus (TTF):pixelsize=16";
|
"st.font" = "Terminus (TTF):pixelsize=16";
|
||||||
|
"st.boxdraw" = 1;
|
||||||
|
"st.boxdraw_bold" = 1;
|
||||||
|
"st.boxdraw_braille" = 1;
|
||||||
|
"st.scrollrate" = 1;
|
||||||
|
|
||||||
"*.background" = primary.background;
|
"*.background" = primary.background;
|
||||||
"*.foreground" = primary.foreground;
|
"*.foreground" = primary.foreground;
|
||||||
|
@ -131,6 +135,31 @@ in
|
||||||
"*.color13" = bright.magenta;
|
"*.color13" = bright.magenta;
|
||||||
"*.color14" = bright.cyan;
|
"*.color14" = bright.cyan;
|
||||||
"*.color15" = bright.white;
|
"*.color15" = bright.white;
|
||||||
|
|
||||||
|
|
||||||
|
#"st.termname" = "st-256color";
|
||||||
|
#"st.borderless" = 1;
|
||||||
|
#"st.font" = "Terminus (TTF):size=16:antialias=true:autohint=true";
|
||||||
|
#"st.borderpx" = 10;
|
||||||
|
#"st.cursorshape" = 3;
|
||||||
|
#"st.cursorthickness" = 1;
|
||||||
|
#"st.cursorblinkstyle" = 0;
|
||||||
|
#"st.cursorblinkontype" = 0;
|
||||||
|
#"st.disablebold" = 0;
|
||||||
|
#"st.disableitalics" = 0;
|
||||||
|
#"st.disableroman" = 0;
|
||||||
|
#"st.scrollrate" = 1;
|
||||||
|
#"st.blinktimeout" = 100;
|
||||||
|
#"st.bellvolume" = 5;
|
||||||
|
#"st.actionfps" = 60;
|
||||||
|
#"st.mouseScrollLines" = 3;
|
||||||
|
#"st.boxdraw" = 1;
|
||||||
|
#"st.boxdraw_bold" = 1;
|
||||||
|
#"st.boxdraw_braille" = 1;
|
||||||
|
#"st.opacity" = 255;
|
||||||
|
#"st.disable_alpha_correction" = 0;
|
||||||
|
#"st.prompt_char" = "λ !`printf '\033[z'`";
|
||||||
|
#"st.shell" = "/usr/bin/bash";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,8 @@ in
|
||||||
font = {
|
font = {
|
||||||
size = 12;
|
size = 12;
|
||||||
#normal.family = "Iosevka";
|
#normal.family = "Iosevka";
|
||||||
normal.family = "Terminus (TTF)";
|
normal.family = "xos4 Terminus";
|
||||||
|
#normal.family = "Terminus (TTF)";
|
||||||
offset.x = 0;
|
offset.x = 0;
|
||||||
#offset.y = -2;
|
#offset.y = -2;
|
||||||
offset.y = 0;
|
offset.y = 0;
|
||||||
|
|
|
@ -169,3 +169,32 @@
|
||||||
"command! -nargs=1 L :lua print(vim.inspect(<args>))")
|
"command! -nargs=1 L :lua print(vim.inspect(<args>))")
|
||||||
|
|
||||||
; vim:foldmarker=foldstart,foldend
|
; vim:foldmarker=foldstart,foldend
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,7 @@ import GHC.IO.Unsafe (unsafePerformIO)
|
||||||
import XMonad.Layout.LayoutModifier
|
import XMonad.Layout.LayoutModifier
|
||||||
import qualified IndependentScreens as IS
|
import qualified IndependentScreens as IS
|
||||||
import Data.List (find)
|
import Data.List (find)
|
||||||
|
import System.Process (readProcess)
|
||||||
--import XMonad.Layout.MultiColumns (multiCol)
|
--import XMonad.Layout.MultiColumns (multiCol)
|
||||||
{-# ANN module "HLint: ignore Redundant $" #-}
|
{-# ANN module "HLint: ignore Redundant $" #-}
|
||||||
{-# ANN module "HLint: ignore Redundant bracket" #-}
|
{-# ANN module "HLint: ignore Redundant bracket" #-}
|
||||||
|
@ -108,6 +109,7 @@ import Data.List (find)
|
||||||
|
|
||||||
-- Values -------------------- {{{
|
-- Values -------------------- {{{
|
||||||
|
|
||||||
|
verticalMonitorIndex = 0 :: Int
|
||||||
myModMask = mod4Mask
|
myModMask = mod4Mask
|
||||||
myLauncher = Rofi.asCommand def ["-show run"]
|
myLauncher = Rofi.asCommand def ["-show run"]
|
||||||
--myTerminal = "alacritty"
|
--myTerminal = "alacritty"
|
||||||
|
@ -275,7 +277,9 @@ myStartupHook = do
|
||||||
io $ threadDelay $ 1000 * 100
|
io $ threadDelay $ 1000 * 100
|
||||||
--spawnOnce "/home/leon/Downloads/picom --config /home/leon/.config/picom.conf --experimental-backends --backend xrender" --no-fading-openclose"
|
--spawnOnce "/home/leon/Downloads/picom --config /home/leon/.config/picom.conf --experimental-backends --backend xrender" --no-fading-openclose"
|
||||||
spawnOnce "picom --config /home/leon/.config/picom.conf --experimental-backends --backend glx" --no-fading-openclose"
|
spawnOnce "picom --config /home/leon/.config/picom.conf --experimental-backends --backend glx" --no-fading-openclose"
|
||||||
spawn "/home/leon/.config/polybar/launch.sh"
|
--spawn "/home/leon/.config/polybar/launch.sh"
|
||||||
|
setupPolybarOn "DisplayPort-0"
|
||||||
|
spawnOnce "eww -c /home/leon/.config/eww-bar open-many bar_2 bar_1 &"
|
||||||
spawn "xsetroot -cursor_name left_ptr"
|
spawn "xsetroot -cursor_name left_ptr"
|
||||||
spawnOnce "nitrogen --restore"
|
spawnOnce "nitrogen --restore"
|
||||||
spawnOnce "mailnag"
|
spawnOnce "mailnag"
|
||||||
|
@ -561,18 +565,15 @@ myManageHook = composeAll
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- Main ------------------------------------ {{{
|
-- Main ------------------------------------ {{{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
currentScreenCount :: Int <- IS.countScreens
|
currentScreenCount :: Int <- IS.countScreens
|
||||||
let monitorIndices = [0..currentScreenCount - 1]
|
|
||||||
|
|
||||||
|
-- set up the fifo for polybar
|
||||||
|
safeSpawn "mkfifo" ["/tmp/xmonad-state-bar" ++ show verticalMonitorIndex]
|
||||||
-- create a fifo named pipe for every monitor (called /tmp/xmonad-state-bar0, etc)
|
|
||||||
for_ monitorIndices (\idx -> safeSpawn "mkfifo" ["/tmp/xmonad-state-bar" ++ show idx])
|
|
||||||
|
|
||||||
-- create polybarLogHooks for every monitor and combine them using the <+> monoid instance
|
|
||||||
let polybarLogHooks = composeAll $ map polybarLogHook monitorIndices
|
|
||||||
|
|
||||||
let myConfig = flip additionalKeysP myKeys
|
let myConfig = flip additionalKeysP myKeys
|
||||||
$ flip removeKeysP removedKeys
|
$ flip removeKeysP removedKeys
|
||||||
|
@ -584,7 +585,8 @@ main = do
|
||||||
, modMask = myModMask
|
, modMask = myModMask
|
||||||
, borderWidth = 0
|
, borderWidth = 0
|
||||||
, layoutHook = myLayout
|
, layoutHook = myLayout
|
||||||
, logHook = mconcat [ polybarLogHooks
|
, logHook = mconcat [ polybarLogHook verticalMonitorIndex
|
||||||
|
, ewwLogHook
|
||||||
, Ewmh.ewmhDesktopsLogHook
|
, Ewmh.ewmhDesktopsLogHook
|
||||||
, logHook Desktop.desktopConfig
|
, logHook Desktop.desktopConfig
|
||||||
--, fadeInactiveLogHook 0.95
|
--, fadeInactiveLogHook 0.95
|
||||||
|
@ -662,7 +664,17 @@ fullscreenFixEventHook _ = return $ All True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- POLYBAR Kram -------------------------------------- {{{
|
-- Bar Kram -------------------------------------- {{{
|
||||||
|
|
||||||
|
-- | Loghook for eww on all monitors. Runs the eww-bar
|
||||||
|
ewwLogHook :: X ()
|
||||||
|
ewwLogHook = spawn "/home/leon/.config/eww-bar/update-workspaces.sh"
|
||||||
|
|
||||||
|
-- | Launch a polybar on the given monitor name
|
||||||
|
setupPolybarOn :: String -> X ()
|
||||||
|
setupPolybarOn name =
|
||||||
|
spawnOnce $ "MONITOR=" ++ name ++ " TRAY_POSITION=right polybar -r --config=/home/leon/.config/polybar/config.ini main &"
|
||||||
|
|
||||||
|
|
||||||
-- | Loghook for polybar on a given monitor.
|
-- | Loghook for polybar on a given monitor.
|
||||||
-- Will write the polybar formatted string to /tmp/xmonad-state-bar${monitor}
|
-- Will write the polybar formatted string to /tmp/xmonad-state-bar${monitor}
|
||||||
|
@ -771,7 +783,7 @@ getXrdbValue key = fromMaybe "" . findValue key <$> runProcessWithInput "xrdb" [
|
||||||
splitAtColon str = splitAtTrimming str <$> (Data.List.elemIndex ':' str)
|
splitAtColon str = splitAtTrimming str <$> (Data.List.elemIndex ':' str)
|
||||||
|
|
||||||
splitAtTrimming :: String -> Int -> (String, String)
|
splitAtTrimming :: String -> Int -> (String, String)
|
||||||
splitAtTrimming str idx = bimap trim trim . (second tail) $ splitAt idx str
|
splitAtTrimming str idx = bimap trim (trim . tail) $ splitAt idx str
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -788,3 +800,16 @@ lastLayout = lastLayout' 123
|
||||||
lastLayout' :: Int -> X ()
|
lastLayout' :: Int -> X ()
|
||||||
lastLayout' 0 = pure ()
|
lastLayout' 0 = pure ()
|
||||||
lastLayout' n = sendMessage NextLayout >> lastLayout' (n - 1)
|
lastLayout' n = sendMessage NextLayout >> lastLayout' (n - 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(!?) :: [a] -> Int -> Maybe a
|
||||||
|
(!?) [] _ = Nothing
|
||||||
|
(!?) (x:_) 0 = Just x
|
||||||
|
(!?) (_:xs) n
|
||||||
|
| n > 0 = xs !? (n - 1)
|
||||||
|
| otherwise = Nothing
|
||||||
|
|
Loading…
Reference in a new issue