1
0
Fork 0
mirror of https://gitlab.com/dwt1/dotfiles.git synced 2023-02-13 20:55:19 -05:00

Adding leftwm with xmobar.

This commit is contained in:
Derek Taylor 2022-10-19 17:44:02 -05:00
parent cfb5e86f9f
commit ffab9f795a
19 changed files with 341 additions and 212 deletions

95
.config/leftwm/config.ron Normal file
View file

@ -0,0 +1,95 @@
// _ ___ ___ _
// | | / __)_ / __|_)
// | | ____| |__| |_ _ _ _ ____ ____ ___ ____ | |__ _ ____ ____ ___ ____
// | |/ _ ) __) _) | | | \ / ___) _ \| _ \| __) |/ _ | / ___) _ \| _ \
// | ( (/ /| | | |_| | | | | | | ( (__| |_| | | | | | | ( ( | |_| | | |_| | | | |
// |_|\____)_| \___)____|_|_|_| \____)___/|_| |_|_| |_|\_|| (_)_| \___/|_| |_|
// A WindowManager for Adventurers (____/
// For info about configuration please visit https://github.com/leftwm/leftwm/wiki
#![enable(implicit_some)]
(
modkey: "Mod4",
mousekey: "Mod4",
workspaces: [],
tags: [
" dev ",
" www ",
" sys ",
" doc ",
" vbox ",
" chat ",
" mus ",
" vid ",
" gfx ",
],
max_window_width: None,
layouts: [
MainAndVertStack,
MainAndHorizontalStack,
MainAndDeck,
GridHorizontal,
EvenHorizontal,
EvenVertical,
Fibonacci,
LeftMain,
CenterMain,
CenterMainBalanced,
CenterMainFluid,
Monocle,
RightWiderLeftStack,
LeftWiderRightStack,
],
layout_mode: Workspace,
insert_behavior: Bottom,
scratchpad: [
(name: "Alacritty", value: "alacritty", x: 860, y: 390, height: 300, width: 200),
],
window_rules: [],
disable_current_tag_swap: false,
disable_tile_drag: false,
disable_window_snap: true,
focus_behaviour: Sloppy,
focus_new_windows: true,
sloppy_mouse_follows_focus: true,
keybind: [
(command: Execute, value: "dmenu_run", modifier: ["modkey", "Shift"], key: "Return"),
(command: Execute, value: "alacritty -e fish", modifier: ["modkey"], key: "Return"),
(command: CloseWindow, value: "", modifier: ["modkey", "Shift"], key: "c"),
(command: SoftReload, value: "", modifier: ["modkey", "Shift"], key: "r"),
(command: Execute, value: "pkill leftwm", modifier: ["modkey", "Shift"], key: "q"),
(command: Execute, value: "slock", modifier: ["modkey", "Control"], key: "l"),
(command: MoveToLastWorkspace, value: "", modifier: ["modkey", "Shift"], key: "w"),
(command: SwapTags, value: "", modifier: ["modkey"], key: "w"),
(command: MoveWindowUp, value: "", modifier: ["modkey", "Shift"], key: "k"),
(command: MoveWindowDown, value: "", modifier: ["modkey", "Shift"], key: "j"),
(command: MoveWindowTop, value: "", modifier: ["modkey", "Shift"], key: "m"),
(command: FocusWindowUp, value: "", modifier: ["modkey"], key: "k"),
(command: FocusWindowDown, value: "", modifier: ["modkey"], key: "j"),
(command: NextLayout, value: "", modifier: ["modkey"], key: "Tab"),
(command: PreviousLayout, value: "", modifier: ["modkey", "Shift"], key: "Tab"),
(command: FocusWorkspaceNext, value: "", modifier: ["modkey"], key: "period"),
(command: FocusWorkspacePrevious, value: "", modifier: ["modkey"], key: "comma"),
(command: GotoTag, value: "1", modifier: ["modkey"], key: "1"),
(command: GotoTag, value: "2", modifier: ["modkey"], key: "2"),
(command: GotoTag, value: "3", modifier: ["modkey"], key: "3"),
(command: GotoTag, value: "4", modifier: ["modkey"], key: "4"),
(command: GotoTag, value: "5", modifier: ["modkey"], key: "5"),
(command: GotoTag, value: "6", modifier: ["modkey"], key: "6"),
(command: GotoTag, value: "7", modifier: ["modkey"], key: "7"),
(command: GotoTag, value: "8", modifier: ["modkey"], key: "8"),
(command: GotoTag, value: "9", modifier: ["modkey"], key: "9"),
(command: MoveToTag, value: "1", modifier: ["modkey", "Shift"], key: "1"),
(command: MoveToTag, value: "2", modifier: ["modkey", "Shift"], key: "2"),
(command: MoveToTag, value: "3", modifier: ["modkey", "Shift"], key: "3"),
(command: MoveToTag, value: "4", modifier: ["modkey", "Shift"], key: "4"),
(command: MoveToTag, value: "5", modifier: ["modkey", "Shift"], key: "5"),
(command: MoveToTag, value: "6", modifier: ["modkey", "Shift"], key: "6"),
(command: MoveToTag, value: "7", modifier: ["modkey", "Shift"], key: "7"),
(command: MoveToTag, value: "8", modifier: ["modkey", "Shift"], key: "8"),
(command: MoveToTag, value: "9", modifier: ["modkey", "Shift"], key: "9"),
(command: IncreaseMainWidth, value: "1", modifier: ["modkey", "Shift"], key: "l"),
(command: DecreaseMainWidth, value: "1", modifier: ["modkey", "Shift"], key: "h"),
],
state_path: None,
)

