Merge branch 'arch' into gentoo

This commit is contained in:
ItsDrike 2021-07-15 03:00:22 +02:00
commit 7c8f8c2a14
No known key found for this signature in database
GPG key ID: B5F6B41F708C3ADD
9 changed files with 99 additions and 16 deletions

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
echo "Invalid amount of arguments passed!" echo "Invalid amount of arguments passed!"
@ -10,7 +10,7 @@ MONITOR_AMOUT="$1"
WIDTH=1920 WIDTH=1920
WORK_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/xmobar" WORK_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/xmobar"
make_line(){ make_position_line(){
xpos=$(($1 * $WIDTH)) xpos=$(($1 * $WIDTH))
line=", position = Static { xpos = $xpos, ypos = 0, width = $WIDTH, height = 24 }" line=", position = Static { xpos = $xpos, ypos = 0, width = $WIDTH, height = 24 }"
echo "$line" echo "$line"
@ -20,8 +20,22 @@ make_line(){
# Remove all already existing specific xmobar configurations # Remove all already existing specific xmobar configurations
find $WORK_DIR -regex '\./xmobarrc[0-9]+' -exec rm {} + find $WORK_DIR -regex '\./xmobarrc[0-9]+' -exec rm {} +
xmobarhs_content="$(cat $WORK_DIR/xmobarrc.hs)"
position_line_0="$(make_position_line 0)"
for ((n=0;n<MONITOR_AMOUT;n++)); do for ((n=0;n<MONITOR_AMOUT;n++)); do
cur_file="$WORK_DIR/xmobarrc$n" cur_file="$WORK_DIR/xmobarrc$n"
sed "s/$(make_line 0)/$(make_line $n)/g" "$WORK_DIR/xmobarrc.hs" > "$cur_file"
# Replace position line to accomodate for multiple monitors
position_line="$(make_position_line $n)"
contents="${xmobarhs_content/$position_line_0/$position_line}"
# Only keep trayer spacer in 1st xmobar
if [ $n -ne 0 ]; then
#contents="${contents/'%trayerpad%'/''}"
contents="$(grep -v trayerpad <<< $contents)"
fi
echo "$contents" > "$cur_file"
echo "$cur_file created." echo "$cur_file created."
done done

View file

@ -0,0 +1,49 @@
#!/bin/sh
# Copied from https://github.com/jaor/xmobar/issues/239#issuecomment-233206552
# Detects the width of running trayer-srg window (xprop name 'panel')
# and creates an XPM icon of that width, 1px height, and transparent.
# Outputs an <icon>-tag for use in xmobar to display the generated
# XPM icon.
#
# Run script from xmobar:
# `Run Com "/where/ever/trayer-padding-icon.sh" [] "trayerpad" 10`
# and use `%trayerpad%` in your template.
# Function to create a transparent Wx1 px XPM icon
create_xpm_icon () {
timestamp=$(date)
pixels=$(for i in `seq $1`; do echo -n "."; done)
cat << EOF > "$2"
/* XPM *
static char * trayer_pad_xpm[] = {
/* This XPM icon is used for padding in xmobar to */
/* leave room for trayer-srg. It is dynamically */
/* updated by by trayer-padding-icon.sh which is run */
/* by xmobar. */
/* Created: ${timestamp} */
/* <w/cols> <h/rows> <colors> <chars per pixel> */
"$1 1 1 1",
/* Colors (none: transparent) */
". c none",
/* Pixels */
"$pixels"
};
EOF
}
# Width of the trayer window
width=$(xprop -name panel | grep 'program specified minimum size' | cut -d ' ' -f 5)
# Icon file name
iconfile="/tmp/trayer-padding-${width}px.xpm"
# If the desired icon does not exist create it
if [ ! -f $iconfile ]; then
create_xpm_icon $width $iconfile
fi
# Output the icon tag for xmobar
echo "<icon=${iconfile}/>"

View file

@ -12,7 +12,8 @@ Config { font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=t
, hideOnStart = False , hideOnStart = False
, allDesktops = True , allDesktops = True
, persistent = True , persistent = True
--, iconRoot = "." -- default: "." -- apparently there's no way to use env var or relpaths here
, iconRoot = "/home/itsdrike/.config/xmobar/xpm"
, commands = [ , commands = [
-- Time and date -- Time and date
Run Date "<fn=2>\xf017</fn> %b %d %Y - (%H:%M) " "date" 50 Run Date "<fn=2>\xf017</fn> %b %d %Y - (%H:%M) " "date" 50
@ -26,6 +27,10 @@ Config { font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=t
, Run DiskU [("/", "<fn=2>\xf0c7</fn> hdd: <free> free")] [] 60 , Run DiskU [("/", "<fn=2>\xf0c7</fn> hdd: <free> free")] [] 60
-- Runs a standard shell command 'uname -r' to get kernel version -- Runs a standard shell command 'uname -r' to get kernel version
, Run Com "uname" ["-r"] "" 3600 , Run Com "uname" ["-r"] "" 3600
-- Add dynamic invisible XPM icon that resizes to accomodate trayer
-- this needs to be an absolute string path, env vars or relpaths aren't accepted
-- this should only be on 1 monitor (single file), so ignore this comment on others
, Run Com "/home/itsdrike/.config/xmobar/trayer-padding-icon.sh" [] "trayerpad" 10
-- Allow mouse clicking by using unsafe stdin reader -- Allow mouse clicking by using unsafe stdin reader
, Run UnsafeStdinReader , Run UnsafeStdinReader
] ]
@ -37,7 +42,9 @@ Config { font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=t
\<fc=#666666>|</fc> <fc=#ff6c6b> <action=`alacritty -e htop`>%memory%</action> </fc> \ \<fc=#666666>|</fc> <fc=#ff6c6b> <action=`alacritty -e htop`>%memory%</action> </fc> \
\<fc=#666666>|</fc> <fc=#51afef> <action=`alacritty -e htop`>%disku%</action> </fc> \ \<fc=#666666>|</fc> <fc=#51afef> <action=`alacritty -e htop`>%disku%</action> </fc> \
\<fc=#666666>|</fc> <fc=#98be65> <action=`alacritty -e sudo iftop`>%wlp2s0%</action> </fc> \ \<fc=#666666>|</fc> <fc=#98be65> <action=`alacritty -e sudo iftop`>%wlp2s0%</action> </fc> \
\<fc=#666666>|</fc> <fc=#46d9ff> %date% </fc>" \<fc=#666666>|</fc> <fc=#46d9ff> %date% </fc> \
\%trayerpad%\
\ "
} }

View file

@ -12,7 +12,8 @@ Config { font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=t
, hideOnStart = False , hideOnStart = False
, allDesktops = True , allDesktops = True
, persistent = True , persistent = True
--, iconRoot = "." -- default: "." -- apparently there's no way to use env var or relpaths here
, iconRoot = "/home/itsdrike/.config/xmobar/xpm"
, commands = [ , commands = [
-- Time and date -- Time and date
Run Date "<fn=2>\xf017</fn> %b %d %Y - (%H:%M) " "date" 50 Run Date "<fn=2>\xf017</fn> %b %d %Y - (%H:%M) " "date" 50
@ -26,6 +27,10 @@ Config { font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=t
, Run DiskU [("/", "<fn=2>\xf0c7</fn> hdd: <free> free")] [] 60 , Run DiskU [("/", "<fn=2>\xf0c7</fn> hdd: <free> free")] [] 60
-- Runs a standard shell command 'uname -r' to get kernel version -- Runs a standard shell command 'uname -r' to get kernel version
, Run Com "uname" ["-r"] "" 3600 , Run Com "uname" ["-r"] "" 3600
-- Add dynamic invisible XPM icon that resizes to accomodate trayer
-- this needs to be an absolute string path, env vars or relpaths aren't accepted
-- this should only be on 1 monitor (single file), so ignore this comment on others
, Run Com "/home/itsdrike/.config/xmobar/trayer-padding-icon.sh" [] "trayerpad" 10
-- Allow mouse clicking by using unsafe stdin reader -- Allow mouse clicking by using unsafe stdin reader
, Run UnsafeStdinReader , Run UnsafeStdinReader
] ]
@ -37,7 +42,7 @@ Config { font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=t
\<fc=#666666>|</fc> <fc=#ff6c6b> <action=`alacritty -e htop`>%memory%</action> </fc> \ \<fc=#666666>|</fc> <fc=#ff6c6b> <action=`alacritty -e htop`>%memory%</action> </fc> \
\<fc=#666666>|</fc> <fc=#51afef> <action=`alacritty -e htop`>%disku%</action> </fc> \ \<fc=#666666>|</fc> <fc=#51afef> <action=`alacritty -e htop`>%disku%</action> </fc> \
\<fc=#666666>|</fc> <fc=#98be65> <action=`alacritty -e sudo iftop`>%wlp2s0%</action> </fc> \ \<fc=#666666>|</fc> <fc=#98be65> <action=`alacritty -e sudo iftop`>%wlp2s0%</action> </fc> \
\<fc=#666666>|</fc> <fc=#46d9ff> %date% </fc>" \<fc=#666666>|</fc> <fc=#46d9ff> %date% </fc> \
\%trayerpad%\
\ "
} }

View file

@ -12,7 +12,8 @@ Config { font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=t
, hideOnStart = False , hideOnStart = False
, allDesktops = True , allDesktops = True
, persistent = True , persistent = True
--, iconRoot = "." -- default: "." -- apparently there's no way to use env var or relpaths here
, iconRoot = "/home/itsdrike/.config/xmobar/xpm"
, commands = [ , commands = [
-- Time and date -- Time and date
Run Date "<fn=2>\xf017</fn> %b %d %Y - (%H:%M) " "date" 50 Run Date "<fn=2>\xf017</fn> %b %d %Y - (%H:%M) " "date" 50
@ -26,6 +27,9 @@ Config { font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=t
, Run DiskU [("/", "<fn=2>\xf0c7</fn> hdd: <free> free")] [] 60 , Run DiskU [("/", "<fn=2>\xf0c7</fn> hdd: <free> free")] [] 60
-- Runs a standard shell command 'uname -r' to get kernel version -- Runs a standard shell command 'uname -r' to get kernel version
, Run Com "uname" ["-r"] "" 3600 , Run Com "uname" ["-r"] "" 3600
-- Add dynamic invisible XPM icon that resizes to accomodate trayer
-- this needs to be an absolute string path, env vars or relpaths aren't accepted
-- this should only be on 1 monitor (single file), so ignore this comment on others
-- Allow mouse clicking by using unsafe stdin reader -- Allow mouse clicking by using unsafe stdin reader
, Run UnsafeStdinReader , Run UnsafeStdinReader
] ]
@ -37,7 +41,6 @@ Config { font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=t
\<fc=#666666>|</fc> <fc=#ff6c6b> <action=`alacritty -e htop`>%memory%</action> </fc> \ \<fc=#666666>|</fc> <fc=#ff6c6b> <action=`alacritty -e htop`>%memory%</action> </fc> \
\<fc=#666666>|</fc> <fc=#51afef> <action=`alacritty -e htop`>%disku%</action> </fc> \ \<fc=#666666>|</fc> <fc=#51afef> <action=`alacritty -e htop`>%disku%</action> </fc> \
\<fc=#666666>|</fc> <fc=#98be65> <action=`alacritty -e sudo iftop`>%wlp2s0%</action> </fc> \ \<fc=#666666>|</fc> <fc=#98be65> <action=`alacritty -e sudo iftop`>%wlp2s0%</action> </fc> \
\<fc=#666666>|</fc> <fc=#46d9ff> %date% </fc>" \<fc=#666666>|</fc> <fc=#46d9ff> %date% </fc> \
\ "
} }

Binary file not shown.

View file

@ -82,7 +82,7 @@ myFocusedBorderColor :: String
myFocusedBorderColor = "#bc96da" myFocusedBorderColor = "#bc96da"
-- Default workspaces. Number of workspaces is determined by the list length. -- Default workspaces. Number of workspaces is determined by the list length.
myWorkspaces = ["dev", "www", "sys", "doc", "vbox", "chat", "mus", "vid", "etc"] myWorkspaces = ["dev", "www", "sys", "chat", "mus", "vid", "doc", "virt", "etc"]
myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..] -- (,) == \x y -> (x,y) myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..] -- (,) == \x y -> (x,y)
-- Make the workspaces clickable -- Make the workspaces clickable
@ -291,16 +291,21 @@ myLayoutHook = avoidStruts $ mouseResize $ windowArrange $ T.toggleLayouts float
myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet) myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet)
myManageHook = composeAll myManageHook = composeAll
-- Make dialog boxes floating, don't tile them
[ className =? "notification" --> doFloat [ className =? "notification" --> doFloat
, className =? "confirm" --> doFloat , className =? "confirm" --> doFloat
, className =? "dialog" --> doFloat , className =? "dialog" --> doFloat
, className =? "error" --> doFloat , className =? "error" --> doFloat
, className =? "download" --> doFloat , className =? "download" --> doFloat
, className =? "file_progress" --> doFloat , className =? "file_progress" --> doFloat
, className =? "splash" --> doFloat
, className =? "toolbar" --> doFloat
, className =? "Qalculate-gtk" --> doFloat , className =? "Qalculate-gtk" --> doFloat
, className =? "mpv" --> doShift ( myWorkspaces !! 7 )
, title =? "Mozilla Firefox" --> doShift ( myWorkspaces !! 1 )
, isFullscreen --> doFullFloat , isFullscreen --> doFullFloat
-- auto-shift applications to their respecitve workspaces
, className =? "discord" --> doShift ( myWorkspaces !! 3 )
, className =? "Code" --> doShift ( myWorkspaces !! 0 )
, title =? "Mozilla Firefox" --> doShift ( myWorkspaces !! 1 )
] ]
------------------------------------------------------------------------ ------------------------------------------------------------------------

Binary file not shown.