add bar2, wireguard block, workspace_apps block, i3_switch_window script
This commit is contained in:
parent
0b227719b4
commit
cd7f6cbc7c
|
@ -1,26 +1,50 @@
|
||||||
[bandwidth_eth0]
|
#[bandwidth_eth0]
|
||||||
command=/home/simon/.i3/bar/src/bandwidth.php eth0 inet eth
|
#command=/home/simon/.i3/bar/src/bandwidth.php eth0 inet eth
|
||||||
format=json
|
#format=json
|
||||||
markup=pango
|
#markup=pango
|
||||||
interval=5
|
#interval=5
|
||||||
|
#
|
||||||
|
#[bandwidth_wg0]
|
||||||
|
#command=/home/simon/.i3/bar/src/bandwidth.php wg0 wg0
|
||||||
|
#format=json
|
||||||
|
#markup=pango
|
||||||
|
#interval=5
|
||||||
|
#
|
||||||
|
#[bandwidth_wg1]
|
||||||
|
#command=/home/simon/.i3/bar/src/bandwidth.php wg1 wg1
|
||||||
|
#format=json
|
||||||
|
#markup=pango
|
||||||
|
#interval=5
|
||||||
|
#
|
||||||
|
#[bandwidth_enx00e04cf69b06]
|
||||||
|
#command=/home/simon/.i3/bar/src/bandwidth.php enx00e04cf69b06 inet eth
|
||||||
|
#format=json
|
||||||
|
#markup=pango
|
||||||
|
#interval=5
|
||||||
|
#
|
||||||
|
#[bandwidth_enx00e04c68022c]
|
||||||
|
#command=/home/simon/.i3/bar/src/bandwidth.php enx00e04c68022c inet eth
|
||||||
|
#format=json
|
||||||
|
#markup=pango
|
||||||
|
#interval=5
|
||||||
|
#
|
||||||
|
#[bandwidth_wlp59s0]
|
||||||
|
#command=/home/simon/.i3/bar/src/bandwidth.php wlp59s0 inet wifi
|
||||||
|
#format=json
|
||||||
|
#markup=pango
|
||||||
|
#interval=1
|
||||||
|
|
||||||
[bandwidth_enx00e04cf69b06]
|
[ip_wg0_inet]
|
||||||
command=/home/simon/.i3/bar/src/bandwidth.php enx00e04cf69b06 inet eth
|
command=/home/simon/.i3/bar/src/ip.php wg0 inet wg0
|
||||||
format=json
|
format=json
|
||||||
markup=pango
|
markup=pango
|
||||||
interval=5
|
interval=10
|
||||||
|
|
||||||
[bandwidth_enx00e04c68022c]
|
[ip_wg1_inet]
|
||||||
command=/home/simon/.i3/bar/src/bandwidth.php enx00e04c68022c inet eth
|
command=/home/simon/.i3/bar/src/ip.php wg1 inet wg1
|
||||||
format=json
|
format=json
|
||||||
markup=pango
|
markup=pango
|
||||||
interval=5
|
interval=10
|
||||||
|
|
||||||
[bandwidth_wlp59s0]
|
|
||||||
command=/home/simon/.i3/bar/src/bandwidth.php wlp59s0 inet wifi
|
|
||||||
format=json
|
|
||||||
markup=pango
|
|
||||||
interval=1
|
|
||||||
|
|
||||||
[ip_eth0_inet]
|
[ip_eth0_inet]
|
||||||
command=/home/simon/.i3/bar/src/ip.php eth0 inet eth
|
command=/home/simon/.i3/bar/src/ip.php eth0 inet eth
|
||||||
|
@ -52,6 +76,18 @@ format=json
|
||||||
markup=pango
|
markup=pango
|
||||||
interval=100
|
interval=100
|
||||||
|
|
||||||
|
[wireguard_wg0]
|
||||||
|
command=/home/simon/.i3/bar/src/wireguard.php wg0 wg0
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
|
||||||
|
[wireguard_wg1]
|
||||||
|
command=/home/simon/.i3/bar/src/wireguard.php wg1 wg1
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
|
||||||
[mount_point_space_root]
|
[mount_point_space_root]
|
||||||
command=/home/simon/.i3/bar/src/mount_point_space.php root /
|
command=/home/simon/.i3/bar/src/mount_point_space.php root /
|
||||||
format=json
|
format=json
|
||||||
|
@ -112,6 +148,18 @@ format=json
|
||||||
markup=pango
|
markup=pango
|
||||||
interval=1000
|
interval=1000
|
||||||
|
|
||||||
|
[app_flameshot]
|
||||||
|
command=/home/simon/.i3/bar/src/app.php app_flameshot "F" "/usr/bin/flameshot gui --delay 500" '#bf007e' '#fff'
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1000
|
||||||
|
|
||||||
|
[app_ksnip]
|
||||||
|
command=/home/simon/.i3/bar/src/app.php app_ksnip "K" "/usr/bin/ksnip" '#a460ef' '#fff'
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1000
|
||||||
|
|
||||||
[app_cloud]
|
[app_cloud]
|
||||||
command=/home/simon/.i3/bar/src/app.php app_cloud C "xdg-open https://deblan.cloud/" '#3c4e74' '#fff'
|
command=/home/simon/.i3/bar/src/app.php app_cloud C "xdg-open https://deblan.cloud/" '#3c4e74' '#fff'
|
||||||
format=json
|
format=json
|
||||||
|
@ -124,17 +172,11 @@ format=json
|
||||||
markup=pango
|
markup=pango
|
||||||
interval=1000
|
interval=1000
|
||||||
|
|
||||||
[app_netflix]
|
#[app_netflix]
|
||||||
command=/home/simon/.i3/bar/src/app.php app_netflix N "xdg-open https://www.netflix.com/browse" '#363636' '#e50914'
|
#command=/home/simon/.i3/bar/src/app.php app_netflix N "xdg-open https://www.netflix.com/browse" '#363636' '#e50914'
|
||||||
format=json
|
#format=json
|
||||||
markup=pango
|
#markup=pango
|
||||||
interval=1000
|
#interval=1000
|
||||||
|
|
||||||
[time]
|
|
||||||
command=/home/simon/.i3/bar/src/time.php "H:i:s d/m"
|
|
||||||
format=json
|
|
||||||
markup=pango
|
|
||||||
interval=1
|
|
||||||
|
|
||||||
[rss_tts]
|
[rss_tts]
|
||||||
command=/home/simon/.i3/bar/src/rss.php "rss_tts" "https://tiny.deblan.org/public.php?op=rss&id=-3&key=17c659af1ad27f30941a724fcf48421d1e83081a" "https://tiny.deblan.org/"
|
command=/home/simon/.i3/bar/src/rss.php "rss_tts" "https://tiny.deblan.org/public.php?op=rss&id=-3&key=17c659af1ad27f30941a724fcf48421d1e83081a" "https://tiny.deblan.org/"
|
||||||
|
|
144
bar/bar2.conf
Normal file
144
bar/bar2.conf
Normal file
|
@ -0,0 +1,144 @@
|
||||||
|
[bandwidth_eth0]
|
||||||
|
command=/home/simon/.i3/bar/src/bandwidth.php eth0 inet eth
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=5
|
||||||
|
|
||||||
|
[bandwidth_wg0]
|
||||||
|
command=/home/simon/.i3/bar/src/bandwidth.php wg0
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=5
|
||||||
|
|
||||||
|
[bandwidth_wg1]
|
||||||
|
command=/home/simon/.i3/bar/src/bandwidth.php wg1
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=5
|
||||||
|
|
||||||
|
[bandwidth_enx00e04cf69b06]
|
||||||
|
command=/home/simon/.i3/bar/src/bandwidth.php enx00e04cf69b06 inet eth
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=5
|
||||||
|
|
||||||
|
[bandwidth_enx00e04c68022c]
|
||||||
|
command=/home/simon/.i3/bar/src/bandwidth.php enx00e04c68022c inet eth
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=5
|
||||||
|
|
||||||
|
[bandwidth_wlp59s0]
|
||||||
|
command=/home/simon/.i3/bar/src/bandwidth.php wlp59s0 inet wifi
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
|
||||||
|
[workspace_apps_0]
|
||||||
|
command=/home/simon/.i3/bar/src/workspace_apps.php 0 $BLOCK_BUTTON
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
align=left
|
||||||
|
|
||||||
|
[workspace_apps_1]
|
||||||
|
command=/home/simon/.i3/bar/src/workspace_apps.php 1 $BLOCK_BUTTON
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
align=left
|
||||||
|
|
||||||
|
[workspace_apps_2]
|
||||||
|
command=/home/simon/.i3/bar/src/workspace_apps.php 2 $BLOCK_BUTTON
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
align=left
|
||||||
|
|
||||||
|
[workspace_apps_3]
|
||||||
|
command=/home/simon/.i3/bar/src/workspace_apps.php 3 $BLOCK_BUTTON
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
align=left
|
||||||
|
|
||||||
|
[workspace_apps_4]
|
||||||
|
command=/home/simon/.i3/bar/src/workspace_apps.php 4 $BLOCK_BUTTON
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
align=left
|
||||||
|
|
||||||
|
[workspace_apps_5]
|
||||||
|
command=/home/simon/.i3/bar/src/workspace_apps.php 5 $BLOCK_BUTTON
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
align=left
|
||||||
|
|
||||||
|
[workspace_apps_6]
|
||||||
|
command=/home/simon/.i3/bar/src/workspace_apps.php 6 $BLOCK_BUTTON
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
align=left
|
||||||
|
|
||||||
|
[workspace_apps_7]
|
||||||
|
command=/home/simon/.i3/bar/src/workspace_apps.php 7 $BLOCK_BUTTON
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
align=left
|
||||||
|
|
||||||
|
[workspace_apps_8]
|
||||||
|
command=/home/simon/.i3/bar/src/workspace_apps.php 8 $BLOCK_BUTTON
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
align=left
|
||||||
|
|
||||||
|
[workspace_apps_9]
|
||||||
|
command=/home/simon/.i3/bar/src/workspace_apps.php 9 $BLOCK_BUTTON
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
align=left
|
||||||
|
|
||||||
|
[workspace_apps_10]
|
||||||
|
command=/home/simon/.i3/bar/src/workspace_apps.php 10 $BLOCK_BUTTON
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
align=left
|
||||||
|
|
||||||
|
[workspace_apps_11]
|
||||||
|
command=/home/simon/.i3/bar/src/workspace_apps.php 11 $BLOCK_BUTTON
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
align=left
|
||||||
|
|
||||||
|
[workspace_apps_12]
|
||||||
|
command=/home/simon/.i3/bar/src/workspace_apps.php 12 $BLOCK_BUTTON
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
align=left
|
||||||
|
|
||||||
|
#[meteo]
|
||||||
|
#command=/home/simon/.i3/bar/src/meteo.php
|
||||||
|
#format=json
|
||||||
|
#markup=pango
|
||||||
|
#interval=3600
|
||||||
|
|
||||||
|
[time]
|
||||||
|
command=/home/simon/.i3/bar/src/time.php "H:i:s d/m/Y"
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1
|
||||||
|
|
||||||
|
[app_system]
|
||||||
|
command=/home/simon/.i3/bar/src/app.php app_system "Système" /home/simon/bin/poweroption '#000' '#fff'
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1000
|
|
@ -83,7 +83,6 @@ function lpspan($text, $foreground = null, $background = null)
|
||||||
return span(sprintf(' %s', $text), $foreground, $background);
|
return span(sprintf(' %s', $text), $foreground, $background);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates span.
|
* Creates span.
|
||||||
*
|
*
|
||||||
|
@ -106,9 +105,6 @@ function span($text, $foreground = null, $background = null)
|
||||||
/**
|
/**
|
||||||
* Returns a json of a block.
|
* Returns a json of a block.
|
||||||
*
|
*
|
||||||
* @param string $name
|
|
||||||
* @param array $options
|
|
||||||
*
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function block(string $name, array $options = [])
|
function block(string $name, array $options = [])
|
||||||
|
|
|
@ -8,7 +8,7 @@ $ipv6 = !empty($argv[1]);
|
||||||
$iface = 'wan';
|
$iface = 'wan';
|
||||||
|
|
||||||
$command = sprintf(
|
$command = sprintf(
|
||||||
'dig +short %s myip.opendns.com @resolver1.opendns.com',
|
'dig +short %s myip.opendns.com @resolver1.opendns.com 2>/dev/null | grep -v could',
|
||||||
$ipv6 ? '-6' : null
|
$ipv6 ? '-6' : null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ $ip = trim(shell_exec($command));
|
||||||
|
|
||||||
if (empty($ip)) {
|
if (empty($ip)) {
|
||||||
$command = sprintf(
|
$command = sprintf(
|
||||||
'dig +short %s TXT o-o.myaddr.l.google.com @ns1.google.com',
|
'dig +short %s TXT o-o.myaddr.l.google.com @ns1.google.com 2>/dev/null | grep -v could',
|
||||||
$ipv6 ? '-6' : '-4'
|
$ipv6 ? '-6' : '-4'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -24,6 +24,15 @@ if (empty($ip)) {
|
||||||
$ip = trim($ip, '"');
|
$ip = trim($ip, '"');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($ip)) {
|
||||||
|
$command = sprintf(
|
||||||
|
'curl %s ifconfig.co 2>/dev/null',
|
||||||
|
$ipv6 ? '-6' : '-4'
|
||||||
|
);
|
||||||
|
|
||||||
|
$ip = trim(shell_exec($command));
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($ip)) {
|
if (empty($ip)) {
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
39
bar/src/wireguard.php
Executable file
39
bar/src/wireguard.php
Executable file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require __DIR__.'/base/block.php';
|
||||||
|
|
||||||
|
$iface = $argv[1] ?? 'wg0';
|
||||||
|
$name = $argv[2] ?? strtoupper($iface);
|
||||||
|
|
||||||
|
$command = 'sudo wg show '.escapeshellarg($iface).' 2>/dev/null';
|
||||||
|
$output = trim(shell_exec($command));
|
||||||
|
|
||||||
|
if (empty($output)) {
|
||||||
|
echo block(
|
||||||
|
'wireguard_'.$iface,
|
||||||
|
[
|
||||||
|
'full_text' => pspan($name, color('warning'), '#000'),
|
||||||
|
'color' => color('warning'),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (getenv('BLOCK_BUTTON') === '1') {
|
||||||
|
$command = 'sudo wg-quick up '.escapeshellarg($iface);
|
||||||
|
shell_exec($command);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo block(
|
||||||
|
'wireguard_'.$iface,
|
||||||
|
[
|
||||||
|
'full_text' => pspan($name, color('normal'), '#000'),
|
||||||
|
'color' => color('normal'),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (getenv('BLOCK_BUTTON') === '1') {
|
||||||
|
$command = 'sudo wg-quick down '.escapeshellarg($iface);
|
||||||
|
shell_exec($command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
139
bar/src/workspace_apps.php
Executable file
139
bar/src/workspace_apps.php
Executable file
|
@ -0,0 +1,139 @@
|
||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$windowKey = $argv[1];
|
||||||
|
$blockButton = $argv[2];
|
||||||
|
|
||||||
|
require __DIR__.'/base/block.php';
|
||||||
|
|
||||||
|
function getWorkspaces(): array
|
||||||
|
{
|
||||||
|
$output = shell_exec('i3-msg -t get_workspaces');
|
||||||
|
|
||||||
|
return json_decode($output, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVisibleWorkspaces(): array
|
||||||
|
{
|
||||||
|
$workspaces = [];
|
||||||
|
|
||||||
|
foreach (getWorkspaces() as $wp) {
|
||||||
|
if (true === $wp['visible']) {
|
||||||
|
$workspaces[] = $wp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $workspaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTree(): array
|
||||||
|
{
|
||||||
|
$output = shell_exec('i3-msg -t get_tree');
|
||||||
|
|
||||||
|
return json_decode($output, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVisibleWorkspacesNodes(array $tree, array $workspaces): array
|
||||||
|
{
|
||||||
|
$nodes = [];
|
||||||
|
$num = $tree['num'] ?? null;
|
||||||
|
$output = $tree['output'] ?? null;
|
||||||
|
|
||||||
|
foreach ($workspaces as $workspace) {
|
||||||
|
if ($num === $workspace['num']) {
|
||||||
|
$nodes = array_merge(
|
||||||
|
$nodes,
|
||||||
|
$tree['nodes']
|
||||||
|
);
|
||||||
|
|
||||||
|
$nodes = array_merge(
|
||||||
|
$nodes,
|
||||||
|
$tree['floating_nodes']
|
||||||
|
);
|
||||||
|
} elseif ($output === '__i3' && isset($tree['window'])) {
|
||||||
|
$nodes[] = $tree;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($tree as $node) {
|
||||||
|
if (is_array($node)) {
|
||||||
|
$nodes = array_merge(
|
||||||
|
$nodes,
|
||||||
|
getVisibleWorkspacesNodes($node, $workspaces)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($nodes as $k => $n) {
|
||||||
|
if (!isset($n['window'])) {
|
||||||
|
unset($nodes[$k]);
|
||||||
|
|
||||||
|
foreach ($n['nodes'] as $node) {
|
||||||
|
$nodes[] = $node;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($n['floating_nodes'] as $node) {
|
||||||
|
$nodes[] = $node;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $nodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
$node = getVisibleWorkspacesNodes(getTree(), getVisibleWorkspaces())[$windowKey] ?? null;
|
||||||
|
|
||||||
|
if (!$node) {
|
||||||
|
die(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = $node['window_properties']['title'];
|
||||||
|
$instance = $node['window_properties']['instance'];
|
||||||
|
$window = $node['window'];
|
||||||
|
$focused = $node['focused'];
|
||||||
|
$urgent = $node['urgent'];
|
||||||
|
$scratchpad = $node['output'] === '__i3';
|
||||||
|
|
||||||
|
if (mb_strlen($title) > 25) {
|
||||||
|
$title = mb_substr($title, 0, 22).'…';
|
||||||
|
}
|
||||||
|
|
||||||
|
$foreground = '#9cb7d1';
|
||||||
|
$background = '#222222';
|
||||||
|
|
||||||
|
if ($focused) {
|
||||||
|
$foreground = '#07c0d4';
|
||||||
|
$background = '#333333';
|
||||||
|
} elseif ($scratchpad) {
|
||||||
|
$foreground = '#bababa';
|
||||||
|
$background = '#222222';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($urgent) {
|
||||||
|
if (date('s') % 2) {
|
||||||
|
$foreground = '#ffffff';
|
||||||
|
$background = '#87af15';
|
||||||
|
} else {
|
||||||
|
$foreground = '#ffffff';
|
||||||
|
$background = '#07c0d4';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$fullText = pspan(mb_strtoupper($title), $foreground, $background).' ';
|
||||||
|
|
||||||
|
if ($blockButton) {
|
||||||
|
shell_exec(sprintf('i3-msg "[id=%s] focus"', $window));
|
||||||
|
}
|
||||||
|
|
||||||
|
echo block(
|
||||||
|
'workspace_apps_'.$windowKey,
|
||||||
|
[
|
||||||
|
'full_text' => $fullText,
|
||||||
|
'color' => color('normal'),
|
||||||
|
'separator' => false,
|
||||||
|
'separator_block_width' => 0,
|
||||||
|
'min_width' => 1,
|
||||||
|
'align' => 'left',
|
||||||
|
]
|
||||||
|
);
|
28
config
28
config
|
@ -12,6 +12,7 @@ set $left Left
|
||||||
set $up Up
|
set $up Up
|
||||||
set $right Right
|
set $right Right
|
||||||
set $down Down
|
set $down Down
|
||||||
|
set $tab Tab
|
||||||
|
|
||||||
set $mouseleft button1
|
set $mouseleft button1
|
||||||
set $mousemiddle button2
|
set $mousemiddle button2
|
||||||
|
@ -197,6 +198,7 @@ bindsym $altleft+$shift+k exec ~/bin/i3_move_mouse.sh right
|
||||||
bindsym $altleft+$shift+u exec ~/bin/i3_move_mouse.sh up
|
bindsym $altleft+$shift+u exec ~/bin/i3_move_mouse.sh up
|
||||||
bindsym $altleft+$shift+j exec ~/bin/i3_move_mouse.sh down
|
bindsym $altleft+$shift+j exec ~/bin/i3_move_mouse.sh down
|
||||||
bindsym $window+$shift+y exec ~/bin/i3_mouse_click.sh
|
bindsym $window+$shift+y exec ~/bin/i3_mouse_click.sh
|
||||||
|
bindsym $altleft+$tab exec ~/.i3/i3_switch_window.php
|
||||||
bindsym $ctrl+$shift+f exec ~/bin/search
|
bindsym $ctrl+$shift+f exec ~/bin/search
|
||||||
bindsym $ctrl+$altleft+$shift+e exec sudo shutdown -h now
|
bindsym $ctrl+$altleft+$shift+e exec sudo shutdown -h now
|
||||||
bindsym $ctrl+$altleft+$shift+r exec sudo shutdown -r now
|
bindsym $ctrl+$altleft+$shift+r exec sudo shutdown -r now
|
||||||
|
@ -264,6 +266,30 @@ bar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bar {
|
||||||
|
status_command i3blocks -c ~/.i3/bar/bar2.conf
|
||||||
|
workspace_buttons no
|
||||||
|
position bottom
|
||||||
|
tray_output none
|
||||||
|
|
||||||
|
output DP1
|
||||||
|
output HDMI1
|
||||||
|
output eDP-1
|
||||||
|
output eDP1
|
||||||
|
|
||||||
|
colors {
|
||||||
|
background #000000
|
||||||
|
statusline #ffffff
|
||||||
|
#border bg text
|
||||||
|
# focused_workspace #a74068 #bd4875 #ffffff
|
||||||
|
# focused_workspace #05abba #07c0d4 #01282c
|
||||||
|
focused_workspace #333333 #333333 #07c0d4
|
||||||
|
active_workspace #5f676a #5f676a #ffffff
|
||||||
|
inactive_workspace #222222 #222222 #bababa
|
||||||
|
urgent_workspace #5aaad8 #6ac6ff #ffffff
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#bar {
|
#bar {
|
||||||
# status_command ~/.i3/processList.sh
|
# status_command ~/.i3/processList.sh
|
||||||
# workspace_buttons no
|
# workspace_buttons no
|
||||||
|
@ -294,7 +320,7 @@ bar {
|
||||||
# exec pulseaudio -D && start-pulseaudio-x11
|
# exec pulseaudio -D && start-pulseaudio-x11
|
||||||
# exec start-pulseaudio-x11
|
# exec start-pulseaudio-x11
|
||||||
exec ~/bin/pulseaudio-start
|
exec ~/bin/pulseaudio-start
|
||||||
exec tint2
|
# exec tint2
|
||||||
exec rofi -key-run 'SuperL+Alt+d' -Key-ssh 'SuperL+Alt+s' -key-window 'SuperL+Alt+w'
|
exec rofi -key-run 'SuperL+Alt+d' -Key-ssh 'SuperL+Alt+s' -key-window 'SuperL+Alt+w'
|
||||||
exec feh --bg-fill ~/wallpaper.jpg
|
exec feh --bg-fill ~/wallpaper.jpg
|
||||||
exec setxkbmap fr oss
|
exec setxkbmap fr oss
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/php5
|
#!/usr/bin/php
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function getTree()
|
function getTree()
|
||||||
|
|
86
i3_switch_window.php
Executable file
86
i3_switch_window.php
Executable file
|
@ -0,0 +1,86 @@
|
||||||
|
#!/usr/bin/php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
function getWorkspaces(): array
|
||||||
|
{
|
||||||
|
$output = shell_exec('i3-msg -t get_workspaces');
|
||||||
|
|
||||||
|
return json_decode($output, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVisibleWorkspaces(): array
|
||||||
|
{
|
||||||
|
$workspaces = [];
|
||||||
|
|
||||||
|
foreach (getWorkspaces() as $wp) {
|
||||||
|
if (true === $wp['visible']) {
|
||||||
|
$workspaces[] = $wp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $workspaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTree(): array
|
||||||
|
{
|
||||||
|
$output = shell_exec('i3-msg -t get_tree');
|
||||||
|
|
||||||
|
return json_decode($output, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVisibleWorkspacesNodes(array $tree, array $workspaces): array
|
||||||
|
{
|
||||||
|
$nodes = [];
|
||||||
|
$num = $tree['num'] ?? null;
|
||||||
|
$output = $tree['output'] ?? null;
|
||||||
|
|
||||||
|
foreach ($workspaces as $workspace) {
|
||||||
|
if ($num === $workspace['num']) {
|
||||||
|
$nodes = array_merge(
|
||||||
|
$nodes,
|
||||||
|
$tree['nodes']
|
||||||
|
);
|
||||||
|
|
||||||
|
$nodes = array_merge(
|
||||||
|
$nodes,
|
||||||
|
$tree['floating_nodes']
|
||||||
|
);
|
||||||
|
} elseif ($output === '__i3' && isset($tree['window'])) {
|
||||||
|
$nodes[] = $tree;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($tree as $node) {
|
||||||
|
if (is_array($node)) {
|
||||||
|
$nodes = array_merge(
|
||||||
|
$nodes,
|
||||||
|
getVisibleWorkspacesNodes($node, $workspaces)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($nodes as $k => $n) {
|
||||||
|
if (!isset($n['window'])) {
|
||||||
|
unset($nodes[$k]);
|
||||||
|
|
||||||
|
foreach ($n['nodes'] as $node) {
|
||||||
|
$nodes[] = $node;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($n['floating_nodes'] as $node) {
|
||||||
|
$nodes[] = $node;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $nodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nodes = getVisibleWorkspacesNodes(getTree(), getVisibleWorkspaces());
|
||||||
|
|
||||||
|
foreach ($nodes as $key => $node) {
|
||||||
|
if ($node['focused']) {
|
||||||
|
shell_exec(sprintf('i3-msg "[id=%s] focus"', $nodes[(++$key) % count($nodes)]['window']));
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/php5
|
#!/usr/bin/php
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function getOrderedWorkspaces()
|
function getOrderedWorkspaces()
|
||||||
|
|
Loading…
Reference in a new issue