View file

@ -1,212 +0,0 @@
modkey = "Mod4"
workspaces = []
tags = [" dev ", " www ", " sys ", " doc ", " vbox ", " chat ", " mus ", " vid ", " gfx "]
[[keybind]]
command = "Execute"
value = "dmenu_run"
modifier = ["modkey", "Shift"]
key = "Return"
[[keybind]]
command = "Execute"
value = "alacritty -e fish"
modifier = ["modkey"]
key = "Return"
[[keybind]]
command = "CloseWindow"
modifier = ["modkey", "Shift"]
key = "c"
[[keybind]]
command = "SoftReload"
modifier = ["modkey", "Shift"]
key = "r"
[[keybind]]
command = "Execute"
value = "pkill leftwm"
modifier = ["modkey", "Shift"]
key = "q"
[[keybind]]
command = "Execute"
value = "slock"
modifier = ["modkey", "Control"]
key = "l"
[[keybind]]
command = "MoveToLastWorkspace"
modifier = ["modkey", "Shift"]
key = "w"
[[keybind]]
command = "SwapTags"
modifier = ["modkey"]
key = "w"
[[keybind]]
command = "MoveWindowUp"
modifier = ["modkey", "Shift"]
key = "k"
[[keybind]]
command = "MoveWindowDown"
modifier = ["modkey", "Shift"]
key = "j"
[[keybind]]
command = "MoveWindowTop"
modifier = ["modkey", "Shift"]
key = "m"
[[keybind]]
command = "FocusWindowUp"
modifier = ["modkey"]
key = "k"
[[keybind]]
command = "FocusWindowDown"
modifier = ["modkey"]
key = "j"
[[keybind]]
command = "NextLayout"
modifier = ["modkey"]
key = "Tab"
[[keybind]]
command = "PreviousLayout"
modifier = ["modkey", "Shift"]
key = "Tab"
[[keybind]]
command = "FocusWorkspaceNext"
modifier = ["modkey"]
key = "period"
[[keybind]]
command = "FocusWorkspacePrevious"
modifier = ["modkey"]
key = "comma"
[[keybind]]
command = "GotoTag"
value = "1"
modifier = ["modkey"]
key = "1"
[[keybind]]
command = "GotoTag"
value = "2"
modifier = ["modkey"]
key = "2"
[[keybind]]
command = "GotoTag"
value = "3"
modifier = ["modkey"]
key = "3"
[[keybind]]
command = "GotoTag"
value = "4"
modifier = ["modkey"]
key = "4"
[[keybind]]
command = "GotoTag"
value = "5"
modifier = ["modkey"]
key = "5"
[[keybind]]
command = "GotoTag"
value = "6"
modifier = ["modkey"]
key = "6"
[[keybind]]
command = "GotoTag"
value = "7"
modifier = ["modkey"]
key = "7"
[[keybind]]
command = "GotoTag"
value = "8"
modifier = ["modkey"]
key = "8"
[[keybind]]
command = "GotoTag"
value = "9"
modifier = ["modkey"]
key = "9"
[[keybind]]
command = "MoveToTag"
value = "1"
modifier = ["modkey", "Shift"]
key = "1"
[[keybind]]
command = "MoveToTag"
value = "2"
modifier = ["modkey", "Shift"]
key = "2"
[[keybind]]
command = "MoveToTag"
value = "3"
modifier = ["modkey", "Shift"]
key = "3"
[[keybind]]
command = "MoveToTag"
value = "4"
modifier = ["modkey", "Shift"]
key = "4"
[[keybind]]
command = "MoveToTag"
value = "5"
modifier = ["modkey", "Shift"]
key = "5"
[[keybind]]
command = "MoveToTag"
value = "6"
modifier = ["modkey", "Shift"]
key = "6"
[[keybind]]
command = "MoveToTag"
value = "7"
modifier = ["modkey", "Shift"]
key = "7"
[[keybind]]
command = "MoveToTag"
value = "8"
modifier = ["modkey", "Shift"]
key = "8"
[[keybind]]
command = "MoveToTag"
value = "9"
modifier = ["modkey", "Shift"]
key = "9"
[[keybind]]
command = "IncreaseMainWidth"
value = "1"
modifier = ["modkey", "Shift"]
key = "l"
[[keybind]]
command = "DecreaseMainWidth"
value = "1"
modifier = ["modkey", "Shift"]
key = "h"

