commit 33c2965d62153ab5465647f038f0a86ece77fb71
parent 849241ac77808642a243bee6ae804b2ada9874c8
Author: Tomas Nemec <nemi@skaut.cz>
Date: Tue, 31 Aug 2021 20:34:10 +0200
update
Diffstat:
D | chcol | | | 35 | ----------------------------------- |
A | cht | | | 35 | +++++++++++++++++++++++++++++++++++ |
M | tmux-dev | | | 27 | +++++++++++++++++++++------ |
3 files changed, 56 insertions(+), 41 deletions(-)
diff --git a/chcol b/chcol
@@ -1,35 +0,0 @@
-#!/bin/zsh
-# Change colorscheme
-# usage: chcol <light|dark>
-
-theme="$1"
-themes=(light dark)
-curr_theme=${THEME:-$CONFIG/theme}
-
-if [[ -z "$theme" ]]; then
- echo "USAGE: chcol <light|dark>"
- exit 1
-fi
-
-if [[ ! -v SCHEME ]]; then
- echo "SCHEME env is not set" >&2
- exit 1
-fi
-
-if (($themes[(Ie)$theme])); then
- echo "$theme" > $curr_theme
- # terminal
- sed "s/^colors:.*/colors: *${SCHEME}_$theme/" -i $CONFIG/alacritty/alacritty.yml
- # file manager
- sed "s/^colorscheme .*/colorscheme: ${SCHEME}-$theme/" -i $CONFIG/vifm/vifmrc
- # neovim
- for sname in $(nvr --serverlist); do nvr --servername "$sname" -cc "set background=${theme}" --nostart -s &; done
-
- # neomutt from $theme file (needs restart)
- exit 0
-else
- echo "'$theme' is not a valid theme"
- echo "USAGE: chcol <light|dark>"
- exit 1
-fi
-
diff --git a/cht b/cht
@@ -0,0 +1,35 @@
+#!/bin/zsh
+# Change colorscheme
+# usage: cht <light|dark>
+
+theme="$1"
+themes=(light dark)
+curr_theme=${THEME:-$CONFIG/theme}
+
+if [[ -z "$theme" ]]; then
+ echo "USAGE: cht <light|dark>"
+ exit 1
+fi
+
+if [[ ! -v SCHEME ]]; then
+ echo "SCHEME env is not set" >&2
+ exit 1
+fi
+
+if (($themes[(Ie)$theme])); then
+ echo "$theme" > $curr_theme
+ # terminal
+ sed "s/^colors:.*/colors: *${SCHEME}_$theme/" -i $CONFIG/alacritty/alacritty.yml
+ # file manager
+ sed "s/^colorscheme .*/colorscheme: ${SCHEME}-$theme/" -i $CONFIG/vifm/vifmrc
+ # neovim
+ for sname in $(nvr --serverlist); do nvr --servername "$sname" -cc "set background=${theme}" --nostart -s &; done
+
+ # neomutt from $theme file (needs restart)
+ exit 0
+else
+ echo "'$theme' is not a valid theme"
+ echo "USAGE: cht <light|dark>"
+ exit 1
+fi
+
diff --git a/tmux-dev b/tmux-dev
@@ -11,11 +11,17 @@ local cmd = {
dw = 'pub get && pub run build_runner serve --delete-conflicting-outputs web:8082 >&1 > >(trun angulardart dw)',
digi = 'pub get && pub run build_runner serve --delete-conflicting-outputs web:8083 >&1 > >(trun angulardart digi)',
dpgw = 'mvn compile && mvn exec:java -Dexec.mainClass=org.medoro.dpgw.DPGWMain',
+ r_dpgw = 'mvn exec:java -Dexec.mainClass=org.medoro.dpgw.DPGWMain',
}
------ APP DEFINITION -------
-- cwd: working directory
-- cmd: command to start/restart
-local dpgw = {key = 'dpgw', cwd = workdir .. '/dpgw', cmd = cmd.dpgw}
+local dpgw = {
+ key = 'dpgw',
+ cwd = workdir .. '/dpgw',
+ cmd = cmd.dpgw,
+ r_cmd = cmd.r_dpgw,
+}
local ui = {key = 'ui', cwd = workdir .. '/ui', cmd = cmd.ui}
local dw = {key = 'dw', cwd = workdir .. '/dw', cmd = cmd.dw}
local digi = {key = 'digi', cwd = workdir .. '/digi', cmd = cmd.digi}
@@ -56,7 +62,13 @@ if #arg == 0 or arg[1] == '-h' or arg[1] == '--help' then
end
local actions = {start = 's', restart = 'r', stop = 't', open = 'o', join = 'j'} -- command mapping
-local action_set = {['s'] = true, ['r'] = true, ['t'] = true, ['o'] = true, ['j'] = true}
+local action_set = {
+ ['s'] = true,
+ ['r'] = true,
+ ['t'] = true,
+ ['o'] = true,
+ ['j'] = true,
+}
local action = string.sub(table.remove(arg, 1), 1, 1); -- get first char of command
-- check for valid command
if not action_set[action] then
@@ -66,7 +78,8 @@ end
-- make action
if #arg == 0 and action == actions.stop then
- local _, _, code = os.execute(string.format('tmux kill-session -t %s', session))
+ local _, _, code = os.execute(
+ string.format('tmux kill-session -t %s', session))
if code < 1 then
io.write('Stopped session', '\n')
end
@@ -79,7 +92,8 @@ end
------ PROCESS UTILS -------
-----------------------------
local function started()
- local _, _, code = os.execute(string.format('tmux has -t %s 2>> /dev/null', session))
+ local _, _, code = os.execute(string.format('tmux has -t %s 2>> /dev/null',
+ session))
return code < 1
end
local function run(cmd, ...) return os.execute(string.format(cmd, ...)) end
@@ -156,7 +170,7 @@ function App:start()
end
function App:restart()
- tsend(self.key, {'^c', self.cmd})
+ tsend(self.key, {'^c', self.r_cmd or self.cmd})
io.write(string.format('Restarted %s', self.key), '\n')
end
@@ -241,7 +255,8 @@ for _, capp in ipairs(curr_apps) do
for _, app in ipairs(slaves) do
if action == actions.start then
if app:started() then
- io.stderr:write(string.format('App \'%s\' is already running.\n', app.key))
+ io.stderr:write(string.format('App \'%s\' is already running.\n',
+ app.key))
else
app:start()
end