View file

@ -0,0 +1,48 @@
# Why have themes
With LeftWM, there are two types of configs:
* **LeftWM Configuration files:** LeftWM configurations are specific to you and dont change for different themes. These are settings like keybindings, workspace locations, and names of desktops/tags. These settings can be found in `~/.config/leftwm/config.toml`.
* **Theme Configuration files:** The appearance of your desktop is different. Its fun to try new looks and feels. Its fun to tweak and customize the appearance (AKA: [ricing](https://www.reddit.com/r/unixporn/comments/3iy3wd/stupid_question_what_is_ricing/)). Its fun to share so others can experience your awesome desktop! LeftWM is built around this concept. By pulling all these settings out into themes, you can now easily tweak, switch, and share your experiences. This configuration is spread between `theme.toml` and related files contained within a theme's folder.
# We want your themes
We are looking to expand the list of available themes for an upcoming release. If you enjoy making desktops look good please consider sharing by making a pull request on [the community themes repository](https://github.com/leftwm/leftwm-community-themes).
# Requirements for a theme
A theme has only two requirements. An “up” and a “down” executable/script. They can be written in whatever makes you happy. The up script you guessed it starts up all the things that make your script unique and awesome. The down script restores the environment to an un-themes state. A theme should be self contained if possible so that it can be shared and doesnt interfere with other themes. For example when booting an application with a config file, put the config file in the theme folder instead of ~/.config. This way other themes can use the same application
# Setup / selection of theme
There are two ways to setup a theme: you can use [leftwm-theme](https://github.com/leftwm/leftwm-theme/) or you can set a symlink yourself.
## Using LeftWM-theme
Install LeftWM-theme, as per the directions on [its Github](https://github.com/leftwm/leftwm-theme).
Update your list of themes:
```bash
leftwm-theme update
```
Install the theme you like:
```bash
leftwm-theme install "THEME NAME GOES HERE"
```
Apply the theme you like as the current theme:
```bash
leftwm-theme apply "THEME NAME GOES HERE"
```
## Using symlinks
To select a theme all that is required is that its located at: `~/.config/leftwm/themes/current`
It is strongly recommended that you do this with a symlink rather than creating a folder. Using a symlink makes it easy to save all your themes in the folder `~/.config/leftwm/themes` and switch between them using a symlink easily.
The following command would set the included basic_polybar to the current theme:
```bash
ln -s ~/.config/leftwm/themes/basic_polybar ~/.config/leftwm/themes/current
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 MiB

View file

@ -0,0 +1,2 @@
#!/usr/bin/env bash
leftwm-command "SendWorkspaceToTag $1 $2"

View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
#set background
if [ -x "$(command -v feh)" ]; then
feh --bg-scale $SCRIPTPATH/reset.jpg
fi
leftwm-command "UnloadTheme"
ps -alh | grep xmobar_control_script | awk '{print $3}' | xargs kill
pkill compton
pkill picom
pkill xmobar
pkill xmobar

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

View file

@ -0,0 +1,3 @@
{% for w in workspaces %}
Static { xpos = {{w.x}} , ypos = {{w.y}}, width = {{w.w}}, height = 24 }
{% endfor %}

View file

@ -0,0 +1,12 @@
{% for tag in workspace.tags %}
{% if tag.mine %}
<action=`$SCRIPTPATH/change_to_tag {{workspace.index}} {{tag.index}}`><fc=#FF0000> {{tag.name}} </fc></action>
{% elsif tag.visible %}
<action=`$SCRIPTPATH/change_to_tag {{workspace.index}} {{tag.index}}`><fc=#FF9999> {{tag.name}} </fc></action>
{% elsif tag.busy %}
<action=`$SCRIPTPATH/change_to_tag {{workspace.index}} {{tag.index}}`> {{tag.name}}* </action>
{% else %}
<action=`$SCRIPTPATH/change_to_tag {{workspace.index}} {{tag.index}}`><fc=#FFFFFF> {{tag.name}} </fc></action>
{% endif %}
{% endfor %}
<fc=#555555> {{ window_title }}</fc>

View file

@ -0,0 +1,6 @@
(border_width: 2,
margin: 12,
default_border_color: "#222222",
floating_border_color: "#555555",
focused_border_color: "#FF3333",
)

View file

@ -0,0 +1,42 @@
#!/usr/bin/env bash
export SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
#down the last running theme
if [ -f "/tmp/leftwm-theme-down" ]; then
/tmp/leftwm-theme-down
rm /tmp/leftwm-theme-down
fi
ln -s $SCRIPTPATH/down /tmp/leftwm-theme-down
#boot compton or picom if it exists
killall conky
killall trayer
lxsession &
picom &
nm-applet &
volumeicon &
/usr/bin/emacs --daemon &
sleep 2 && conky -c $HOME/.config/conky/xmonad/doom-one-01.conkyrc
sleep 2 && trayer --edge top --align right --widthtype request --padding 6 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 --tint 0x282c34 --height 22
#set the theme.ron config
leftwm-command "LoadTheme $SCRIPTPATH/theme.ron"
# SET WALLPAPER
# Uncomment only ONE of the following FOUR lines, depending on which wallpaper setter you use.
xargs xwallpaper --stretch < ~/.cache/wall
# ~/.fehbg &" -- set last saved feh wallpaper
# feh --randomize --bg-fill /usr/share/backgrounds/dtos-backgrounds/*" -- feh set random wallpaper
# nitrogen --restore &" -- if you prefer nitrogen to feh
index=0
leftwm-state -q -n -t $SCRIPTPATH/sizes.liquid | sed -r '/^\s*$/d' | while read size
do
leftwm-state -w $index -t $SCRIPTPATH/template.liquid | xmobar -p "$size" $SCRIPTPATH/xmobar-config.hs --alpha=230 &
let index=index+1
done

View file

@ -0,0 +1,23 @@
Config { font = "-misc-fixed-*-*-*-*-13-*-*-*-*-*-*-*"
, bgColor = "black"
, fgColor = "grey"
, position = Top
, lowerOnStart = True
, allDesktops = True
, pickBroadest = False
, overrideRedirect = False
, commands = [ Run Weather "KSHV" ["-t"," <tempF>F","-L","64","-H","77","--normal","green","--high","red","--low","lightblue"] 36000
, Run Network "eno1" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run MultiCpu ["-L","15","-H","50","--normal","green","--high","red"] 10
, Run Memory [] 10
, Run Swap [] 10
, Run TopProc [] 10
, Run Date "%a %b %_d %Y %H:%M:%S" "date" 10
, Run UnsafeStdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = "%UnsafeStdinReader% }{ %top% | %multicpu% | %memory% * %swap% | %eno1% | %date% | %KSHV%"
}

View file

@ -0,0 +1,52 @@
Config { font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=true"
, additionalFonts = [ "xft:Mononoki:pixelsize=11:antialias=true:hinting=true"
, "xft:Font Awesome 6 Free Solid:pixelsize=12"
, "xft:Font Awesome 6 Brands:pixelsize=12"
]
, bgColor = "#282c34"
, fgColor = "#ff6c6b"
-- Position TopSize and BottomSize take 3 arguments:
-- an alignment parameter (L/R/C) for Left, Right or Center.
-- an integer for the percentage width, so 100 would be 100%.
-- an integer for the minimum pixel height for xmobar, so 24 would force a height of at least 24 pixels.
-- NOTE: The height should be the same as the trayer (system tray) height.
, position = TopSize L 100 24
, lowerOnStart = True
, hideOnStart = False
, allDesktops = True
, overrideRedirect = False
, persistent = True
, commands = [
-- Echos a "penguin" icon in front of the kernel output.
Run Com "echo" ["<fn=3>\xf17c</fn>"] "penguin" 3600
-- Get kernel version (script found in .local/bin)
, Run Com ".local/bin/kernel" [] "kernel" 36000
-- Cpu usage in percent
, Run Cpu ["-t", "<fn=2>\xf108</fn> cpu: (<total>%)","-H","50","--high","red"] 20
-- Ram used number and percent
, Run Memory ["-t", "<fn=2>\xf233</fn> mem: <used>M (<usedratio>%)"] 20
-- Disk space free
, Run DiskU [("/", "<fn=2>\xf0c7</fn> hdd: <free> free")] [] 60
-- Echos an "up arrow" icon in front of the uptime output.
, Run Com "echo" ["<fn=2>\xf0aa</fn>"] "uparrow" 3600
-- Uptime
, Run Uptime ["-t", "uptime: <days>d <hours>h"] 360
-- Echos a "bell" icon in front of the pacman updates.
, Run Com "echo" ["<fn=2>\xf0f3</fn>"] "bell" 3600
-- Check for pacman updates (script found in .local/bin)
, Run Com ".local/bin/pacupdate" [] "pacupdate" 36000
-- Echos a "battery" icon in front of the pacman updates.
, Run Com "echo" ["<fn=2>\xf242</fn>"] "baticon" 3600
-- Battery
, Run BatteryP ["BAT0"] ["-t", "<acstatus><watts> (<left>%)"] 360
-- Time and date
, Run Date "<fn=2>\xf017</fn> %b %d %Y - (%H:%M) " "date" 50
-- Script that dynamically adjusts xmobar padding depending on number of trayer icons.
, Run Com ".config/xmobar/trayer-padding-icon.sh" [] "trayerpad" 20
-- Prints out the left side items such as workspaces, layout, etc.
, Run UnsafeStdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = " %UnsafeStdinReader% }{ <box type=Bottom width=2 mb=2 color=#51afef><fc=#51afef>%penguin% %kernel%</fc></box> <box type=Bottom width=2 mb=2 color=#ecbe7b><fc=#ecbe7b><action=`alacritty -e htop`>%cpu%</action></fc></box> <box type=Bottom width=2 mb=2 color=#ff6c6b><fc=#ff6c6b><action=`alacritty -e htop`>%memory%</action></fc></box> <box type=Bottom width=2 mb=2 color=#a9a1e1><fc=#a9a1e1>%disku%</fc></box> <box type=Bottom width=2 mb=2 color=#98be65><fc=#98be65>%uparrow% %uptime%</fc></box> <box type=Bottom width=2 mb=2 color=#c678dd><fc=#c678dd>%bell% <action=`alacritty -e sudo pacman -Syu`>%pacupdate%</action></fc></box> <box type=Bottom width=2 mb=2 color=#da8548><fc=#da8548>%baticon% %battery%</fc></box> <box type=Bottom width=2 mb=2 color=#46d9ff><fc=#46d9ff><action=`emacsclient -c -a 'emacs' --eval '(doom/window-maximize-buffer(dt/year-calendar))'`>%date%</action></fc></box> %trayerpad%"
}

View file

@ -0,0 +1,30 @@
# How to control LeftWM from an external proccess
LeftWM supports being controlled using EWMH calls and from an external pipe
file.
This folder has example of how to send commands to LeftWM using its external pipe
file.
A full list of supported commands can be found here:
```
LoadTheme PATH_TO_THEME
UnloadTheme
Reload
SendWorkspaceToTag INDEX_OF_WORKSPACE, INDEX_OF_TAG
SendWindowToTag INDEX_OF_TAG
SwapScreens
MoveWindowToLastWorkspace
MoveWindowUp
MoveWindowDown
FocusWindowUp
FocusWindowDown
FocusWorkspaceNext
FocusWorkspacePrevious
CloseWindow
NextLayout
PreviousLayout
```

View file

@ -0,0 +1,2 @@
#!/usr/bin/env bash
leftwm-command "SendWorkspaceToTag $1 $2"

View file

@ -0,0 +1,2 @@
#!/usr/bin/env bash
leftwm-command "MoveWindowToLastWorkspace"

View file

@ -0,0 +1,2 @@
#!/usr/bin/env bash
leftwm-command "SendWindowToTag $1"

View file

@ -0,0 +1,2 @@
#!/usr/bin/env bash
leftwm-command "SwapScreens"

View file

@ -0,0 +1 @@
/home/dt/.config/leftwm/themes/basic_xmobar